Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
8 / 8 |
PhpClassHelper | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
8 / 8 |
setFileName($fileName) | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
_getFileContent() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
getFunctions($functionEnding = "") | |
100.00% |
1 / 1 |
1 | |
100.00% |
5 / 5 |
<?php | |
/** | |
* | |
*/ | |
namespace aae\util { | |
/** | |
* @author Axel Ancona Esselmann | |
* @package aae\util | |
*/ | |
class PhpClassHelper { | |
protected $_fileName; | |
public function setFileName($fileName) { | |
$this->_fileName = $fileName; | |
} | |
private function _getFileContent() { | |
return file_get_contents($this->_fileName); | |
} | |
public function getFunctions($functionEnding = "") { | |
$fileContent = $this->_getFileContent(); | |
$matches = []; | |
preg_match_all('/(function[\s]*)([a-zA-Z0-9_\-]*'.$functionEnding.')(\s*\()/s', $fileContent, $matches); | |
$functions = $matches[2]; | |
return $functions; | |
} | |
} | |
} |