vendor/pimcore/pimcore/lib/Workflow/EventSubscriber/ChangePublishedStateSubscriber.php line 38
<?phpdeclare(strict_types=1);/*** Pimcore** This source file is available under two different licenses:* - GNU General Public License version 3 (GPLv3)* - Pimcore Commercial License (PCL)* Full copyright and license information is available in* LICENSE.md which is distributed with this source code.** @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)* @license http://www.pimcore.org/license GPLv3 and PCL*/namespace Pimcore\Workflow\EventSubscriber;use Pimcore\Model\DataObject\Concrete;use Pimcore\Model\Document;use Pimcore\Workflow\Transition;use Symfony\Component\EventDispatcher\EventSubscriberInterface;use Symfony\Component\Workflow\Event\Event;/*** @internal*/class ChangePublishedStateSubscriber implements EventSubscriberInterface{const NO_CHANGE = 'no_change';const FORCE_PUBLISHED = 'force_published';const FORCE_UNPUBLISHED = 'force_unpublished';const SAVE_VERSION = 'save_version';public function onWorkflowCompleted(Event $event): void{if (!$this->checkEvent($event)) {return;}/** @var Transition $transition */$transition = $event->getTransition();/** @var Document|Concrete $subject */$subject = $event->getSubject();$changePublishedState = $transition->getChangePublishedState();if ($changePublishedState === self::FORCE_UNPUBLISHED) {$subject->setPublished(false);} elseif ($changePublishedState === self::FORCE_PUBLISHED) {$subject->setPublished(true);}}/*** check's if the event subscriber should be executed*/private function checkEvent(Event $event): bool{return $event->getTransition() instanceof Transition&& ($event->getSubject() instanceof Concrete || $event->getSubject() instanceof Document);}public static function getSubscribedEvents(): array{return ['workflow.completed' => 'onWorkflowCompleted',];}}