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.
Test Failed
Push — master ( 02540b...4b5b9f )
by Roelof Jan
03:26 queued 12s
created

FrontMatterCreator::toSnakeCase()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 1
dl 0
loc 11
ccs 7
cts 7
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace AloiaCms\Writer;
5
6
use Illuminate\Support\Collection;
7
use Symfony\Component\Yaml\Yaml;
8
9
class FrontMatterCreator
10
{
11
    private $matter = [];
12
13
    private $content = '';
14
15
    /**
16
     * FrontMatterCreator constructor.
17
     * @param array $matter
18
     * @param string $content
19
     */
20 52
    private function __construct(array $matter, string $content)
21
    {
22 52
        $this->matter = $matter;
23 52
        $this->content = $content;
24 52
    }
25
26
    /**
27
     * Provide the front matter and file content
28
     *
29
     * @param array $matter
30
     * @param string $content
31
     * @return static
32
     */
33 52
    public static function seed(array $matter, string $content)
34
    {
35 52
        return new static($matter, $content);
36
    }
37
38
    /**
39
     * Create a data file including the front matter
40
     *
41
     * @return string
42
     */
43 52
    public function create(): string
44
    {
45 52
        $matter = Collection::make($this->matter)
0 ignored issues
show
Bug introduced by
$this->matter of type array is incompatible with the type Illuminate\Contracts\Support\Arrayable expected by parameter $items of Illuminate\Support\Collection::make(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

45
        $matter = Collection::make(/** @scrutinizer ignore-type */ $this->matter)
Loading history...
46 52
            ->keysToSnakeCase()
47 43
            ->toArray();
48 52
49 52
        $front_matter_string = "";
50
51 52
        if (count($matter) > 0) {
52
            $front_matter_string = "---\n";
53 52
            $front_matter_string .= Yaml::dump($matter);
54 43
            $front_matter_string .= "---\n";
55 43
        }
56 43
57
        $front_matter_string .= $this->content;
58
59 52
        return $front_matter_string;
60
    }
61
}
62