Saibamen/HotelManager

View on GitHub

Showing 279 of 279 total issues

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class CreateRoomsTable extends Migration

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class CreateUsersTable extends Migration

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class CreatePasswordResetsTable extends Migration

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

$factory->state(App\Models\Guest::class, 'belarus', function () {
    $faker = \Faker\Factory::create('bg_BG');

    return [
        'first_name' => $faker->firstName(),
Severity: Major
Found in database/factories/GuestFactory.php and 3 other locations - About 55 mins to fix
database/factories/GuestFactory.php on lines 31..43
database/factories/GuestFactory.php on lines 59..71
database/factories/GuestFactory.php on lines 73..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 99.

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 4 locations. Consider refactoring.
Open

$factory->state(App\Models\Guest::class, 'german', function () {
    $faker = \Faker\Factory::create('de_DE');

    return [
        'first_name' => $faker->firstName(),
Severity: Major
Found in database/factories/GuestFactory.php and 3 other locations - About 55 mins to fix
database/factories/GuestFactory.php on lines 45..57
database/factories/GuestFactory.php on lines 59..71
database/factories/GuestFactory.php on lines 73..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 99.

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 4 locations. Consider refactoring.
Open

$factory->state(App\Models\Guest::class, 'czech', function () {
    $faker = \Faker\Factory::create('cs_CZ');

    return [
        'first_name' => $faker->firstName(),
Severity: Major
Found in database/factories/GuestFactory.php and 3 other locations - About 55 mins to fix
database/factories/GuestFactory.php on lines 31..43
database/factories/GuestFactory.php on lines 45..57
database/factories/GuestFactory.php on lines 59..71

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 99.

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 4 locations. Consider refactoring.
Open

$factory->state(App\Models\Guest::class, 'french', function () {
    $faker = \Faker\Factory::create('fr_FR');

    return [
        'first_name' => $faker->firstName(),
Severity: Major
Found in database/factories/GuestFactory.php and 3 other locations - About 55 mins to fix
database/factories/GuestFactory.php on lines 31..43
database/factories/GuestFactory.php on lines 45..57
database/factories/GuestFactory.php on lines 73..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 99.

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

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 8 and the first side effect is on line 22.
Open

<?php
Severity: Minor
Found in public/index.php by phpcodesniffer

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

class ReservationController extends Controller implements ManageTableInterface
{
    protected $reservationTableService;

    public function __construct(ReservationTableService $reservationTableService)

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

Avoid too many return statements within this method.
Open

        return $dataset;
Severity: Major
Found in app/Services/RoomTableService.php - About 30 mins to fix

    The method getFields has a boolean flag argument $forAdd, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function getFields($forAdd = false)

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

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

    Avoid too many return statements within this method.
    Open

                        return $data->contact;
    Severity: Major
    Found in app/Services/GuestTableService.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                          return $data->comment;
      Severity: Major
      Found in app/Services/RoomTableService.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                            return $data->people;
        Severity: Major
        Found in app/Services/ReservationTableService.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return redirect()->route($this->reservationTableService->getRouteName().'.index');
          Severity: Major
          Found in app/Http/Controllers/ReservationController.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return $dataset;
            Severity: Major
            Found in app/Services/ReservationTableService.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return $dataset;
              Severity: Major
              Found in app/Services/GuestTableService.php - About 30 mins to fix

                Avoid using static access to class '\Carbon\Carbon' in method 'scopeCurrentlyFreeRooms'.
                Open

                                ->where('date_end', '>', Carbon::today());
                Severity: Minor
                Found in app/Models/Room.php by phpmd

                StaticAccess

                Since: 1.4.0

                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                Example

                class Foo
                {
                    public function bar()
                    {
                        Bar::baz();
                    }
                }

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

                Avoid using static access to class '\Illuminate\Support\Facades\Log' in method 'returnBack'.
                Open

                            Log::info('Request loop: '.back()->getTargetUrl());
                Severity: Minor
                Found in app/Http/Controllers/Controller.php by phpmd

                StaticAccess

                Since: 1.4.0

                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                Example

                class Foo
                {
                    public function bar()
                    {
                        Bar::baz();
                    }
                }

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

                Avoid using static access to class '\Illuminate\Support\Facades\Session' in method 'chooseFreeRoom'.
                Open

                        $people = Session::get('people');

                StaticAccess

                Since: 1.4.0

                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                Example

                class Foo
                {
                    public function bar()
                    {
                        Bar::baz();
                    }
                }

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

                Severity
                Category
                Status
                Source
                Language