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.

Issues (32)

src/Writer/FrontMatterCreator.php (1 issue)

Labels
Severity
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
$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
        $content = ltrim($this->content, "\r\n");
58
59 52
        if (strlen($content) > 0) {
60
            $front_matter_string .= "\n" . $content;
61 52
        }
62
63
        return $front_matter_string;
64
    }
65
}
66