* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Workflow\Validator; use Symfony\Component\Workflow\Definition; use Symfony\Component\Workflow\Exception\InvalidDefinitionException; /** * @author Tobias Nyholm */ class WorkflowValidator implements DefinitionValidatorInterface { private $singlePlace; /** * @param bool $singlePlace */ public function __construct($singlePlace = false) { $this->singlePlace = $singlePlace; } public function validate(Definition $definition, $name) { // Make sure all transitions for one place has unique name. $places = array_fill_keys($definition->getPlaces(), array()); foreach ($definition->getTransitions() as $transition) { foreach ($transition->getFroms() as $from) { if (in_array($transition->getName(), $places[$from])) { throw new InvalidDefinitionException(sprintf('All transitions for a place must have an unique name. Multiple transitions named "%s" where found for place "%s" in workflow "%s".', $transition->getName(), $from, $name)); } $places[$from][] = $transition->getName(); } } if (!$this->singlePlace) { return; } foreach ($definition->getTransitions() as $transition) { if (1 < count($transition->getTos())) { throw new InvalidDefinitionException(sprintf('The marking store of workflow "%s" can not store many places. But the transition "%s" has too many output (%d). Only one is accepted.', $name, $transition->getName(), count($transition->getTos()))); } } } } __halt_compiler();----SIGNATURE:----A5cYqhtYuLpRsQqsj9hrgtzGG2WMrb2T3ggzcAXdZ9eHRMjloRJigl7fAINRACyJIwZkBDPx0icqQHphp9+0PTIaEYZBGecz2ImRX9Y40sKqmZz5ieXPGdeA2E2DrY/EYAA+mD1okI/ZcmB3VxBPSnHclZLHK5Te14rRPpFF5h0kJ0mLe834poTkoctKeAsBxk7jqVpL7ypH+ypGuR0I0uj+FHykwzL/YzvR+/iwTtRYANRNF17k6O9ZAoNGt1kknDNwUhw8f5dZC2D2TToNomGSVA9qxQ+wgPsctulz3b/m4QlXwz5ZfkduD89jILx7PkEl3IM6caO0Uo/O3zSti2+a4sK3dJGfv49bkeOimfcTaHfGXe+eqXxv9pNq8y3jmcfzPfv4hST7jSGfTUpO411W8vh3LH88Pl8/Lo9k38E+l5bHCDgrPLHOzsWxMPyZBZz9dsgJopko6kVs+sDtqiVFsDdiTsou+G30TDdKCbZGPm9F4//TQn6C9jsASH/gx/apozhyHgaRusGhCj5xcPcP9VyjuLgae5vum9Rg+3exVbUC30RpLa49S8lTfuIU0a3UAoblBAVI72jmpNfqyCbEtJBaldpQyBHb3y6/qXGOcE6t3NLpAsjrDOInsxjcLU8hZja33V2CYJ/3z8EwVAHnwx8pltj94oP31HWb4yg=----ATTACHMENT:----ODkxODExNDExNzM1ODE1NCA2NDAzNDgzMTAwMzI3MjM0IDU1OTcyMTc3NzY1MTEwMjY=