| Conditions | 4 |
| Paths | 5 |
| Total Lines | 28 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public static function mergeWhitelists(Whitelist ...$whitelists): Whitelist |
||
| 27 | { |
||
| 28 | Assertion::greaterThan(count($whitelists), 0, 'Expected to have at least one whitelist, none given'); |
||
| 29 | |||
| 30 | /** @var Whitelist $whitelist */ |
||
| 31 | $whitelist = clone array_shift($whitelists); |
||
| 32 | |||
| 33 | foreach ($whitelists as $whitelistToMerge) { |
||
| 34 | $recordedWhitelistedClasses = $whitelistToMerge->getRecordedWhitelistedClasses(); |
||
| 35 | |||
| 36 | foreach ($recordedWhitelistedClasses as [$original, $alias]) { |
||
| 37 | $whitelist->recordWhitelistedClass( |
||
| 38 | new FullyQualified($original), |
||
| 39 | new FullyQualified($alias) |
||
| 40 | ); |
||
| 41 | } |
||
| 42 | |||
| 43 | $recordedWhitelistedFunctions = $whitelistToMerge->getRecordedWhitelistedFunctions(); |
||
| 44 | |||
| 45 | foreach ($recordedWhitelistedFunctions as [$original, $alias]) { |
||
| 46 | $whitelist->recordWhitelistedFunction( |
||
| 47 | new FullyQualified($original), |
||
| 48 | new FullyQualified($alias) |
||
| 49 | ); |
||
| 50 | } |
||
| 51 | } |
||
| 52 | |||
| 53 | return $whitelist; |
||
| 54 | } |
||
| 56 |