* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Workflow; use Symfony\Component\Workflow\Exception\InvalidArgumentException; /** * Builds a definition. * * @author Fabien Potencier * @author Grégoire Pineau * @author Tobias Nyholm */ class DefinitionBuilder { private $places = array(); private $transitions = array(); private $initialPlace; /** * @param string[] $places * @param Transition[] $transitions */ public function __construct(array $places = array(), array $transitions = array()) { $this->addPlaces($places); $this->addTransitions($transitions); } /** * @return Definition */ public function build() { return new Definition($this->places, $this->transitions, $this->initialPlace); } /** * Clear all data in the builder. * * @return $this */ public function reset() { $this->places = array(); $this->transitions = array(); $this->initialPlace = null; return $this; } /** * @param string $place * * @return $this */ public function setInitialPlace($place) { $this->initialPlace = $place; return $this; } /** * @param string $place * * @return $this */ public function addPlace($place) { if (!preg_match('{^[\w_-]+$}', $place)) { throw new InvalidArgumentException(sprintf('The place "%s" contains invalid characters.', $place)); } if (!$this->places) { $this->initialPlace = $place; } $this->places[$place] = $place; return $this; } /** * @param string[] $places * * @return $this */ public function addPlaces(array $places) { foreach ($places as $place) { $this->addPlace($place); } return $this; } /** * @param Transition[] $transitions * * @return $this */ public function addTransitions(array $transitions) { foreach ($transitions as $transition) { $this->addTransition($transition); } return $this; } /** * @return $this */ public function addTransition(Transition $transition) { $this->transitions[] = $transition; return $this; } } __halt_compiler();----SIGNATURE:----WDHi6SJ6uMaPr05KOYLDHZ4yvTHOaAAfYn5wN2gEvT55qMMN+oMJwrrZRW4KAOl/koEgyVctwYA/kghVpb2d/8Dk+GeMJCbyC3AxpdOoMqr7yjR2BnzkmeV6RO1ytUtV8rM14KogBcLC8J3utTpp8ApmBW2ZYWJQnAb8g8EA6u5fsDUnK8veYXKhq8ucqwCgc2fctfBBTkB6hWNs/tpe/yj0H8vPvVb4oRSwxjzeNrA0ll2xi1QGJwddillUTZOyvGLw3JSI0aY8GDnvDGsBxX82bvvI3egH276KBKfYupADp5NlbSbpzo1hEqihPUvFbvdLH637ULzLYTt7eVdiF2oIA4CAOEq3QwecuthaSFgQOy+T8e4TFq+3Cz5u4PhEH3HogbCCoTTxHSBzKxko3satRah9wFZKL0x6Z2rvgbb5TiitUYtoV9TV1Gx4DqhBtvijidMRU4JMO9dSdxfIf0whsPGEBu79YCnujoUzbNJwulqtXpkMDBkLK+Lq+4FSAnDbsYPQMS33fjhQJg1su6K7ewHNhYYEEyhOsmJwpphtav/M5hJuxqEt0hcHV9xryD0erVCO4DvcPNH6YbUn/g80bY0F0OJVTzvdUbsXq0nGf/KP4AEXF4O87CjQgEQLKYf/YQcPl0ZBLFnpNbKq8lkJ9TSkBzoH040BsAfYBZg=----ATTACHMENT:----MjA1NDczNjQwNTc3MDY1NiAzMjIxMTUzNDMwNTAwNjE0IDc3ODU1NzQ2MzIwMzE4MjI=