| 1 | <?php |
||
| 7 | class RefererParser |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Referer parser instance. |
||
| 11 | * |
||
| 12 | * @var Parser |
||
| 13 | */ |
||
| 14 | private $parser; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Referer parser instance. |
||
| 18 | * |
||
| 19 | * @var \Snowplow\RefererParser\Referer |
||
| 20 | */ |
||
| 21 | private $referer; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Create a referer parser instance. |
||
| 25 | * |
||
| 26 | * @return mixed |
||
|
|
|||
| 27 | */ |
||
| 28 | public function __construct(Parser $parser) |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Parse a referer. |
||
| 35 | * |
||
| 36 | * @return RefererParser |
||
| 37 | */ |
||
| 38 | public function parse($refererUrl, $pageUrl) |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Get the search medium. |
||
| 47 | * |
||
| 48 | * @return string|null |
||
| 49 | */ |
||
| 50 | public function getMedium() |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Get the search source. |
||
| 59 | * |
||
| 60 | * @return string|null |
||
| 61 | */ |
||
| 62 | public function getSource() |
||
| 68 | |||
| 69 | /** |
||
| 70 | * Get the search term. |
||
| 71 | * |
||
| 72 | * @return string|null |
||
| 73 | */ |
||
| 74 | public function getSearchTerm() |
||
| 80 | |||
| 81 | /** |
||
| 82 | * Check if the referer is knwon. |
||
| 83 | * |
||
| 84 | * @return bool |
||
| 85 | */ |
||
| 86 | public function isKnown() |
||
| 90 | |||
| 91 | /** |
||
| 92 | * Set the referer. |
||
| 93 | * |
||
| 94 | * @param \Snowplow\RefererParser\Referer $referer |
||
| 95 | * |
||
| 96 | * @return RefererParser |
||
| 97 | */ |
||
| 98 | public function setReferer($referer) |
||
| 104 | } |
||
| 105 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.