Showing 58 of 662 total issues
Function parse
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function parse(Request $request, Params $params, array $body)
{
$entityData = [];
if (empty($body[$params->primaryType])) {
- 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
Method processLinkedResources
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function processLinkedResources(
ResourceCollectionInterface $resources,
array $include,
LinkedResourcesSerialization $resourcesSerialization,
$depth = 0
Function setRelationships
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function setRelationships(
\ReflectionClass $class,
ResourceEntityInterface $entity,
array $relationships
)
- 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 hydrate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function hydrate(Params $params, array &$resourceObject)
{
if (empty($resourceObject[self::LINKS])) {
return;
} elseif (!is_array($resourceObject[self::LINKS])) {
- 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 mergeLinkedResources
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function mergeLinkedResources(array &$champion, array $challenger)
{
static $key = 'linked';
if (isset($champion[$key]) || isset($challenger[$key])) {
- 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 serializeTransationObject
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function serializeTransationObject(array $resourceTranslations)
{
$translations = [];
foreach (
- 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 mergeResourceMeta
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function mergeResourceMeta(array &$champion, array $challenger)
{
static $key = 'meta';
if (isset($champion[$key]) || isset($challenger[$key])) {
- 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
Method serialize
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function serialize()
{
$metadata = $this->resource->getMetadata();
$json = [
'id' => $this->resource->id,
Method parse
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parse(Request $request)
{
$content = $request->getContent();
if (!empty($content) && self::HTTP_DELETE == $request->getMethod()) {
Method processToManyRelationship
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function processToManyRelationship(
ResourceCollectionInterface $resources,
$relationshipName,
array &$linkedResources,
LinkedResourcesSerialization $resourcesSerialization
Method parse
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parse(Request $request, Params $params, array $body)
{
$entityData = [];
if (empty($body[$params->primaryType])) {
Function parse
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function parse(Request $request, Params $params, array $body)
{
$translations = [];
if (
- 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 parse
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function parse(Request $request, Params $params, array $body)
{
$entityData = [];
if (empty($body[$params->primaryType])) {
- 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
Method hydrate
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function hydrate(Params $params, array &$resourceObject)
{
if (empty($resourceObject[self::LINKS])) {
return;
} elseif (!is_array($resourceObject[self::LINKS])) {
Method processToOneRelationship
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function processToOneRelationship(
ResourceCollectionInterface $resources,
$relationshipName,
array &$linkedResources,
LinkedResourcesSerialization $resourcesSerialization
Function serialize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function serialize()
{
$metadata = $this->resource->getMetadata();
$json = [
'id' => $this->resource->id,
- 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 serialize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function serialize(JsonApi\Document $document)
{
$json = [];
if ($document->i18n) {
- 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
Method __construct
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
ResourceEntityMapper $resourceEntityMapper,
DocNavigator $docNavigator,
FilterParser $filterParser,
PaginationParser $paginationParser,
BodyParser $bodyParser,
Method parse
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parse(Request $request, Params $params, array $body)
{
$translations = [];
if (
Method getRelationships
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getRelationships($entityClassName, $primaryType)
{
$relationships = new ResourceRelationships;
$metadata = $this->metadataCache->getMapping($entityClassName);
$class = $this->metadataCache->getReflection($entityClassName);