EscolaLMS/topic-types

View on GitHub
src/Helpers/Markdown.php

Summary

Maintainability
A
0 mins
Test Coverage
D
69%

Avoid using static access to class '\Illuminate\Support\Facades\Storage' in method 'convertFilePathByApiPattern'.
Open

        if (!Storage::exists($destination)) {
Severity: Minor
Found in src/Helpers/Markdown.php by phpmd

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

            $info = getimagesize(Storage::path($destination));
Severity: Minor
Found in src/Helpers/Markdown.php by phpmd

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::put($destination, file_get_contents($filepath));
Severity: Minor
Found in src/Helpers/Markdown.php by phpmd

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\Str' in method 'convertFilePathByHttp'.
Open

        $destination = sprintf($destinationPrefix . '%s', Str::slug(basename($filepath)));
Severity: Minor
Found in src/Helpers/Markdown.php by phpmd

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

            if (Storage::exists($destination . '.' . $ext[1])) {
Severity: Minor
Found in src/Helpers/Markdown.php by phpmd

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 'convertFilePathByStorage'.
Open

        Storage::move($filepath, $destination);
Severity: Minor
Found in src/Helpers/Markdown.php by phpmd

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 'convertFilePathByApiPattern'.
Open

            Storage::move($filepath, $destination);
Severity: Minor
Found in src/Helpers/Markdown.php by phpmd

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::copy($destination, $destination . '.' . $ext[1]);
Severity: Minor
Found in src/Helpers/Markdown.php by phpmd

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]);
Severity: Minor
Found in src/Helpers/Markdown.php by phpmd

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 closing parenthesis and the opening brace of a multi-line function declaration must be on the same line
Open

    {
Severity: Minor
Found in src/Helpers/Markdown.php by phpcodesniffer

Line exceeds 120 characters; contains 158 characters
Open

                    str_contains($filepath, 'api/images/img') => $results[] = $this->convertFilePathByApiPattern($destinationPrefix, $filepath, $destination),
Severity: Minor
Found in src/Helpers/Markdown.php by phpcodesniffer

Line exceeds 120 characters; contains 142 characters
Open

                    str_contains($filepath, 'http') => $results[] = $this->convertFilePathByHttp($destinationPrefix, $filepath, $destination),
Severity: Minor
Found in src/Helpers/Markdown.php by phpcodesniffer

Line exceeds 120 characters; contains 128 characters
Open

                    str_contains($filepath, 'storage') => $results[] = $this->convertFilePathByStorage($filepath, $destination),
Severity: Minor
Found in src/Helpers/Markdown.php by phpcodesniffer

Expected 1 space after IF keyword; 0 found
Open

                if(str_contains($filepath, 'http') && !str_starts_with($filepath, url('/'))) {
Severity: Minor
Found in src/Helpers/Markdown.php by phpcodesniffer

Space before opening parenthesis of function call prohibited
Open

                match (true) {
Severity: Minor
Found in src/Helpers/Markdown.php by phpcodesniffer

Line indented incorrectly; expected at least 20 spaces, found 18
Open

                  return str_replace($match[3], $match[3], $match[0]);
Severity: Minor
Found in src/Helpers/Markdown.php by phpcodesniffer

There are no issues that match your filters.

Category
Status