| Total Complexity | 8 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class File |
||
| 6 | { |
||
| 7 | private $fname; |
||
| 8 | private $file; |
||
| 9 | |||
| 10 | public function __construct(string $fname = null) |
||
| 11 | { |
||
| 12 | $this->fname = $fname; |
||
| 13 | } |
||
| 14 | |||
| 15 | public function exists(): bool |
||
| 16 | { |
||
| 17 | if (file_exists($this->fname)) { |
||
| 18 | return true; |
||
| 19 | } |
||
| 20 | |||
| 21 | return false; |
||
| 22 | } |
||
| 23 | |||
| 24 | public function open() |
||
| 25 | { |
||
| 26 | return $this->file = fopen($this->fname, 'r'); |
||
| 27 | } |
||
| 28 | |||
| 29 | public function create() |
||
| 30 | { |
||
| 31 | return $this->file = fopen($this->fname, 'w+'); |
||
| 32 | } |
||
| 33 | |||
| 34 | public function write(string $content): void |
||
| 38 | } |
||
| 39 | |||
| 40 | public function read(array $data): string |
||
| 41 | { |
||
| 42 | extract($data); |
||
| 43 | |||
| 44 | ob_start(); |
||
| 45 | |||
| 46 | include $this->fname; |
||
| 47 | |||
| 48 | return ob_get_clean(); |
||
| 49 | } |
||
| 50 | |||
| 51 | public function close(): void |
||
| 54 | } |
||
| 55 | } |
||
| 56 |