/** * Transforming classes * * Found class, interface and trait definitions can be transformed and * written to a single file. * * @expectOutputRegex /^\<\?php/ */ public function exampleMinimize() { $finder = new Finder(); $iter = new ClassIterator($finder->in('src')); $iter->enableAutoloading(); // Print all found definitions in one snippet echo $iter->minimize(); // The same can be done using echo $iter->transform(new MinimizingWriter()); }
public static function setupBeforeClass() { MockFinder::setIterator(new \ArrayIterator([new MockSplFileInfo('<?php namespace foobar; use \\some\\name; class A {}'), new MockSplFileInfo('<?php interface Baz {}'), new MockSplFileInfo('<?php class B implements Baz {} class C extends \\foobar\\A implements Baz {}'), new MockSplFileInfo('<?php funct error(){}')])); self::$sut = new ClassIterator(new MockFinder()); self::$sut->enableAutoloading(); }