| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 3 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 28 | 5 | public function __construct(PDO $resource) |
|
| 29 | { |
||
| 30 | 5 | $this->checkEnvironment(); |
|
| 31 | 5 | if ($resource->getAttribute(\PDO::ATTR_DRIVER_NAME) != 'sqlite') { |
|
| 32 | 1 | $msg = __CLASS__ . " requires pdo connection to be 'sqlite'"; |
|
| 33 | 1 | throw new Exception\InvalidArgumentException($msg); |
|
| 34 | } |
||
| 35 | 5 | $this->resource = $resource; |
|
| 36 | 5 | $this->connection = new PdoSqliteConnection($this, $resource); |
|
|
|
|||
| 37 | 5 | } |
|
| 38 | |||
| 49 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: