Skip to content

Commit

Permalink
Fix for FilesPluginInformation trying to load external files, like .D…
Browse files Browse the repository at this point in the history
…S_Store

Notice: Undefined offset: 1 in /Users/artjom/PhpstormProjects/PHPCI/PHPCI/Plugin/Util/FilesPluginInformation.php on line 99
  • Loading branch information
tot-ra committed Nov 7, 2014
1 parent aaee968 commit d943eeb
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions PHPCI/Plugin/Util/FilesPluginInformation.php
Expand Up @@ -67,7 +67,7 @@ protected function loadPluginInfo()
$this->pluginInfo = array();
foreach ($this->files as $fileInfo) {
if ($fileInfo instanceof \SplFileInfo) {
if ($fileInfo->isFile()) {
if ($fileInfo->isFile() && $fileInfo->getExtension()=='php') {
$this->addPluginFromFile($fileInfo);
}
}
Expand All @@ -93,12 +93,17 @@ protected function getFullClassFromFile(\SplFileInfo $fileInfo)

$matches = array();
preg_match('#class +([A-Za-z]+) +implements#i', $contents, $matches);
$className = $matches[1];

$matches = array();
preg_match('#namespace +([A-Za-z\\\\]+);#i', $contents, $matches);
$namespace = $matches[1];

return $namespace . '\\' . $className;
if(isset($matches[1])){
$className = $matches[1];

$matches = array();
preg_match('#namespace +([A-Za-z\\\\]+);#i', $contents, $matches);
$namespace = $matches[1];

return $namespace . '\\' . $className;
}
else{
echo 'Unable to load plugin info from '.$fileInfo->getRealPath();
}
}
}

0 comments on commit d943eeb

Please sign in to comment.