sansaralab/monk

View on GitHub

Showing 15 of 15 total issues

Method send has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public function send(): Response
{
$this->assertPredefined();
 
$requestParameters = [];
Severity: Minor
Found in src/Monk.php - About 1 hr to fix

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

    public function send(): Response
    {
    $this->assertPredefined();
     
    $requestParameters = [];
    Severity: Minor
    Found in src/Monk.php - About 35 mins to fix

    Missing class import via use statement (line '181', column '23').
    Open

    throw new \Exception('Url former must be set');
    Severity: Minor
    Found in src/Monk.php by phpmd

    Missing class import via use statement (line '134', column '27').
    Open

    throw new \Exception("Wrong request params type: '{$this->config()->getParamsType()}'");
    Severity: Minor
    Found in src/Monk.php by phpmd

    Missing class import via use statement (line '175', column '23').
    Open

    throw new \Exception('Request method must be set');
    Severity: Minor
    Found in src/Monk.php by phpmd

    Missing class import via use statement (line '178', column '23').
    Open

    throw new \Exception('Request resource must be set');
    Severity: Minor
    Found in src/Monk.php by phpmd

    Avoid using static access to class '\Monk\Monk\Config' in method 'getMonk'.
    Open

    $monk->setConfig($this->monkDefaultConfig ?? Config::factory());
    Severity: Minor
    Found in src/MonkTrait.php by phpmd

    Avoid using static access to class '\PHPUnit_Framework_Assert' in method 'statusCode'.
    Open

    PHPUnit_Framework_Assert::assertEquals(
    $code,
    $this->getResponse()->getResponse()->getStatusCode(),
    $this->getErrorMessage($errorMessage)
    );
    Severity: Minor
    Found in src/Monk/ResponseValidator.php by phpmd

    Avoid using static access to class '\PHPUnit_Framework_Assert' in method 'headers'.
    Open

    PHPUnit_Framework_Assert::assertTrue($has, $this->getErrorMessage($errorMessage));
    Severity: Minor
    Found in src/Monk/ResponseValidator.php by phpmd

    Avoid using static access to class '\PHPUnit_Framework_Assert' in method 'headers'.
    Open

    PHPUnit_Framework_Assert::assertEquals($expectedValues, $headers, $this->getErrorMessage($errorMessage));
    Severity: Minor
    Found in src/Monk/ResponseValidator.php by phpmd

    Avoid using static access to class '\PHPUnit_Framework_Assert' in method 'jsonPointer'.
    Open

    PHPUnit_Framework_Assert::assertEquals(
    $expectedValue,
    $actualValue,
    $this->getErrorMessage($errorMessage)
    );
    Severity: Minor
    Found in src/Monk/ResponseValidator.php by phpmd

    Avoid using static access to class '\PHPUnit_Framework_Assert' in method 'jsonSchema'.
    Open

    PHPUnit_Framework_Assert::assertTrue($validator->isValid(), $errorMessage);
    Severity: Minor
    Found in src/Monk/ResponseValidator.php by phpmd

    Avoid using static access to class '\PHPUnit_Framework_Assert' in method 'hasHeader'.
    Open

    PHPUnit_Framework_Assert::assertTrue($has, $this->getErrorMessage($errorMessage));
    Severity: Minor
    Found in src/Monk/ResponseValidator.php by phpmd

    The method send uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

    } else {
    throw new \Exception("Wrong request params type: '{$this->config()->getParamsType()}'");
    }
    Severity: Minor
    Found in src/Monk.php by phpmd

    Avoid using static access to class 'Monk\Monk' in method 'getMonk'.
    Open

    $monk = Monk::factory();
    Severity: Minor
    Found in src/MonkTrait.php by phpmd
    Severity
    Category
    Status
    Source
    Language