Showing 51 of 65 total issues
Method run
has 260 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function run()
{
$countries = [
['id' => '1', 'name' => 'Italy', 'continent_id' => '6', 'code' => 'IT'],
['id' => '2', 'name' => 'United States', 'continent_id' => '3', 'code' => 'US'],
File EventController.php
has 399 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace DavideCasiraghi\LaravelEventsCalendar\Http\Controllers;
use DavideCasiraghi\LaravelEventsCalendar\Facades\LaravelEventsCalendar;
File LaravelEventsCalendar.php
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace DavideCasiraghi\LaravelEventsCalendar;
use Carbon\Carbon;
Method boot
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function boot()
{
/*
* Optional methods to load your package assets
*/
File CountriesTableSeeder.php
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
File Event.php
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace DavideCasiraghi\LaravelEventsCalendar\Models;
use Carbon\Carbon;
Method getEvents
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function getEvents(array $filters, $itemPerPage)
{
if (! array_key_exists('startDate', $filters) || ! $filters['startDate']) {
$filters['startDate'] = Carbon::now()->format('Y-m-d');
}
EventController
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class EventController extends Controller
{
/***************************************************************************/
/* Restrict the access to this resource just to logged in users except show view */
public function __construct()
File create.blade.php
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
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 --}}
File edit.blade.php
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
@extends('laravel-events-calendar::events.layout')
@section('content')
<div class="container max-w-lg px-0">
<div class="row py-4">
Method calculateMonthlySelectOptions
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
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.
Method saveMonthlyRepeatDates
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
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];
Consider simplifying this complex logical expression. Open
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::
Method getActiveEventsMapGeoJSON
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 () {
Method preSave
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function preSave(array $requestArray, $eventPicture): void
{
$teachers = Teacher::pluck('name', 'id');
$this->title = $requestArray['title'];
Method index
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Method decodeOnMonthlyKind
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function decodeOnMonthlyKind(string $onMonthlyKindCode)
{
$ret = '';
$onMonthlyKindCodeArray = explode('|', $onMonthlyKindCode);
$weekDays = [
Method getRepetitionTextString
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function getRepetitionTextString(Event $event, EventRepetition $firstRpDates)
{
$ret = '';
switch ($event->repeat_type) {
Method getMapMarkerIconColor
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function getMapMarkerIconColor(int $eventCategoryId)
{
$ret = '';
switch ($eventCategoryId) {
case 1: //Regular Jam
Method index
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function index(Request $request)
{
//$countries = Country::orderBy('countries.name')->pluck('name', 'id');
$countries = Country::getCountriesWithTeachers();