1 | <?php namespace Arcanedev\LaravelTracker\Trackers; |
||
16 | class RefererTracker implements RefererTrackerContract |
||
17 | { |
||
18 | /* ------------------------------------------------------------------------------------------------ |
||
19 | | Properties |
||
20 | | ------------------------------------------------------------------------------------------------ |
||
21 | */ |
||
22 | /** @var \Arcanedev\LaravelTracker\Contracts\Parsers\RefererParser */ |
||
23 | private $refererParser; |
||
24 | |||
25 | /* ------------------------------------------------------------------------------------------------ |
||
26 | | Constructor |
||
27 | | ------------------------------------------------------------------------------------------------ |
||
28 | */ |
||
29 | /** |
||
30 | * RefererTracker constructor. |
||
31 | * |
||
32 | * @param \Arcanedev\LaravelTracker\Contracts\Parsers\RefererParser $refererParser |
||
33 | */ |
||
34 | 36 | public function __construct(RefererParser $refererParser) |
|
38 | |||
39 | /* ------------------------------------------------------------------------------------------------ |
||
40 | | Main Functions |
||
41 | | ------------------------------------------------------------------------------------------------ |
||
42 | */ |
||
43 | /** |
||
44 | * Track the referer and return the id. |
||
45 | * |
||
46 | * @param string $refererUrl |
||
47 | * @param string $pageUrl |
||
48 | * |
||
49 | * @return int|null |
||
50 | */ |
||
51 | 12 | public function track($refererUrl, $pageUrl) |
|
88 | |||
89 | /** |
||
90 | * Track the domain and get the id. |
||
91 | * |
||
92 | * @param string $name |
||
93 | * |
||
94 | * @return int |
||
95 | */ |
||
96 | 6 | private function trackDomain($name) |
|
102 | |||
103 | /** |
||
104 | * Store the referer's search terms. |
||
105 | * |
||
106 | * @param int $refererId |
||
107 | * @param string $searchTerms |
||
108 | */ |
||
109 | 6 | private function trackRefererSearchTerms($refererId, $searchTerms) |
|
120 | } |
||
121 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.