CrawlerDetector   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 30
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isRobot() 0 4 1
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