iranianpep/code-jetter

View on GitHub

Showing 251 of 1,173 total issues

Method getServer has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getServer($key)
    {
        switch ($key) {
            case 'SERVER_NAME':
                $info = filter_input(INPUT_SERVER, 'SERVER_NAME', FILTER_SANITIZE_STRING);
Severity: Minor
Found in core/io/Request.php - About 1 hr to fix

    Method getAllLoggedIn has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getAllLoggedIn(array $whiteList = null)
        {
            if (!isset($_SESSION['loggedIn']) || empty($_SESSION['loggedIn']) || !is_array($_SESSION['loggedIn'])) {
                return false;
            }
    Severity: Minor
    Found in components/user/services/UserAuthentication.php - About 1 hr to fix

      Method testGetTableNameByClassName has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function testGetTableNameByClassName()
          {
              $stateMapper = new StateMapper();
      
              $inputOutputs = [
      Severity: Minor
      Found in tests/BaseMapperTest.php - About 1 hr to fix

        Method testRemoveSuffix has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function testRemoveSuffix()
            {
                $utility = new StringUtility();
        
                $inputOutputs = [
        Severity: Minor
        Found in tests/StringUtilityTest.php - About 1 hr to fix

          Method testUpdateQuery has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function testUpdateQuery()
              {
                  $queryMaker = new \CodeJetter\core\database\QueryMaker('testTable');
          
                  $criteria = [
          Severity: Minor
          Found in tests/QueryMakerTest.php - About 1 hr to fix

            Method getInputs has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getInputs(array $inputKeys = [], $requestMethod = null)
                {
                    if (isset($this->inputs)) {
                        return $this->inputs;
                    }
            Severity: Minor
            Found in core/io/Request.php - About 1 hr to fix

              Method getAccessRole has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function getAccessRole($urlPath, $roles = [])
                  {
                      if (empty($roles)) {
                          $roles = Registry::getConfigClass()->get('roles');
                      }
              Severity: Minor
              Found in core/Router.php - About 1 hr to fix

                Method testLogin has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        public function testLogin()
                        {
                            $app = App::getInstance();
                            $app->init('dev');
                
                
                Severity: Minor
                Found in tests/UserAuthenticationTest.php - About 1 hr to fix

                  Method getPersonalizedMenu has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getPersonalizedMenu()
                      {
                          $routeInfo = Registry::getRouterClass()->getLastRoute();
                  
                          if (!$routeInfo instanceof RouteInfo) {
                  Severity: Minor
                  Found in core/layout/blocks/Menu.php - About 1 hr to fix

                    Method generateCheckboxes has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function generateCheckboxes($options, $name = null, $checked = null, array $configs = [])
                        {
                            $html = '';
                    
                            $name = ($name !== null) ? " name='{$name}'" : '';
                    Severity: Minor
                    Found in core/utility/HtmlUtility.php - About 1 hr to fix

                      Method getSelectFromTables has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getSelectFromTables($fromColumns = null)
                          {
                              $joinedSelect = [];
                              $counter = 1;
                              $from = '';
                      Severity: Minor
                      Found in core/database/QueryMaker.php - About 1 hr to fix

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

                            public function getDefinedInputs($action = null, array $includingInputs = [], array $excludingInputs = [])
                            {
                                if ($action === 'batchUpdate') {
                                    $idRule = new ValidatorRule('id');
                                    $definedInputs['id'] = new DatabaseInput('id', [$idRule]);
                        Severity: Minor
                        Found in components/user/mappers/UserMapper.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 10 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                $routeType,
                                $requestMethod,
                                $url,
                                $component,
                                $controller,
                        Severity: Major
                        Found in core/RouteInfo.php - About 1 hr to fix

                          Method generateConfirmationModal has 10 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  $divId,
                                  $labelId,
                                  $modalTitlePrefix,
                                  FormHandler $formHandler,
                                  $formClass,
                          Severity: Major
                          Found in core/utility/HtmlUtility.php - About 1 hr to fix

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

                                public function login(User $user, $password)
                                {
                                    $output = new Output();
                            
                                    $userModel = $user->getClassNameFromNamespace();
                            Severity: Minor
                            Found in components/user/services/UserAuthentication.php - About 1 hr to fix

                              Function applyPlacement has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                Tooltip.prototype.applyPlacement = function (offset, placement) {
                                  var $tip   = this.tip()
                                  var width  = $tip[0].offsetWidth
                                  var height = $tip[0].offsetHeight
                              
                              
                              Severity: Minor
                              Found in public/scripts/bootstrap.js - About 1 hr to fix

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

                                    public function add(array $inputs, array $fieldsValues = [], $extraDefinedInputs = [])
                                    {
                                        /**
                                         * Start validating.
                                         */
                                Severity: Minor
                                Found in components/user/mappers/MemberGroupMapper.php - About 1 hr to fix

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

                                      private function logMessage($level, $message, $context = [])
                                      {
                                          if ($this->getConfigs()['inOperation'] !== true) {
                                              return false;
                                          }
                                  Severity: Minor
                                  Found in core/ErrorHandler.php - About 1 hr to fix

                                    Function appendDataObjectToForm has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function appendDataObjectToForm(data, form, whitelist)
                                    {
                                        if (typeof data != "undefined" && typeof form != "undefined") {
                                    
                                            var foundDiv = $(form).find('.appended-data');
                                    Severity: Minor
                                    Found in public/scripts/script.js - About 1 hr to fix

                                      Method safeDeleteChild has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public function safeDeleteChild()
                                          {
                                              $inputs = (new Request('POST'))->getInputs();
                                      
                                              if (empty($inputs['id'])) {
                                      Severity: Minor
                                      Found in components/user/controllers/MemberUserController.php - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language