for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace BEAR\AppMeta;
use Koriym\Psr4List\Psr4List;
abstract class AbstractAppMeta
{
/**
* Application name "{Vendor}\{Project}"
*
* @var string
*/
public $name;
public $appDir;
public $tmpDir;
public $logDir;
public function getResourceListGenerator() : \Generator
$list = new Psr4List;
return $list($this->name . '\Resource', $this->appDir . '/src/Resource');
}
* @param string $scheme 'app' | 'page' | '*'
public function getGenerator(string $scheme = '*') : \Generator
foreach ($this->getResourceListGenerator() as list($class, $file)) {
$paths = explode('\\', $class);
$path = array_slice($paths, 3);
array_walk($path, [$this, 'camel2kebab']);
if ($scheme === '*') {
$uri = sprintf('%s://self/%s', $path[0], implode('/', array_slice($path, 1)));
yield new ResMeta($uri, $class, $file);
if ($scheme === $path[0]) {
$uri = sprintf('/%s', implode('/', array_slice($path, 1)));
private function camel2kebab(string &$str)
$str = ltrim(strtolower((string) preg_replace('/[A-Z]/', '-\0', $str)), '-');