示例#1
0
 /**
  * @dataProvider getInvalidMessageRefs
  *
  * @param string $string
  */
 public function testInvalidMessageRefs($string)
 {
     try {
         $ref = MessageRef::fromString($string);
     } catch (\Exception $e) {
         $this->assertTrue(true, sprintf('MessageRef correctly failed on string [%s].', $string));
         return;
     }
     $this->fail(sprintf('MessageRef accepted and invalid string [%s].', $string));
 }
示例#2
0
 /**
  * @param MessageRef $other
  * @return bool
  */
 public function equals(MessageRef $other)
 {
     return $this->toString() === $other->toString();
 }
示例#3
0
 /**
  * @param mixed $value
  * @param Field $field
  *
  * @return MessageRef
  */
 public function decodeMessageRef($value, Field $field)
 {
     return MessageRef::fromArray($value);
 }
示例#4
0
 /**
  * @param MessageRef $messageRef
  * @param Field $field
  *
  * @return mixed
  */
 public function encodeMessageRef(MessageRef $messageRef, Field $field)
 {
     return ['M' => ['curie' => [self::TYPE_STRING => $messageRef->getCurie()->toString()], 'id' => [self::TYPE_STRING => $messageRef->getId()], 'tag' => $messageRef->hasTag() ? [self::TYPE_STRING => $messageRef->getTag()] : ['NULL' => true]]];
 }