* * 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; use Symfony\Component\Workflow\SupportStrategy\ClassInstanceSupportStrategy; use Symfony\Component\Workflow\SupportStrategy\SupportStrategyInterface; /** * @author Fabien Potencier * @author Grégoire Pineau */ class Registry { private $workflows = array(); /** * @param Workflow $workflow * @param string|SupportStrategyInterface $supportStrategy */ public function add(Workflow $workflow, $supportStrategy) { if (!$supportStrategy instanceof SupportStrategyInterface) { @trigger_error('Support of class name string was deprecated after version 3.2 and won\'t work anymore in 4.0.', E_USER_DEPRECATED); $supportStrategy = new ClassInstanceSupportStrategy($supportStrategy); } $this->workflows[] = array($workflow, $supportStrategy); } /** * @param object $subject * @param string|null $workflowName * * @return Workflow */ public function get($subject, $workflowName = null) { $matched = null; foreach ($this->workflows as list($workflow, $supportStrategy)) { if ($this->supports($workflow, $supportStrategy, $subject, $workflowName)) { if ($matched) { throw new InvalidArgumentException('At least two workflows match this subject. Set a different name on each and use the second (name) argument of this method.'); } $matched = $workflow; } } if (!$matched) { throw new InvalidArgumentException(sprintf('Unable to find a workflow for class "%s".', get_class($subject))); } return $matched; } private function supports(Workflow $workflow, $supportStrategy, $subject, $workflowName) { if (null !== $workflowName && $workflowName !== $workflow->getName()) { return false; } return $supportStrategy->supports($workflow, $subject); } } __halt_compiler();----SIGNATURE:----odABRy9yYTYlWGFHqTfRoFj8z6wY5aoVSj+Ms8Vx8Nl2LP6/E3/5cMY9IYOzEdfJ9s6bRVgQb+IYG4m+HQXMajezBeGSL3v8ci9ORKlh6UerNwRddZghQLS59BG1VZk2jozlVUlEkOAVJziU6a53iCwnm1SMG/rLPQ7a/ZEoDJ6S4jkqoI01irqGgLHVGiazi1SUL/UQDGCtIK+UK1w+9ivtKuWnVBlfFIUEahnArKjjUrRhvd90YGGxxo8OJHCproocakOhZwlROMvwSbliG5e7lCJHPUnwGvfAPu7eLrpz44qvHXqr5/FSuYJgs2LuEnh2KCyYy3AyDk82LPzJ+L2r6UAjcU4K4+fusSow3gb4jaMY7vJcnIon2iyU8DJdsUdlrzXzukzlzqPFS/9nxj4fBeM/xe1AcAyLWv/rQeImMF/C2fn/GKwEKh1JMn8C++DL57rSYRFDvImGpbqKFDQvGJJ3pAd8K8m3Lf5BGCnEDIPKqrqjHAQq8tZgZT9o/m40zU45El/nuURM0F6q4yGOdww+YxvuB/ni3iDjgwZXxnps8gjmbCUmZiy4bo9pXTrUxyz00VO6YZjma9zWRsH7PzhOSIQggWNmq54ycyfTl42LA97vC4Q9nOf/CCdzWBthtKIq1nGqQdGWdYYgZVJgvl6q7/sBfqExADK6uDA=----ATTACHMENT:----NzkyMjA1NTQ5ODU4MDk0MCAzMzE2ODY0ODQyMDAzMjEgNzIwNjA1NjIzODY1OTI0