timegridio/timegrid

View on GitHub

Showing 28 of 390 total issues

Method buildStatements has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    protected function buildStatements(Service $service, HumanResource $humanResource, $weekdays, $startAt, $finishAt, $timezone)
Severity: Minor
Found in app/Http/Controllers/Manager/BusinessVacancyController.php - About 45 mins to fix

Function store has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function store(Business $business, Request $request)
    {
        logger()->info(__METHOD__);
        logger()->info(sprintf('businessId:%s', $business->id));

Severity: Minor
Found in app/Http/Controllers/Manager/BusinessVacancyController.php - About 45 mins to fix

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 redirect()->route('user.agenda', '#'.$appointment->code);
Severity: Major
Found in app/Http/Controllers/User/AgendaController.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

            return view('guest.appointment.show', compact('appointment'));
Severity: Major
Found in app/Http/Controllers/User/AgendaController.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

            return redirect()->route('manager.business.agenda.index', compact('business'));
Severity: Major
Found in app/Http/Controllers/User/AgendaController.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

        return $this->value;
Severity: Major
Found in app/Models/Preference.php - About 30 mins to fix

Function value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function value()
    {
        switch ($this->type) {
            case 'string':
                return (string) $this->value;
Severity: Minor
Found in app/Models/Preference.php - About 25 mins to fix

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 cast has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function cast($value, $type)
    {
        switch ($type) {
            case 'bool':
                $value = boolval($value);
Severity: Minor
Found in app/Traits/Preferenceable.php - About 25 mins to fix

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

Severity
Category
Status
Source
Language