Security update for permissions_by_term
[yaffs-website] / vendor / behat / behat / src / Behat / Testwork / Suite / Generator / GenericSuiteGenerator.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\Generator;
12
13 use Behat\Testwork\Suite\GenericSuite;
14
15 /**
16  * Generates generic test suites.
17  *
18  * @author Konstantin Kudryashov <ever.zet@gmail.com>
19  */
20 final class GenericSuiteGenerator implements SuiteGenerator
21 {
22     /**
23      * @var array
24      */
25     private $defaultSettings = array();
26
27     /**
28      * Initializes suite generator.
29      *
30      * @param array $defaultSettings
31      */
32     public function __construct(array $defaultSettings = array())
33     {
34         $this->defaultSettings = $defaultSettings;
35     }
36
37     /**
38      * {@inheritdoc}
39      */
40     public function supportsTypeAndSettings($type, array $settings)
41     {
42         return null === $type;
43     }
44
45     /**
46      * {@inheritdoc}
47      */
48     public function generateSuite($suiteName, array $settings)
49     {
50         return new GenericSuite($suiteName, $this->mergeDefaultSettings($settings));
51     }
52
53     /**
54      * Merges provided settings into default ones.
55      *
56      * @param array $settings
57      *
58      * @return array
59      */
60     private function mergeDefaultSettings(array $settings)
61     {
62         return array_merge($this->defaultSettings, $settings);
63     }
64 }