Showing 636 of 636 total issues
Avoid unused local variables such as '$oa'. Open
return preg_match('/^(http|https):.*$/', $logotype, $oa) ?
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid using static access to class '\EscolaLms\Webinar\Database\Factories\WebinarFactory' in method 'newFactory'. Open
return WebinarFactory::new();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid unused local variables such as '$oa'. Open
return preg_match('/^(http|https):.*$/', $imagePath, $oa) ?
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid using static access to class 'EscolaLms\Webinar\Http\Resources\TrainerResource' in method 'toArray'. Open
'trainers' => TrainerResource::collection($this->resource->trainers),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Illuminate\Support\Facades\Storage' in method 'getImageUrlAttribute'. Open
$imagePath = Storage::url($path);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Illuminate\Support\Facades\Storage' in method 'getLogotypeUrlAttribute'. Open
$logotype = Storage::url(trim($this->attributes['logotype_path'], '/'));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\EscolaLms\Webinar\Tests\Database\Factories\UserFactory' in method 'newFactory'. Open
return UserFactory::new();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Carbon\Carbon' in method 'toArray'. Open
'active_to' => Carbon::make($this->resource->active_to),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method prepareFilters() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10. Open
public static function prepareFilters(array $search)
{
$dto = new self($search);
$user = auth()->user();
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Only one argument is allowed per line in a multi-line function call Open
$query->orWhereHas('users', fn ($query) =>
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
$query->orWhereHas('trainers', fn ($query) =>
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
return $query->whereHas('tags', fn (Builder $query) =>
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$dto->addToCriteria(new WhereCriterion($dto->model()->getTable() . '.active_to', $dto->getDateTimeTo(), '<='));
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
$search['active_from'] = isset($search['active_from']) ? Carbon::make($search['active_from'])->format('Y-m-d') : $now;
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
$dto->addToCriteria(new WhereCriterion($dto->model()->getTable() . '.active_to', $dto->getDateTimeToLowerThan(), '>='));
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
$dto->addToCriteria(new WebinarIncomingCriterion(now()->format('Y-m-d H:i:s'), $dto->getIncomingWithDuration()));
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
->where(fn (Builder $query) => $query->whereNull('duration')->where('webinars.active_to', '>', $this->value));
- Exclude checks
Line exceeds 120 characters; contains 204 characters Open
WHEN SUBSTRING_INDEX(duration, ' ', -1) = 'minutes' or SUBSTRING_INDEX(duration, ' ', -1) = 'minute' THEN DATE_ADD(active_to, INTERVAL SUBSTRING_INDEX(duration, ' ', 1) MINUTE )
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
public function getWebinarsList(array $search = [], bool $onlyActive = false, ?OrderDto $orderDto = null, bool $onlyIncoming = false): Builder
- Exclude checks
Line exceeds 120 characters; contains 172 characters Open
->whereRaw("active_to + CASE WHEN (duration ~ '^\\d+$') THEN (duration || ' hours')::interval ELSE (duration)::interval END > ?", [$this->value])
- Exclude checks