Пример #1
0
 /**
  * @param string $type
  * @param string $url
  * @param string $blockChain
  */
 public function __construct($type, $url, $blockChain = Chain::BLOCK_CHAIN_BITCOIN)
 {
     if (!Notification::validateType($type)) {
         throw new \Nette\InvalidArgumentException("Unknown type {$type}.");
     }
     if (!Chain::validateBlockChain($blockChain)) {
         throw new \Nette\InvalidArgumentException("Unknown block chain {$blockChain}.");
     }
     $this->parameters['type'] = $type;
     $this->parameters['url'] = $url;
     $this->parameters['block_chain'] = $blockChain;
 }
Пример #2
0
 /**
  * @param string $id
  * @param string $secret
  * @param string $blockChain
  */
 public function __construct($id, $secret, $blockChain)
 {
     if (!Chain::validateBlockChain($blockChain)) {
         throw new \Nette\InvalidArgumentException("Unknown block chain {$blockChain}.");
     }
     $this->baseUrl = Chain::URL . '/' . $blockChain;
     $this->sender = new CurlSender();
     $this->sender->headers['Content-Type'] = 'application/json';
     $this->sender->options['HTTPAUTH'] = CURLAUTH_BASIC;
     $this->sender->options['USERPWD'] = $id . ':' . $secret;
     $this->sender->options['CAINFO'] = __DIR__ . '/certificates/cacert.pem';
 }