]> git.mxchange.org Git - friendica.git/blobdiff - src/Console/Typo.php
Remove deprecated code
[friendica.git] / src / Console / Typo.php
index 5f5fa0ba6876667ed2a4bd945ddf8606aa08ca9a..eed0a31816331f81b6b448dfafd7f4133c7fe96f 100644 (file)
@@ -2,7 +2,7 @@
 
 namespace Friendica\Console;
 
-use Friendica\BaseObject;
+use Friendica\Core\Config\IConfig;
 
 /**
  * Tired of chasing typos and finding them after a commit.
@@ -14,6 +14,11 @@ class Typo extends \Asika\SimpleConsole\Console
 {
        protected $helpOptions = ['h', 'help', '?'];
 
+       /**
+        * @var IConfig
+        */
+       private $config;
+
        protected function getHelp()
        {
                $help = <<<HELP
@@ -31,6 +36,13 @@ HELP;
                return $help;
        }
 
+       public function __construct(IConfig $config, array $argv = null)
+       {
+               parent::__construct($argv);
+
+               $this->config = $config;
+       }
+
        protected function doExecute()
        {
                if ($this->getOption('v')) {
@@ -43,7 +55,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');
@@ -57,6 +69,18 @@ HELP;
                        }
                }
 
+               if ($this->getOption('v')) {
+                       $this->out('Directory: tests');
+               }
+
+               $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: mod');
                }