Security update for permissions_by_term
[yaffs-website] / vendor / behat / behat / src / Behat / Testwork / Suite / SuiteBootstrapper.php
1 <?php
2
3 /*
4  * This file is part of the Behat Testwork.
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\Testwork\Suite;
12
13 use Behat\Testwork\Suite\Setup\SuiteSetup;
14
15 /**
16  * Configures provided suites using registered suite setups.
17  *
18  * @author Konstantin Kudryashov <ever.zet@gmail.com>
19  */
20 final class SuiteBootstrapper
21 {
22     /**
23      * @var SuiteSetup[]
24      */
25     private $setups = array();
26
27     /**
28      * Registers suite setup.
29      *
30      * @param SuiteSetup $setup
31      */
32     public function registerSuiteSetup(SuiteSetup $setup)
33     {
34         $this->setups[] = $setup;
35     }
36
37     /**
38      * Bootstraps provided suites using registered setups.
39      *
40      * @param Suite[] $suites
41      */
42     public function bootstrapSuites(array $suites)
43     {
44         array_map(array($this, 'bootstrapSuite'), $suites);
45     }
46
47     /**
48      * Bootstraps provided suite using registered setup.
49      *
50      * @param Suite $suite
51      */
52     public function bootstrapSuite(Suite $suite)
53     {
54         foreach ($this->setups as $setup) {
55             if ($setup->supportsSuite($suite)) {
56                 $setup->setupSuite($suite);
57             }
58         }
59     }
60 }