Security update for permissions_by_term
[yaffs-website] / vendor / behat / behat / src / Behat / Behat / Context / Snippet / Generator / AggregatePatternIdentifier.php
1 <?php
2
3 /*
4  * This file is part of the Behat.
5  * (c) Konstantin Kudryashov <ever.zet@gmail.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 namespace Behat\Behat\Context\Snippet\Generator;
12
13 /**
14  * Uses multiple child identifiers - the first one that returns non-null result would
15  * be the winner.
16  */
17 final class AggregatePatternIdentifier implements PatternIdentifier
18 {
19     /**
20      * @var PatternIdentifier[]
21      */
22     private $identifiers;
23
24     /**
25      * Initialises identifier.
26      *
27      * @param PatternIdentifier[] $identifiers
28      */
29     public function __construct(array $identifiers)
30     {
31         $this->identifiers = $identifiers;
32     }
33
34     /**
35      * {@inheritdoc}
36      */
37     public function guessPatternType($contextClass)
38     {
39         foreach ($this->identifiers as $identifier) {
40             $pattern = $identifier->guessPatternType($contextClass);
41
42             if (null !== $pattern) {
43                 return $pattern;
44             }
45         }
46
47         return null;
48     }
49 }