JsonApi/Request/BodyParser.php
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
JsonCoder $jsonCoder,
Raml\DocNavigator $docNavigator,
ResourceLinksHydrant $hydrant,
CreateBodyParser $creationBodyParser,
UpdateBodyParser $mutationBodyParser,
The class BodyParser has a coupling between objects value of 24. Consider to reduce the number of dependencies under 13. Open
Open
class BodyParser
{
const ERROR_PRIMARY_TYPE_KEY = "The resource type key is missing from the body.",
ERROR_MISSING_SCHEMA = "A RAML schema was expected for the current action upon the resource \"%s\".",
ERROR_MALFORMED_SCHEMA = "The RAML schema for the current action is missing the primary type key, \"%s\".",
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Avoid using static access to class '\GoIntegro\Hateoas\Util\ArrayHelper' in method 'prepareData'. Open
Open
$json = Util\ArrayHelper::toObject($data);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
There must be one USE keyword per declaration Open
Open
use GoIntegro\Hateoas\JsonApi\JsonApiSpec,
- Exclude checks
The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line Open
Open
{
- Exclude checks
The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line Open
Open
{
- Exclude checks
TRUE, FALSE and NULL must be lowercase; expected "null" but found "NULL" Open
Open
$data = NULL;
- Exclude checks
The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line Open
Open
{
- Exclude checks
Multi-line function declarations must define one parameter per line Open
Open
Params $params, $schema, array &$entityData
- Exclude checks
The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line Open
Open
{
- Exclude checks
TRUE, FALSE and NULL must be lowercase; expected "null" but found "NULL" Open
Open
$schema = NULL;
- Exclude checks
Multi-line function declarations must define one parameter per line Open
Open
Request $request, Params $params
- Exclude checks
Multi-line function declarations must define one parameter per line Open
Open
Request $request, Params $params
- Exclude checks
Multi-line function declarations must define one parameter per line Open
Open
Params $params, $schema, array &$entityData
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
self::ERROR_MALFORMED_SCHEMA, $params->primaryType
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
$request, $params, $body
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
$method, '/' . $params->primaryType
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
$request, $params, $body
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
$request, $params, $body
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
self::ERROR_MISSING_SCHEMA, $params->primaryType
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
$params, Raml\RamlSpec::HTTP_POST
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
$params, Raml\RamlSpec::HTTP_PUT
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
$request, $params, $body
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
Open
ERROR_UNSUPPORTED_CONTENT_TYPE = "The expected content type is \"%s\". The content type \"%s\" is not supported.";
- Exclude checks
Expected 0 spaces after opening bracket; newline found Open
Open
} elseif (
- Exclude checks