Skip to content

Commit

Permalink
Fixed exception thrown when _plugins dir does not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
victorpuertas committed Dec 7, 2013
1 parent f0b8392 commit f293ce5
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/Yosymfony/Spress/Plugin/PluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,23 @@ public function dispatchEvent($eventName, Event $event = null)
public function getPlugins()
{
$result = [];
$dir = $this->contentLocator->getPluginDir();

$finder = new Finder();
$finder->files()
->in($this->contentLocator->getPluginDir())
->name('*.php');

foreach($finder as $file)
if($dir)
{
$className = $file->getBasename('.php');

if($this->isValidClassName($className))
$finder = new Finder();
$finder->files()
->in($dir)
->name('*.php');

foreach($finder as $file)
{
$result[] = new PluginItem(new $className);
$className = $file->getBasename('.php');

if($this->isValidClassName($className))
{
$result[] = new PluginItem(new $className);
}
}
}

Expand Down

0 comments on commit f293ce5

Please sign in to comment.