Showing 51 of 65 total issues
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
Method index
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function index(Request $request)
{
$countries = Country::getCountries();
$regions = Region::listsTranslations('name')->pluck('name', 'id');
Method index
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function index(Request $request)
{
$countries = Country::getCountries();
//$countries = Country::getActiveCountries();
Method eventsValidator
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function eventsValidator(Request $request)
{
$rules = [
'title' => 'required',
'description' => 'required',
Method saveEventRepetitions
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function saveEventRepetitions(Request $request, int $eventId): void
{
EventRepetition::deletePreviousRepetitions($eventId);
// Saving repetitions - If it's a single event will be stored with just one repetition
Method build
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function build()
{
// Configure email parameters in .env file
switch ($this->report['reason']) {
Function getMapMarkerIconColor
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function getMapMarkerIconColor(int $eventCategoryId)
{
$ret = '';
switch ($eventCategoryId) {
case 1: //Regular Jam
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method cleanString
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function cleanString(string $text)
{
// Transform whitespaces to %20 for the URL
$text = str_replace(' ', '%20', $text);
$text = str_replace('ß', '%DF', $text);
Method getActiveEventsMapMarkersDataFromDb
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getActiveEventsMapMarkersDataFromDb()
{
$seconds = 86400; // One day (this cache tag get invalidates also on event save)
$ret = Cache::remember('active_events_map_markers_db_data', $seconds, function () {
Function saveMonthlyRepeatDates
has a Cognitive Complexity of 9 (exceeds 5 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];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function preSave
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function preSave(array $requestArray, $eventPicture): void
{
$teachers = Teacher::pluck('name', 'id');
$this->title = $requestArray['title'];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method saveWeeklyRepeatDates
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function saveWeeklyRepeatDates(int $eventId, array $weekDays, string $startDate, string $repeatUntilDate, string $timeStart, string $timeEnd)
Method saveMonthlyRepeatDates
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function saveMonthlyRepeatDates(int $eventId, array $monthRepeatDatas, string $startDate, string $repeatUntilDate, string $timeStart, string $timeEnd)
Function setEventRepeatFields
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function setEventRepeatFields(array $requestArray)
{
// Set Repeat Until
$this->repeat_type = $requestArray['repeat_type'];
if (isset($requestArray['repeat_until']) && array_key_exists('repeat_until', $requestArray)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method saveMultipleRepeatDates
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function saveMultipleRepeatDates(int $eventId, array $singleDaysRepeatDatas, string $startDate, string $timeStart, string $timeEnd)
Method uploadImageOnServer
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function uploadImageOnServer($imageFile, string $imageName, string $imageSubdir, int $imageWidth, int $thumbWidth): void
Method saveEventRepetitionOnDB
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function saveEventRepetitionOnDB(int $eventId, string $dateStart, string $dateEnd, string $timeStart, string $timeEnd)
Avoid too many return
statements within this method. Open
return $query->where('event_venues.city', 'like', '%'.$city.'%');
Avoid too many return
statements within this method. Open
return "<?php echo date('g.i a', strtotime($expression))?>";
Avoid too many return
statements within this method. Open
return view('laravel-events-calendar::events.index', compact('events'))
->with('i', (request()->input('page', 1) - 1) * 20)
->with('eventCategories', $eventCategories)
->with('countries', $countries)
->with('venues', $venues)