Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
33.33% |
1 / 3 |
CRAP | |
22.22% |
2 / 9 |
File | |
0.00% |
0 / 1 |
|
33.33% |
1 / 3 |
11.53 | |
22.22% |
2 / 9 |
__construct($pathString, $createNonexisting = false) | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
getContents() | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
_create($pathString) | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 6 |
<?php | |
/** | |
* | |
*/ | |
namespace aae\fs { | |
/** | |
* @author Axel Ancona Esselmann | |
* @package aae\fs | |
*/ | |
class File extends Path { | |
public function __construct($pathString, $createNonexisting = false) { | |
parent::__construct($pathString, $createNonexisting); | |
#if (!is_file($this->_pathString)) throw new \Exception("Error: '$pathString' is not a file.", 213141118); | |
} | |
public function getContents() { | |
return file_get_contents($this->_pathString); | |
} | |
protected function _create($pathString) { | |
if (!file_exists(dirname($pathString))) { | |
parent::_create(dirname($pathString)); | |
} | |
$handle = fopen($pathString, "w"); | |
fclose($handle); | |
} | |
} | |
} |