mambax7/extgallery

View on GitHub
class/AudioPhpCaptcha.php

Summary

Maintainability
A
0 mins
Test Coverage

__construct accesses the super-global variable $_SESSION.
Open

    public function __construct(
        $sFlitePath = CAPTCHA_FLITE_PATH, // path to flite binary
        $sAudioPath = CAPTCHA_AUDIO_PATH // the location to temporarily store the generated audio CAPTCHA
    )
    {
Severity: Minor
Found in class/AudioPhpCaptcha.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

__construct accesses the super-global variable $_SESSION.
Open

    public function __construct(
        $sFlitePath = CAPTCHA_FLITE_PATH, // path to flite binary
        $sAudioPath = CAPTCHA_AUDIO_PATH // the location to temporarily store the generated audio CAPTCHA
    )
    {
Severity: Minor
Found in class/AudioPhpCaptcha.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Remove error control operator '@' on line 144.
Open

    public function Create()
    {
        $sText = $this->Mask($this->sCode);
        $sFile = \md5($this->sCode . \time());

Severity: Minor
Found in class/AudioPhpCaptcha.php by phpmd

ErrorControlOperator

Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

Example

function foo($filePath) {
    $file = @fopen($filPath); // hides exceptions
    $key = @$array[$notExistingKey]; // assigns null to $key
}

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

Avoid unused local variables such as '$iValue'.
Open

        foreach ($sText as $i => $iValue) {
Severity: Minor
Found in class/AudioPhpCaptcha.php by phpmd

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

Method name "AudioPhpCaptcha::SetFlitePath" is not in camel caps format
Open

    public function SetFlitePath($sFlitePath)
Severity: Minor
Found in class/AudioPhpCaptcha.php by phpcodesniffer

Method name "AudioPhpCaptcha::Mask" is not in camel caps format
Open

    public function Mask($sText)
Severity: Minor
Found in class/AudioPhpCaptcha.php by phpcodesniffer

The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line
Open

    {
Severity: Minor
Found in class/AudioPhpCaptcha.php by phpcodesniffer

Multi-line function declarations must define one parameter per line
Open

        $sFlitePath = CAPTCHA_FLITE_PATH, // path to flite binary
Severity: Minor
Found in class/AudioPhpCaptcha.php by phpcodesniffer

Method name "AudioPhpCaptcha::SetAudioPath" is not in camel caps format
Open

    public function SetAudioPath($sAudioPath)
Severity: Minor
Found in class/AudioPhpCaptcha.php by phpcodesniffer

Method name "AudioPhpCaptcha::Create" is not in camel caps format
Open

    public function Create()
Severity: Minor
Found in class/AudioPhpCaptcha.php by phpcodesniffer

The method SetFlitePath is not named in camelCase.
Open

    public function SetFlitePath($sFlitePath)
    {
        $this->sFlitePath = $sFlitePath;
    }
Severity: Minor
Found in class/AudioPhpCaptcha.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method Mask is not named in camelCase.
Open

    public function Mask($sText)
    {
        $iLength = mb_strlen($sText);

        // loop through characters in code and format
Severity: Minor
Found in class/AudioPhpCaptcha.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method SetAudioPath is not named in camelCase.
Open

    public function SetAudioPath($sAudioPath)
    {
        $this->sAudioPath = $sAudioPath;
    }
Severity: Minor
Found in class/AudioPhpCaptcha.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method Create is not named in camelCase.
Open

    public function Create()
    {
        $sText = $this->Mask($this->sCode);
        $sFile = \md5($this->sCode . \time());

Severity: Minor
Found in class/AudioPhpCaptcha.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

There are no issues that match your filters.

Category
Status