davide-casiraghi/laravel-events-calendar

View on GitHub

Showing 51 of 65 total issues

Method run has 260 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function run()
    {
        $countries = [
            ['id' => '1', 'name' => 'Italy', 'continent_id' => '6', 'code' => 'IT'],
            ['id' => '2', 'name' => 'United States', 'continent_id' => '3', 'code' => 'US'],
Severity: Major
Found in database/seeds/CountriesTableSeeder.php - About 1 day to fix

    File EventController.php has 399 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace DavideCasiraghi\LaravelEventsCalendar\Http\Controllers;
    
    use DavideCasiraghi\LaravelEventsCalendar\Facades\LaravelEventsCalendar;
    Severity: Minor
    Found in src/Http/Controllers/EventController.php - About 5 hrs to fix

      File LaravelEventsCalendar.php has 320 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace DavideCasiraghi\LaravelEventsCalendar;
      
      use Carbon\Carbon;
      Severity: Minor
      Found in src/LaravelEventsCalendar.php - About 3 hrs to fix

        Method boot has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function boot()
            {
                /*
                 * Optional methods to load your package assets
                 */
        Severity: Major
        Found in src/LaravelEventsCalendarServiceProvider.php - About 2 hrs to fix

          File CountriesTableSeeder.php has 269 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          use Illuminate\Database\Seeder;
          use Illuminate\Support\Facades\DB;
          
          
          Severity: Minor
          Found in database/seeds/CountriesTableSeeder.php - About 2 hrs to fix

            File Event.php has 265 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            namespace DavideCasiraghi\LaravelEventsCalendar\Models;
            
            use Carbon\Carbon;
            Severity: Minor
            Found in src/Models/Event.php - About 2 hrs to fix

              Method getEvents has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function getEvents(array $filters, $itemPerPage)
                  {
                      if (! array_key_exists('startDate', $filters) || ! $filters['startDate']) {
                          $filters['startDate'] = Carbon::now()->format('Y-m-d');
                      }
              Severity: Major
              Found in src/Models/Event.php - About 2 hrs to fix

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

                class EventController extends Controller
                {
                    /***************************************************************************/
                    /* Restrict the access to this resource just to logged in users except show view */
                    public function __construct()
                Severity: Minor
                Found in src/Http/Controllers/EventController.php - About 2 hrs to fix

                  File create.blade.php has 252 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  @extends('laravel-events-calendar::events.layout')
                  
                  @section('javascript-document-ready')
                      @parent
                      {{-- End date update after start date has changed, and doesn't allow to select a date before the start --}}
                  Severity: Minor
                  Found in resources/views/events/create.blade.php - About 2 hrs to fix

                    File edit.blade.php has 251 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    @extends('laravel-events-calendar::events.layout')
                    
                    @section('content')
                        <div class="container max-w-lg px-0">
                            <div class="row py-4">
                    Severity: Minor
                    Found in resources/views/events/edit.blade.php - About 2 hrs to fix

                      Method calculateMonthlySelectOptions has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function calculateMonthlySelectOptions(Request $request)
                          {
                              $monthlySelectOptions = [];
                              $date = implode('-', array_reverse(explode('/', $request->day)));  // Our YYYY-MM-DD date string
                              $unixTimestamp = strtotime($date);  // Convert the date string into a unix timestamp.
                      Severity: Minor
                      Found in src/Http/Controllers/EventController.php - About 1 hr to fix

                        Method saveMonthlyRepeatDates has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function saveMonthlyRepeatDates(int $eventId, array $monthRepeatDatas, string $startDate, string $repeatUntilDate, string $timeStart, string $timeEnd)
                            {
                                $month = Carbon::createFromFormat('Y-m-d', $startDate);
                                $end = Carbon::createFromFormat('Y-m-d', $repeatUntilDate);
                                $weekdayArray = [Carbon::MONDAY, Carbon::TUESDAY, Carbon::WEDNESDAY, Carbon::THURSDAY, Carbon::FRIDAY, Carbon::SATURDAY, Carbon::SUNDAY];
                        Severity: Minor
                        Found in src/Models/EventRepetition.php - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                  if ($filters['keywords'] || $filters['category'] || $filters['city'] || $filters['country'] || $filters['region'] || $filters['continent'] || $filters['teacher'] || $filters['venue'] || $filters['endDate']) {
                          
                                  //$start = microtime(true);
                                      //DB::enableQueryLog();
                                      $ret = self::
                          Severity: Critical
                          Found in src/Models/Event.php - About 1 hr to fix

                            Method getActiveEventsMapGeoJSON has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public static function getActiveEventsMapGeoJSON()
                                {
                                    $cacheExpireMinutes = 1440; // Set the duration time of the cache (1 day - 1440 minutes) - this cache tag get invalidates also on event save
                            
                                    $eventsMapGeoJSONArrayCached = Cache::remember('active_events_map_markers_json', $cacheExpireMinutes, function () {
                            Severity: Minor
                            Found in src/Models/Event.php - About 1 hr to fix

                              Method preSave has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function preSave(array $requestArray, $eventPicture): void
                                  {
                                      $teachers = Teacher::pluck('name', 'id');
                              
                                      $this->title = $requestArray['title'];
                              Severity: Minor
                              Found in src/Models/Event.php - About 1 hr to fix

                                Method index has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function index(Request $request)
                                    {
                                        // To show just the events created by the the user - If admin or super admin is set to null show all the events
                                        $authorUserId = ($this->getLoggedAuthorId()) ? $this->getLoggedAuthorId() : null; // if is 0 (super admin or admin) it's setted to null to avoid include it in the query
                                
                                
                                Severity: Minor
                                Found in src/Http/Controllers/EventController.php - About 1 hr to fix

                                  Method decodeOnMonthlyKind has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public static function decodeOnMonthlyKind(string $onMonthlyKindCode)
                                      {
                                          $ret = '';
                                          $onMonthlyKindCodeArray = explode('|', $onMonthlyKindCode);
                                          $weekDays = [
                                  Severity: Minor
                                  Found in src/LaravelEventsCalendar.php - About 1 hr to fix

                                    Method getRepetitionTextString has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public static function getRepetitionTextString(Event $event, EventRepetition $firstRpDates)
                                        {
                                            $ret = '';
                                    
                                            switch ($event->repeat_type) {
                                    Severity: Minor
                                    Found in src/LaravelEventsCalendar.php - About 1 hr to fix

                                      Method getMapMarkerIconColor has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public static function getMapMarkerIconColor(int $eventCategoryId)
                                          {
                                              $ret = '';
                                              switch ($eventCategoryId) {
                                                  case 1: //Regular Jam
                                      Severity: Minor
                                      Found in src/LaravelEventsCalendar.php - About 1 hr to fix

                                        Method index has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            public function index(Request $request)
                                            {
                                                //$countries = Country::orderBy('countries.name')->pluck('name', 'id');
                                        
                                                $countries = Country::getCountriesWithTeachers();
                                        Severity: Minor
                                        Found in src/Http/Controllers/TeacherController.php - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language