Analyzer.php
5 years ago
ClosureContext.php
5 years ago
ClosureScope.php
5 years ago
ClosureStream.php
5 years ago
ISecurityProvider.php
5 years ago
ReflectionClosure.php
5 years ago
SecurityException.php
5 years ago
SecurityProvider.php
5 years ago
SelfReference.php
5 years ago
SerializableClosure.php
5 years ago
Analyzer.php
63 lines
| 1 | <?php |
| 2 | /* =========================================================================== |
| 3 | * Copyright (c) 2018-2019 Zindex Software |
| 4 | * |
| 5 | * Licensed under the MIT License |
| 6 | * =========================================================================== */ |
| 7 | |
| 8 | namespace Opis\Closure; |
| 9 | |
| 10 | use Closure; |
| 11 | use SuperClosure\Analyzer\ClosureAnalyzer; |
| 12 | |
| 13 | /** |
| 14 | * @deprecated We'll remove this class |
| 15 | */ |
| 16 | class Analyzer extends ClosureAnalyzer |
| 17 | { |
| 18 | /** |
| 19 | * Analyzer a given closure. |
| 20 | * |
| 21 | * @param Closure $closure |
| 22 | * |
| 23 | * @return array |
| 24 | */ |
| 25 | public function analyze(Closure $closure) |
| 26 | { |
| 27 | $reflection = new ReflectionClosure($closure); |
| 28 | $scope = $reflection->getClosureScopeClass(); |
| 29 | |
| 30 | $data = [ |
| 31 | 'reflection' => $reflection, |
| 32 | 'code' => $reflection->getCode(), |
| 33 | 'hasThis' => $reflection->isBindingRequired(), |
| 34 | 'context' => $reflection->getUseVariables(), |
| 35 | 'hasRefs' => false, |
| 36 | 'binding' => $reflection->getClosureThis(), |
| 37 | 'scope' => $scope ? $scope->getName() : null, |
| 38 | 'isStatic' => $reflection->isStatic(), |
| 39 | ]; |
| 40 | |
| 41 | return $data; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * @param array $data |
| 46 | * @return mixed |
| 47 | */ |
| 48 | protected function determineCode(array &$data) |
| 49 | { |
| 50 | return null; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * @param array $data |
| 55 | * @return mixed |
| 56 | */ |
| 57 | protected function determineContext(array &$data) |
| 58 | { |
| 59 | return null; |
| 60 | } |
| 61 | |
| 62 | } |
| 63 |