YetiForceCompany/YetiForceCRM

View on GitHub
app/Base.php

Summary

Maintainability
A
0 mins
Test Coverage
C
77%

The method getForSql has a boolean flag argument $skipEmtpy, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getForSql($key, $skipEmtpy = true)
Severity: Minor
Found in app/Base.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Avoid using static access to class 'App\Purifier' in method 'getForHtml'.
Open

        return Purifier::encodeHtml($this->get($key));
Severity: Minor
Found in app/Base.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 'App\Purifier' in method 'getForSql'.
Open

        return Purifier::purifySql($this->get($key), $skipEmtpy);
Severity: Minor
Found in app/Base.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 'App\Json' in method 'getArray'.
Open

            $value = Json::decode($this->value[$key]);
Severity: Minor
Found in app/Base.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 method getArray uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $value = (array) $this->value[$key];
        }
Severity: Minor
Found in app/Base.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getForSql($key, $skipEmtpy = true)
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to get the html encoded value for a given key.
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $key
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getArray($key, $value = [])
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $value = Json::decode($this->value[$key]);
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function setData($values)
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param array $values
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function get($key)
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return $value;
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    protected $value;
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return mixed Value for the given key
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return array
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return $this
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /** @var array Values */
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to get all the values of the Object.
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return $this->value;
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to get keys.
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Constructor.
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function __construct($values = [])
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->value = $values;
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return Purifier::purifySql($this->get($key), $skipEmtpy);
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to get the array values for a given key.
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            return $value;
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $value = (array) $this->value[$key];
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return $this;
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to set all the values.
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $key
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return empty($this->value[$key]);
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to remove the value.
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return mixed Value for the given key
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $key
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (\is_string($this->value[$key]) && (0 === strpos($this->value[$key], '[') || 0 === strpos($this->value[$key], '{'))) {
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return array
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return bool
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param array  $value
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $key
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Line exceeds 120 characters; contains 129 characters
Open

        if (\is_string($this->value[$key]) && (0 === strpos($this->value[$key], '[') || 0 === strpos($this->value[$key], '{'))) {
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getForHtml($key)
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function has($key)
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return isset($this->value[$key]);
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to check if the key is empty.
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return bool
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        unset($this->value[$key]);
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to get the value for a given key.
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        } else {
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function set($key, $value)
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->value = $values;
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return mixed
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param mixed $values
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return $this
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getKeys()
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return $this->value[$key] ?? null;
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return Purifier::encodeHtml($this->get($key));
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return $this;
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to get the value if its safe to use for SQL Query (column).
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $key
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param mixed  $value
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getData()
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $key
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param bool   $skipEmtpy Skip the check if string is empty
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $key
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (!isset($this->value[$key])) {
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to set the value for a given key.
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->value[$key] = $value;
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return string[]
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $key
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function remove($key)
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function isEmpty($key)
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return array_keys($this->value);
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to check if the key exists.
Severity: Minor
Found in app/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Base.php by phpcodesniffer

There are no issues that match your filters.

Category
Status