Showing 65 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'],
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($searchKeywords || $searchCountry) {
$eventVenues = DB::table('event_venues')
->when($authorUserId, function ($query, $authorUserId) {
return $query->where('created_by', $authorUserId);
})
- Read upRead up
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 213.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($searchKeywords || $searchCountry) {
$teachers = DB::table('teachers')
->when($authorUserId, function ($query, $authorUserId) {
return $query->where('created_by', $authorUserId);
})
- Read upRead up
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 213.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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;
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function store(Request $request)
{
// Validate form datas
$validator = Validator::make($request->all(), [
'name' => 'required',
- Read upRead up
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 166.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function store(Request $request)
{
// Validate form datas
$validator = Validator::make($request->all(), [
'name' => 'required',
- Read upRead up
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 166.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
File LaravelEventsCalendar.php
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace DavideCasiraghi\LaravelEventsCalendar;
use Carbon\Carbon;
Method boot
has 71 lines of code (exceeds 25 allowed). Consider refactoring. 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
<?php
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
File Event.php
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace DavideCasiraghi\LaravelEventsCalendar\Models;
use Carbon\Carbon;
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');
}
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()
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 --}}
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">
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.
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];
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function store(Request $request)
{
// Validate form datas
$validator = $this->teachersValidator($request);
if ($validator->fails()) {
- Read upRead up
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 115.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function store(Request $request)
{
// Validate form datas
$validator = $this->organizersValidator($request);
if ($validator->fails()) {
- Read upRead up
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 115.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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::
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 () {