Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| Isolation | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
| require | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php declare(strict_types=1); |
| 2 | /* |
| 3 | * This file is part of Aplus Framework Helpers Library. |
| 4 | * |
| 5 | * (c) Natan Felles <natanfelles@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 | namespace Framework\Helpers; |
| 11 | |
| 12 | /** |
| 13 | * Class Isolation. |
| 14 | * |
| 15 | * @package helpers |
| 16 | */ |
| 17 | class Isolation |
| 18 | { |
| 19 | /** |
| 20 | * Requires a file in a sub-isolated scope. |
| 21 | * |
| 22 | * @param string $__filename The file to be required |
| 23 | * @param array<int|string,mixed> $__data Data to be extracted as variables |
| 24 | * |
| 25 | * @return mixed The return of the require |
| 26 | */ |
| 27 | public static function require(string $__filename, array $__data = []) : mixed |
| 28 | { |
| 29 | if ($__data) { |
| 30 | \extract($__data, \EXTR_SKIP); |
| 31 | } |
| 32 | return require $__filename; |
| 33 | } |
| 34 | } |