Asymptix/Framework

View on GitHub

Showing 129 of 720 total issues

Function sqlPushValues has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function sqlPushValues($values, $separator = ", ") {
        $chunks = [];
        foreach ($values as $fieldName => $fieldValue) {
            if (!is_array($fieldValue)) {
                if (!is_null($fieldValue)) {
Severity: Minor
Found in framework/db/DBPreparedQuery.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

Function __call has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function __call($methodName, $methodParams) {
        /*
         * Selects DBObject record by some field value.
         *
         * @param <mixed> Value of the field
Severity: Minor
Found in framework/db/DBSelector.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

Function localize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public static function localize($value = "") {
        $localizedValue = Languages::$langs;
        if (is_array($value)) {
            foreach ($localizedValue as $langKey => &$lValue) {
                if (isset($value[$langKey])) {
Severity: Minor
Found in framework/localization/Localization.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 __construct has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct($optionValue, $option, $currentValue, $template = "") {
        if (empty($template)) {
            $template = self::DEFAULT_TEMPLATE;
        }
        if (isObject($option)) {
Severity: Minor
Found in framework/ui/components/UIListOption.php - About 1 hr to fix

    Method getRedirectUrl has 30 lines of code (exceeds 25 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 1 hr to fix

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

          public static function getLanguages() {
              if (is_null(self::$langs)) {
                  self::$langs = [
                      'en' => new Language('en', [
                          'en' => "English",
      Severity: Minor
      Found in framework/localization/Languages.php - About 1 hr to fix

        Method start has 28 lines of code (exceeds 25 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 1 hr to fix

          Method getSQLCondition has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function getSQLCondition($queryCondition, $operator = "") {
                  $operator = strtoupper(trim($operator));
                  if ($operator === "OR" || $operator === "AND") {
                      if (is_array($queryCondition)) {
                          if ($operator === "AND") {
          Severity: Minor
          Found in framework/db/DBQueryCondition.php - About 1 hr to fix

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

                public function css($propertyName, $propertyValue = null) {
                    if (is_null($propertyValue)) {
                        if (isset($this->style[$propertyName])) {
                            return $this->style[$propertyName];
                        }
            Severity: Minor
            Found in framework/ui/UIComponent.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

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

                public function prepareLimit() {
                    $count = null;
                    if (!is_null($this->limit)) {
                        if (Tools::isInteger($this->limit)) {
                            $this->query.= " LIMIT " . $this->limit;
            Severity: Minor
            Found in framework/db/DBPreparedQuery.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

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

                public static function checkAccountAccess($roles = array()) {
                    global $_USER;
            
                    if (self::checkLoggedIn()) {
                        if (empty($roles)) {
            Severity: Minor
            Found in classes/db/access/User.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 sqlConditionType has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static function sqlConditionType($conditionType) {
                    $conditionType = preg_replace("#[[:blank:]]{2,}#", " ", strtolower(trim($conditionType)));
            
                    $conditionTypes = [
                        // Equal operator
            Severity: Minor
            Found in framework/db/DBQueryCondition.php - About 1 hr to fix

              Method getPrintableSQLValue has 27 lines of code (exceeds 25 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 1 hr to fix

                Method castFieldValue has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function castFieldValue($fieldName, $type) {
                        global $_FIELDS;
                
                        if (isset($_FIELDS[$fieldName])) {
                            switch ($type) {
                Severity: Minor
                Found in framework/web/Request.php - About 1 hr to fix

                  Method secondsToTime has 26 lines of code (exceeds 25 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 1 hr to fix

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

                        public static function showQueryDebugInfo($query = "", $types = "", array $params = []) {
                            OutputStream::start();
                            if (!empty($query)) {
                                if (empty($types) && empty($params)) {
                                    OutputStream::message(OutputStream::MSG_INFO, "Q: " . $query);
                    Severity: Minor
                    Found in framework/db/DBQuery.php - About 1 hr to fix

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

                          public static function start($name = "", array $iniSettings = [], $useCookie = false,
                                  $lifetime = null, $path = null, $domain = null, $secure = null, $httponly = null)
                          {
                              if (!empty($iniSettings)) {
                                  foreach ($iniSettings as $key => $value) {
                      Severity: Minor
                      Found in framework/web/Session.php - About 1 hr to fix

                        Method open has 26 lines of code (exceeds 25 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 1 hr to fix

                          Method start has 8 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public static function start($name = "", array $iniSettings = [], $useCookie = false,
                                      $lifetime = null, $path = null, $domain = null, $secure = null, $httponly = null)
                          Severity: Major
                          Found in framework/web/Session.php - About 1 hr to fix

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language