Completed
Pull Request — master (#150)
by Brent
07:23 queued 33s
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 Spatie\Robots\RobotsTxt;
6
use Psr\Http\Message\UriInterface;
7
use Spatie\Browsershot\Browsershot;
8
use Spatie\Crawler\CrawlQueue\CrawlQueue;
9
10
trait CrawlerProperties
11
{
12
    public function setConcurrency(int $concurrency): self
13
    {
14
        $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...
15
16
        return $this;
17
    }
18
19
    public function setMaximumResponseSize(int $maximumResponseSizeInBytes): self
20
    {
21
        $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...
22
23
        return $this;
24
    }
25
26
    public function getMaximumResponseSize(): ?int
27
    {
28
        return $this->maximumResponseSize;
29
    }
30
31
    public function setMaximumCrawlCount(int $maximumCrawlCount): self
32
    {
33
        $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...
34
35
        return $this;
36
    }
37
38
    public function getMaximumCrawlCount(): ?int
39
    {
40
        return $this->maximumCrawlCount;
41
    }
42
43
    public function getCrawlerUrlCount(): int
44
    {
45
        return $this->crawledUrlCount;
0 ignored issues
show
Bug introduced by
The property crawledUrlCount 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...
46
    }
47
48
    public function setMaximumDepth(int $maximumDepth): self
49
    {
50
        $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...
51
52
        return $this;
53
    }
54
55
    public function getMaximumDepth(): ?int
56
    {
57
        return $this->maximumDepth;
58
    }
59
60
    public function ignoreRobots(): self
61
    {
62
        $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...
63
64
        return $this;
65
    }
66
67
    public function respectRobots(): self
68
    {
69
        $this->respectRobots = true;
70
71
        return $this;
72
    }
73
74
    public function mustRespectRobots(): bool
75
    {
76
        return $this->respectRobots;
77
    }
78
79
    public function getRobotsTxt(): RobotsTxt
80
    {
81
        return $this->robotsTxt;
0 ignored issues
show
Bug introduced by
The property robotsTxt 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...
82
    }
83
84
    public function setCrawlQueue(CrawlQueue $crawlQueue): self
85
    {
86
        $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...
87
88
        return $this;
89
    }
90
91
    public function getCrawlQueue(): CrawlQueue
92
    {
93
        return $this->crawlQueue;
94
    }
95
96
    public function executeJavaScript(): self
97
    {
98
        $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...
99
100
        return $this;
101
    }
102
103
    public function doNotExecuteJavaScript(): self
104
    {
105
        $this->executeJavaScript = false;
106
107
        return $this;
108
    }
109
110
    public function mayExecuteJavascript(): bool
111
    {
112
        return $this->executeJavaScript;
113
    }
114
115
    /**
116
     * @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...
117
     *
118
     * @return $this
119
     */
120
    public function setCrawlObserver($crawlObservers): self
121
    {
122
        if (! is_array($crawlObservers)) {
123
            $crawlObservers = [$crawlObservers];
124
        }
125
126
        return $this->setCrawlObservers($crawlObservers);
127
    }
128
129
    public function setCrawlObservers(array $crawlObservers): self
130
    {
131
        $this->crawlObservers = new ObserverCollection($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...
132
133
        return $this;
134
    }
135
136
    public function addCrawlObserver(CrawlObserver $crawlObserver): self
137
    {
138
        $this->crawlObservers->addObserver($crawlObserver);
139
140
        return $this;
141
    }
142
143
    public function getCrawlObservers(): ObserverCollection
144
    {
145
        return $this->crawlObservers;
146
    }
147
148
    public function setCrawlProfile(CrawlProfile $crawlProfile): self
149
    {
150
        $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...
151
152
        return $this;
153
    }
154
155
    public function getCrawlProfile(): CrawlProfile
156
    {
157
        return $this->crawlProfile;
158
    }
159
160
    public function setBrowsershot(Browsershot $browsershot)
161
    {
162
        $this->browsershot = $browsershot;
0 ignored issues
show
Bug introduced by
The property browsershot 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...
163
164
        return $this;
165
    }
166
167
    public function getBrowsershot(): Browsershot
168
    {
169
        if (! $this->browsershot) {
170
            $this->browsershot = new Browsershot();
171
        }
172
173
        return $this->browsershot;
174
    }
175
176
    public function getBaseUrl(): UriInterface
177
    {
178
        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...
179
    }
180
}
181