Saibamen/HotelManager

View on GitHub
app/Http/Controllers/ReservationController.php

Summary

Maintainability
F
3 days
Test Coverage
A
100%

File ReservationController.php has 525 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace App\Http\Controllers;

use App\Http\Interfaces\ManageTableInterface;
Severity: Major
Found in app/Http/Controllers/ReservationController.php - About 1 day to fix

    The class ReservationController has an overall complexity of 51 which is very high. The configured complexity threshold is 50.
    Open

    class ReservationController extends Controller implements ManageTableInterface
    {
        protected $reservationTableService;
    
        public function __construct(ReservationTableService $reservationTableService)

    The class ReservationController has 16 public methods. Consider refactoring ReservationController to keep number of public methods under 10.
    Open

    class ReservationController extends Controller implements ManageTableInterface
    {
        protected $reservationTableService;
    
        public function __construct(ReservationTableService $reservationTableService)

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

    Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

    ReservationController has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ReservationController extends Controller implements ManageTableInterface
    {
        protected $reservationTableService;
    
        public function __construct(ReservationTableService $reservationTableService)
    Severity: Minor
    Found in app/Http/Controllers/ReservationController.php - About 2 hrs to fix

      Method add has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function add($guestId, $roomId)
          {
              if (!$this->isReservationDataInSessionCorrect()) {
                  return $this->returnBack([
                      'message'     => trans('general.session_error'),
      Severity: Minor
      Found in app/Http/Controllers/ReservationController.php - About 1 hr to fix

        Method postEdit has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function postEdit(ReservationEditRequest $request, $objectId)
            {
                try {
                    $object = Reservation::with('room:id,capacity')
                        ->findOrFail($objectId);
        Severity: Minor
        Found in app/Http/Controllers/ReservationController.php - About 1 hr to fix

          Method getFields has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getFields($forAdd = false)
              {
                  return [
                      [
                          'id'    => 'date_start',
          Severity: Minor
          Found in app/Http/Controllers/ReservationController.php - About 1 hr to fix

            Method chooseFreeRoom has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function chooseFreeRoom(RoomTableService $roomTableService, $guestId)
                {
                    if (!$this->isReservationDataInSessionCorrect()) {
                        return $this->returnBack([
                            'message'     => trans('general.session_error'),
            Severity: Minor
            Found in app/Http/Controllers/ReservationController.php - About 1 hr to fix

              Method editChangeRoom has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function editChangeRoom($reservationId, $roomId)
                  {
                      try {
                          $reservation = Reservation::select('id', 'people', 'date_start', 'date_end')
                              ->findOrFail($reservationId);
              Severity: Minor
              Found in app/Http/Controllers/ReservationController.php - About 1 hr to fix

                Method getActionButtons has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getActionButtons()
                    {
                        return [
                            'id'         => 'action_buttons',
                            'type'       => 'buttons',
                Severity: Minor
                Found in app/Http/Controllers/ReservationController.php - About 1 hr to fix

                  Method editChooseRoom has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function editChooseRoom(RoomTableService $roomTableService, $reservationId)
                      {
                          try {
                              $reservation = Reservation::select('id', 'guest_id', 'date_start', 'date_end', 'people')
                                  ->findOrFail($reservationId);
                  Severity: Minor
                  Found in app/Http/Controllers/ReservationController.php - About 1 hr 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

                      Class "ReservationController" has 21 methods, which is greater than 20 authorized. Split it into smaller classes.
                      Open

                      class ReservationController extends Controller implements ManageTableInterface

                      A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

                      Reduce the number of returns of this function 4, down to the maximum allowed 3.
                      Open

                          public function postEdit(ReservationEditRequest $request, $objectId)

                      Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function myFunction(){ // Noncompliant as there are 4 return statements
                        if (condition1) {
                          return true;
                        } else {
                          if (condition2) {
                            return false;
                          } else {
                            return true;
                          }
                        }
                        return false;
                      }
                      

                      Reduce the number of returns of this function 4, down to the maximum allowed 3.
                      Open

                          public function editChangeRoom($reservationId, $roomId)

                      Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function myFunction(){ // Noncompliant as there are 4 return statements
                        if (condition1) {
                          return true;
                        } else {
                          if (condition2) {
                            return false;
                          } else {
                            return true;
                          }
                        }
                        return false;
                      }
                      

                      Reduce the number of returns of this function 5, down to the maximum allowed 3.
                      Open

                          public function add($guestId, $roomId)

                      Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function myFunction(){ // Noncompliant as there are 4 return statements
                        if (condition1) {
                          return true;
                        } else {
                          if (condition2) {
                            return false;
                          } else {
                            return true;
                          }
                        }
                        return false;
                      }
                      

                      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

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

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

                              $dateStart = Carbon::parse($request->input('date_start'));

                      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 '\Carbon\Carbon' in method 'editChooseRoom'.
                      Open

                              $dateStart = Carbon::parse($reservation->date_start);

                      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 '\Carbon\Carbon' in method 'editChangeRoom'.
                      Open

                              $dateStart = Carbon::parse($reservation->date_start);

                      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 '\Carbon\Carbon' in method 'chooseFreeRoom'.
                      Open

                              $dateEnd = Carbon::parse($dateEnd);

                      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 '\Carbon\Carbon' in method 'add'.
                      Open

                              $dateEnd = Carbon::parse($dateEnd);

                      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 'chooseFreeRoom'.
                      Open

                                  Log::warning(__CLASS__.'::'.__FUNCTION__.' at '.__LINE__.': '.$e->getMessage());

                      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 '\Carbon\Carbon' in method 'add'.
                      Open

                              $dateStart = Carbon::parse($dateStart);

                      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 'isReservationDataInSessionCorrect'.
                      Open

                                  Log::error('Missing one of Session keys: date_start, date_end, 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

                      Avoid using static access to class '\Illuminate\Support\Facades\Session' in method 'add'.
                      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

                      Avoid using static access to class '\App\Models\Reservation' in method 'delete'.
                      Open

                                  $object = Reservation::findOrFail($objectId);

                      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

                              $dateEnd = Session::get('date_end');

                      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 '\Carbon\Carbon' in method 'chooseFreeRoom'.
                      Open

                              $dateStart = Carbon::parse($dateStart);

                      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 '\Carbon\Carbon' in method 'editChooseRoom'.
                      Open

                              $dateEnd = Carbon::parse($reservation->date_end);

                      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 '\Carbon\Carbon' in method 'editChangeRoom'.
                      Open

                              $dateEnd = Carbon::parse($reservation->date_end);

                      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 'isReservationDataInSessionCorrect'.
                      Open

                              if (!Session::has(['date_start', 'date_end', '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

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

                              Session::reflash();

                      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

                              $dateStart = Session::get('date_start');

                      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 'add'.
                      Open

                              $dateStart = Session::get('date_start');

                      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 'add'.
                      Open

                              $dateEnd = Session::get('date_end');

                      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 'add'.
                      Open

                                  Log::warning(__CLASS__.'::'.__FUNCTION__.' at '.__LINE__.': '.$e->getMessage());

                      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 '\Carbon\Carbon' in method 'postEdit'.
                      Open

                              $dateEnd = Carbon::parse($request->input('date_end'));

                      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

                      Define a constant instead of duplicating this literal "readonly" 4 times.
                      Open

                                      'readonly' => 'readonly',

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "guest_id" 6 times.
                      Open

                              $dataset = Reservation::select('id', 'room_id', 'guest_id', 'date_start', 'date_end', 'people')

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "room_id" 5 times.
                      Open

                              $dataset = Reservation::select('id', 'room_id', 'guest_id', 'date_start', 'date_end', 'people')

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "general.people_exceeds_room_capacity" 3 times.
                      Open

                                      'message'     => trans('general.people_exceeds_room_capacity'),

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "general.object_not_found" 11 times.
                      Open

                                      'message'     => trans('general.object_not_found'),

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "optional" 7 times.
                      Open

                                  'optional' => [

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "general.saved" 4 times.
                      Open

                              $this->addFlashMessage(trans('general.saved'), 'alert-success');

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "room:id,number" 4 times.
                      Open

                                  ->with('room:id,number')

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "alert-success" 5 times.
                      Open

                              $this->addFlashMessage(trans('general.saved'), 'alert-success');

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "alert-danger" 26 times.
                      Open

                                  $this->addFlashMessage(trans('general.no_reservations_in_database'), 'alert-danger');

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "dataset" 9 times.
                      Open

                                  'dataset'       => $dataset,

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "general.no_reservations_in_database" 3 times.
                      Open

                                  $this->addFlashMessage(trans('general.no_reservations_in_database'), 'alert-danger');

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "last_name" 4 times.
                      Open

                              $dataset = Guest::select('id', 'first_name', 'last_name', 'address', 'zip_code', 'place', 'PESEL', 'contact')

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "routeName" 8 times.
                      Open

                                  'routeName'     => $this->reservationTableService->getRouteName(),

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "alert-class" 21 times.
                      Open

                                      'alert-class' => 'alert-danger',

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "people" 12 times.
                      Open

                              $dataset = Reservation::select('id', 'room_id', 'guest_id', 'date_start', 'date_end', 'people')

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "general.dates_coincide_different_booking" 3 times.
                      Open

                                      'message'     => trans('general.dates_coincide_different_booking'),

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "number" 3 times.
                      Open

                              $dataset = Room::select('id', 'number', 'floor', 'capacity', 'price', 'comment')

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "first_name" 4 times.
                      Open

                              $dataset = Guest::select('id', 'first_name', 'last_name', 'address', 'zip_code', 'place', 'PESEL', 'contact')

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "class" 6 times.
                      Open

                                  $data = ['class' => 'alert-danger', 'message' => trans('general.object_not_found')];

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "message" 23 times.
                      Open

                                      'message'     => trans('general.object_not_found'),

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "date_start" 13 times.
                      Open

                              $dataset = Reservation::select('id', 'room_id', 'guest_id', 'date_start', 'date_end', 'people')

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "value" 7 times.
                      Open

                                  'value' => function (Reservation $data) {

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "required" 6 times.
                      Open

                                          'required'    => 'required',

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "capacity" 4 times.
                      Open

                              $dataset = Room::select('id', 'number', 'floor', 'capacity', 'price', 'comment')

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "date_end" 16 times.
                      Open

                              $dataset = Reservation::select('id', 'room_id', 'guest_id', 'date_start', 'date_end', 'people')

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "additionalRouteParams" 3 times.
                      Open

                                  'additionalRouteParams' => $guest->id,

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "columns" 7 times.
                      Open

                                  'columns'       => $this->reservationTableService->getColumns(),

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "title" 14 times.
                      Open

                                  'title'         => $title,

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "routeChooseName" 4 times.
                      Open

                                  'routeChooseName' => $this->reservationTableService->getRouteName().'.search_free_rooms',

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

                      Define a constant instead of duplicating this literal "guest:id,first_name,last_name" 4 times.
                      Open

                                  ->with('guest:id,first_name,last_name')

                      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                      Noncompliant Code Example

                      With the default threshold of 3:

                      function run() {
                        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                        execute('action1');
                        release('action1');
                      }
                      

                      Compliant Solution

                      ACTION_1 = 'action1';
                      
                      function run() {
                        prepare(ACTION_1);
                        execute(ACTION_1);
                        release(ACTION_1);
                      }
                      

                      Exceptions

                      To prevent generating some false-positives, literals having less than 5 characters are excluded.

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

                          public function current()
                          {
                              $title = trans('navigation.current_reservations');
                      
                              $dataset = Reservation::select('id', 'room_id', 'guest_id', 'date_start', 'date_end', 'people')
                      Severity: Major
                      Found in app/Http/Controllers/ReservationController.php and 1 other location - About 3 hrs to fix
                      app/Http/Controllers/ReservationController.php on lines 79..102

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

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

                          public function future()
                          {
                              $title = trans('navigation.future_reservations');
                      
                              $dataset = Reservation::select('id', 'room_id', 'guest_id', 'date_start', 'date_end', 'people')
                      Severity: Major
                      Found in app/Http/Controllers/ReservationController.php and 1 other location - About 3 hrs to fix
                      app/Http/Controllers/ReservationController.php on lines 54..77

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

                      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

                      Avoid excessively long variable names like $reservationsIdsForDates. Keep variable name length under 20.
                      Open

                              $reservationsIdsForDates = DB::table('reservations')

                      LongVariable

                      Since: 0.2

                      Detects when a field, formal or local variable is declared with a long name.

                      Example

                      class Something {
                          protected $reallyLongIntName = -3; // VIOLATION - Field
                          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                              $otherReallyLongName = -5; // VIOLATION - Local
                              for ($interestingIntIndex = 0; // VIOLATION - For
                                   $interestingIntIndex < 10;
                                   $interestingIntIndex++ ) {
                              }
                          }
                      }

                      Source https://phpmd.org/rules/naming.html#longvariable

                      Avoid excessively long variable names like $reservationTableService. Keep variable name length under 20.
                      Open

                          protected $reservationTableService;

                      LongVariable

                      Since: 0.2

                      Detects when a field, formal or local variable is declared with a long name.

                      Example

                      class Something {
                          protected $reallyLongIntName = -3; // VIOLATION - Field
                          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                              $otherReallyLongName = -5; // VIOLATION - Local
                              for ($interestingIntIndex = 0; // VIOLATION - For
                                   $interestingIntIndex < 10;
                                   $interestingIntIndex++ ) {
                              }
                          }
                      }

                      Source https://phpmd.org/rules/naming.html#longvariable

                      Avoid excessively long variable names like $reservationTableService. Keep variable name length under 20.
                      Open

                          public function __construct(ReservationTableService $reservationTableService)

                      LongVariable

                      Since: 0.2

                      Detects when a field, formal or local variable is declared with a long name.

                      Example

                      class Something {
                          protected $reallyLongIntName = -3; // VIOLATION - Field
                          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                              $otherReallyLongName = -5; // VIOLATION - Local
                              for ($interestingIntIndex = 0; // VIOLATION - For
                                   $interestingIntIndex < 10;
                                   $interestingIntIndex++ ) {
                              }
                          }
                      }

                      Source https://phpmd.org/rules/naming.html#longvariable

                      Line exceeds 120 characters; contains 126 characters
                      Open

                              $submitRoute = route($this->reservationTableService->getRouteName().'.post_search_free_rooms', [$dataset->guest->id]);

                      There are no issues that match your filters.

                      Category
                      Status