X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FBehat%2FDefinition%2FPattern%2FPatternTransformer.php;fp=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FBehat%2FDefinition%2FPattern%2FPatternTransformer.php;h=0000000000000000000000000000000000000000;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=6af5bacd6b76dbbda891317a57a08eec5b584f4f;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;p=yaffs-website diff --git a/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/PatternTransformer.php b/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/PatternTransformer.php deleted file mode 100644 index 6af5bacd6..000000000 --- a/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/PatternTransformer.php +++ /dev/null @@ -1,79 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Pattern; - -use Behat\Behat\Definition\Exception\UnknownPatternException; -use Behat\Behat\Definition\Exception\UnsupportedPatternTypeException; -use Behat\Behat\Definition\Pattern\Policy\PatternPolicy; - -/** - * Transforms patterns using registered policies. - * - * @author Konstantin Kudryashov - */ -final class PatternTransformer -{ - /** - * @var PatternPolicy[] - */ - private $policies = array(); - - /** - * Registers pattern policy. - * - * @param PatternPolicy $policy - */ - public function registerPatternPolicy(PatternPolicy $policy) - { - $this->policies[] = $policy; - } - - /** - * Generates pattern. - * - * @param string $type - * @param string $stepText - * - * @return Pattern - * - * @throws UnsupportedPatternTypeException - */ - public function generatePattern($type, $stepText) - { - foreach ($this->policies as $policy) { - if ($policy->supportsPatternType($type)) { - return $policy->generatePattern($stepText); - } - } - - throw new UnsupportedPatternTypeException(sprintf('Can not find policy for a pattern type `%s`.', $type), $type); - } - - /** - * Transforms pattern string to regex. - * - * @param string $pattern - * - * @return string - * - * @throws UnknownPatternException - */ - public function transformPatternToRegex($pattern) - { - foreach ($this->policies as $policy) { - if ($policy->supportsPattern($pattern)) { - return $policy->transformPatternToRegex($pattern); - } - } - - throw new UnknownPatternException(sprintf('Can not find policy for a pattern `%s`.', $pattern), $pattern); - } -}