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.
Completed
Push — master ( 755836...79062a )
by Sebastian
01:14
created

Exporter::includeFiles()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Spatie\Export;
4
5
use Illuminate\Contracts\Bus\Dispatcher;
6
use Spatie\Export\Jobs\CleanDestination;
7
use Spatie\Export\Jobs\CrawlSite;
8
use Spatie\Export\Jobs\IncludeFiles;
9
10
class Exporter
11
{
12
    /** @var \Illuminate\Contracts\Bus\Dispatcher */
13
    protected $dispatcher;
14
15
    /** @var boolean */
16
    protected $cleanBeforeExport = false;
17
18
    /** @var boolean */
19
    protected $crawl = false;
20
21
    /** @var string[] */
22
    protected $paths = [];
23
24
    /** @var string[] */
25
    protected $includeFiles = [];
26
27
    /** @var string[] */
28
    protected $excludeFilePatterns = [];
29
30
    public function __construct(Dispatcher $dispatcher)
31
    {
32
        $this->dispatcher = $dispatcher;
33
    }
34
35
    public function cleanBeforeExport(bool $cleanBeforeExport): self
36
    {
37
        $this->cleanBeforeExport = $cleanBeforeExport;
38
39
        return $this;
40
    }
41
42
    public function crawl(bool $crawl): self
43
    {
44
        $this->crawl = $crawl;
45
46
        return $this;
47
    }
48
49
    public function paths(array $paths): self
50
    {
51
        $this->paths = array_merge($this->paths, $paths);
0 ignored issues
show
Documentation Bug introduced by
It seems like array_merge($this->paths, $paths) of type array is incompatible with the declared type array<integer,string> of property $paths.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
52
53
        return $this;
54
    }
55
56
    public function includeFiles(array $includeFiles): self
57
    {
58
        $this->includeFiles = array_merge($this->includeFiles, $includeFiles);
0 ignored issues
show
Documentation Bug introduced by
It seems like array_merge($this->includeFiles, $includeFiles) of type array is incompatible with the declared type array<integer,string> of property $includeFiles.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
59
60
        return $this;
61
    }
62
63
    public function excludeFilePatterns(array $excludeFilePatterns): self
64
    {
65
        $this->excludeFilePatterns = array_merge($this->excludeFilePatterns, $excludeFilePatterns);
0 ignored issues
show
Documentation Bug introduced by
It seems like array_merge($this->exclu..., $excludeFilePatterns) of type array is incompatible with the declared type array<integer,string> of property $excludeFilePatterns.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
66
67
        return $this;
68
    }
69
70
    public function export()
71
    {
72
        if ($this->cleanBeforeExport) {
73
            $this->dispatcher->dispatchNow(
74
                new CleanDestination()
75
            );
76
        }
77
78
        if ($this->crawl) {
79
            $this->dispatcher->dispatchNow(
80
                new CrawlSite()
81
            );
82
        }
83
84
        if (count($this->includeFiles)) {
85
            $this->dispatcher->dispatchNow(
86
                new IncludeFiles($this->includeFiles, $this->excludeFilePatterns)
87
            );
88
        }
89
    }
90
}
91