Handler
has 45 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class Handler {
/**
* @see Validator::KNOWN_PARAM_SOURCES
*/
File Handler.php
has 386 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace MediaWiki\Rest;
use DateTime;
Method parseBodyData
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parseBodyData( RequestInterface $request ): ?array {
// Parse the body based on its content type
$contentType = $request->getBodyType();
// HACK: If the Handler uses a custom BodyValidator, the
Method getOpenApiSpec
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getOpenApiSpec( string $method ): array {
$parameters = [];
// XXX: Maybe we want to be able to define a spec file in the route definition?
// NOTE: the route definition may not be loaded if this is called before initContext()!
Function getOpenApiSpec
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getOpenApiSpec( string $method ): array {
$parameters = [];
// XXX: Maybe we want to be able to define a spec file in the route definition?
// NOTE: the route definition may not be loaded if this is called before initContext()!
- Read upRead up
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 getRequestSpec
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function getRequestSpec(): ?array {
$request = [];
// TODO: Implement spec generation based on getBodyParamSettings(),
// since BodyValidator is going away soon (T358560).
- Read upRead up
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 processRequestBody
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function processRequestBody( RequestInterface $request ) {
// fail if the request method is in NO_BODY_METHODS but has body
$requestMethod = $request->getMethod();
if ( in_array( $requestMethod, RequestInterface::NO_BODY_METHODS ) ) {
// check if the request has a body
- Read upRead up
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 applyCacheControl
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function applyCacheControl( ResponseInterface $response ) {
// NOTE: keep this consistent with the logic in OutputPage::sendCacheControl
// If the response sets cookies, it must not be cached in proxies.
// If there's an active cookie-based session (logged-in user or anonymous user with
- Read upRead up
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 parseBodyData
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function parseBodyData( RequestInterface $request ): ?array {
// Parse the body based on its content type
$contentType = $request->getBodyType();
// HACK: If the Handler uses a custom BodyValidator, the
- Read upRead up
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"