Method send
has 33 lines of code (exceeds 25 allowed). Consider refactoring.
public function send(): Response
{
$this->assertPredefined();
$requestParameters = [];
Function send
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
public function send(): Response
{
$this->assertPredefined();
$requestParameters = [];
Missing class import via use statement (line '181', column '23').
throw new \Exception('Url former must be set');
Missing class import via use statement (line '134', column '27').
throw new \Exception("Wrong request params type: '{$this->config()->getParamsType()}'");
Missing class import via use statement (line '175', column '23').
throw new \Exception('Request method must be set');
Missing class import via use statement (line '178', column '23').
throw new \Exception('Request resource must be set');
Avoid using static access to class '\Monk\Monk\Config' in method 'getMonk'.
$monk->setConfig($this->monkDefaultConfig ?? Config::factory());
Avoid using static access to class '\PHPUnit_Framework_Assert' in method 'statusCode'.
PHPUnit_Framework_Assert::assertEquals(
$code,
$this->getResponse()->getResponse()->getStatusCode(),
$this->getErrorMessage($errorMessage)
);
Avoid using static access to class '\PHPUnit_Framework_Assert' in method 'headers'.
PHPUnit_Framework_Assert::assertTrue($has, $this->getErrorMessage($errorMessage));
Avoid using static access to class '\PHPUnit_Framework_Assert' in method 'headers'.
PHPUnit_Framework_Assert::assertEquals($expectedValues, $headers, $this->getErrorMessage($errorMessage));
Avoid using static access to class '\PHPUnit_Framework_Assert' in method 'jsonPointer'.
PHPUnit_Framework_Assert::assertEquals(
$expectedValue,
$actualValue,
$this->getErrorMessage($errorMessage)
);
Avoid using static access to class '\PHPUnit_Framework_Assert' in method 'jsonSchema'.
PHPUnit_Framework_Assert::assertTrue($validator->isValid(), $errorMessage);
Avoid using static access to class '\PHPUnit_Framework_Assert' in method 'hasHeader'.
PHPUnit_Framework_Assert::assertTrue($has, $this->getErrorMessage($errorMessage));
The method send uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
throw new \Exception("Wrong request params type: '{$this->config()->getParamsType()}'");
}
Avoid using static access to class 'Monk\Monk' in method 'getMonk'.
$monk = Monk::factory();