Asymptix/Framework

View on GitHub

Showing 129 of 720 total issues

Function log has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function log($type, $called, $script, $line, $message) {
        if (is_null($called)) {
            $called = $_SERVER['SCRIPT_NAME'];
        }

Severity: Minor
Found in classes/db/tools/ErrorLog.php - About 55 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 bindResults has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function bindResults($stmt) {
        $resultSet = [];
        $metaData = $stmt->result_metadata();
        $fieldsCounter = 0;
        while ($field = $metaData->fetch_field()) {
Severity: Minor
Found in framework/db/DBCore.php - About 55 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 log has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function log($type, $message, $format = "\[Y-m-d H:i:s\]", $time = null) {
        $msgType = null;
        switch ($type) {
            case (self::LOG_INFO):
                $msgType = OutputStream::MSG_INFO;
Severity: Minor
Found in framework/tools/logging/Logger.php - About 55 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 start has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function start() {
        switch ($this->direction) {
            case (self::TO_OUTPUT_STREAM):
                OutputStream::start();

Severity: Minor
Found in framework/tools/logging/Logger.php - About 55 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 secondsToTime has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function secondsToTime($inputSeconds, $format = self::HUMAN_FORMAT_DEFAULT) {
        $secondsInAMinute = 60;
        $secondsInAnHour = 60 * $secondsInAMinute;
        $secondsInADay = 24 * $secondsInAnHour;

Severity: Minor
Found in framework/core/Time.php - About 55 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 getPrintableSQLValue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private static function getPrintableSQLValue($type, $value) {
        if (strpos($type, "varchar") === 0
         || strpos($type, "text") === 0
         || strpos($type, "longtext") === 0
         || strpos($type, "enum") === 0
Severity: Minor
Found in framework/db/DBCore.php - About 55 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 prepare has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function prepare($query, $conditions = null, $order = null, $offset = null, $count = null) {
        if (empty($query)) {
            throw new DBCoreException("Nothing to run, SQL query is not initialized");
        }
        $this->query = $query;
Severity: Minor
Found in framework/db/DBPreparedQuery.php - About 55 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 sendNotification has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

            $email, $subject, $languageCode, $template,
            array $params = null, $format = self::FORMAT_TEXT,
            $replyTo = ""
Severity: Major
Found in framework/mail/Email.php - About 50 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

    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

    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 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

    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 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 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

      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 __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 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 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
                Severity
                Category
                Status
                Source
                Language