* * 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:----hJTEeOPd5rBL1U7DiCMqXw39LIF5oNVFaPG0IenEYcVK6DkmZwc6Rbm+8DCmDMvNJMUzUs7cO4L2LmLe6/JHy+k1efJssrP6uVrNpPy6u5Yh9MWl4XuzAWMgSNFcEsvYlpG+vM6D1lMVr/LJquIxQ4QCu+X+9FTq4MpOkb5ii5+lSLeR3am964KEPFoKRGQruTWehiu+Q9He3d3c6s0q2Eklgh3pIoH3wtu8JtDP253bhxsIZtwBDgYbK3TNumhZ1gSIZBIZoI92Zve10gcOLCsyyxYz2ww8cKgJ5j1Tx8/XQWom1DfKch8sspphSZ8AgQ07WpkJ+731I8fMHcP7ZNFBQokj3/IiCB2OhPbBqKiUbHXjIIFaCEV+1/OLTApbFofiXcrCzhdL6L1/Qh1cHjFO9km8u9iqLhuzl9861pWKCmsCQA3u2YnqcsD6PD8UvAODYVXQhqoCXlIqmDEl3QvHHPNNJcTZDZkQ4G4bW+F5ldG2VYCJmADNUjY9UwQTJ1hDcDe0TcVCJ1+WUugQxIVOB0PPKjgIpO7ha/4B8c8dcV1fA4jZspKl8tdYPuw+qTvEtonAz36uZnyYNpDUB1AQWp0sWVdOfgq4bj3mM3n0AyOfIBabzq3cEnB6Zs/Dgz3I/PJU2ySxl9qF3q91DumFank36dcDGKZP4oQd3I4=----ATTACHMENT:----ODYwMjYyMTc3MTc1Njk3OCAxNzA5NTYwMDQyMDEwMTM1IDE5MDQzODI0ODkzMDk1Mzg=