/** * @param MeasurementProtocolClient $client */ public function register($client) { $cookieName = $this->cookieName; $client->getEventDispatcher()->addListener('command.before_prepare', function ($e) use($cookieName) { if (!array_key_exists($cookieName, $_COOKIE)) { return; } $parser = new Parser(); $data = $parser->parse($_COOKIE[$cookieName]); /** @var \Guzzle\Service\Command\OperationCommand $command */ $command = $e['command']; if (!$command->hasKey(HitInterface::FIELD_CUSTOMER_ID)) { $command->set(HitInterface::FIELD_CUSTOMER_ID, $data->getClientId()); } }); }
public function testInvalidArgument() { $this->setExpectedException('InvalidArgumentException'); $parser = new GoogleAnalyticsCookieParser(); $parser->parse('incorrectstring'); }