Showing 1,795 of 1,795 total issues

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

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

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        public function get($request, $match)
        {
            $order = null;
            if (isset($match['secureId'])) {
                $order = Shop_Shortcuts_GetObjectBySecureIdOr404('Shop_Order', $match['secureId']);
    Severity: Major
    Found in src/Shop/Views/OrderAttachment.php and 3 other locations - About 3 hrs to fix
    src/Shop/Views/OrderAttachment.php on lines 43..61
    src/Shop/Views/OrderAttachment.php on lines 83..101
    src/Shop/Views/OrderAttachment.php on lines 103..121

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 156.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        public function find($request, $match)
        {
            $order = null;
            if (isset($match['secureId'])) {
                $order = Shop_Shortcuts_GetObjectBySecureIdOr404('Shop_Order', $match['secureId']);
    Severity: Major
    Found in src/Shop/Views/OrderAttachment.php and 3 other locations - About 3 hrs to fix
    src/Shop/Views/OrderAttachment.php on lines 63..81
    src/Shop/Views/OrderAttachment.php on lines 83..101
    src/Shop/Views/OrderAttachment.php on lines 103..121

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 156.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        public function delete($request, $match)
        {
            $order = null;
            if (isset($match['secureId'])) {
                $order = Shop_Shortcuts_GetObjectBySecureIdOr404('Shop_Order', $match['secureId']);
    Severity: Major
    Found in src/Shop/Views/OrderAttachment.php and 3 other locations - About 3 hrs to fix
    src/Shop/Views/OrderAttachment.php on lines 43..61
    src/Shop/Views/OrderAttachment.php on lines 63..81
    src/Shop/Views/OrderAttachment.php on lines 83..101

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 156.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        public function update($request, $match)
        {
            $order = null;
            if (isset($match['secureId'])) {
                $order = Shop_Shortcuts_GetObjectBySecureIdOr404('Shop_Order', $match['secureId']);
    Severity: Major
    Found in src/Shop/Views/OrderAttachment.php and 3 other locations - About 3 hrs to fix
    src/Shop/Views/OrderAttachment.php on lines 43..61
    src/Shop/Views/OrderAttachment.php on lines 63..81
    src/Shop/Views/OrderAttachment.php on lines 103..121

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 156.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    The class Shop_Form_OrderCreate has 11 public methods. Consider refactoring Shop_Form_OrderCreate to keep number of public methods under 10.
    Open

    class Shop_Form_OrderCreate extends Pluf_Form
    {
    
        public $user = null;
    
    
    Severity: Minor
    Found in src/Shop/Form/OrderCreate.php by phpmd

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

    Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

    Function get has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function get($request, $match)
        {
            // Check if service exsit
            $item = Pluf_Shortcuts_GetObjectOr404('Shop_Service', $match['modelId']);
            // Extract metafield id or metafield key if id is not provided
    Severity: Minor
    Found in src/Shop/Views/ServiceMetafield.php - About 3 hrs 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 22 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function get($request, $match)
        {
            // Check if product exsit
            $item = Pluf_Shortcuts_GetObjectOr404('Shop_Product', $match['modelId']);
            // Extract metafield id or metafield key if id is not provided
    Severity: Minor
    Found in src/Shop/Views/ProductMetafield.php - About 3 hrs 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

    File Event.php has 291 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    class Shop_Order_Event
    {
    
    
    Severity: Minor
    Found in src/Shop/Order/Event.php - About 3 hrs to fix

      File DigiDoki.php has 288 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      class Shop_Order_Event_DigiDoki extends Shop_Order_Event
      {
      
      
      Severity: Minor
      Found in src/Shop/Order/Event/DigiDoki.php - About 2 hrs to fix

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

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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              public function createOrUpdate($request, $match)
              {
                  // Extract order id
                  $orderId = self::extractOrderId($match);
                  $match['parentId'] = $orderId;
          Severity: Major
          Found in src/Shop/Views/OrderMetafield.php and 1 other location - About 2 hrs to fix
          src/Shop/Views/OrderItemMetafield.php on lines 8..26

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 138.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              public function createOrUpdate($request, $match)
              {
                  // Extract order id
                  $itemId = self::extractOrderItemId($match);
                  $match['parentId'] = $itemId;
          Severity: Major
          Found in src/Shop/Views/OrderItemMetafield.php and 1 other location - About 2 hrs to fix
          src/Shop/Views/OrderMetafield.php on lines 8..26

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 138.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

              function init()
              {
                  parent::init();
                  $this->_model = 'Shop_Zone';
                  $this->_a['table'] = 'shop_zone';
          Severity: Major
          Found in src/Shop/Zone.php - About 2 hrs to fix

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

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

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

                  function init()
                  {
                      parent::init();
                      $this->_a['table'] = 'shop_agency';
                      $this->_a['model'] = 'Shop_Agency';
              Severity: Major
              Found in src/Shop/Agency.php - About 2 hrs to fix

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

                    function init()
                    {
                        $this->_a['table'] = 'shop_order_attachments';
                        $this->_a['cols'] = array(
                            // شناسه‌ها
                Severity: Major
                Found in src/Shop/OrderAttachment.php - About 2 hrs to fix

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

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

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

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

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

                          function init()
                          {
                              $this->_a['table'] = 'shop_address';
                              $this->_a['verbose'] = 'Shop_Address';
                              $this->_model = 'Shop_Address';
                      Severity: Major
                      Found in src/Shop/Address.php - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language