Showing 313 of 313 total issues
Avoid using static access to class '\Illuminate\Support\Facades\Schema' in method 'up'. Open
Schema::table('topic_richtexts', function (Blueprint $table) {
$table->bigInteger('length')->nullable();
});
- 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\Schema' in method 'up'. Open
Schema::table('topic_videos', function (Blueprint $table) {
$table->bigInteger('length')->nullable();
});
- 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\Courses\Facades\Topic' in method 'boot'. Open
Topic::registerContentClasses([
Audio::class,
Video::class,
Image::class,
RichText::class,
- 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\HeadlessH5P\Repositories\H5PContentRepository' in method 'register'. Open
H5PContentRepository::extendQueryJoin(
fn () => [['topic_h5ps.value', 'hh5p_contents.id']],
'topic_h5ps'
);
- 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 'convertFilePathByHttp'. Open
Storage::delete($destination . '.' . $ext[1]);
- 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 parameters such as '$request'. Open
public function toArray($request)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid using static access to class '\Illuminate\Support\Facades\Storage' in method 'toArray'. Open
'url' => $this->resource->value ? Storage::url($this->resource->value) : null,
- 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 parameters such as '$request'. Open
public function toArray($request)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid using static access to class '\EscolaLms\TopicTypes\Facades\Path' in method 'toArray'. Open
'value' => Path::sanitizePathForExport(Markdown::getImagesPathsWithoutImageApi($this->resource->value)),
- 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 EscolaLms\TopicTypes\Database\Factories\FakerMarkdownProvider\count() function in do loops. Open
do {
$parts[] = self::markdownH1();
if (self::randomDigit() > 3) {
$parts[] = self::markdownP();
}
- Read upRead up
- Exclude checks
CountInLoopExpression
Since: 2.7.0
Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.
Example
class Foo {
public function bar()
{
$array = array();
for ($i = 0; count($array); $i++) {
// ...
}
}
}
Source https://phpmd.org/rules/design.html#countinloopexpression
Only one argument is allowed per line in a multi-line function call Open
Storage::putFileAs($path, new File(realpath(__DIR__.'/../mocks/1.pdf'), $filename);
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
fn () => [['topic_h5ps.value', 'hh5p_contents.id']],
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
str_contains($filepath, 'storage') => $results[] = $this->convertFilePathByStorage($filepath, $destination),
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
DB::Connection() instanceof PostgresConnection ? 'hh5p_contents.parameters::jsonb' : 'hh5p_contents.parameters',
- Exclude checks
Line exceeds 120 characters; contains 147 characters Open
'content' => isset($this->resource->value) ? app(HeadlessH5PServiceContract::class)->getContentSettings($this->resource->value) : null,
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
return isset($lengthKey['length_key']) ? count(Arr::get($parameters, $lengthKey['length_key'])) : $lengthKey['default_length'];
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
$destination = sprintf('course/%d/topic/%d/%s/%s', $course->id, $topic->id, $this->getStoragePathFinalSegment(), $basename);
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
str_contains($filepath, 'http') => $results[] = $this->convertFilePathByHttp($destinationPrefix, $filepath, $destination),
- Exclude checks
Line exceeds 120 characters; contains 158 characters Open
str_contains($filepath, 'api/images/img') => $results[] = $this->convertFilePathByApiPattern($destinationPrefix, $filepath, $destination),
- Exclude checks
Line exceeds 120 characters; contains 147 characters Open
'content' => isset($this->resource->value) ? app(HeadlessH5PServiceContract::class)->getContentSettings($this->resource->value) : null,
- Exclude checks