OmarElGabry/miniPHP

View on GitHub

Showing 81 of 119 total issues

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

    public static function isCookieValid(){

        // "auth" or "remember me" cookie
        if(empty($_COOKIE['auth'])) {
            return false;
Severity: Minor
Found in app/core/Cookie.php - About 1 hr to fix

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

        public function isEmailVerificationTokenValid($userId, $emailToken){
    
            if (empty($userId) || empty($emailToken)) {
                return false;
            }
    Severity: Minor
    Found in app/models/Login.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 updateBackup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public function updateBackup(){
    
             $dir = APP . "backups/";
             $files = scandir($dir);
    
    
    Severity: Minor
    Found in app/models/Admin.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 getBackups has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

         public function getBackups() {
    
             $files = scandir(APP . "backups/");
             $basename = $filename = $unixTimestamp = null;
    
    
    Severity: Minor
    Found in app/models/Admin.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 form has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function form($config){
    
            if(empty($config['fields']) || $this->request->dataSizeOverflow()){
                 return false;
            }
    Severity: Minor
    Found in app/core/components/SecurityComponent.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 emailUnique has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private function emailUnique($email){
    
            $database = Database::openConnection();
    
            // email is unique in the database, So, we can't have more than 2 same emails
    Severity: Minor
    Found in app/models/Validation.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 isForgottenPasswordTokenValid has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function isForgottenPasswordTokenValid($userId, $passwordToken){
    
            if (empty($userId) || empty($passwordToken)) {
                return false;
            }
    Severity: Minor
    Found in app/models/Login.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 init has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            init: function(){
    
                $("ul.pagination a").click(function(e){
    
                    var pageNumber;
    Severity: Minor
    Found in public/js/main.js - 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 validateData has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        validateData: function (result, targetBlock, errorFunc, errorType, returnVal){
    Severity: Minor
    Found in public/js/main.js - About 35 mins to fix

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

          public function register($name, $email, $password, $confirmPassword, $captcha){
      Severity: Minor
      Found in app/models/Login.php - About 35 mins to fix

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

            public function updateProfileInfo($userId, $name, $password, $email, $confirmEmail){
        Severity: Minor
        Found in app/models/User.php - About 35 mins to fix

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

              public function updateUserInfo($userId, $adminId, $name, $password, $role){
          Severity: Minor
          Found in app/models/Admin.php - About 35 mins to fix

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

                public function doLogIn($email, $password, $rememberMe, $userIp, $userAgent){
            Severity: Minor
            Found in app/models/Login.php - About 35 mins to fix

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

                  public static function handleError($errno, $errmsg, $filename, $linenum, $vars){
              Severity: Minor
              Found in app/core/Handler.php - About 35 mins to fix

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

                    public static function pagination($table, $options, $values, $pageNum, $extraOffset = 0){
                Severity: Minor
                Found in app/models/Pagination.php - About 35 mins to fix

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

                      init: function (){
                  
                          // initialize todo application event
                          events.todo.init();
                          
                  Severity: Minor
                  Found in public/js/main.js - 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 sendEmail has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                       public static function sendEmail($type, $email, $userData, $data){
                  
                           $mail             = new PHPMailer();
                           $mail->IsSMTP();
                  
                  
                  Severity: Minor
                  Found in app/core/Email.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 send has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function send(){
                  
                          $this->sendHeaders();
                  
                          if ($this->file) {
                  Severity: Minor
                  Found in app/core/Response.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 doLogIn has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function doLogIn($email, $password, $rememberMe, $userIp, $userAgent){
                  
                          // 1. check if user is blocked
                          if($this->isIpBlocked($userIp)) {
                              $this->errors[] = "Your IP Address has been blocked";
                  Severity: Minor
                  Found in app/models/Login.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 _get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private static function _get($key, $source){
                  
                          if (!isset(self::$config[$source])) {
                  
                              $config_file = APP . 'config/' . $source . '.php';
                  Severity: Minor
                  Found in app/core/Config.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