Implementing 'rec' type validation in WebSocket\Message.
This commit is contained in:
parent
16489b509e
commit
ac0d905ce4
|
@ -12,7 +12,7 @@ class Message implements ValidableInterface
|
||||||
{
|
{
|
||||||
public const TYPE_COMMENT = 'comment';
|
public const TYPE_COMMENT = 'comment';
|
||||||
public const TYPE_POST = 'post';
|
public const TYPE_POST = 'post';
|
||||||
public const TYPE_POST_RECOMMENDATION = 'rec';
|
public const TYPE_POST_COMMENT_RECOMMENDATION = 'rec';
|
||||||
public const TYPE_COMMENT_RECOMMENDATION = 'ok';
|
public const TYPE_COMMENT_RECOMMENDATION = 'ok';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -187,6 +187,17 @@ class Message implements ValidableInterface
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case null:
|
||||||
throw new \RuntimeException('Message has NULL type.');
|
throw new \RuntimeException('Message has NULL type.');
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue