GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

BladeDirectiveHelpers::parseExpression()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 4
c 1
b 0
f 0
nc 3
nop 2
dl 0
loc 9
rs 10
1
<?php
2
3
namespace ProtoneMedia\LaravelMixins\Blade;
4
5
use Illuminate\Support\Facades\Blade;
6
7
trait BladeDirectiveHelpers
8
{
9
    /**
10
     * Strips the parentheses from the expression and splits the arguments into parts.
11
     * It returns an array containing the parts or the given defaults for each part.
12
     *
13
     * @param string $expression
14
     * @param array $defaults
15
     * @return array
16
     */
17
    public static function parseExpression(string $expression, array $defaults = []): array
18
    {
19
        $parts = explode(',', Blade::stripParentheses($expression));
20
21
        foreach ($defaults as $key => $default) {
22
            $parts[$key] = isset($parts[$key]) ? trim($parts[$key]) : $default;
23
        }
24
25
        return $parts;
26
    }
27
}
28