Asymptix/Framework

View on GitHub

Showing 720 of 720 total issues

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

                $t = explode(' ', $q);
Severity: Minor
Found in framework/mail/POP.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

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

    public static function _get($ip, $type, $provider) {

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

Function sqlTypesString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public static function sqlTypesString($fieldsList, $idFieldName = "") {
        $typesString = "";
        foreach ($fieldsList as $fieldName => $fieldValue) {
            if ($fieldName != $idFieldName) {
                if (Tools::isDouble($fieldValue)) {
Severity: Minor
Found in framework/db/DBPreparedQuery.php - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

Function getRedirectUrl has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getRedirectUrl($url) {
        $urlParts = @parse_url($url);
        if (!$urlParts) {
            return false;
        }
Severity: Minor
Found in framework/web/Http.php - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

Function validateNotEmpty has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public static function validateNotEmpty($fieldName) {
        $fieldValue = Request::getFieldValue($fieldName);
        if (is_array($fieldValue)) {
            foreach ($fieldValue as $value) {
                $value = trim($value);
Severity: Minor
Found in framework/localization/Localization.php - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

Function getEmails has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getEmails($delete = true, $number = null) {
        $emails = [];

        for ($i = 1; (is_null($number) ? true : $i <= $number); $i++) {
            $message = $this->getMessage($i);
Severity: Minor
Found in framework/mail/POP.php - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

Function open has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function open($host = "localhost", $port = 110, $username = "", $password = "") {
        $sock = fsockopen($host, $port);

        if ($sock) {
            fgets($sock, 1024);
Severity: Minor
Found in framework/mail/POP.php - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

Avoid deeply nested control flow statements.
Open

                        if (!isset($array[$key]) || !is_array($array[$key])) {
                            break;
                        }
Severity: Major
Found in framework/helpers/Naming.php - About 45 mins to fix

    Function selectDBObjectsFromStatement has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function selectDBObjectsFromStatement($stmt, $className) {
            if (is_object($className)) {
                $className = get_class($className);
            }
    
    
    Severity: Minor
    Found in framework/db/DBCore.php - About 45 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        protected function sendMail($email, $subject, $message, $format = self::FORMAT_TEXT, $replyTo = "") {
    Severity: Minor
    Found in framework/mail/Email.php - About 35 mins to fix

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

          public function prepare($query, $conditions = null, $order = null, $offset = null, $count = null) {
      Severity: Minor
      Found in framework/db/DBPreparedQuery.php - About 35 mins to fix

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

            public static function log($type, $called, $script, $line, $message) {
        Severity: Minor
        Found in classes/db/tools/ErrorLog.php - About 35 mins to fix

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

              public function __construct($url = "", $pagesNumber = 1, $currentPage = 1, $pagesOffset = 3, $template = "") {
          Severity: Minor
          Found in framework/ui/controls/UIPagination.php - About 35 mins to fix

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

                public static function send($to, $subject, $message, $headers = [], $parameters = "") {
            Severity: Minor
            Found in framework/mail/Email.php - About 35 mins to fix

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

                  public function uniqueListing() {
                      fwrite($this->connection, "UIDL\r\n");
                      $response = "";
              
                      while (true) {
              Severity: Minor
              Found in framework/mail/POP.php - About 35 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

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

                  public static function selectDBObjectFromStatement($stmt, $className) {
                      if (is_object($className)) {
                          $className = get_class($className);
                      }
              
              
              Severity: Minor
              Found in framework/db/DBCore.php - About 35 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

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

                  public static function selectSingleRecord($query, $types = "", $params = []) {
                      if (!Tools::isInstanceOf($query, new DBPreparedQuery())) {
                          $dbQuery = new DBPreparedQuery($query, $types, $params);
                      } else {
                          $dbQuery = $query;
              Severity: Minor
              Found in framework/db/DBCore.php - About 35 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

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

                  public function parseHeader($header) {
                      $avar = explode("\n", $header);
                      $len = count($avar);
                      $ret = $L2 = $L3 = null;
                      for ($i = 0; $i < $len; $i++) {
              Severity: Minor
              Found in framework/mail/POP.php - About 35 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

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

                  public function prepareOrder() {
                      if (!empty($this->order)) {
                          $this->query.= " ORDER BY";
                          if (is_array($this->order)) {
                              foreach ($this->order as $fieldName => $ord) {
              Severity: Minor
              Found in framework/db/DBPreparedQuery.php - About 35 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

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

                  public function updateAvatar($newAvatarFileName) {
                      $currentAvatarFileName = $this->avatar;
                      if (!empty($currentAvatarFileName) && file_exists(Config::DIR_AVATARS . $currentAvatarFileName)) {
                          unlink(Config::DIR_AVATARS . $currentAvatarFileName);
                      }
              Severity: Minor
              Found in classes/db/access/User.php - About 35 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

              Severity
              Category
              Status
              Source
              Language