* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Workflow\DependencyInjection; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\Workflow\Validator\StateMachineValidator; use Symfony\Component\Workflow\Validator\WorkflowValidator; /** * @author Tobias Nyholm */ class ValidateWorkflowsPass implements CompilerPassInterface { private $definitionTag; public function __construct($definitionTag = 'workflow.definition') { $this->definitionTag = $definitionTag; } public function process(ContainerBuilder $container) { $taggedServices = $container->findTaggedServiceIds($this->definitionTag, true); foreach ($taggedServices as $id => $tags) { foreach ($tags as $tag) { if (!array_key_exists('name', $tag)) { throw new RuntimeException(sprintf('The "name" for the tag "%s" of service "%s" must be set.', $this->definitionTag, $id)); } if (!array_key_exists('type', $tag)) { throw new RuntimeException(sprintf('The "type" for the tag "%s" of service "%s" must be set.', $this->definitionTag, $id)); } if (!array_key_exists('marking_store', $tag)) { throw new RuntimeException(sprintf('The "marking_store" for the tag "%s" of service "%s" must be set.', $this->definitionTag, $id)); } $this->createValidator($tag)->validate($container->get($id), $tag['name']); } } } private function createValidator($tag) { if ('state_machine' === $tag['type']) { return new StateMachineValidator(); } if ('single_state' === $tag['marking_store']) { return new WorkflowValidator(true); } return new WorkflowValidator(); } } __halt_compiler();----SIGNATURE:----aOBF/xU3mRmCUaHcLsEHuRdsJlbPBHLvGkx/9r0s1CoF0bd3Jwc4xo5TPxgLsXDRS+5MBuP1g9OFoOrgg3iXXITzPqAIbFl5cGJQmFp4ltVgSquih86OU9XMhvstO3dBvqDnouuVRQAg/y0X+sqixaTtDXVHMmumV5UkNRFa1Zl2gOludlO0R5oV6WiUiiZ5pp+i6Ccl1iqFrZP2DB7pQENUhHnD5DSpqoO27vAwrXGFTm/QccIjtyoHTuR0C27F88UkvZutsptLULkR5juvgUNyP63PYLs2Q2jXRiR019pFQOUhJNAO4u6pZyuCOtr6ul6fattrc0ZutMwn4zWpKmZCdtaAtkhn52fTQuxYOkjqHER/WJpnIuNjCW1VhgdYvfpqjwcYJrj4r3rEP+sYN4qDF7kgjc/4uZL4/tys3nmIus57MtEtBc9D9ypHCqvavkOije6IhfU4QUsTbq4PYbG4Tz2jSHzSVSLKOLCh7eHYOzE1q0JSrT0hHFMLoVYnE+ld6R0PnqeBnXImP+QAWXpTyWpBTtd9OP6aXPxiz4EUs0c54YildIrrUD5pZ3VsohRfh5Xwkckt5zKIQBX+dykR2Z/muBp8rX89Gb/wQcbUVnzP1rTAfi5ApDxp1sI3BujrI9REl4tRH6kChTjsAboBrUueFScm9QP1RMkRISU=----ATTACHMENT:----NzYxMDYyODY4MTg5ODk1MiA1NjA0MzAwMjk2NzI1MzY0IDc3NTgxMjY0Mjc1NzA1MDE=