Showing 17 of 17 total issues

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

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

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

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

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

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

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

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

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

              public function create($request, $match)
              {
                  // Check amount
                  $amount = $request->REQUEST['amount'];
                  if ($amount <= 0.0) {
          Severity: Major
          Found in src/Bank/Views/Transfer.php - About 2 hrs to fix

            Method createPayment has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function createPayment($request, $match)
                {
                    // Check wallet and permissions to access wallet
                    Pluf::loadFunction('Pluf_Shortcuts_GetObjectOr404');
                    $toWallet = Pluf_Shortcuts_GetObjectOr404('Bank_Wallet', $match['parentId']);
            Severity: Minor
            Found in src/Bank/Views/Transfer.php - About 1 hr to fix

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

                  public function getExtraParam()
                  {
                      return array(
                          array(
                              'name' => self::ClientID,
              Severity: Minor
              Found in src/Bank/Engine/PayPall.php - About 1 hr to fix

                Method create has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function create($receipt)
                    {
                
                        $backend = $receipt->get_backend();
                        $clientId = $backend->getMeta(self::ClientID, null);
                Severity: Minor
                Found in src/Bank/Engine/PayPall.php - About 1 hr to fix

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

                      public function getGeneralParam()
                      {
                          $params = array();
                          $params[] = array(
                              'name' => 'title',
                  Severity: Minor
                  Found in src/Bank/Engine.php - About 1 hr to fix

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

                        public function getExtraParam()
                        {
                            return array(
                                array(
                                    'name' => self::ClientID,
                    Severity: Minor
                    Found in src/Bank/Engine/BitPay.php - About 1 hr to fix

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

                          public function getPayment($request, $match)
                          {
                              Pluf::loadFunction('Pluf_Shortcuts_GetObjectOr404');
                              // Check wallets and permissions to access wallets
                              $wallet = Pluf_Shortcuts_GetObjectOr404('Bank_Wallet', $match['parentId']);
                      Severity: Minor
                      Found in src/Bank/Views/Transfer.php - About 1 hr to fix

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

                            public function initFields($extra = array())
                            {
                                $this->fields['amount'] = new Pluf_Form_Field_Integer(array(
                                    'required' => true,
                                    'label' => 'amount'
                        Severity: Minor
                        Found in src/Bank/Form/ReceiptNew.php - About 1 hr to fix

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

                                  foreach ($params['children'] as $param) {
                                      $options = array(
                                          // 'required' => $param['required']
                                          'required' => false
                                      );
                          Severity: Minor
                          Found in src/Bank/Form/BackendUpdate.php and 1 other location - About 55 mins to fix
                          src/Bank/Form/BackendNew.php on lines 51..66

                          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 99.

                          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

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

                                  foreach ($params['children'] as $param) {
                                      $options = array(
                                          // 'required' => $param['required']
                                          'required' => false
                                      );
                          Severity: Minor
                          Found in src/Bank/Form/BackendNew.php and 1 other location - About 55 mins to fix
                          src/Bank/Form/BackendUpdate.php on lines 45..60

                          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 99.

                          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

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

                              function save($commit = true)
                              {
                                  if (! $this->isValid()) {
                                      // TODO: maso, 1395: باید از خطای مدل فرم استفاده شود.
                                      throw new  \Pluf\Exception('Cannot save the backend from an invalid form.');
                          Severity: Minor
                          Found in src/Bank/Form/BackendNew.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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function create($request, $match)
                              {
                                  // Check amount
                                  $amount = $request->REQUEST['amount'];
                                  if ($amount <= 0.0) {
                          Severity: Minor
                          Found in src/Bank/Views/Transfer.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 getPayment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function getPayment($request, $match)
                              {
                                  Pluf::loadFunction('Pluf_Shortcuts_GetObjectOr404');
                                  // Check wallets and permissions to access wallets
                                  $wallet = Pluf_Shortcuts_GetObjectOr404('Bank_Wallet', $match['parentId']);
                          Severity: Minor
                          Found in src/Bank/Views/Transfer.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