Completed
Pull Request — master (#150)
by Brent
03:17
created

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