symplely/http

View on GitHub

Showing 36 of 36 total issues

Sessions has 36 functions (exceeds 20 allowed). Consider refactoring.
Open

class Sessions implements SessionsInterface
{
    const SESSION_KEY = '__SESSIONS_SESSION__';

    const SESSION_ID_LENGTH = 32;
Severity: Minor
Found in Http/Sessions.php - About 4 hrs to fix

    SetCookie has 34 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class SetCookie
    {
        /** @var string */
        private $name;
        /** @var string|null */
    Severity: Minor
    Found in Http/SetCookie.php - About 4 hrs to fix

      Cookie has 27 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Cookie implements CookieInterface
      {
          const EXPIRY_FORMAT = 'l, d-M-Y H:i:s T';
      
          /**
      Severity: Minor
      Found in Http/Cookie.php - About 3 hrs to fix

        File Sessions.php has 294 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        declare(strict_types=1);
        
        namespace Async\Http;
        Severity: Minor
        Found in Http/Sessions.php - About 3 hrs to fix

          Function getHeaders has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              protected static function getHeaders(array $server)
              {
                  $headers = array();
                  static $pick = array('CONTENT_', 'HTTP_');
                  foreach ($server as $key => $value) {
          Severity: Minor
          Found in Http/ServerRequestFactory.php - About 2 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 getUri has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function getUri(array $server)
              {
                  $uri = new Uri();
                  $scheme = isset($server['HTTPS']) && ($server['HTTPS'] === 'on') ? 'https' : 'http';
                  $uri = $uri->withScheme($scheme);
          Severity: Minor
          Found in Http/ServerRequestFactory.php - About 2 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 SetCookie.php has 270 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          declare(strict_types=1);
          
          namespace Async\Http;
          Severity: Minor
          Found in Http/SetCookie.php - About 2 hrs to fix

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

                public static function getUri(array $server)
                {
                    $uri = new Uri();
                    $scheme = isset($server['HTTPS']) && ($server['HTTPS'] === 'on') ? 'https' : 'http';
                    $uri = $uri->withScheme($scheme);
            Severity: Minor
            Found in Http/ServerRequestFactory.php - About 2 hrs to fix

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

                  public static function fromGlobals(array $globals): Uri
                  {
                      // Scheme
                      $https = isset($globals['HTTPS']) ? $globals['HTTPS'] : false;
                      $scheme = !$https || $https === 'off' ? 'http' : 'https';
              Severity: Minor
              Found in Http/Uri.php - About 1 hr to fix

                Function fromGlobals has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function fromGlobals(array $globals): Uri
                    {
                        // Scheme
                        $https = isset($globals['HTTPS']) ? $globals['HTTPS'] : false;
                        $scheme = !$https || $https === 'off' ? 'http' : 'https';
                Severity: Minor
                Found in Http/Uri.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 fromString has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function fromString(string $string): self
                    {
                        $rawAttributes = Cookie::splitOnDelimiter($string);
                
                        $rawAttribute = \array_shift($rawAttributes);
                Severity: Minor
                Found in Http/SetCookie.php - About 1 hr to fix

                  Method validateHeader has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function validateHeader(string $header, $values = []): void
                      {
                          if (!\preg_match('@^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$@', $header)) {
                              throw new \InvalidArgumentException(
                                  \sprintf(
                  Severity: Minor
                  Found in Http/MessageAbstract.php - About 1 hr to fix

                    Function parseUploadedFiles has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function parseUploadedFiles(array $uploadedFiles): array
                        {
                            $parsed = [];
                            foreach ($uploadedFiles as $field => $uploadedFile) {
                                if (!isset($uploadedFile['error'])) {
                    Severity: Minor
                    Found in Http/UploadedFile.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 requestAllHeaders has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function requestAllHeaders()
                        {
                            $headers = [];
                            $copy_server = array(
                                'CONTENT_TYPE' => 'Content-Type',
                    Severity: Minor
                    Found in Http/ServerRequestFactory.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 __construct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function __construct($file, $size, $error, $clientFilename = null, $clientMediaType = null)
                        {
                            if (\is_int($error) && (0 <= $error) && (8 >= $error)) {
                                $this->error = $error;
                            } else {
                    Severity: Minor
                    Found in Http/UploadedFile.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 fromString has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function fromString(string $string): self
                        {
                            $rawAttributes = Cookie::splitOnDelimiter($string);
                    
                            $rawAttribute = \array_shift($rawAttributes);
                    Severity: Minor
                    Found in Http/SetCookie.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 create has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function create($header)
                        {
                            $parts = \preg_split('~\\s*[;]\\s*~', $header);
                            list($name, $value) = \explode('=', \array_shift($parts), 2);
                            $cookie = new self($name);
                    Severity: Minor
                    Found in Http/Cookie.php - About 1 hr to fix

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

                          public function __construct(string $id = '', $cacheLimiter = 'nocache', $cacheExpire = 180)
                          {
                              $this->cacheLimiter = empty($cacheLimiter) ? 'nocache' : $cacheLimiter;
                              $this->cacheExpire = (int) $cacheExpire;
                      
                      
                      Severity: Minor
                      Found in Http/Sessions.php - About 1 hr to fix

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

                            public static function create(string $uri = ''): UriInterface
                            {
                                $obj = new self();
                                if (empty($uri)) {
                                    return $obj;
                        Severity: Minor
                        Found in Http/Uri.php - About 1 hr to fix

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

                              private static function parseUploadedFiles(array $uploadedFiles): array
                              {
                                  $parsed = [];
                                  foreach ($uploadedFiles as $field => $uploadedFile) {
                                      if (!isset($uploadedFile['error'])) {
                          Severity: Minor
                          Found in Http/UploadedFile.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language