lib/Ajde/Component/String.php

Summary

Maintainability
F
5 days
Test Coverage

Function validEmail has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

    public static function validEmail($email)
    {
        $isValid = true;
        $atIndex = strrpos($email, '@');
        if (is_bool($atIndex) && !$atIndex) {
Severity: Minor
Found in lib/Ajde/Component/String.php - About 1 day 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 time2str has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

    public static function time2str($date, $today = false)
    {
        if (!$today) {
            $today = new DateTime();
            $today = $today->format('U');
Severity: Minor
Found in lib/Ajde/Component/String.php - About 1 day 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

File String.php has 417 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

class Ajde_Component_String extends Ajde_Component
{
    protected static $_allowedTags = '<table><tr><td><th><tfoot><tbody><thead><a><br><p><div><ul><li><b><h1><h2><h3><h4><h5><h6><strong><i><em><u><img><span><pre>';
Severity: Minor
Found in lib/Ajde/Component/String.php - About 6 hrs to fix

    The class Ajde_Component_String has 18 public methods. Consider refactoring Ajde_Component_String to keep number of public methods under 10.
    Open

    class Ajde_Component_String extends Ajde_Component
    {
        protected static $_allowedTags = '<table><tr><td><th><tfoot><tbody><thead><a><br><p><div><ul><li><b><h1><h2><h3><h4><h5><h6><strong><i><em><u><img><span><pre>';
    
        public static function processStatic(Ajde_Template_Parser $parser, $attributes)
    Severity: Minor
    Found in lib/Ajde/Component/String.php by phpmd

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

    Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

    The class Ajde_Component_String has an overall complexity of 100 which is very high. The configured complexity threshold is 50.
    Open

    class Ajde_Component_String extends Ajde_Component
    {
        protected static $_allowedTags = '<table><tr><td><th><tfoot><tbody><thead><a><br><p><div><ul><li><b><h1><h2><h3><h4><h5><h6><strong><i><em><u><img><span><pre>';
    
        public static function processStatic(Ajde_Template_Parser $parser, $attributes)
    Severity: Minor
    Found in lib/Ajde/Component/String.php by phpmd

    Method time2str has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function time2str($date, $today = false)
        {
            if (!$today) {
                $today = new DateTime();
                $today = $today->format('U');
    Severity: Major
    Found in lib/Ajde/Component/String.php - About 2 hrs to fix

      Ajde_Component_String has 21 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Ajde_Component_String extends Ajde_Component
      {
          protected static $_allowedTags = '<table><tr><td><th><tfoot><tbody><thead><a><br><p><div><ul><li><b><h1><h2><h3><h4><h5><h6><strong><i><em><u><img><span><pre>';
      
          public static function processStatic(Ajde_Template_Parser $parser, $attributes)
      Severity: Minor
      Found in lib/Ajde/Component/String.php - About 2 hrs to fix

        Method link has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function link($text)
            {
                /*
                 *  Regular expression bits used by htmlEscapeAndLinkUrls() to match URLs.
                 */
        Severity: Major
        Found in lib/Ajde/Component/String.php - About 2 hrs to fix

          Method validEmail has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function validEmail($email)
              {
                  $isValid = true;
                  $atIndex = strrpos($email, '@');
                  if (is_bool($atIndex) && !$atIndex) {
          Severity: Minor
          Found in lib/Ajde/Component/String.php - About 1 hr to fix

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

                public static function link($text)
                {
                    /*
                     *  Regular expression bits used by htmlEscapeAndLinkUrls() to match URLs.
                     */
            Severity: Minor
            Found in lib/Ajde/Component/String.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

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

                public static function textDiff($from, $to, $truncate = false)
                {
                    require_once 'lib/finediff.php';
                    $diff = new FineDiff($from, $to, FineDiff::$wordGranularity);
                    if (!$truncate) {
            Severity: Minor
            Found in lib/Ajde/Component/String.php - About 1 hr to fix

              Function textDiff has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function textDiff($from, $to, $truncate = false)
                  {
                      require_once 'lib/finediff.php';
                      $diff = new FineDiff($from, $to, FineDiff::$wordGranularity);
                      if (!$truncate) {
              Severity: Minor
              Found in lib/Ajde/Component/String.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

              Method decrypt has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function decrypt($text)
                  {
                      if (empty($text)) {
                          return false;
                      }
              Severity: Minor
              Found in lib/Ajde/Component/String.php - About 1 hr to fix

                Avoid too many return statements within this method.
                Open

                                return ceil($day_diff / 7).' week'.(ceil($day_diff / 7) != 1 ? 's' : '').' ago';
                Severity: Major
                Found in lib/Ajde/Component/String.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return 'in '.ceil($day_diff / 7).' week'.(ceil($day_diff / 7) != 1 ? 's' : '');
                  Severity: Major
                  Found in lib/Ajde/Component/String.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return date('l', $date);
                    Severity: Major
                    Found in lib/Ajde/Component/String.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return 'next month';
                      Severity: Major
                      Found in lib/Ajde/Component/String.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                            return '1 hour ago';
                        Severity: Major
                        Found in lib/Ajde/Component/String.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                              return floor($diff / 3600).' hours ago';
                          Severity: Major
                          Found in lib/Ajde/Component/String.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return date('F Y', $date);
                            Severity: Major
                            Found in lib/Ajde/Component/String.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                              return 'yesterday';
                              Severity: Major
                              Found in lib/Ajde/Component/String.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                    return 'in an hour';
                                Severity: Major
                                Found in lib/Ajde/Component/String.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                  return 'next week';
                                  Severity: Major
                                  Found in lib/Ajde/Component/String.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                        return 'in '.floor($diff / 3600).' hours';
                                    Severity: Major
                                    Found in lib/Ajde/Component/String.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                          return 'in a minute';
                                      Severity: Major
                                      Found in lib/Ajde/Component/String.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                        return $day_diff.' day'.($day_diff != 1 ? 's' : '').' ago';
                                        Severity: Major
                                        Found in lib/Ajde/Component/String.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                          return 'last month';
                                          Severity: Major
                                          Found in lib/Ajde/Component/String.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                                return 'in '.floor($diff / 60).' minutes';
                                            Severity: Major
                                            Found in lib/Ajde/Component/String.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                              return 'tomorrow';
                                              Severity: Major
                                              Found in lib/Ajde/Component/String.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                            return date('F Y', $date);
                                                Severity: Major
                                                Found in lib/Ajde/Component/String.php - About 30 mins to fix

                                                  The method time2str() has an NPath complexity of 4010. The configured NPath complexity threshold is 200.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  NPathComplexity

                                                  Since: 0.1

                                                  The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                  Example

                                                  class Foo {
                                                      function bar() {
                                                          // lots of complicated code
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/codesize.html#npathcomplexity

                                                  The method validEmail() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10.
                                                  Open

                                                      public static function validEmail($email)
                                                      {
                                                          $isValid = true;
                                                          $atIndex = strrpos($email, '@');
                                                          if (is_bool($atIndex) && !$atIndex) {
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CyclomaticComplexity

                                                  Since: 0.1

                                                  Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                  Example

                                                  // Cyclomatic Complexity = 11
                                                  class Foo {
                                                  1   public function example() {
                                                  2       if ($a == $b) {
                                                  3           if ($a1 == $b1) {
                                                                  fiddle();
                                                  4           } elseif ($a2 == $b2) {
                                                                  fiddle();
                                                              } else {
                                                                  fiddle();
                                                              }
                                                  5       } elseif ($c == $d) {
                                                  6           while ($c == $d) {
                                                                  fiddle();
                                                              }
                                                  7        } elseif ($e == $f) {
                                                  8           for ($n = 0; $n < $h; $n++) {
                                                                  fiddle();
                                                              }
                                                          } else {
                                                              switch ($z) {
                                                  9               case 1:
                                                                      fiddle();
                                                                      break;
                                                  10              case 2:
                                                                      fiddle();
                                                                      break;
                                                  11              case 3:
                                                                      fiddle();
                                                                      break;
                                                                  default:
                                                                      fiddle();
                                                                      break;
                                                              }
                                                          }
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                  The method time2str() has a Cyclomatic Complexity of 27. The configured cyclomatic complexity threshold is 10.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CyclomaticComplexity

                                                  Since: 0.1

                                                  Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                  Example

                                                  // Cyclomatic Complexity = 11
                                                  class Foo {
                                                  1   public function example() {
                                                  2       if ($a == $b) {
                                                  3           if ($a1 == $b1) {
                                                                  fiddle();
                                                  4           } elseif ($a2 == $b2) {
                                                                  fiddle();
                                                              } else {
                                                                  fiddle();
                                                              }
                                                  5       } elseif ($c == $d) {
                                                  6           while ($c == $d) {
                                                                  fiddle();
                                                              }
                                                  7        } elseif ($e == $f) {
                                                  8           for ($n = 0; $n < $h; $n++) {
                                                                  fiddle();
                                                              }
                                                          } else {
                                                              switch ($z) {
                                                  9               case 1:
                                                                      fiddle();
                                                                      break;
                                                  10              case 2:
                                                                      fiddle();
                                                                      break;
                                                  11              case 3:
                                                                      fiddle();
                                                                      break;
                                                                  default:
                                                                      fiddle();
                                                                      break;
                                                              }
                                                          }
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                  The method link() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                                                  Open

                                                      public static function link($text)
                                                      {
                                                          /*
                                                           *  Regular expression bits used by htmlEscapeAndLinkUrls() to match URLs.
                                                           */
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CyclomaticComplexity

                                                  Since: 0.1

                                                  Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                  Example

                                                  // Cyclomatic Complexity = 11
                                                  class Foo {
                                                  1   public function example() {
                                                  2       if ($a == $b) {
                                                  3           if ($a1 == $b1) {
                                                                  fiddle();
                                                  4           } elseif ($a2 == $b2) {
                                                                  fiddle();
                                                              } else {
                                                                  fiddle();
                                                              }
                                                  5       } elseif ($c == $d) {
                                                  6           while ($c == $d) {
                                                                  fiddle();
                                                              }
                                                  7        } elseif ($e == $f) {
                                                  8           for ($n = 0; $n < $h; $n++) {
                                                                  fiddle();
                                                              }
                                                          } else {
                                                              switch ($z) {
                                                  9               case 1:
                                                                      fiddle();
                                                                      break;
                                                  10              case 2:
                                                                      fiddle();
                                                                      break;
                                                  11              case 3:
                                                                      fiddle();
                                                                      break;
                                                                  default:
                                                                      fiddle();
                                                                      break;
                                                              }
                                                          }
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

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

                                                      public static function textDiff($from, $to, $truncate = false)
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.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 '460', column '26').
                                                  Open

                                                              $today = new DateTime();
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.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 '37', column '19').
                                                  Open

                                                          throw new Ajde_Component_Exception();
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.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 toBoolean has a boolean flag argument $forceLowercase, which is a certain sign of a Single Responsibility Principle violation.
                                                  Open

                                                      public static function toBoolean($val, $trueValues = ['yes', 'y', 'true'], $forceLowercase = true)
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.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 '421', column '21').
                                                  Open

                                                          $diff = new FineDiff($from, $to, FineDiff::$wordGranularity);
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.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 time2str has a boolean flag argument $today, which is a certain sign of a Single Responsibility Principle violation.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.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

                                                  Avoid using static access to class 'HTMLPurifier_Config' in method 'purify'.
                                                  Open

                                                              $config = HTMLPurifier_Config::createDefault();
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  StaticAccess

                                                  Since: 1.4.0

                                                  Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                                  Example

                                                  class Foo
                                                  {
                                                      public function bar()
                                                      {
                                                          Bar::baz();
                                                      }
                                                  }

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

                                                  The method validEmail uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                              } else {
                                                                  if ($domainLen < 1 || $domainLen > 255) {
                                                                      // domain part length exceeded
                                                                      $isValid = false;
                                                                  } else {
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  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

                                                  The method validEmail uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                                      } else {
                                                                          if (preg_match('/\\.\\./', $local)) {
                                                                              // local part has two consecutive dots
                                                                              $isValid = false;
                                                                          } else {
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  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

                                                  The method validEmail uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                                                  } else {
                                                                                      if (!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/',
                                                                                          str_replace('\\\\', '', $local))
                                                                                      ) {
                                                                                          // character not valid in local part unless
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  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

                                                  The method link uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                              } else {
                                                                  // Not a valid URL.
                                                                  $html .= $url;
                                                              }
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  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

                                                  The method toBoolean uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                          } else {
                                                              return (bool) $val;
                                                          }
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  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

                                                  The method rescape uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                          } else {
                                                              $var = htmlspecialchars($var, ENT_QUOTES);
                                                          }
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  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

                                                  The method escape uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                          } else {
                                                              return self::_escape($var);
                                                          }
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  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

                                                  The method purify uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                          } else {
                                                              return self::clean($var);
                                                          }
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  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

                                                  Avoid using static access to class 'HTMLPurifier_Config' in method 'purify'.
                                                  Open

                                                              $purifier->config = HTMLPurifier_Config::create($config);
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  StaticAccess

                                                  Since: 1.4.0

                                                  Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                                  Example

                                                  class Foo
                                                  {
                                                      public function bar()
                                                      {
                                                          Bar::baz();
                                                      }
                                                  }

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

                                                  The method validEmail uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                          } else {
                                                              $domain = substr($email, $atIndex + 1);
                                                              $local = substr($email, 0, $atIndex);
                                                              $localLen = strlen($local);
                                                              $domainLen = strlen($domain);
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  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

                                                  Avoid using static access to class 'Ajde_Core_ExternalLibs' in method 'purify'.
                                                  Open

                                                          $external = Ajde_Core_ExternalLibs::getInstance();
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  StaticAccess

                                                  Since: 1.4.0

                                                  Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                                  Example

                                                  class Foo
                                                  {
                                                      public function bar()
                                                      {
                                                          Bar::baz();
                                                      }
                                                  }

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

                                                  Avoid assigning values to variables in if clauses and the like (line '239', column '18').
                                                  Open

                                                      public static function highlight($str, $search, $trim = 100, $delim = '...')
                                                      {
                                                          $str = str_ireplace($search, '<span class="highlight">'.$search.'</span>', $str);
                                                          if ($trim) {
                                                              if (($first = strpos($str, '<span class="highlight">')) > ($trim / 2)) {
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  IfStatementAssignment

                                                  Since: 2.7.0

                                                  Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                                  Example

                                                  class Foo
                                                  {
                                                      public function bar($flag)
                                                      {
                                                          if ($foo = 'bar') { // possible typo
                                                              // ...
                                                          }
                                                          if ($baz = 0) { // always false
                                                              // ...
                                                          }
                                                      }
                                                  }

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

                                                  The method time2str uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                          } else {
                                                              $diff = abs($diff);
                                                              $day_diff = floor($diff / 86400);
                                                              if ($day_diff == 0) {
                                                                  if ($diff < 120) {
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  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

                                                  The method validEmail uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                                  } else {
                                                                      if ($local[0] == '.' || $local[$localLen - 1] == '.') {
                                                                          // local part starts or ends with '.'
                                                                          $isValid = false;
                                                                      } else {
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  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

                                                  The method trim uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                          } else {
                                                              return $str;
                                                          }
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  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

                                                  The method link uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                                  } else {
                                                                      // Prepend http:// if no scheme is specified
                                                                      $completeUrl = $scheme ? $url : "http://$url";
                                                                      $linkText = "$domain$port$path";
                                                                  }
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  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

                                                  The method textDiff uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                          } else {
                                                              $html = $diff->renderDiffToHTML();
                                                  
                                                              // find first change
                                                              $firstDel = strpos($html, '<del>');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  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

                                                  The method validEmail uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                                          } else {
                                                                              if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) {
                                                                                  // character not valid in domain part
                                                                                  $isValid = false;
                                                                              } else {
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  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

                                                  The method validEmail uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                                              } else {
                                                                                  if (preg_match('/\\.\\./', $domain)) {
                                                                                      // domain part has two consecutive dots
                                                                                      $isValid = false;
                                                                                  } else {
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  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

                                                  Avoid unused private methods such as 'rescape'.
                                                  Open

                                                      private static function rescape(&$var, $key)
                                                      {
                                                          if (is_array($var)) {
                                                              array_walk($var, ['Ajde_Component_String', 'rescape']);
                                                          } else {
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  UnusedPrivateMethod

                                                  Since: 0.2

                                                  Unused Private Method detects when a private method is declared but is unused.

                                                  Example

                                                  class Something
                                                  {
                                                      private function foo() {} // unused
                                                  }

                                                  Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

                                                  Avoid unused parameters such as '$key'.
                                                  Open

                                                      private static function rescape(&$var, $key)
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  UnusedFormalParameter

                                                  Since: 0.2

                                                  Avoid passing parameters to methods or constructors and then not using those parameters.

                                                  Example

                                                  class Foo
                                                  {
                                                      private function bar($howdy)
                                                      {
                                                          // $howdy is not used
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

                                                  TODO found
                                                  Open

                                                          // TODO:
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by fixme

                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                  Open

                                                      public static function toBytes($str)
                                                      {
                                                          $val = trim($str);
                                                          $last = strtolower($str[strlen($str) - 1]);
                                                          switch ($last) {
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php and 1 other location - About 30 mins to fix
                                                  lib/Ajde/Component/Form/UploadHelper.php on lines 118..132

                                                  Duplicated Code

                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                  Tuning

                                                  This issue has a mass of 91.

                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                  Refactorings

                                                  Further Reading

                                                  The property $_allowedTags is not named in camelCase.
                                                  Open

                                                  class Ajde_Component_String extends Ajde_Component
                                                  {
                                                      protected static $_allowedTags = '<table><tr><td><th><tfoot><tbody><thead><a><br><p><div><ul><li><b><h1><h2><h3><h4><h5><h6><strong><i><em><u><img><span><pre>';
                                                  
                                                      public static function processStatic(Ajde_Template_Parser $parser, $attributes)
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.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

                                                  Avoid variables with short names like $n. Configured minimum length is 3.
                                                  Open

                                                      public static function trim($str, $n, $delim = '...')
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  ShortVariable

                                                  Since: 0.2

                                                  Detects when a field, local, or parameter has a very short name.

                                                  Example

                                                  class Something {
                                                      private $q = 15; // VIOLATION - Field
                                                      public static function main( array $as ) { // VIOLATION - Formal
                                                          $r = 20 + $this->q; // VIOLATION - Local
                                                          for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                              $r += $this->q;
                                                          }
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/naming.html#shortvariable

                                                  The class Ajde_Component_String is not named in CamelCase.
                                                  Open

                                                  class Ajde_Component_String extends Ajde_Component
                                                  {
                                                      protected static $_allowedTags = '<table><tr><td><th><tfoot><tbody><thead><a><br><p><div><ul><li><b><h1><h2><h3><h4><h5><h6><strong><i><em><u><img><span><pre>';
                                                  
                                                      public static function processStatic(Ajde_Template_Parser $parser, $attributes)
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseClassName

                                                  Since: 0.2

                                                  It is considered best practice to use the CamelCase notation to name classes.

                                                  Example

                                                  class class_name {
                                                  }

                                                  Source

                                                  Avoid variables with short names like $to. Configured minimum length is 3.
                                                  Open

                                                      public static function textDiff($from, $to, $truncate = false)
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  ShortVariable

                                                  Since: 0.2

                                                  Detects when a field, local, or parameter has a very short name.

                                                  Example

                                                  class Something {
                                                      private $q = 15; // VIOLATION - Field
                                                      public static function main( array $as ) { // VIOLATION - Formal
                                                          $r = 20 + $this->q; // VIOLATION - Local
                                                          for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                              $r += $this->q;
                                                          }
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/naming.html#shortvariable

                                                  The variable $day_diff is not named in camelCase.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $day_diff is not named in camelCase.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $day_diff is not named in camelCase.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $day_diff is not named in camelCase.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $day_diff is not named in camelCase.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $day_diff is not named in camelCase.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $day_diff is not named in camelCase.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $day_diff is not named in camelCase.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $day_diff is not named in camelCase.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $day_diff is not named in camelCase.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $day_diff is not named in camelCase.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $day_diff is not named in camelCase.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $day_diff is not named in camelCase.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $day_diff is not named in camelCase.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $day_diff is not named in camelCase.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $day_diff is not named in camelCase.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $day_diff is not named in camelCase.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $day_diff is not named in camelCase.
                                                  Open

                                                      public static function time2str($date, $today = false)
                                                      {
                                                          if (!$today) {
                                                              $today = new DateTime();
                                                              $today = $today->format('U');
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The method _init is not named in camelCase.
                                                  Open

                                                      protected function _init()
                                                      {
                                                          return [
                                                              'escape' => 'escape',
                                                              'clean'  => 'clean',
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseMethodName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function get_name() {
                                                      }
                                                  }

                                                  Source

                                                  The method _escape is not named in camelCase.
                                                  Open

                                                      private static function _escape($var)
                                                      {
                                                          return htmlspecialchars($var, ENT_QUOTES);
                                                      }
                                                  Severity: Minor
                                                  Found in lib/Ajde/Component/String.php by phpmd

                                                  CamelCaseMethodName

                                                  Since: 0.2

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

                                                  Example

                                                  class ClassName {
                                                      public function get_name() {
                                                      }
                                                  }

                                                  Source

                                                  There are no issues that match your filters.

                                                  Category
                                                  Status