Showing 58 of 95 total issues
Method run
has 255 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run()
{
$countries = [
['name' => 'Italy', 'continent_id' => '6', 'code' => 'IT'],
['name' => 'United States', 'continent_id' => '3', 'code' => 'US'],
File create.blade.php
has 361 lines of code (exceeds 250 allowed). Consider refactoring. Open
@extends('layouts.backend')
@section('title')
@lang('event.create_new_event')
@endsection
File edit.blade.php
has 360 lines of code (exceeds 250 allowed). Consider refactoring. Open
@extends('layouts.backend')
@section('title')
@lang('views.edit_insight')
@endsection
File edit.blade.php
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
@extends('layouts.backend')
@section('title')
@lang('event.edit_event')
@endsection
File edit.blade.php
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
@extends('layouts.backend')
@section('title')
@lang('views.edit_post')
@endsection
File EventService.php
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Services;
use App\Helpers\DateHelpers;
Method run
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run()
{
// Reset cached roles and permissions
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
File repeat-event.blade.php
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
@section('javascript-document-ready')
@parent
{{-- ON LOAD --}}
File CountriesTableSeeder.php
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Database\Seeders;
use App\Models\Country;
Function users
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function users(int $recordsPerPage = null, array $searchParameters = null)
{
$query = User::orderBy('email', 'asc');
$query->with('profile');
- 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
File intakeForm.blade.php
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
@extends('layouts.app')
@section('title')@lang('static_pages.footer.get_a_treatment')@endsection
@section('content')
Method getMonthlySelectOptions
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getMonthlySelectOptions(string $date): string
{
$monthlySelectOptions = [];
$date = implode('-', array_reverse(explode('/', $date))); // 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): void
{
$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];
Method getRepetitionTextString
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getRepetitionTextString(Event $event, EventRepetition $firstRpDates): string
{
$ret = '';
switch ($event->repeat_type) {
Method prepareImageHtml
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prepareImageHtml(?Media $image, array $parameters): string
{
if (is_null($image)) {
return "<div class='p-4 bg-yellow-200'>A image with this id has not been found.</div>";
}
Method getAll
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAll(int $recordsPerPage = null, array $searchParameters = null, string $orderDirection = 'asc')
{
// Upcoming events are shown first
$query = Event::select('events.*', 'event_repetitions.start_repeat', 'event_repetitions.end_repeat')
->with(['category', 'teachers', 'venue', 'venue.country'])
Function getAll
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getAll(int $recordsPerPage = null, array $searchParameters = null)
{
$query = Post::orderBy('created_at', 'desc');
if (!is_null($searchParameters)) {
- 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 getAll
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getAll(int $recordsPerPage = null, array $searchParameters = null, string $orderDirection = 'asc')
{
// Upcoming events are shown first
$query = Event::select('events.*', 'event_repetitions.start_repeat', 'event_repetitions.end_repeat')
->with(['category', 'teachers', 'venue', 'venue.country'])
- 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 decodeOnMonthlyKind
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function decodeOnMonthlyKind(string $onMonthlyKindCode): string
{
$ret = '';
$onMonthlyKindCodeArray = explode('|', $onMonthlyKindCode);
$weekDays = [
Method definition
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function definition()
{
// Facebook data
$publishedOnFacebookOn = $facebookUrl = $facebookBody = null;
if ($this->faker->boolean(50)) {