detain/myadmin-plugin-installer

View on GitHub

Showing 54 of 54 total issues

Method execute has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln([ // outputs multiple lines to the console (adding "\n" at the end of each line)
            'MyAdmin DocBlock Parser',
            '=======================',
Severity: Major
Found in src/Command/Parse.php - About 2 hrs to fix

    Function get_module_db has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function get_module_db($module)
    {
        if ($module == 'powerdns') {
            if (!isset($GLOBALS['powerdns_dbh'])) {
                $GLOBALS['powerdns_dbh'] = new \MyDb\Mdb2\Db(POWERDNS_DB, POWERDNS_USER, POWERDNS_PASSWORD, POWERDNS_HOST);
    Severity: Minor
    Found in src/modules.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function get_module_name has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    function get_module_name($module = 'default')
    {
        if ($module != 'default') {
            if (isset($GLOBALS[$module.'_dbh'])) {
                return $module;
    Severity: Minor
    Found in src/modules.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    The parameter $http_user is not named in camelCase.
    Open

        public static function SetfaclPermissionsSetter(Event $event, $http_user, $path)
        {
            self::EnsureDirExists($event, $path);
            self::runProcess($event, 'setfacl -m u:"'.$http_user.'":rwX -m u:'.$_SERVER['USER'].':rwX '.$path);
            self::runProcess($event, 'setfacl -d -m u:"'.$http_user.'":rwX -m u:'.$_SERVER['USER'].':rwX '.$path);
    Severity: Minor
    Found in src/Plugin.php by phpmd

    CamelCaseParameterName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name parameters.

    Example

    class ClassName {
        public function doSomething($user_name) {
        }
    }

    Source

    The property $admin_routes is not named in camelCase.
    Open

    class Loader
    {
        protected $requirements;
        protected $routes;
        protected $admin_routes;
    Severity: Minor
    Found in src/Loader.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The parameter $http_user is not named in camelCase.
    Open

        public static function ChmodPermissionsSetter(Event $event, $http_user, $path, $type = 'dir')
        {
            if ($type == 'dir') {
                self::EnsureDirExists($event, $path);
            //            self::runProcess($event, 'chmod +a "'.$http_user.' allow delete,write,append,file_inherit,directory_inherit" '.$path);
    Severity: Minor
    Found in src/Plugin.php by phpmd

    CamelCaseParameterName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name parameters.

    Example

    class ClassName {
        public function doSomething($user_name) {
        }
    }

    Source

    The property $public_routes is not named in camelCase.
    Open

    class Loader
    {
        protected $requirements;
        protected $routes;
        protected $admin_routes;
    Severity: Minor
    Found in src/Loader.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    Method add_route_requirement has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function add_route_requirement($type, $function, $source = '', $path = false, $methods = false)
    Severity: Minor
    Found in src/Loader.php - About 35 mins to fix

      Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
      Severity: Minor
      Found in src/Installer.php - About 35 mins to fix

        Function do_call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                function do_call($parent, $call, $calls)
                {
                    echo "Running \$parent->$call();".PHP_EOL;
                    $response = $parent->$call();
                    if (isset($calls[$call])) {
        Severity: Minor
        Found in src/Command/Parse.php - About 35 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Missing class import via use statement (line '134', column '43').
        Open

                    $GLOBALS['zonemta_dbh'] = new \MyDb\Mysqli\Db(ZONEMTA_MYSQL_DB, ZONEMTA_MYSQL_USERNAME, ZONEMTA_MYSQL_PASSWORD, ZONEMTA_MYSQL_HOST);
        Severity: Minor
        Found in src/modules.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '168', column '23').
        Open

                    throw new \Exception('The writable-dirs must be an array.');
        Severity: Minor
        Found in src/Plugin.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '128', column '44').
        Open

                    $GLOBALS['powerdns_dbh'] = new \MyDb\Mdb2\Db(POWERDNS_DB, POWERDNS_USER, POWERDNS_PASSWORD, POWERDNS_HOST);
        Severity: Minor
        Found in src/modules.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '183', column '23').
        Open

                    throw new \Exception('The writable-files must be specified in composer arbitrary extra data.');
        Severity: Minor
        Found in src/Plugin.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Avoid too many return statements within this method.
        Open

            return 'default';
        Severity: Major
        Found in src/modules.php - About 30 mins to fix

          Missing class import via use statement (line '133', column '28').
          Open

                      $files[] = new \phpDocumentor\Reflection\File\LocalFile(__DIR__.'/../../../../../'.$path);
          Severity: Minor
          Found in src/Command/Parse.php by phpmd

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Missing class import via use statement (line '288', column '27').
          Open

                          throw new \Exception('Path Not Found: '.$path);
          Severity: Minor
          Found in src/Plugin.php by phpmd

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Missing class import via use statement (line '120', column '23').
          Open

                      throw new \InvalidArgumentException('Package is not installed: '.$initial);
          Severity: Minor
          Found in src/Installer.php by phpmd

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Missing class import via use statement (line '30', column '23').
          Open

                      throw new \InvalidArgumentException(
          Severity: Minor
          Found in src/TemplateInstaller.php by phpmd

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Missing class import via use statement (line '139', column '23').
          Open

                      throw new \InvalidArgumentException('Package is not installed: '.$package);
          Severity: Minor
          Found in src/Installer.php by phpmd

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Severity
          Category
          Status
          Source
          Language