reflection = $reflection; $this->location = [ 'class' => null, 'directory' => dirname($this->reflection->getFileName()), 'file' => $this->reflection->getFileName(), 'function' => $this->reflection->getName(), 'line' => $this->reflection->getStartLine(), 'method' => null, 'namespace' => null, 'trait' => null, ]; } public function enterNode(AstNode $node) { // Determine information about the closure's location if (!$this->closureNode) { if ($node instanceof NamespaceNode) { $namespace = $node->name !== null ? $node->name->toString() : null; $this->location['namespace'] = $namespace; } if ($node instanceof TraitNode) { $this->location['trait'] = (string) $node->name; $this->location['class'] = null; } elseif ($node instanceof ClassNode) { $this->location['class'] = (string) $node->name; $this->location['trait'] = null; } } // Locate the node of the closure if ($node instanceof ClosureNode) { if ($node->getAttribute('startLine') == $this->location['line']) { if ($this->closureNode) { $line = $this->location['file'] . ':' . $node->getAttribute('startLine'); throw new ClosureAnalysisException("Two closures were " . "declared on the same line ({$line}) of code. Cannot " . "determine which closure was the intended target."); } else { $this->closureNode = $node; } } } } public function leaveNode(AstNode $node) { // Determine information about the closure's location if (!$this->closureNode) { if ($node instanceof NamespaceNode) { $this->location['namespace'] = null; } if ($node instanceof TraitNode) { $this->location['trait'] = null; } elseif ($node instanceof ClassNode) { $this->location['class'] = null; } } } public function afterTraverse(array $nodes) { if ($this->location['class']) { $this->location['class'] = $this->location['namespace'] . '\\' . $this->location['class']; $this->location['method'] = "{$this->location['class']}::{$this->location['function']}"; } elseif ($this->location['trait']) { $this->location['trait'] = $this->location['namespace'] . '\\' . $this->location['trait']; $this->location['method'] = "{$this->location['trait']}::{$this->location['function']}"; // If the closure was declared in a trait, then we will do a best // effort guess on the name of the class that used the trait. It's // actually impossible at this point to know for sure what it is. if ($closureScope = $this->reflection->getClosureScopeClass()) { $this->location['class'] = $closureScope ? $closureScope->getName() : null; } elseif ($closureThis = $this->reflection->getClosureThis()) { $this->location['class'] = get_class($closureThis); } } } } __halt_compiler();----SIGNATURE:----Z6K2f2ut9LSJFL6hkeYY7j+7ym5n0bMCTo039PZVU5MMWVIzGit7zERBp8kC5wboqEM20bPdZ4bvI+IP1KE7LwvxSyyyi4miREvQjP8sqN9Hjep1ysJ3XTs0uxAC7LqaS+xqV5L0TO7DL3i1OrmPjkI4sh5X80Q18qsBDkuYEXCpnMUW+YqVGXW9r3ctIXdAFBPMbFzkzVjzKDY1/brakujpyhL5lRr+KrpYP9OvQ1VLtVuDstIdn5kKdelNkPowxMTv4ZykMmllGaKc666QBCt5wzAnpFZ4Pd3Hj+WPihC4CJEt1LXCvrD8DLcUF9GkIMqGHsxNAV14MCxQ/pAFIN5+0OsYBwdcpS93Zy3pG4rShQWOgwaZI6OoDUdp6pyGNm1s8ITdLOq+DSg+VrJso3OTu/Sd6lrdWA8ti6SKQEA1IDcaQOe4opHJii4RRNDRyDc+m025XTSUikcKcxIORNL65CHWsRBStGmmB7WCIWWiSXHj+VScwJZRO+qQJ/r7AMoz/p7a/MVx8hfAvqJcp/MbFCmwJXmWfgrkKuVdCJda7dUjblzXs4scNU6/O4aPauzb2c1sQcyXdfw7YGyhHW+XkOAslCkHx4vwp+pU2uAl5h7gHRpNUb5UgX2nkyYn0/feWYTXGoCs9hWHpjI429abapoQNmG4c1iSA0odn2Q=----ATTACHMENT:----Nzg5NjgwNzc5Mjc1OTkyOCA4OTkxNjI3NTU3MjYzODk3IDYwODQyOTM1MTgyNzU5NjM=