Пример #1
0
 /**
  * @covers GravityMedia\Urn\Urn::toString()
  */
 public function testStringExtraction()
 {
     $urn = new Urn();
     $urn->setNamespaceIdentifier('this-is-an-example');
     $urn->setNamespaceSpecificString('t(h)i+s,i-s.a:n=o@t;h$e_r!e*x\'a%m/p?l#e');
     $this->assertEquals('urn:this-is-an-example:t(h)i+s,i-s.a:n=o@t;h$e_r!e*x\'a%m/p?l#e', $urn->toString());
 }
Пример #2
0
 /**
  * @inheritdoc
  */
 public function setNamespaceSpecificString($namespaceSpecificString)
 {
     parent::setNamespaceSpecificString($namespaceSpecificString);
     $tuple = explode(':', parent::getNamespaceSpecificString(), 3);
     $category = array_shift($tuple);
     if (2 !== count($tuple) || $category !== $this->getCategory()) {
         throw new InvalidArgumentException(sprintf('Invalid namespace specific string "%s"', $namespaceSpecificString));
     }
     $this->setType(array_shift($tuple));
     $this->setVersion(intval(array_pop($tuple)));
     return $this;
 }