/** * * UserId could be obj with an ->equals? * * @return Payload| boolean * */ function hasSameUserIdPayload(TodoEntity $todo, $userId) { // or an equals function if the Id can be an object if ((string) $userId !== (string) $todo->userId()) { return $this->payload->setStatus(Payload::NOT_AUTHORIZED)->setInput($userId)->setOutput($todo)->setMessages('the UserId & the UserId on the Todo are not the same'); } return false; }