Saibamen/HotelManager

View on GitHub

Showing 279 of 279 total issues

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

      Avoid using short method names like CreateGuestsTable::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::create('guests', function (Blueprint $table) {
                  $table->increments('id');
                  $table->string('first_name', 35);

      ShortMethodName

      Since: 0.2

      Detects when very short method names are used.

      Example

      class ShortMethod {
          public function a( $index ) { // Violation
          }
      }

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

      Avoid using short method names like CreateRoomsTable::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::create('rooms', function (Blueprint $table) {
                  $table->increments('id');
                  $table->string('number', 5);

      ShortMethodName

      Since: 0.2

      Detects when very short method names are used.

      Example

      class ShortMethod {
          public function a( $index ) { // Violation
          }
      }

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

      Avoid using short method names like CreateReservationsTable::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::create('reservations', function (Blueprint $table) {
                  $table->increments('id');
                  $table->integer('room_id')->unsigned();

      ShortMethodName

      Since: 0.2

      Detects when very short method names are used.

      Example

      class ShortMethod {
          public function a( $index ) { // Violation
          }
      }

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

      Avoid using short method names like CreateUsersTable::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::create('users', function (Blueprint $table) {
                  $table->increments('id');
                  $table->string('name');

      ShortMethodName

      Since: 0.2

      Detects when very short method names are used.

      Example

      class ShortMethod {
          public function a( $index ) { // Violation
          }
      }

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

      Avoid using short method names like CreatePasswordResetsTable::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::create('password_resets', function (Blueprint $table) {
                  $table->string('email')->index();
                  $table->string('token');

      ShortMethodName

      Since: 0.2

      Detects when very short method names are used.

      Example

      class ShortMethod {
          public function a( $index ) { // Violation
          }
      }

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

      Method getColumns has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getColumns()
          {
              $dataset = [
                  [
                      'title' => trans('general.first_name'),
      Severity: Minor
      Found in app/Services/GuestTableService.php - About 1 hr to fix

        Method getColumns has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getColumns()
            {
                $dataset = [
                    [
                        'title' => trans('general.room'),
        Severity: Minor
        Found in app/Services/ReservationTableService.php - About 1 hr to fix

          Method getColumns has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getColumns()
              {
                  $dataset = [
                      [
                          'title' => trans('general.number'),
          Severity: Minor
          Found in app/Services/RoomTableService.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

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

                          if (typeof $(modal.relatedTarget).data("href") !== 'undefined') {
                              window.deleteHref = $(modal.relatedTarget).data("href");
                          }
                  Severity: Major
                  Found in resources/assets/js/deletemodal.js and 1 other location - About 1 hr to fix
                  resources/assets/js/deletemodal.js on lines 8..10

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

                  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

                          if (typeof $(modal.relatedTarget).data("id") !== 'undefined') {
                              window.deleteId = $(modal.relatedTarget).data("id");
                          }
                  Severity: Major
                  Found in resources/assets/js/deletemodal.js and 1 other location - About 1 hr to fix
                  resources/assets/js/deletemodal.js on lines 12..14

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

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

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

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

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

                  Refactorings

                  Further Reading

                  Method getInitialStateFields has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getInitialStateFields()
                      {
                          return [
                              [
                                  'id'    => 'rooms',
                  Severity: Minor
                  Found in app/Http/Controllers/AdminController.php - About 1 hr to fix

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

                    class UsersTableSeeder extends Seeder

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

                    class CreateReservationsTable extends Migration

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

                    class DatabaseSeeder extends Seeder

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

                    class CreateGuestsTable extends Migration
                    Severity
                    Category
                    Status
                    Source
                    Language