X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FBehat%2FContext%2FSnippet%2FGenerator%2FAggregatePatternIdentifier.php;fp=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FBehat%2FContext%2FSnippet%2FGenerator%2FAggregatePatternIdentifier.php;h=1e1fc27a2c489baf4538720713c1fc1b1c9ffac1;hp=0000000000000000000000000000000000000000;hb=1270d9129ce8f27c9b28b10518e32132c58e0aca;hpb=c27c0f0cdaa3f354b1fe54a56ae7e854be6e3f68 diff --git a/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/AggregatePatternIdentifier.php b/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/AggregatePatternIdentifier.php new file mode 100644 index 000000000..1e1fc27a2 --- /dev/null +++ b/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/AggregatePatternIdentifier.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Behat\Behat\Context\Snippet\Generator; + +/** + * Uses multiple child identifiers - the first one that returns non-null result would + * be the winner. + */ +final class AggregatePatternIdentifier implements PatternIdentifier +{ + /** + * @var PatternIdentifier[] + */ + private $identifiers; + + /** + * Initialises identifier. + * + * @param PatternIdentifier[] $identifiers + */ + public function __construct(array $identifiers) + { + $this->identifiers = $identifiers; + } + + /** + * {@inheritdoc} + */ + public function guessPatternType($contextClass) + { + foreach ($this->identifiers as $identifier) { + $pattern = $identifier->guessPatternType($contextClass); + + if (null !== $pattern) { + return $pattern; + } + } + + return null; + } +}