Example #1
0
 /**
  * @return Client
  */
 public function getErpkClient()
 {
     if (!isset($this->erpkClient)) {
         throw new \RuntimeException('Missing configuration file.');
     }
     if ($this->erpkClient->hasProxy() && $this->erpkClient->getProxy() instanceof HttpProxy) {
         $ip = $this->erpkClient->get('http://httpbin.org/ip')->send()->json()['origin'];
         if ($ip != $this->erpkClient->getProxy()->hostname) {
             throw new \RuntimeException("Proxy you're using is not safe. You're being recognized as {$ip}.");
         }
     }
     return $this->erpkClient;
 }