1 | <?php |
||
10 | trait CrawlerProperties |
||
11 | { |
||
12 | public function setConcurrency(int $concurrency): self |
||
18 | |||
19 | public function setMaximumResponseSize(int $maximumResponseSizeInBytes): self |
||
25 | |||
26 | public function getMaximumResponseSize(): ?int |
||
30 | |||
31 | public function setMaximumCrawlCount(int $maximumCrawlCount): self |
||
37 | |||
38 | public function getMaximumCrawlCount(): ?int |
||
42 | |||
43 | public function getCrawlerUrlCount(): int |
||
47 | |||
48 | public function setMaximumDepth(int $maximumDepth): self |
||
54 | |||
55 | public function getMaximumDepth(): ?int |
||
59 | |||
60 | public function ignoreRobots(): self |
||
66 | |||
67 | public function respectRobots(): self |
||
73 | |||
74 | public function mustRespectRobots(): bool |
||
78 | |||
79 | public function getRobotsTxt(): RobotsTxt |
||
83 | |||
84 | public function setCrawlQueue(CrawlQueue $crawlQueue): self |
||
90 | |||
91 | public function getCrawlQueue(): CrawlQueue |
||
95 | |||
96 | public function executeJavaScript(): self |
||
102 | |||
103 | public function doNotExecuteJavaScript(): self |
||
109 | |||
110 | public function mayExecuteJavascript(): bool |
||
114 | |||
115 | /** |
||
116 | * @param \Spatie\Crawler\CrawlObserver|array[\Spatie\Crawler\CrawlObserver] $crawlObservers |
||
117 | * |
||
118 | * @return $this |
||
119 | */ |
||
120 | public function setCrawlObserver($crawlObservers): self |
||
128 | |||
129 | public function setCrawlObservers(array $crawlObservers): self |
||
135 | |||
136 | public function addCrawlObserver(CrawlObserver $crawlObserver): self |
||
142 | |||
143 | public function getCrawlObservers(): ObserverCollection |
||
147 | |||
148 | public function setCrawlProfile(CrawlProfile $crawlProfile): self |
||
154 | |||
155 | public function getCrawlProfile(): CrawlProfile |
||
159 | |||
160 | public function setBrowsershot(Browsershot $browsershot) |
||
166 | |||
167 | public function getBrowsershot(): Browsershot |
||
175 | |||
176 | public function getBaseUrl(): UriInterface |
||
180 | } |
||
181 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: