Showing 12 of 12 total issues
Method handle
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$date = $this->option('date') ? Carbon::parse($this->option('date')) : Carbon::now();
$templateCalendarEvents = $this->templateCalendarEvent
->where('is_recurring', true)
Function arrayIsEqualWithDB
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function arrayIsEqualWithDB(array $array, \Illuminate\Database\Eloquent\Model $model, array $skippable = []): bool
{
$columns = $model->getFillable();
foreach ($columns as $column) {
if (in_array($column, $skippable)) continue;
- 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 handle
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function handle()
{
$date = $this->option('date') ? Carbon::parse($this->option('date')) : Carbon::now();
$templateCalendarEvents = $this->templateCalendarEvent
->where('is_recurring', true)
- 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 getNextDateFromTemplate
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function getNextDateFromTemplate(TemplateCalendarEvent $templateCalendarEvent, CalendarEvent $calendarEventTmpLast, \DateTimeInterface $date)
{
$dateNext = null;
// TODO Refactor: OCP, Strategy
if ($calendarEventTmpLast) {
Method getNextCalendarEventStartDateTime
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getNextCalendarEventStartDateTime(\DateTimeInterface $startDateTime)
{
if (!$this->is_recurring) {
return null;
}
Method updateCalendarEvent
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateCalendarEvent(array $attributes, UserInterface $user = null, PlaceInterface $place = null)
{
DB::transaction(function () use ($attributes, $user, $place, &$calendarEventNew) {
$calendarEventNew = $this->createCalendarEvent(
array_merge(
Method showPotentialCalendarEventsOfMonth
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function showPotentialCalendarEventsOfMonth(\DateTimeInterface $date)
{
$endOfRecurring = $date->lastOfMonth()->hour(23)->minute(59)->second(59);
$month = str_pad($endOfRecurring->month, 2, '0', STR_PAD_LEFT);
$templateCalendarEvents = self::getMonthlyEvents($endOfRecurring);
Function getNextCalendarEventStartDateTime
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getNextCalendarEventStartDateTime(\DateTimeInterface $startDateTime)
{
if (!$this->is_recurring) {
return null;
}
- 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 deleteCalendarEvent
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function deleteCalendarEvent(bool $isRecurring = null)
{
DB::transaction(function () use ($isRecurring, &$isDeleted) {
if ($isRecurring === null) {
$isRecurring = $this->template->is_recurring;
- 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
Consider simplifying this complex logical expression. Open
if ($dateNext !== null
&& ($templateCalendarEvent->end_of_recurring === null
|| $dateNext <= $templateCalendarEvent->end_of_recurring
)
&& $dateNext >= $date
Function getNextDateFromTemplate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function getNextDateFromTemplate(TemplateCalendarEvent $templateCalendarEvent, CalendarEvent $calendarEventTmpLast, \DateTimeInterface $date)
{
$dateNext = null;
// TODO Refactor: OCP, Strategy
if ($calendarEventTmpLast) {
- 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 showPotentialCalendarEventsOfMonth
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function showPotentialCalendarEventsOfMonth(\DateTimeInterface $date)
{
$endOfRecurring = $date->lastOfMonth()->hour(23)->minute(59)->second(59);
$month = str_pad($endOfRecurring->month, 2, '0', STR_PAD_LEFT);
$templateCalendarEvents = self::getMonthlyEvents($endOfRecurring);
- 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"