forked from Cavemanon/cavepaintings
add some tests
This commit is contained in:
@@ -792,36 +792,6 @@ function iterator_map_to_array(callable $callback, iterator $iter): array
|
||||
return iterator_to_array(iterator_map($callback, $iter));
|
||||
}
|
||||
|
||||
function get_class_from_file(string $file): string
|
||||
{
|
||||
$fp = fopen($file, 'r');
|
||||
$class = $buffer = '';
|
||||
$i = 0;
|
||||
while (!$class) {
|
||||
if (feof($fp)) {
|
||||
break;
|
||||
}
|
||||
|
||||
$buffer .= fread($fp, 512);
|
||||
$tokens = token_get_all($buffer);
|
||||
|
||||
if (strpos($buffer, '{') === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (;$i<count($tokens);$i++) {
|
||||
if ($tokens[$i][0] === T_CLASS) {
|
||||
for ($j=$i+1;$j<count($tokens);$j++) {
|
||||
if ($tokens[$j] === '{') {
|
||||
$class = $tokens[$i+2][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $class;
|
||||
}
|
||||
|
||||
function stringer($s)
|
||||
{
|
||||
if (is_array($s)) {
|
||||
|
Reference in New Issue
Block a user