gdbots/common-php

View on GitHub

Showing 137 of 137 total issues

The method loadTraits has a boolean flag argument $deep, which is a certain sign of a Single Responsibility Principle violation.
Open

    private static function loadTraits($class, $deep = true, $autoload = true)
Severity: Minor
Found in src/Common/Util/ClassUtils.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Missing class import via use statement (line '115', column '21').
Open

        return (new \ReflectionClass($className))->getConstants();
Severity: Minor
Found in src/Common/Util/ClassUtils.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 false;
Severity: Major
Found in src/Common/Util/HashtagUtils.php - About 30 mins to fix

    The method getTraits has a boolean flag argument $autoload, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public static function getTraits($class, $deep = true, $autoload = true)
    Severity: Minor
    Found in src/Common/Util/ClassUtils.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

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

                throw new \InvalidArgumentException(
    Severity: Minor
    Found in src/Common/Microtime.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

    The method createFromCamel has a boolean flag argument $allowSlashes, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public static function createFromCamel($string, $allowSlashes = false)
    Severity: Minor
    Found in src/Common/Util/SlugUtils.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

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

                throw new \InvalidArgumentException(

    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 'true';
    Severity: Major
    Found in src/Common/Util/StringUtils.php - About 30 mins to fix

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

                  throw new \InvalidArgumentException(

      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 '42').
      Open

                  self::$values[$class] = (new \ReflectionClass($class))->getConstants();
      Severity: Minor
      Found in src/Common/Enum.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 (string)$var;
      Severity: Major
      Found in src/Common/Util/StringUtils.php - About 30 mins to fix

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

                    throw new \InvalidArgumentException('Latitude must be within range [-90.0, 90.0]');
        Severity: Minor
        Found in src/Common/GeoPoint.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

        The method getTraits has a boolean flag argument $deep, which is a certain sign of a Single Responsibility Principle violation.
        Open

            public static function getTraits($class, $deep = true, $autoload = true)
        Severity: Minor
        Found in src/Common/Util/ClassUtils.php by phpmd

        BooleanArgumentFlag

        Since: 1.4.0

        A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

        Example

        class Foo {
            public function bar($flag = true) {
            }
        }

        Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

        The method create has a boolean flag argument $allowSlashes, which is a certain sign of a Single Responsibility Principle violation.
        Open

            public static function create($string, $allowSlashes = false)
        Severity: Minor
        Found in src/Common/Util/SlugUtils.php by phpmd

        BooleanArgumentFlag

        Since: 1.4.0

        A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

        Example

        class Foo {
            public function bar($flag = true) {
            }
        }

        Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

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

                    throw new \InvalidArgumentException(
        Severity: Minor
        Found in src/Identifiers/SlugIdentifier.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 '157', column '19').
        Open

                throw new \BadMethodCallException("No static method or enum constant '$name' in class " . get_called_class());
        Severity: Minor
        Found in src/Common/Enum.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

        Remove error control operator '@' on line 23.
        Open

            protected function __construct($slug)
            {
                @trigger_error(sprintf('"%s" is deprecated.  Use "Gdbots\Pbj\WellKnown\DatedSlugIdentifier" from "gdbots/pbj" 1.1.x or later instead.', __CLASS__), E_USER_DEPRECATED);
        
                if (!is_string($slug)) {

        ErrorControlOperator

        Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

        Example

        function foo($filePath) {
            $file = @fopen($filPath); // hides exceptions
            $key = @$array[$notExistingKey]; // assigns null to $key
        }

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

        Remove error control operator '@' on line 22.
        Open

            protected function __construct($string)
            {
                @trigger_error(sprintf('"%s" is deprecated.  Use "Gdbots\Pbj\WellKnown\StringIdentifier" from "gdbots/pbj" 1.1.x or later instead.', __CLASS__), E_USER_DEPRECATED);
        
                if (!is_string($string)) {
        Severity: Minor
        Found in src/Identifiers/StringIdentifier.php by phpmd

        ErrorControlOperator

        Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

        Example

        function foo($filePath) {
            $file = @fopen($filPath); // hides exceptions
            $key = @$array[$notExistingKey]; // assigns null to $key
        }

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

        Remove error control operator '@' on line 27.
        Open

            public function __construct($lat, $lon)
            {
                @trigger_error(sprintf('"%s" is deprecated.  Use "Gdbots\Pbj\WellKnown\GeoPoint" from "gdbots/pbj" 1.1.x or later instead.', __CLASS__), E_USER_DEPRECATED);
        
                $this->latitude = (float)$lat;
        Severity: Minor
        Found in src/Common/GeoPoint.php by phpmd

        ErrorControlOperator

        Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

        Example

        function foo($filePath) {
            $file = @fopen($filPath); // hides exceptions
            $key = @$array[$notExistingKey]; // assigns null to $key
        }

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

        Remove error control operator '@' on line 36.
        Open

            private function __construct()
            {
                @trigger_error(sprintf('"%s" is deprecated.  Use "Gdbots\Pbj\WellKnown\Microtime" from "gdbots/pbj" 1.1.x or later instead.', __CLASS__), E_USER_DEPRECATED);
            }
        Severity: Minor
        Found in src/Common/Microtime.php by phpmd

        ErrorControlOperator

        Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

        Example

        function foo($filePath) {
            $file = @fopen($filPath); // hides exceptions
            $key = @$array[$notExistingKey]; // assigns null to $key
        }

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

        Severity
        Category
        Status
        Source
        Language