timegridio/timegrid

View on GitHub

Showing 390 of 390 total issues

Avoid using undefined variables such as '$template' which will lead to PHP notices.
Open

                        ->template($template)

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$subject' which will lead to PHP notices.
Open

                        ->subject($subject)

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$locale' which will lead to PHP notices.
Open

        $this->transmail->locale($locale)

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$timezone' which will lead to PHP notices.
Open

                        ->timezone($timezone)

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$header' which will lead to PHP notices.
Open

                        ->send($header, $params);

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$params' which will lead to PHP notices.
Open

                        ->send($header, $params);

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Method handle has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function handle(AppointmentWasConfirmed $event)
    {
        logger()->info(__METHOD__);

        $code = $event->appointment->code;
Severity: Minor
Found in app/Listeners/SendAppointmentConfirmationNotification.php - About 1 hr to fix

Method handle has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function handle(AppointmentWasCanceled $event)
    {
        logger()->info(__METHOD__);

        $code = $event->appointment->code;
Severity: Minor
Found in app/Listeners/SendAppointmentCancellationNotification.php - About 1 hr to fix

Function postStore has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function postStore(Request $request)
    {
        logger()->info(__METHOD__);

        //////////////////
Severity: Minor
Found in app/Http/Controllers/User/AgendaController.php - About 1 hr 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 getAvailability has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAvailability(Business $business, Request $request)
    {
        logger()->info(__METHOD__);

        if (auth()->user()) {
Severity: Minor
Found in app/Http/Controllers/User/AgendaController.php - About 1 hr 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

Method store has 27 lines of code (exceeds 25 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 1 hr to fix

Function render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function render($request, Exception $exception)
    {
        if (app()->environment('production') || app()->environment('demo')) {
            // Catch TokenMismatchException to show a friendly error message
            if ($exception instanceof \Illuminate\Session\TokenMismatchException) {
Severity: Minor
Found in app/Exceptions/Handler.php - About 55 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

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 3 and the first side effect is on line 17.
Open

<?php
Severity: Minor
Found in bootstrap/autoload.php by phpcodesniffer

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function edit(Business $business, Humanresource $humanresource)
    {
        logger()->info(__METHOD__);
        logger()->info(sprintf('businessId:%s humanresourceId:%s', $business->id, $humanresource->id));

Severity: Major
Found in app/Http/Controllers/Manager/HumanresourceController.php and 2 other locations - About 45 mins to fix
app/Http/Controllers/Manager/HumanresourceController.php on lines 63..73
app/Http/Controllers/User/ContactController.php on lines 134..144

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 96.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function edit(Business $business, Contact $contact)
    {
        logger()->info(__METHOD__);
        logger()->info(sprintf('businessId:%s contactId:%s', $business->id, $contact->id));

Severity: Major
Found in app/Http/Controllers/User/ContactController.php and 2 other locations - About 45 mins to fix
app/Http/Controllers/Manager/HumanresourceController.php on lines 63..73
app/Http/Controllers/Manager/HumanresourceController.php on lines 75..85

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 96.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function show(Business $business, Humanresource $humanresource)
    {
        logger()->info(__METHOD__);
        logger()->info(sprintf('businessId:%s humanresourceId:%s', $business->id, $humanresource->id));

Severity: Major
Found in app/Http/Controllers/Manager/HumanresourceController.php and 2 other locations - About 45 mins to fix
app/Http/Controllers/Manager/HumanresourceController.php on lines 75..85
app/Http/Controllers/User/ContactController.php on lines 134..144

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 96.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

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

    protected function addSlots(array &$times, Vacancy $vacancy, Carbon $beginTime, $duration, $step, $maxNumberOfSlots)
Severity: Minor
Found in app/TG/Availability/AvailabilityService.php - About 45 mins to fix

The class AgendaController has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13.
Open

class AgendaController extends Controller
{
    /**
     * Concierge service implementation.
     *

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

Severity
Category
Status
Source
Language