, * Pádraic Brady * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Humbug\PhpScoper; use Humbug\PhpScoper\PhpParser\TraverserFactory; use Humbug\PhpScoper\Scoper\Composer\InstalledPackagesScoper; use Humbug\PhpScoper\Scoper\Composer\JsonFileScoper; use Humbug\PhpScoper\Scoper\NullScoper; use Humbug\PhpScoper\Scoper\PatchScoper; use Humbug\PhpScoper\Scoper\PhpScoper; use Humbug\PhpScoper\Scoper\SymfonyScoper; use PhpParser\Lexer; use PhpParser\Parser; use PhpParser\ParserFactory; final class Container { private $parser; private $reflector; private $scoper; public function getScoper(): Scoper { if (null === $this->scoper) { $this->scoper = new PatchScoper( new PhpScoper( $this->getParser(), new JsonFileScoper( new InstalledPackagesScoper( new SymfonyScoper( new NullScoper() ) ) ), new TraverserFactory($this->getReflector()) ) ); } return $this->scoper; } public function getParser(): Parser { if (null === $this->parser) { $this->parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7, new Lexer()); } return $this->parser; } public function getReflector(): Reflector { if (null === $this->reflector) { $this->reflector = new Reflector(); } return $this->reflector; } }