for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PragmaRX\Tracker\Support;
use Snowplow\RefererParser\Parser;
class RefererParser
{
/**
* Referer parser instance.
*
* @var Parser
*/
private $parser;
* @var \Snowplow\RefererParser\Referer
private $referer;
* Create a referer parser instance.
* @return mixed
@return
Adding a @return annotation 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.
public function __construct(Parser $parser)
$this->parser = $parser;
}
* Parse a referer.
* @return RefererParser
public function parse($refererUrl, $pageUrl)
$this->setReferer($this->parser->parse($refererUrl, $pageUrl));
return $this;
* Get the search medium.
* @return string|null
public function getMedium()
if ($this->isKnown()) {
return $this->referer->getMedium();
* Get the search source.
public function getSource()
return $this->referer->getSource();
* Get the search term.
public function getSearchTerm()
return $this->referer->getSearchTerm();
* Check if the referer is knwon.
* @return bool
public function isKnown()
return $this->referer->isKnown();
* Set the referer.
* @param \Snowplow\RefererParser\Referer $referer
public function setReferer($referer)
$this->referer = $referer;
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.