예제 #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]]];
 }