Skip to content

Commit

Permalink
Update for as-phar usage
Browse files Browse the repository at this point in the history
  • Loading branch information
wapmorgan committed Aug 17, 2017
1 parent d2e4bca commit be152c9
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/PhpCodeAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public function setSinceVersion($version){
}

public function loadData() {
foreach (glob(dirname(dirname(__FILE__)).'/data/*.php') as $extension_file) {
$extensions = $this->getExtensionFiles();
foreach ($extensions as $extension_file) {
$ext = basename($extension_file, '.php');
$extension_data = include $extension_file;

Expand Down Expand Up @@ -323,4 +324,20 @@ public function printUsedExtensions() {
echo PHP_EOL;
}
}

protected function getExtensionFiles()
{
$files = [];
$dir = dirname(dirname(__FILE__)).'/data/';
$resource = opendir($dir);

if ($resource === null)
return [];

while (($file = readdir($resource)) !== false) {
if (strtolower(pathinfo($file, PATHINFO_EXTENSION)) == 'php')
$files[] = $dir.'/'.$file;
}
return $files;
}
}

0 comments on commit be152c9

Please sign in to comment.