Completed
Pull Request — master (#150)
by Brent
02:13
created

CrawlerProperties::setConcurrency()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Spatie\Crawler;
4
5
use Psr\Http\Message\UriInterface;
6
use Spatie\Crawler\CrawlQueue\CrawlQueue;
7
8
trait CrawlerProperties
9
{
10
    public function setConcurrency(int $concurrency): self
11
    {
12
        $this->concurrency = $concurrency;
0 ignored issues
show
Bug introduced by
The property concurrency does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
13
14
        return $this;
15
    }
16
17
    public function setMaximumResponseSize(int $maximumResponseSizeInBytes): self
18
    {
19
        $this->maximumResponseSize = $maximumResponseSizeInBytes;
0 ignored issues
show
Bug introduced by
The property maximumResponseSize does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
20
21
        return $this;
22
    }
23
24
    public function setMaximumCrawlCount(int $maximumCrawlCount): self
25
    {
26
        $this->maximumCrawlCount = $maximumCrawlCount;
0 ignored issues
show
Bug introduced by
The property maximumCrawlCount does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
27
28
        return $this;
29
    }
30
31
    public function setMaximumDepth(int $maximumDepth): self
32
    {
33
        $this->maximumDepth = $maximumDepth;
0 ignored issues
show
Bug introduced by
The property maximumDepth does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
34
35
        return $this;
36
    }
37
38
    public function ignoreRobots(): self
39
    {
40
        $this->respectRobots = false;
0 ignored issues
show
Bug introduced by
The property respectRobots does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
41
42
        return $this;
43
    }
44
45
    public function respectRobots(): self
46
    {
47
        $this->respectRobots = true;
48
49
        return $this;
50
    }
51
52
    public function setCrawlQueue(CrawlQueue $crawlQueue): self
53
    {
54
        $this->crawlQueue = $crawlQueue;
0 ignored issues
show
Bug introduced by
The property crawlQueue does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
55
56
        return $this;
57
    }
58
59
    public function executeJavaScript(): self
60
    {
61
        $this->executeJavaScript = true;
0 ignored issues
show
Bug introduced by
The property executeJavaScript does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
62
63
        return $this;
64
    }
65
66
    public function doNotExecuteJavaScript(): self
67
    {
68
        $this->executeJavaScript = false;
69
70
        return $this;
71
    }
72
73
    /**
74
     * @param \Spatie\Crawler\CrawlObserver|array[\Spatie\Crawler\CrawlObserver] $crawlObservers
0 ignored issues
show
Documentation introduced by
The doc-type \Spatie\Crawler\CrawlObs...\Crawler\CrawlObserver] could not be parsed: Expected "]" at position 4, but found "\Spatie\Crawler\CrawlObserver". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
75
     *
76
     * @return $this
77
     */
78
    public function setCrawlObserver($crawlObservers)
79
    {
80
        if (! is_array($crawlObservers)) {
81
            $crawlObservers = [$crawlObservers];
82
        }
83
84
        return $this->setCrawlObservers($crawlObservers);
85
    }
86
87
    public function setCrawlObservers(array $crawlObservers): self
88
    {
89
        $this->crawlObservers = $crawlObservers;
0 ignored issues
show
Bug introduced by
The property crawlObservers does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
90
91
        return $this;
92
    }
93
94
    public function addCrawlObserver(CrawlObserver $crawlObserver): self
95
    {
96
        $this->crawlObservers[] = $crawlObserver;
97
98
        return $this;
99
    }
100
101
    public function setCrawlProfile(CrawlProfile $crawlProfile): self
102
    {
103
        $this->crawlProfile = $crawlProfile;
0 ignored issues
show
Bug introduced by
The property crawlProfile does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
104
105
        return $this;
106
    }
107
108
    public function getBaseUrl(): UriInterface
109
    {
110
        return $this->baseUrl;
0 ignored issues
show
Bug introduced by
The property baseUrl does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
111
    }
112
113
    public function getCrawlQueue(): CrawlQueue
114
    {
115
        return $this->crawlQueue;
116
    }
117
118
    public function getCrawlProfile(): CrawlProfile
119
    {
120
        return $this->crawlProfile;
121
    }
122
123
    /**
124
     * @return \Spatie\Crawler\CrawlObserver[]
125
     */
126
    public function getCrawlObservers(): array
127
    {
128
        return $this->crawlObservers;
129
    }
130
131
    public function getMaximumResponseSize(): ?int
132
    {
133
        return $this->maximumResponseSize;
134
    }
135
136
    public function mustRespectRobots(): bool
137
    {
138
        return $this->respectRobots;
139
    }
140
}
141