Skip to content

Commit

Permalink
Merge pull request #17 from koriym/refactor
Browse files Browse the repository at this point in the history
Move method to abstract class
  • Loading branch information
koriym authored Jul 24, 2017
2 parents f4f2df9 + e985d7a commit fa86520
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
12 changes: 9 additions & 3 deletions src/AbstractAppMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*/
namespace BEAR\AppMeta;

use Koriym\Psr4List\Psr4List;

abstract class AbstractAppMeta
{
/**
Expand All @@ -31,9 +33,13 @@ abstract class AbstractAppMeta
public $logDir;

/**
* Return resource list generator
*
* @return \Generator
*/
abstract public function getResourceListGenerator();
public function getResourceListGenerator()
{
$list = new Psr4List();
$resourceListGenerator = $list($this->name . '\Resource', $this->appDir . '/src/Resource');

return $resourceListGenerator;
}
}
14 changes: 1 addition & 13 deletions src/AppMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

use BEAR\AppMeta\Exception\AppNameException;
use BEAR\AppMeta\Exception\NotWritableException;
use Koriym\Psr4List\Psr4List;

class AppMeta extends AbstractAppMeta
{
Expand Down Expand Up @@ -39,24 +38,13 @@ public function __construct($name, $context = 'app', $appDir = null)
}
}

/**
* @return \Generator
*/
public function getResourceListGenerator()
{
$list = new Psr4List;
$resourceListGenerator = $list($this->name . '\Resource', $this->appDir . '/src/Resource');

return $resourceListGenerator;
}

/**
* @param string $dir
*/
private function clearTmpDirectory($dir)
{
/**
* A flag for clear once because called many times during the unit testing
* A flag for not deleting tmp directories many times with single request
*/
static $cleanUpFlg = [];

Expand Down

0 comments on commit fa86520

Please sign in to comment.