mrcnpdlk/grandstream-xmlapp

View on GitHub

Showing 13 of 13 total issues

Method resizeImage has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function resizeImage(int $width = 100, int $height = null)
    {
        if (!file_exists($this->sImgPath) || !is_readable($this->sImgPath)) {
            throw new Exception('Image not exists');
        }
Severity: Minor
Found in src/Application/Model/Components/ElemBitmap.php - About 1 hr to fix

    Method toGreyScale has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function toGreyScale(int $tone = null)
        {
            if (is_null($tone)) {
                return 'None';
            }
    Severity: Minor
    Found in src/Helper/Color.php - About 1 hr to fix

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

          public function setVisibleStatusLine(bool $isVisible = true)
      Severity: Minor
      Found in src/Application/Model/Page.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 '141', column '47').
      Open

              $imagick->setImageBackgroundColor(new \ImagickPixel('white'));

      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 '152', column '48').
      Open

              $canvas->newImage($width, $height, new \ImagickPixel('white'));

      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 '32', column '27').
      Open

              $this->oXml = new \SimpleXMLElement(sprintf('<?xml version="1.0" encoding="UTF-8"?><%s></%s>', $nodeRootName, $nodeRootName));
      Severity: Minor
      Found in src/MyXML.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 setVisibleStatusLine has a boolean flag argument $isVisible, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function setVisibleStatusLine(bool $isVisible = true)
      Severity: Minor
      Found in src/Application/View.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 ignoreCallUpdate has a boolean flag argument $ignoreCallUpdate, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function ignoreCallUpdate(bool $ignoreCallUpdate = false)
      Severity: Minor
      Found in src/Application/Model/Page.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 '76', column '40').
      Open

              $dom                     = new \DOMDocument("1.0", 'UTF-8');
      Severity: Minor
      Found in src/MyXML.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 '151', column '23').
      Open

              $canvas = new \Imagick();

      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 setSelected has a boolean flag argument $isSelected, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function setSelected(bool $isSelected = true)

      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 '123', column '24').
      Open

              $imagick = new \Imagick(realpath($this->sImgPath));

      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 resizeImage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

              } else {//za wysoki
                  $imgHeight = $height;
                  $imgWidth  = intval($height * $origFactor);
              }

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

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

      Severity
      Category
      Status
      Source
      Language