| Total Complexity | 8 |
| Total Lines | 78 |
| Duplicated Lines | 0 % |
| Coverage | 72.72% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class File |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var string |
||
| 13 | */ |
||
| 14 | private $fname; |
||
| 15 | /** |
||
| 16 | * @var |
||
| 17 | */ |
||
| 18 | private $file; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * File constructor. |
||
| 22 | * @param string|null $fname |
||
| 23 | */ |
||
| 24 | 2 | public function __construct(string $fname = null) |
|
| 25 | { |
||
| 26 | 2 | $this->fname = $fname; |
|
| 27 | 2 | } |
|
| 28 | |||
| 29 | /** |
||
| 30 | * @return bool |
||
| 31 | */ |
||
| 32 | public function exists(): bool |
||
| 33 | { |
||
| 34 | if (file_exists($this->fname)) { |
||
| 35 | return true; |
||
| 36 | } |
||
| 37 | |||
| 38 | return false; |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @return bool|resource |
||
| 43 | */ |
||
| 44 | public function open() |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @return bool|resource |
||
| 51 | */ |
||
| 52 | 2 | public function create() |
|
| 53 | { |
||
| 54 | 2 | return $this->file = fopen($this->fname, 'w+'); |
|
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @param string $content |
||
| 59 | */ |
||
| 60 | 2 | public function write(string $content): void |
|
| 64 | 2 | } |
|
| 65 | |||
| 66 | /** |
||
| 67 | * @param array $data |
||
| 68 | * @return string |
||
| 69 | */ |
||
| 70 | 2 | public function read(array $data): string |
|
| 79 | } |
||
| 80 | |||
| 81 | /** |
||
| 82 | * |
||
| 83 | */ |
||
| 84 | 2 | public function close(): void |
|
| 87 | 2 | } |
|
| 88 | } |
||
| 89 |