/** * NotPrimaryServerException constructor. * * @param ServerInterface $primaryServer */ public function __construct(ServerInterface $primaryServer) { parent::__construct(sprintf('Server is not primary of this object. Redirect to given Server "%s:%s".', $primaryServer->getHost(), $primaryServer->getPort())); $this->primaryServer = $primaryServer; }
public function fetch($hash, $class, ServerInterface $server) { $route = $this->router->generate('get_object', array('hash' => $hash, 'class' => $class)); $response = $this->client->get($server->getUrl($route)); return $response->getBody()->getContents(); }