Showing 6 of 37 total issues
Controller
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class Controller extends IlluminateController
{
/**
* Maps request parameters to database columns.
*
File Controller.php
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace SehrGut\Laravel5_Api;
use Illuminate\Database\Eloquent\Builder;
Function replaceWithIdsOrClear
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function replaceWithIdsOrClear($model)
{
if (!$this->config['replace_with_ids']) {
// Remove all relatives from all relations on the model
$model->setRelations([]);
- 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 validateInput
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function validateInput($only_present = false, $many = false)
{
$validator = $this->model_mapping->getValidatorFor($this->model);
$raw_rules = $many ? $validator::getRulesMany() : $validator::getRules();
$rules = $this->adaptRules($raw_rules);
- 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 filterByRequest
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function filterByRequest($query, $mapping = null)
{
$mapping = $mapping ?: $this->key_mapping;
foreach ($mapping as $request_key => $db_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 createResource
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function createResource(array $attributes = null)
{
$input = is_null($attributes) ? $this->context->input : $attributes;
$this->context->resource = new $this->model($input);
- 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"