public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null)
{
if (!$value instanceof APINewSectionLimitation) {
throw new InvalidArgumentException('$value', 'Must be of type: APINewSectionLimitation');
}
if (!$object instanceof ContentInfo && !$object instanceof Content && !$object instanceof VersionInfo) {
throw new InvalidArgumentException('$object', 'Must be of type: Content, VersionInfo or ContentInfo');
}
if (empty($targets)) {
throw new InvalidArgumentException('$targets', 'Must contain objects of type: Section');
}
if (empty($value->limitationValues)) {
return false;
}
foreach ($targets as $target) {
if (!$target instanceof Section && !$target instanceof SPISection) {
throw new InvalidArgumentException('$targets', 'Must contain objects of type: Section');
}
if (!in_array($target->id, $value->limitationValues)) {
return false;
}
}
return true;
}