CrawlerDetector::isRobot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace PragmaRX\Tracker\Support;
4
5
use Jaybizzle\CrawlerDetect\CrawlerDetect;
6
7
class CrawlerDetector
8
{
9
    /**
10
     * Crawler detector.
11
     *
12
     * @var \Jaybizzle\CrawlerDetect\CrawlerDetect
13
     */
14
    private $detector;
15
16
    /**
17
     * Instantiate detector.
18
     *
19
     * @param array $headers
20
     * @param $agent
21
     */
22
    public function __construct(array $headers, $agent)
23
    {
24
        $this->detector = new CrawlerDetect($headers, $agent);
25
    }
26
27
    /**
28
     * Check if current request is from a bot.
29
     *
30
     * @return bool
31
     */
32
    public function isRobot()
33
    {
34
        return $this->detector->isCrawler();
35
    }
36
}
37