File MovementsController.php
has 393 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
Method document
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function document(Request $request, $type, $subtype = 'none')
{
$user = $this->checkAuth();
switch ($type) {
Function document
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function document(Request $request, $type, $subtype = 'none')
{
$user = $this->checkAuth();
switch ($type) {
- 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 show
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function show(Request $request, $id)
{
$dom_id = $request->input('dom_id', rand());
try {
Method create
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create(Request $request)
{
$type = $request->input('type', null);
if (is_null($type)) {
return view('movement.create');
Method index
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function index(Request $request)
{
try {
$data['movements'] = $this->service->list($request->all());
$ret = null;
Function index
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function index(Request $request)
{
try {
$data['movements'] = $this->service->list($request->all());
$ret = null;
- 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 getHistoryDetails
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getHistoryDetails(Request $request)
{
$this->checkAuth();
$date = $request->input('date');
Method exportIntegralCES
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function exportIntegralCES($gas, $objects, $filename, $body)
{
$currency = Currency::where('context', 'integralces')->first();
return output_csv($filename, null, $objects, function($object) use ($gas, $currency, $body) {
Function getHistoryDetails
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getHistoryDetails(Request $request)
{
$this->checkAuth();
$date = $request->input('date');
- 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
Avoid too many return
statements within this method. Open
return $this->exportIntegralCES($user->gas, $suppliers, $filename, $body);
Avoid too many return
statements within this method. Open
return output_csv($filename, $headers, $suppliers, function($supplier) use ($currencies) {
$row = [];
$row[] = $supplier->id;
$row[] = $supplier->printableName();
Function create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function create(Request $request)
{
$type = $request->input('type', null);
if (is_null($type)) {
return view('movement.create');
- 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"