PromisePay/promisepay-php

View on GitHub

Showing 33 of 72 total issues

Method createItem has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function createItem(Item $item)
    {
        $payload = '';
        $preparePayload = array(
            "id"            => $item->getId(),
Severity: Minor
Found in lib/ItemRepository.php - About 1 hr to fix

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

        public function __construct($jsonData)
        {
            if (count($jsonData)) {
                $this->_itemName                = array_key_exists('item_name', $jsonData)?$jsonData['item_name']:'';
                $this->_fullAmount              = array_key_exists('full_amount', $jsonData)?$jsonData['full_amount']:'';
    Severity: Minor
    Found in lib/DataObjects/Widget.php - About 1 hr to fix

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

          public function requestSessionToken(Token $token)
          {
      
              $payload = '';
              $preparePayload = array(
      Severity: Minor
      Found in lib/TokenRepository.php - About 1 hr to fix

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

            public function updateCompany(Company $company)
            {
        
                $payload='';
                $preparePayload = array(
        Severity: Minor
        Found in lib/CompanyRepository.php - About 1 hr to fix

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

              protected function stripBom($body)
              {
                  if ( substr($body,0,3) === "\xef\xbb\xbf" )  // UTF-8
                      $body = substr($body,3);
                  else if ( substr($body,0,4) === "\xff\xfe\x00\x00" || substr($body,0,4) === "\x00\x00\xfe\xff" )  // UTF-32
          Severity: Minor
          Found in lib/Vendors/Httpful/Handlers/MimeHandlerAdapter.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

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

              public function buildUserAgent()
              {
                  $user_agent = 'User-Agent: Httpful/' . Httpful::VERSION . ' (cURL/';
                  $curl = \curl_version();
          
          
          Severity: Minor
          Found in lib/Vendors/Httpful/Request.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 __call has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __call($method, $args)
              {
                  // This method supports the sends* methods
                  // like sendsJSON, sendsForm
                  //!method_exists($this, $method) &&
          Severity: Minor
          Found in lib/Vendors/Httpful/Request.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

          Method useProxy has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function useProxy($proxy_host, $proxy_port = 80, $auth_type = null, $auth_username = null, $auth_password = null, $proxy_type = Proxy::HTTP)
          Severity: Minor
          Found in lib/Vendors/Httpful/Request.php - About 45 mins to fix

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

                public function useSocks5Proxy($proxy_host, $proxy_port = 80, $auth_type = null, $auth_username = null, $auth_password = null)
            Severity: Minor
            Found in lib/Vendors/Httpful/Request.php - About 35 mins to fix

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

                  public function useSocks4Proxy($proxy_host, $proxy_port = 80, $auth_type = null, $auth_username = null, $auth_password = null)
              Severity: Minor
              Found in lib/Vendors/Httpful/Request.php - About 35 mins to fix

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

                    public function attach($files)
                    {
                        $finfo = finfo_open(FILEINFO_MIME_TYPE);
                        foreach ($files as $key => $file) {
                            $mimeType = finfo_file($finfo, $file);
                Severity: Minor
                Found in lib/Vendors/Httpful/Request.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 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function send()
                    {
                
                        if (!$this->hasBeenInitialized())
                            $this->_curlPrep();
                Severity: Minor
                Found in lib/Vendors/Httpful/Request.php - About 25 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 _serializePayload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function _serializePayload($payload)
                    {
                        if (empty($payload) || $this->serialize_payload_method === self::SERIALIZE_PAYLOAD_NEVER)
                            return $payload;
                
                
                Severity: Minor
                Found in lib/Vendors/Httpful/Request.php - About 25 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