PoweredLocal/vrata

View on GitHub

Showing 122 of 122 total issues

Expected 1 space after FUNCTION keyword; 0 found
Open

        $this->app->singleton(RouteRegistry::class, function() {

Expected 1 space after FUNCTION keyword; 0 found
Open

        $this->app->singleton(Client::class, function() {

Expected 1 space after FUNCTION keyword; 0 found
Open

        $wrapper->setCritical($batch->filter(function($action) { return $action->isCritical(); })->count());
Severity: Minor
Found in app/Services/RestClient.php by phpcodesniffer

Expected 1 space after FUNCTION keyword; 0 found
Open

        return collect($paths)->reduce(function($carry, $route) {

There must be one blank line after the namespace declaration
Open

namespace App\Exceptions;

Expected 1 space after FUNCTION keyword; 0 found
Open

        return $data->map(function($input) use ($url, $serviceId, $docRoot) {

Expected 1 space after FUNCTION keyword; 0 found
Open

                collect($key)->each(function($outputKey, $property) use (&$data, &$carry, $key) {

There must be one blank line after the namespace declaration
Open

namespace App\Presenters;

There must be one blank line after the namespace declaration
Open

namespace App\Services;

Expected 1 space after FUNCTION keyword; 0 found
Open

        return $resources->reduce(function($carry, $resource) {

Expected 1 space after FUNCTION keyword; 0 found
Open

        return collect($this->config['services'])->map(function($settings, $serviceId) {

Expected 1 space after FUNCTION keyword; 0 found
Open

        return collect($swagger['paths'])->map(function($data, $path) use ($basePath) {

Expected 1 space after FUNCTION keyword; 0 found
Open

        $promises = $batch->reduce(function($carry, $action) use ($parametersJar) {
Severity: Minor
Found in app/Services/RestClient.php by phpcodesniffer

Function injectParams has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function injectParams($url, array $params, $prefix = '')
    {
        foreach ($params as $key => $value) {
            if (is_array($value)) {
                $url = $this->injectParams($url, $value, $prefix . $key . '.');
Severity: Minor
Found in app/Services/RestClient.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

The method route uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            return $route[2][$param];
        }
Severity: Minor
Found in app/Http/Request.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

Avoid using static access to class '\Laravel\Passport\Passport' in method 'boot'.
Open

        Passport::tokensExpireIn(Carbon::now()->addDays(15));
Severity: Minor
Found in app/Providers/AppServiceProvider.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 '\Dusterio\LumenPassport\LumenPassport' in method 'boot'.
Open

        LumenPassport::tokensExpireIn(Carbon::now()->addYears(50), 2);
Severity: Minor
Found in app/Providers/AppServiceProvider.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 '\Dusterio\LumenPassport\LumenPassport' in method 'boot'.
Open

        LumenPassport::allowMultipleTokens();
Severity: Minor
Found in app/Providers/AppServiceProvider.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 '\Illuminate\Support\Facades\Log' in method 'registerRoutes'.
Open

            Log::info('Not adding any service routes - route file is missing');
Severity: Minor
Found in app/Providers/AppServiceProvider.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\Routing\RouteRegistry' in method 'boot'.
Open

            return RouteRegistry::initFromFile('routes.json');
Severity: Minor
Found in app/Providers/AppServiceProvider.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

Severity
Category
Status
Source
Language