public acceptValue ( eZ\Publish\API\Repository\Values\User\Limitation $limitationValue ) | ||
$limitationValue | eZ\Publish\API\Repository\Values\User\Limitation |
public function acceptValue(APILimitationValue $limitationValue)
{
if (!$limitationValue instanceof APINewObjectStateLimitation) {
throw new InvalidArgumentType('$limitationValue', 'NewObjectStateLimitation', $limitationValue);
} elseif (!is_array($limitationValue->limitationValues)) {
throw new InvalidArgumentType('$limitationValue->limitationValues', 'array', $limitationValue->limitationValues);
}
foreach ($limitationValue->limitationValues as $key => $id) {
if (!is_string($id) && !is_int($id)) {
throw new InvalidArgumentType("\$limitationValue->limitationValues[{$key}]", 'int|string', $id);
}
}
}
/** * @dataProvider providerForTestAcceptValueException * @depends testConstruct * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException * * @param \eZ\Publish\API\Repository\Values\User\Limitation $limitation * @param \eZ\Publish\Core\Limitation\NewObjectStateLimitationType $limitationType */ public function testAcceptValueException(Limitation $limitation, NewObjectStateLimitationType $limitationType) { $limitationType->acceptValue($limitation); }