]> git.mxchange.org Git - friendica.git/blobdiff - src/Console/Typo.php
Posts per author/server on the community pages (#13764)
[friendica.git] / src / Console / Typo.php
index 216d05723285bce1e818da6b9fbd4ef3186edba1..a3e9b770505b6873540c0d9ba10aae6bdcacd227 100644 (file)
@@ -1,19 +1,41 @@
 <?php
+/**
+ * @copyright Copyright (C) 2010-2023, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
 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 <hypolite@mrpetovan.com>
  */
 class Typo extends \Asika\SimpleConsole\Console
 {
        protected $helpOptions = ['h', 'help', '?'];
 
+       /**
+        * @var IManageConfigValues
+        */
+       private $config;
+
        protected function getHelp()
        {
                $help = <<<HELP
@@ -31,7 +53,14 @@ HELP;
                return $help;
        }
 
-       protected function doExecute()
+       public function __construct(IManageConfigValues $config, array $argv = null)
+       {
+               parent::__construct($argv);
+
+               $this->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()->getConfig()->get('config', 'php_path', 'php');
+               $php_path = $this->config->get('config', 'php_path', 'php');
 
                if ($this->getOption('v')) {
                        $this->out('Directory: src');
@@ -76,13 +105,6 @@ HELP;
                $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');
                }