X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FConsole%2FTypo.php;h=a3e9b770505b6873540c0d9ba10aae6bdcacd227;hb=d27576059670faf87f80eaae2b4560f85b5310fc;hp=5f5fa0ba6876667ed2a4bd945ddf8606aa08ca9a;hpb=4dcdc56e8173d6db3410014fa4c4ae3445a2436d;p=friendica.git diff --git a/src/Console/Typo.php b/src/Console/Typo.php index 5f5fa0ba68..a3e9b77050 100644 --- a/src/Console/Typo.php +++ b/src/Console/Typo.php @@ -1,19 +1,41 @@ . + * + */ namespace Friendica\Console; -use Friendica\BaseObject; +use Friendica\Core\Config\Capability\IManageConfigValues; /** * Tired of chasing typos and finding them after a commit. * Run this and quickly see if we've got any parse errors in our application files. - * - * @author Hypolite Petovan */ class Typo extends \Asika\SimpleConsole\Console { protected $helpOptions = ['h', 'help', '?']; + /** + * @var IManageConfigValues + */ + private $config; + protected function getHelp() { $help = <<config = $config; + } + + protected function doExecute(): int { if ($this->getOption('v')) { $this->out('Class: ' . __CLASS__); @@ -43,7 +72,7 @@ HELP; throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments'); } - $php_path = BaseObject::getApp()->getConfigCache()->get('config', 'php_path', 'php'); + $php_path = $this->config->get('config', 'php_path', 'php'); if ($this->getOption('v')) { $this->out('Directory: src'); @@ -58,17 +87,22 @@ HELP; } if ($this->getOption('v')) { - $this->out('Directory: mod'); + $this->out('Directory: tests'); } - $files = glob('mod/*.php'); - $this->checkFiles($php_path, $files); + $Iterator = new \RecursiveDirectoryIterator('tests'); + + foreach (new \RecursiveIteratorIterator($Iterator) as $file) { + if (substr($file, -4) === '.php') { + $this->checkFile($php_path, $file); + } + } if ($this->getOption('v')) { - $this->out('Directory: include'); + $this->out('Directory: mod'); } - $files = glob('include/*.php'); + $files = glob('mod/*.php'); $this->checkFiles($php_path, $files); if ($this->getOption('v')) {