Showing 33 of 43 total issues

Method SDP_Shortcuts_Mime2Ext has 562 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function SDP_Shortcuts_Mime2Ext ($mime_type)
{
    $Ext2Mime = array(
            'hqx' => array(
                    'application/mac-binhex40',
Severity: Major
Found in src/SDP/Shortcuts.php - About 2 days to fix

    File Shortcuts.php has 612 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /*
     * This file is part of Pluf Framework, a simple PHP Application Framework.
     * Copyright (C) 2010-2020 Phoinex Scholars Co. (http://dpq.co.ir)
    Severity: Major
    Found in src/SDP/Shortcuts.php - About 1 day to fix

      Method init has 123 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function init()
          {
              $this->_a['table'] = 'sdp_asset';
              $this->_a['verbose'] = 'SDP Asset';
              $this->_a['cols'] = array(
      Severity: Major
      Found in src/SDP/Asset.php - About 4 hrs to fix

        File Asset.php has 339 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /*
         * This file is part of Pluf Framework, a simple PHP Application Framework.
         * Copyright (C) 2010-2020 Phoinex Scholars Co. (http://dpq.co.ir)
        Severity: Minor
        Found in src/SDP/Views/Asset.php - About 4 hrs to fix

          Method init has 97 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function init()
              {
                  $this->_a['table'] = 'sdp_link';
                  $this->_a['verbose'] = 'SDP Link';
                  $this->_a['cols'] = array(
          Severity: Major
          Found in src/SDP/Link.php - About 3 hrs to fix

            Method init has 71 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function init()
                {
                    $this->_a['table'] = 'sdp_category';
                    $this->_a['verbose'] = 'SDP Category';
                    $this->_a['cols'] = array(
            Severity: Major
            Found in src/SDP/Category.php - About 2 hrs to fix

              Method initFields has 68 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function initFields($extra = array())
                  {
                      $this->asset = $extra['asset'];
              
                      $this->fields['name'] = new Pluf_Form_Field_Varchar(array(
              Severity: Major
              Found in src/SDP/Form/AssetUpdate.php - About 2 hrs to fix

                Method init has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function init()
                    {
                        $this->_a['table'] = 'sdp_assetrelation';
                        $this->_a['verbose'] = 'AssetRelation';
                        $this->_a['cols'] = array(
                Severity: Major
                Found in src/SDP/AssetRelation.php - About 2 hrs to fix

                  Method init has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function init()
                      {
                          $this->_a['table'] = 'sdp_profile';
                          $this->_a['model'] = 'SDP_Profile';
                          $this->_model = 'SDP_Profile';
                  Severity: Major
                  Found in src/SDP/Profile.php - About 2 hrs to fix

                    Method init has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function init()
                        {
                            $this->_a['table'] = 'sdp_drives';
                            $this->_a['cols'] = array(
                                'id' => array(
                    Severity: Major
                    Found in src/SDP/Drive.php - About 2 hrs to fix

                      Method getGeneralParam has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getGeneralParam()
                          {
                              $params = array();
                              $params[] = array(
                                  'name' => 'title',
                      Severity: Major
                      Found in src/SDP/Driver.php - About 2 hrs to fix

                        Method init has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function init()
                            {
                                $this->_a['table'] = 'sdp_tag';
                                $this->_a['verbose'] = 'SDP Tag';
                                $this->_a['cols'] = array(
                        Severity: Major
                        Found in src/SDP/Tag.php - About 2 hrs to fix

                          Method relations has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function relations($request, $match)
                              {
                                  $asset = Pluf_Shortcuts_GetObjectOr404('SDP_Asset', $match['assetId']);
                                  $relatedAsset = new SDP_Asset();
                                  $relatedAssetTable = $relatedAsset->_a['table'];
                          Severity: Major
                          Found in src/SDP/Views/Asset.php - About 2 hrs to fix

                            Method getExtraParam has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function getExtraParam()
                                {
                                    return array(
                                        array(
                                            'name' => 'encrypt_key',
                            Severity: Minor
                            Found in src/SDP/Driver/Cactus.php - About 2 hrs to fix

                              Function createViewQuery has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private static function createViewQuery($request)
                                  {
                                      $includeTag = isset($request->REQUEST['include_tag']) ? $request->REQUEST['include_tag'] : null;
                                      $excludeTag = isset($request->REQUEST['exclude_tag']) ? $request->REQUEST['exclude_tag'] : 0;
                                      $includeCategory = isset($request->REQUEST['include_category']) ? $request->REQUEST['include_category'] : null;
                              Severity: Minor
                              Found in src/SDP/Views/Asset.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 initFields has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function initFields($extra = array())
                                  {
                                      $this->userRequest = $extra['request'];
                              
                                      $this->fields['name'] = new Pluf_Form_Field_Varchar(array(
                              Severity: Minor
                              Found in src/SDP/Form/AssetCreate.php - About 1 hr to fix

                                Method find has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public static function find($request, $match)
                                    {
                                        // Restrict find to current user or user is owner of tenant
                                        $links = new Pluf_Paginator(new SDP_Link());
                                        if (! User_Precondition::isOwner($request)) {
                                Severity: Minor
                                Found in src/SDP/Views/Link.php - About 1 hr to fix

                                  Method payment has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public static function payment($request, $match)
                                      {
                                          $link = Pluf_Shortcuts_GetObjectOr404('SDP_Link', $match['linkId']);
                                          $asset = $link->get_asset();
                                  
                                  
                                  Severity: Minor
                                  Found in src/SDP/Views/Link.php - About 1 hr to fix

                                    Function save has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        function save($commit = true)
                                        {
                                            if (! $this->isValid()) {
                                                throw new \Pluf\Exception('cannot save the asset from an invalid form');
                                            }
                                    Severity: Minor
                                    Found in src/SDP/Form/AssetCreate.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 categories has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public static function categories($request, $match)
                                        {
                                            $asset = Pluf_Shortcuts_GetObjectOr404('SDP_Asset', $match['assetId']);
                                            $category = new SDP_Category();
                                            $categoryTable = $category->_con->pfx . $category->_a['table'];
                                    Severity: Minor
                                    Found in src/SDP/Views/Asset.php - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language