chamilo/chamilo-lms

View on GitHub
src/CoreBundle/ServiceHelper/ThemeHelper.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid assigning values to variables in if clauses and the like (line '153', column '17').
Open

    public function getAssetBase64Encoded(string $path): string
    {
        try {
            if ($fullPath = $this->getFileLocation($path)) {
                $detector = new ExtensionMimeTypeDetector();

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

Avoid assigning values to variables in if clauses and the like (line '134', column '17').
Open

    public function getAssetContents(string $path): string
    {
        try {
            if ($fullPath = $this->getFileLocation($path)) {
                $stream = $this->filesystem->readStream($fullPath);

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

Missing function doc comment
Open

    public function __construct(

Variable "lp_theme_css" is not in valid camel caps format
Open

        global $lp_theme_css;

Missing function doc comment
Open

    public function getAssetBase64Encoded(string $path): string

Missing class doc comment
Open

final class ThemeHelper

Variable "lp_theme_css" is not in valid camel caps format
Open

                    $visualTheme = $lp_theme_css;

Missing function doc comment
Open

    public function getAssetContents(string $path): string

Add a single space around assignment operators
Open

declare(strict_types=1);

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

        #[Autowire(service: 'oneup_flysystem.themes_filesystem')]

Closing brace must be on a line by itself
Open

    ) {}

Missing function doc comment
Open

    public function getThemeAssetUrl(string $path, bool $absoluteUrl = false): string

Missing function doc comment
Open

    public function getThemeAssetLinkTag(string $path, bool $absoluteUrl = false): string

Line indented incorrectly; expected 4 spaces, found 8
Open

        private readonly UserHelper $userHelper,

Line indented incorrectly; expected 4 spaces, found 8
Open

        private readonly RouterInterface $router,

Closing brace must be on a line by itself
Open

    ) {}

Line indented incorrectly; expected 4 spaces, found 8
Open

        private readonly CidReqHelper $cidReqHelper,

Line indented incorrectly; expected 4 spaces, found 8
Open

        private readonly AccessUrlHelper $accessUrlHelper,

Line indented incorrectly; expected 4 spaces, found 8
Open

        private readonly SettingsCourseManager $settingsCourseManager,

Line indented incorrectly; expected 4 spaces, found 8
Open

        private readonly SettingsManager $settingsManager,

Line indented incorrectly; expected 4 spaces, found 8
Open

        private readonly FilesystemOperator $filesystem,

The variable $lp_theme_css is not named in camelCase.
Open

    public function getVisualTheme(): string
    {
        static $visualTheme;

        global $lp_theme_css;

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $lp_theme_css is not named in camelCase.
Open

    public function getVisualTheme(): string
    {
        static $visualTheme;

        global $lp_theme_css;

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

There are no issues that match your filters.

Category
Status