Ejemplo n.º 1
0
 public function __construct(Identifier $identifier, ContentLength $contentLength, Content $content, array $children = [])
 {
     parent::__construct($identifier, $contentLength, $content, $children);
     $this->nrOfUnusedBits = $nrOfUnusedBits = ord($content->binaryData[0]);
     if (!is_numeric($nrOfUnusedBits) || $nrOfUnusedBits < 0) {
         throw new Exception('BitString: second parameter needs to be a positive number (or zero)!');
     }
 }
Ejemplo n.º 2
0
 /**
  * Creates a new ASN.1 BitString object.
  *
  * @param string|int $value Either the hexadecimal value as a string (spaces are allowed - leading 0x is optional) or a numeric value
  * @param int $nrOfUnusedBits the number of unused bits in the last octet [optional].
  *
  * @throws Exception if the second parameter is no positive numeric value
  */
 public function __construct($value, $nrOfUnusedBits = 0)
 {
     parent::__construct($value);
     if (!is_numeric($nrOfUnusedBits) || $nrOfUnusedBits < 0) {
         throw new Exception('BitString: second parameter needs to be a positive number (or zero)!');
     }
     $this->nrOfUnusedBits = $nrOfUnusedBits;
 }