| Conditions | 5 |
| Paths | 3 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | 180 | public function __construct($file) |
|
| 30 | { |
||
| 31 | 180 | if (null === $file || !file_exists($file) && !touch($file)) { |
|
| 32 | 4 | throw new InvalidArgumentException( |
|
| 33 | 4 | sprintf('Log file "%s" cannot be created', $file), 1 |
|
| 34 | 1 | ); |
|
| 35 | } |
||
| 36 | 176 | if (!is_writable($file)) { |
|
| 37 | 4 | throw new InvalidArgumentException( |
|
| 38 | 4 | sprintf('Log file "%s" is not writable', $file), 2 |
|
| 39 | 1 | ); |
|
| 40 | } |
||
| 41 | |||
| 42 | 172 | $this->destination = $file; |
|
| 43 | 172 | $this->type = static::FILE; |
|
| 44 | 43 | } |
|
| 45 | |||
| 47 |