| Conditions | 1 |
| Paths | 1 |
| Total Lines | 10 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function __construct($name = null, array $data = [], $dataName = '') |
||
|
|
|||
| 25 | { |
||
| 26 | // Create a client object |
||
| 27 | $this->client = new Client(); |
||
| 28 | |||
| 29 | // Set auth credentials |
||
| 30 | $this->client->setHttpAuth($GLOBALS['USERNAME'], $GLOBALS['PASSWORD']); |
||
| 31 | |||
| 32 | parent::__construct($name, $data, $dataName); |
||
| 33 | } |
||
| 34 | } |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: