YetiForceCompany/YetiForceCRM

View on GitHub
app/Controller/ExposeMethod.php

Summary

Maintainability
A
0 mins
Test Coverage
B
87%

Missing class import via use statement (line '70', column '13').
Open

        throw new \App\Exceptions\AppException('ERR_NOT_ACCESSIBLE', 406);
Severity: Minor
Found in app/Controller/ExposeMethod.php by phpmd

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 '80', column '7').
Open

    public function process(\App\Request $request)
    {
        if ($mode = $request->getMode()) {
            $this->invokeExposedMethod($mode, $request);
        }
Severity: Minor
Found in app/Controller/ExposeMethod.php by phpmd

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

Saw an @param annotation for request, but the param list of function invokeExposedMethod() : \App\Controller\type is empty
Open

     * @param \App\Request $request
Severity: Info
Found in app/Controller/ExposeMethod.php by phan

Return type of invokeExposedMethod() is undeclared type \App\Controller\type
Open

    public function invokeExposedMethod()
Severity: Minor
Found in app/Controller/ExposeMethod.php by phan

Saw an @param annotation for name, but the param list of function invokeExposedMethod() : \App\Controller\type is empty
Open

     * @param string       $name    - method name
Severity: Info
Found in app/Controller/ExposeMethod.php by phan

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

     *

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

     *

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

     *

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

     * Function checks if the method is exposed for client usage.

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

            return true;

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

        }

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

        }

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

     *

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

    {

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

     *

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

    {

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

     * @return type

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

    }

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

    /**

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

        if (\in_array($name, $this->exposedMethods)) {

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

        $parameters = \func_get_args();

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

            $this->invokeExposedMethod($mode, $request);

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

     * Control the exposure of methods to be invoked from client (kind-of RPC).

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

     */

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

        if (!\in_array($name, $this->exposedMethods)) {

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

     * Function invokes exposed methods for this class.

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

            $this->exposedMethods[] = $name;

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

     * @param string $name - method name

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

    }

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

    /**

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

     * @param string       $name    - method name

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

            return \call_user_func_array([$this, $name], $parameters);

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

        if ($mode = $request->getMode()) {

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

        }

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

     * @var string[]

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

    protected function exposeMethod($name)

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

    }

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

     * @return bool

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

     * @param \App\Request $request

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

    public function invokeExposedMethod()

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

    public function isMethodExposed($name)

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

    {

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

        if (!empty($name) && $this->isMethodExposed($name)) {

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

        }

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

     * Function that will expose methods for external access.

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

    /**

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

     */

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

     *

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

     * @param \App\Request $request

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

     */

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

    protected $exposedMethods = [];

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

    /**

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

     *

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

        $name = array_shift($parameters);

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

     * @param string $name - method name

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

     * @throws \App\Exceptions\AppException

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

     *

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

    }

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

        return false;

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

    {

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

     * Process action.

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

    /**

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

     */

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

        throw new \App\Exceptions\AppException('ERR_NOT_ACCESSIBLE', 406);

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

     */

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

    public function process(\App\Request $request)

There are no issues that match your filters.

Category
Status