Neos\Media\Validator\ImageOrientationValidator::isValid PHP Метод

isValid() защищенный Метод

The given $value is valid if it is an \Neos\Media\Domain\Model\ImageInterface of the configured orientation (square, portrait and/or landscape) Note: a value of NULL or empty string ('') is considered valid
protected isValid ( Neos\Media\Domain\Model\ImageInterface $image ) : void
$image Neos\Media\Domain\Model\ImageInterface The image that should be validated
Результат void
    protected function isValid($image)
    {
        $this->validateOptions();
        if (!$image instanceof ImageInterface) {
            $this->addError('The given value was not an Image instance.', 1328028604);
            return;
        }
        if (!in_array($image->getOrientation(), $this->options['allowedOrientations'])) {
            if (count($this->options['allowedOrientations']) === 1) {
                reset($this->options['allowedOrientations']);
                $allowedOrientation = current($this->options['allowedOrientations']);
                $this->addError('The image orientation must be "%s".', 1328029406, array($allowedOrientation));
            } else {
                $this->addError('The image orientation "%s" is not allowed.', 1328029362, array($image->getOrientation()));
            }
        }
    }
ImageOrientationValidator