PHP Class ClassPreloader\ClassPreloader

This is the main point of entry for interacting with this package.
Show file Open project: classpreloader/classpreloader Class Usage Examples

Protected Properties

Property Type Description
$parser PhpParser\Parser The parser.
$printer PhpParser\PrettyPrinter\Standard The printer.
$traverser ClassPreloader\Parser\NodeTraverser The traverser.

Public Methods

Method Description
__construct ( Standard $printer, PhpParser\Parser $parser, ClassPreloader\Parser\NodeTraverser $traverser ) : void Create a new class preloader instance.
getCode ( string $file, $comments = true ) : string Get a pretty printed string of code from a file while applying visitors.
prepareOutput ( string $output, boolean $strict = false ) : resource Prepare the output file and directory.

Protected Methods

Method Description
getCodeWrappedIntoNamespace ( array $parsed, string $pretty ) : string Wrap the code into a namespace.
parsedCodeHasNamespaces ( array $parsed ) : boolean Check parsed code for having namespaces.

Method Details

__construct() public method

Create a new class preloader instance.
public __construct ( Standard $printer, PhpParser\Parser $parser, ClassPreloader\Parser\NodeTraverser $traverser ) : void
$printer PhpParser\PrettyPrinter\Standard
$parser PhpParser\Parser
$traverser ClassPreloader\Parser\NodeTraverser
return void

getCode() public method

Get a pretty printed string of code from a file while applying visitors.
public getCode ( string $file, $comments = true ) : string
$file string
return string

getCodeWrappedIntoNamespace() protected method

Wrap the code into a namespace.
protected getCodeWrappedIntoNamespace ( array $parsed, string $pretty ) : string
$parsed array
$pretty string
return string

parsedCodeHasNamespaces() protected method

Check parsed code for having namespaces.
protected parsedCodeHasNamespaces ( array $parsed ) : boolean
$parsed array
return boolean

prepareOutput() public method

Prepare the output file and directory.
public prepareOutput ( string $output, boolean $strict = false ) : resource
$output string
$strict boolean
return resource

Property Details

$parser protected property

The parser.
protected Parser,PhpParser $parser
return PhpParser\Parser

$printer protected property

The printer.
protected Standard,PhpParser\PrettyPrinter $printer
return PhpParser\PrettyPrinter\Standard

$traverser protected property

The traverser.
protected NodeTraverser,ClassPreloader\Parser $traverser
return ClassPreloader\Parser\NodeTraverser