DirVisitor.php 387 B

12345678910111213141516
  1. <?php
  2. namespace ClassPreloader\Parser;
  3. /**
  4. * Finds all references to __DIR__ and replaces them with the actual directory
  5. */
  6. class DirVisitor extends AbstractNodeVisitor
  7. {
  8. public function enterNode(\PHPParser_Node $node)
  9. {
  10. if ($node instanceof \PHPParser_Node_Scalar_DirConst) {
  11. return new \PHPParser_Node_Scalar_String($this->getDir());
  12. }
  13. }
  14. }