Completed
Pull Request — master (#6)
by Peter
07:16
created

DDNS::inwxGetNameserverInfo()   B

Complexity

Conditions 6
Paths 12

Size

Total Lines 36
Code Lines 19

Duplication

Lines 10
Ratio 27.78 %

Importance

Changes 0
Metric Value
cc 6
eloc 19
nc 12
nop 0
dl 10
loc 36
rs 8.439
c 0
b 0
f 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 18 and the first side effect is on line 13.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
namespace Affenrakete;
4
5
/**
6
 * INWX DDNS Manager
7
 *
8
 * @author Peter Siemer <[email protected]>
9
 * @license https://opensource.org/licenses/GPL-3.0 GNU Public License
10
 * @link https://affenrakete.de
11
 *
12
 */
13
header('Content-type: text/plain; charset=utf-8'); // Set UFT-8 Header
14
15
require_once('./includes/ddns.php');
16
require_once('./vendor/autoload.php');
17
18
define("DEBUG", false);
19
define("OUTPUT", true);
20
21
if (DEBUG) {
22
    error_reporting(-1);
23
    ini_set("display_errors", 1);
24
}
25
26
$input['domain'] = filter_has_var(INPUT_GET, 'domain') ? filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/(?!.{253})((?!-)[A-Za-z0-9-]{1,63}(?<!-)\.){1,126}+[A-Za-z]{2,6}/']]) : null;
27
$input['password'] = filter_has_var(INPUT_GET, 'password') ? filter_input(INPUT_GET, 'password') : null;
28
$input['ipv4'] = filter_has_var(INPUT_GET, 'ipv4') ? filter_input(INPUT_GET, 'ipv4', FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) : null;
29
$input['ipv6'] = filter_has_var(INPUT_GET, 'ipv6') ? filter_input(INPUT_GET, 'ipv6', FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) : null;
30
31
$ddns = new DDNS($input['domain'], $input['password']);
32
$ddns->updateIP($input['ipv4'], $input['ipv6']);
33
$ddns->inwxLogout();
34