Exemplo n.º 1
0
 /**
  * Constructor
  *
  * @param Crypto $crypto
  * @param PathValidationConfig $config
  * @param Certificate ...$certificates
  */
 public function __construct(Crypto $crypto, PathValidationConfig $config, Certificate ...$certificates)
 {
     if (!count($certificates)) {
         throw new \LogicException("No certificates.");
     }
     $this->_crypto = $crypto;
     $this->_config = $config;
     $this->_certificates = $certificates;
     // if trust anchor is explicitly given in configuration
     if ($config->hasTrustAnchor()) {
         $this->_trustAnchor = $config->trustAnchor();
     } else {
         $this->_trustAnchor = $certificates[0];
     }
 }