/**
  * Store Marketing Information in Session
  *        'refererDomain' => domain.org
  *        'referer' => http://domain.org/xyz/test.html
  *        'country' => Germany
  *        'mobileDevice' => 1
  *        'frontendLanguage' => 3
  *        'browserLanguage' => en-us
  *        'feUser' => userAbc
  *        'pageFunnel' => array(2, 5, 1)
  *
  * @param string $referer Referer
  * @param int $language Frontend Language Uid
  * @param int $pid Page Id
  * @param int $mobileDevice Is mobile device?
  * @return void
  */
 public static function storeMarketingInformation($referer = null, $language = 0, $pid = 0, $mobileDevice = 0)
 {
     $marketingInfo = self::getSessionValue('powermail_marketing');
     // initially create array with marketing info
     if (!is_array($marketingInfo)) {
         $marketingInfo = ['refererDomain' => FrontendUtility::getDomainFromUri($referer), 'referer' => $referer, 'country' => FrontendUtility::getCountryFromIp(), 'mobileDevice' => $mobileDevice, 'frontendLanguage' => $language, 'browserLanguage' => GeneralUtility::getIndpEnv('HTTP_ACCEPT_LANGUAGE'), 'pageFunnel' => [$pid]];
     } else {
         // add current pid to funnel
         $marketingInfo['pageFunnel'][] = $pid;
         // clean pagefunnel if has more than 256 entries
         if (count($marketingInfo['pageFunnel']) > 256) {
             $marketingInfo['pageFunnel'] = [$pid];
         }
     }
     // store in session
     self::setSessionValue('powermail_marketing', $marketingInfo, true);
 }
 /**
  * getDomainFromUri Test
  *
  * @param string $value
  * @param string $expectedResult
  * @dataProvider getDomainFromUriReturnsStringDataProvider
  * @return void
  * @test
  */
 public function getDomainFromUriReturnsString($value, $expectedResult)
 {
     $this->assertSame($expectedResult, FrontendUtility::getDomainFromUri($value));
 }