Conditions | 5 |
Paths | 5 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | public function __construct($hostname = '', $port = 9100) |
||
32 | { |
||
33 | if (empty($hostname)) { |
||
34 | throw new InvalidArgumentException("A hostname or a valid IP must be passed."); |
||
35 | } |
||
36 | if (empty($port) || ! is_numeric($port)) { |
||
37 | $port = 9100; |
||
38 | } |
||
39 | $errno = 0; |
||
40 | $errstr = ''; |
||
41 | $this->resource = @fsockopen($ip, $port, $errno, $errstr); |
||
|
|||
42 | if($this->resource === false) { |
||
43 | throw new RuntimeException("Cannot initialise NetworkPrintConnector: " . $errstr); |
||
44 | } |
||
45 | } |
||
46 | } |
||
47 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.