Security update for permissions_by_term
[yaffs-website] / vendor / behat / behat / src / Behat / Behat / Transformation / TransformationRepository.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\Transformation;
12
13 use Behat\Testwork\Call\Callee;
14 use Behat\Testwork\Environment\Environment;
15 use Behat\Testwork\Environment\EnvironmentManager;
16
17 /**
18  * Provides transformations using environment manager.
19  *
20  * @author Konstantin Kudryashov <ever.zet@gmail.com>
21  */
22 final class TransformationRepository
23 {
24     /**
25      * @var EnvironmentManager
26      */
27     private $environmentManager;
28
29     /**
30      * Initializes repository.
31      *
32      * @param EnvironmentManager $environmentManager
33      */
34     public function __construct(EnvironmentManager $environmentManager)
35     {
36         $this->environmentManager = $environmentManager;
37     }
38
39     /**
40      * Returns all available definitions for a specific environment.
41      *
42      * @param Environment $environment
43      *
44      * @return Transformation[]
45      */
46     public function getEnvironmentTransformations(Environment $environment)
47     {
48         return array_filter(
49             $this->environmentManager->readEnvironmentCallees($environment),
50             function (Callee $callee) {
51                 return $callee instanceof Transformation;
52             }
53         );
54     }
55 }