} ?> <?php // Conditional block with source code of class if ($example) { ?> <div class="panel panel-default"> <div class="panel-heading"> <a data-toggle="collapse" href="#collapseTwo"> Source code of class </a></div> <div class="panel-body well panel-collapse collapse out" id="collapseTwo"> <?php $refObject = new ReflectionObject($example); Highlighter::highlight(MagicConstantTransformer::resolveFileName($refObject->getFileName())); ?> </div> </div> <?php // End of conditional block with source code of class } ?> </div><!-- /.accordion --> </div><!-- /.container --> <!-- Bootstrap core JavaScript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
public function testTransformerWrapsReflectionFileName() { $this->metadata->source = '<?php $class = new ReflectionClass("stdClass"); echo $class->getFileName(); ?>'; $this->transformer->transform($this->metadata); $this->assertStringEndsWith('::resolveFileName($class->getFileName()); ?>', $this->metadata->source); }