public function __construct($url, $referrer)
 {
     $this->url = isset($url) ? parse_url($url) : null;
     $this->referrer = isset($referrer) ? parse_url($referrer) : null;
     $refererParser = new Parser();
     $this->referrerParsed = isset($url) && isset($referrer) ? $refererParser->parse($referrer, $url) : null;
 }
 public function testCustomInternalHosts()
 {
     $parser = $this->createParser(['google.com']);
     $this->assertSame(Medium::INTERNAL, $parser->parse('http://google.com')->getMedium());
     $this->assertSame(Medium::SEARCH, $this->parser->parse('http://google.com')->getMedium());
 }
Example #3
0
 /**
  * Parse a referer.
  *
  * @return mixed
  */
 public function parse($refererUrl, $pageUrl)
 {
     $this->setReferer($this->parser->parse($refererUrl, $pageUrl));
     return $this;
 }
 /**
  * @inheritdoc
  */
 public function parse($refererUrl, $pageUrl = null)
 {
     $this->ready = true;
     return parent::parse($refererUrl, $pageUrl);
 }