Implementing 'rec' type validation in WebSocket\Message.

This commit is contained in:
Alexey Skobkin 2019-02-25 19:12:52 +03:00
parent 16489b509e
commit ac0d905ce4

View file

@ -12,7 +12,7 @@ class Message implements ValidableInterface
{
public const TYPE_COMMENT = 'comment';
public const TYPE_POST = 'post';
public const TYPE_POST_RECOMMENDATION = 'rec';
public const TYPE_POST_COMMENT_RECOMMENDATION = 'rec';
public const TYPE_COMMENT_RECOMMENDATION = 'ok';
/**
@ -187,6 +187,17 @@ class Message implements ValidableInterface
}
break;
case self::TYPE_POST_COMMENT_RECOMMENDATION;
if (
null !== $this->author &&
null !== $this->authorId &&
null !== $this->postId &&
null !== $this->postAuthorId
) {
return true;
}
break;
case null:
throw new \RuntimeException('Message has NULL type.');
break;