Neos\Media\Domain\Model\ImageVariant::applyAdjustment PHP Метод

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

If an adjustment of the given type already exists, the existing one will be overridden by the new one.
protected applyAdjustment ( Neos\Media\Domain\Model\Adjustment\ImageAdjustmentInterface $adjustment ) : void
$adjustment Neos\Media\Domain\Model\Adjustment\ImageAdjustmentInterface
Результат void
    protected function applyAdjustment(ImageAdjustmentInterface $adjustment)
    {
        $existingAdjustmentFound = false;
        $newAdjustmentClassName = TypeHandling::getTypeForValue($adjustment);
        foreach ($this->adjustments as $existingAdjustment) {
            if (TypeHandling::getTypeForValue($existingAdjustment) === $newAdjustmentClassName) {
                foreach (ObjectAccess::getGettableProperties($adjustment) as $propertyName => $propertyValue) {
                    ObjectAccess::setProperty($existingAdjustment, $propertyName, $propertyValue);
                }
                $existingAdjustmentFound = true;
            }
        }
        if (!$existingAdjustmentFound) {
            $this->adjustments->add($adjustment);
            $adjustment->setImageVariant($this);
            $this->adjustments = $this->adjustments->matching(new Criteria(null, array('position' => 'ASC')));
        }
        $this->lastModified = new \DateTime();
    }