lib/Ajde/Resource/Local/Compressor.php

Summary

Maintainability
A
0 mins
Test Coverage

Missing class import via use statement (line '149', column '23').
Open

            throw new Ajde_Exception(sprintf('Directory %s is not writable', $this->getBase()), 90014);

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

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

Missing class import via use statement (line '21', column '23').
Open

            throw new Ajde_Exception(sprintf('Compressor for type %s not found', $type), 90017);

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

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

Missing class import via use statement (line '134', column '20').
Open

        return new Ajde_Resource_Local_Compressed($this->getType(), $this->getFilename());

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

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

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

    public function getCacheStatus()
    {
        $hash = $this->getHash();
        $fileTimePattern = $hash['fileName'].'.'.$hash['fileTime'].'.'.$this->getType();
        if ($fileName = Ajde_Fs_Find::findFile($this->getBase(), $fileTimePattern)) {

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 using static access to class 'Ajde_Event' in method 'saveCache'.
Open

        Ajde_Event::trigger($this, 'afterCompress');

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 assigning values to variables in if clauses and the like (line '111', column '13').
Open

    public function getCacheStatus()
    {
        $hash = $this->getHash();
        $fileTimePattern = $hash['fileName'].'.'.$hash['fileTime'].'.'.$this->getType();
        if ($fileName = Ajde_Fs_Find::findFile($this->getBase(), $fileTimePattern)) {

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 using static access to class 'Ajde_Fs_Find' in method 'getCacheStatus'.
Open

        if ($fileName = Ajde_Fs_Find::findFile($this->getBase(), $fileTimePattern)) {

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 'Ajde_Document' in method 'saveCache'.
Open

        Ajde_Document::registerDocumentProcessor($this->getType(), 'compressor');

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 'Ajde_Event' in method 'saveCache'.
Open

        Ajde_Event::trigger($this, 'beforeCompress');

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 'Ajde_Fs_Find' in method 'getCacheStatus'.
Open

        if ($fileName = Ajde_Fs_Find::findFile($this->getBase(), $fileNamePattern)) {

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 property $_contents is not named in camelCase.
Open

abstract class Ajde_Resource_Local_Compressor extends Ajde_Object_Standard
{
    const CACHE_STATUS_NOT_EXIST = 0;
    const CACHE_STATUS_EXIST = 1;
    const CACHE_STATUS_UPDATE = 2;

CamelCasePropertyName

Since: 0.2

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

Example

class ClassName {
    protected $property_name;
}

Source

The property $_resources is not named in camelCase.
Open

abstract class Ajde_Resource_Local_Compressor extends Ajde_Object_Standard
{
    const CACHE_STATUS_NOT_EXIST = 0;
    const CACHE_STATUS_EXIST = 1;
    const CACHE_STATUS_UPDATE = 2;

CamelCasePropertyName

Since: 0.2

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

Example

class ClassName {
    protected $property_name;
}

Source

The class Ajde_Resource_Local_Compressor is not named in CamelCase.
Open

abstract class Ajde_Resource_Local_Compressor extends Ajde_Object_Standard
{
    const CACHE_STATUS_NOT_EXIST = 0;
    const CACHE_STATUS_EXIST = 1;
    const CACHE_STATUS_UPDATE = 2;

CamelCaseClassName

Since: 0.2

It is considered best practice to use the CamelCase notation to name classes.

Example

class class_name {
}

Source

There are no issues that match your filters.

Category
Status