Example #1
0
 /**
  * @param string|\FG\ASN1\Universal\ObjectIdentifier $objectIdentifierString
  * @param string|\FG\ASN1\Object $value
  */
 public function __construct($objectIdentifierString, $value)
 {
     if (PrintableString::isValid($value)) {
         $value = new PrintableString($value);
     } else {
         if (IA5String::isValid($value)) {
             $value = new IA5String($value);
         } else {
             $value = new UTF8String($value);
         }
     }
     parent::__construct($objectIdentifierString, $value);
 }
Example #2
0
 public function testIsPrintableString()
 {
     $validString = 'Hello World';
     $this->assertTrue(PrintableString::isValid($validString));
     $invalidString = 'Hello ♥♥♥ World';
     $this->assertFalse(PrintableString::isValid($invalidString));
 }