X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FConsole%2FTypo.php;h=32ba6ded35186878bea79e9bf8cac456c8444172;hb=3cd654e76f32dbcf505aef6a60a3e42d318f8b61;hp=4213fc8325970f571b828c773846e46836ade263;hpb=620e9842e109530ec2cc88218ddc2f73e1bbad0c;p=friendica.git diff --git a/src/Core/Console/Typo.php b/src/Core/Console/Typo.php index 4213fc8325..32ba6ded35 100644 --- a/src/Core/Console/Typo.php +++ b/src/Core/Console/Typo.php @@ -1,119 +1,117 @@ - - */ -class Typo extends \Asika\SimpleConsole\Console -{ - protected $helpOptions = ['h', 'help', '?']; - - protected function getHelp() - { - $help = <<getOption('v')) { - $this->out('Class: ' . __CLASS__); - $this->out('Arguments: ' . var_export($this->args, true)); - $this->out('Options: ' . var_export($this->options, true)); - } - - if (count($this->args) > 0) { - throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments'); - } - - $a = get_app(); - - $php_path = $a->getConfigValue('config', 'php_path', 'php'); - - if ($this->getOption('v')) { - $this->out('Directory: src'); - } - - $Iterator = new \RecursiveDirectoryIterator('src'); - - foreach (new \RecursiveIteratorIterator($Iterator) as $file) { - if (substr($file, -4) === '.php') { - $this->checkFile($php_path, $file); - } - } - - if ($this->getOption('v')) { - $this->out('Directory: mod'); - } - - $files = glob('mod/*.php'); - $this->checkFiles($php_path, $files); - - if ($this->getOption('v')) { - $this->out('Directory: include'); - } - - $files = glob('include/*.php'); - $this->checkFiles($php_path, $files); - - if ($this->getOption('v')) { - $this->out('Directory: addon'); - } - - $dirs = glob('addon/*'); - foreach ($dirs as $dir) { - $addon = basename($dir); - $files = glob($dir . '/' . $addon . '.php'); - $this->checkFiles($php_path, $files); - } - - if ($this->getOption('v')) { - $this->out('String files'); - } - - $this->checkFile($php_path, 'util/strings.php'); - - $files = glob('view/lang/*/strings.php'); - $this->checkFiles($php_path, $files); - - $this->out('No errors.'); - - return 0; - } - - private function checkFiles($php_path, array $files) - { - foreach ($files as $file) { - $this->checkFile($php_path, $file); - } - } - - private function checkFile($php_path, $file) - { - if ($this->getOption('v')) { - $this->out('Checking ' . $file); - } - - $output = []; - $ret = 0; - exec("$php_path -l $file", $output, $ret); - if ($ret !== 0) { - throw new \RuntimeException('Parse error found in ' . $file . ', scan stopped.'); - } - } -} + + */ +class Typo extends \Asika\SimpleConsole\Console +{ + protected $helpOptions = ['h', 'help', '?']; + + protected function getHelp() + { + $help = <<getOption('v')) { + $this->out('Class: ' . __CLASS__); + $this->out('Arguments: ' . var_export($this->args, true)); + $this->out('Options: ' . var_export($this->options, true)); + } + + if (count($this->args) > 0) { + throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments'); + } + + $php_path = BaseObject::getApp()->getConfig()->get('config', 'php_path', 'php'); + + if ($this->getOption('v')) { + $this->out('Directory: src'); + } + + $Iterator = new \RecursiveDirectoryIterator('src'); + + foreach (new \RecursiveIteratorIterator($Iterator) as $file) { + if (substr($file, -4) === '.php') { + $this->checkFile($php_path, $file); + } + } + + if ($this->getOption('v')) { + $this->out('Directory: mod'); + } + + $files = glob('mod/*.php'); + $this->checkFiles($php_path, $files); + + if ($this->getOption('v')) { + $this->out('Directory: include'); + } + + $files = glob('include/*.php'); + $this->checkFiles($php_path, $files); + + if ($this->getOption('v')) { + $this->out('Directory: addon'); + } + + $dirs = glob('addon/*'); + foreach ($dirs as $dir) { + $addon = basename($dir); + $files = glob($dir . '/' . $addon . '.php'); + $this->checkFiles($php_path, $files); + } + + if ($this->getOption('v')) { + $this->out('String files'); + } + + $files = glob('view/lang/*/strings.php'); + $this->checkFiles($php_path, $files); + + $this->out('No errors.'); + + return 0; + } + + private function checkFiles($php_path, array $files) + { + foreach ($files as $file) { + $this->checkFile($php_path, $file); + } + } + + private function checkFile($php_path, $file) + { + if ($this->getOption('v')) { + $this->out('Checking ' . $file); + } + + $output = []; + $ret = 0; + exec("$php_path -l $file", $output, $ret); + if ($ret !== 0) { + throw new \RuntimeException('Parse error found in ' . $file . ', scan stopped.'); + } + } +}