darrynten/sage-one-php

View on GitHub

Showing 21 of 35 total issues

File Company.php has 539 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
* SageOne Library
*
* @category Library
Severity: Major
Found in src/Models/Company.php - About 1 day to fix

    File Customer.php has 350 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
    * SageOne Library
    *
    * @category Library
    Severity: Minor
    Found in src/Models/Customer.php - About 4 hrs to fix

      File TaxInvoice.php has 321 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
      * SageOne Library
      *
      * @category Library
      Severity: Minor
      Found in src/Models/TaxInvoice.php - About 3 hrs to fix

        File BaseModel.php has 314 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
        * SageOne Library - Base Model
        *
        * @category Library
        Severity: Minor
        Found in src/BaseModel.php - About 3 hrs to fix

          File SupplierInvoice.php has 308 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
          * SageOne Library
          *
          * @category Library
          Severity: Minor
          Found in src/Models/SupplierInvoice.php - About 3 hrs to fix

            File SupplierReturn.php has 278 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
            * SageOne Library
            *
            * @category Library
            Severity: Minor
            Found in src/Models/SupplierReturn.php - About 2 hrs to fix

              BaseModel has 22 functions (exceeds 20 allowed). Consider refactoring.
              Open

              abstract class BaseModel
              {
              use Validation;
              /**
              * A request object
              Severity: Minor
              Found in src/BaseModel.php - About 2 hrs to fix

                File Supplier.php has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                * SageOne Library
                * @category Library
                * @package SageOne
                Severity: Minor
                Found in src/Models/Supplier.php - About 2 hrs to fix

                  Method validateRange has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  public function validateRange($value, $min, $max)
                  {
                  if (gettype($value) === 'integer') {
                  if (($value < $min) || ($value > $max)) {
                  throw new ValidationException(
                  Severity: Minor
                  Found in src/Validation.php - About 1 hr to fix

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

                    public function __construct($class, $config, $results)
                    {
                    $collectionObject = $results;
                    if (is_array($results)) {
                    $collectionObject = new \StdClass;
                    Severity: Minor
                    Found in src/Models/ModelCollection.php - About 1 hr to fix

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

                      private function prepareObjectRow($key, $config)
                      {
                      $value = $this->__get($key);
                       
                      // If null and allowed to be null, return null
                      Severity: Minor
                      Found in src/BaseModel.php - About 1 hr to fix

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

                      private function processResultItem($resultItem, $config)
                      {
                      if ($this->isValidPrimitive($resultItem, $config['type'])) {
                      return $resultItem;
                      }
                      Severity: Minor
                      Found in src/BaseModel.php - About 1 hr to fix

                        Function makeRequest has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        public function makeRequest(string $method, string $uri, array $options, array $parameters)
                        {
                        if (!in_array($method, $this->verbs)) {
                        throw new RequestHandlerException('405 Bad HTTP Verb', RequestHandlerException::HTTP_VERB_ERROR);
                        }
                        Severity: Minor
                        Found in src/Request/RequestHandler.php - About 1 hr to fix

                        Method prepareObjectRow has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        private function prepareObjectRow($key, $config)
                        {
                        $value = $this->__get($key);
                         
                        // If null and allowed to be null, return null
                        Severity: Minor
                        Found in src/BaseModel.php - About 1 hr to fix

                          Function loadResult has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          public function loadResult(\stdClass $result)
                          {
                          // We only care about entries that are defined in the model
                          foreach ($this->fields as $key => $config) {
                          $remoteKey = $this->getRemoteKey($key);
                          Severity: Minor
                          Found in src/BaseModel.php - About 45 mins to fix

                          Function processResultItem has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          private function processResultItem($resultItem, $config)
                          {
                          if ($this->isValidPrimitive($resultItem, $config['type'])) {
                          return $resultItem;
                          }
                          Severity: Minor
                          Found in src/BaseModel.php - About 45 mins to fix

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

                          public function validateRange($value, $min, $max)
                          {
                          if (gettype($value) === 'integer') {
                          if (($value < $min) || ($value > $max)) {
                          throw new ValidationException(
                          Severity: Minor
                          Found in src/Validation.php - About 35 mins to fix

                          Avoid too many return statements within this method.
                          Open

                          return $value->toObject();
                          Severity: Major
                          Found in src/BaseModel.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                            return $instance;
                            Severity: Major
                            Found in src/BaseModel.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                              return $this->prepareModelCollection($config, $value);
                              Severity: Major
                              Found in src/BaseModel.php - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language