refinery29/piston

View on GitHub

Showing 7 of 7 total issues

Request has 30 functions (exceeds 20 allowed). Consider refactoring.
Open

class Request extends ServerRequest
{
    const PAGED_PAGINATION = 'paged';
    const OFFSET_LIMIT_PAGINATION = 'offset_limit';
    const CURSOR_PAGINATION = 'cursor';
Severity: Minor
Found in src/Request.php - About 3 hrs to fix

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

        public function __invoke($payload)
        {
            /** @var Request $request */
            $request = $payload->getRequest();
    
    
    Severity: Minor
    Found in src/Middleware/Request/Sorts.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

    Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            CookieJar $jar = null,
            array $serverParams = [],
            array $uploadedFiles = [],
            $uri = null,
            $method = null,
    Severity: Major
    Found in src/Request.php - About 50 mins to fix

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

          public function __invoke($payload)
          {
              /* @var Request $request */
              $request = $payload->getRequest();
      
      
      Severity: Minor
      Found in src/Middleware/Request/Pagination/CursorBasedPagination.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 fromGlobals has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              array $server = null,
              array $query = null,
              array $body = null,
              array $cookies = null,
              array $files = null
      Severity: Minor
      Found in src/RequestFactory.php - About 35 mins to fix

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

            public function __invoke($payload)
            {
                /** @var Request $request */
                $request = $payload->getRequest();
        
        
        Severity: Minor
        Found in src/Middleware/Request/IncludedResource.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 launch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function launch()
            {
                try {
                    $this->processPipeline();
        
        
        Severity: Minor
        Found in src/Piston.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