PHP Класс Zephir\Compiler

Main compiler
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$backend BaseBackend
$functionDefinitions zephir\FunctionDefinition[]
$parserCompiled

Защищенные свойства (Protected)

Свойство Тип Описание
$anonymousFiles array | string[]
$compiledFiles array | string[]
$config zephir\Config
$constants
$currentVersion string
$definitions ClassDefinition[]
$externalDependencies array External dependencies
$extraFiles array
$fcallManager Zephir\Backends\ZendEngine3\FcallManager | Zephir\Backends\ZendEngine2\FcallManager
$files CompilerFile[]
$globals array Extension globals
$internalDefinitions ReflectionClass[]
$internalInitializers array Additional initializer code used for static property initialization
$loadedPrototypes boolean
$logger zephir\Logger
$stringManager zephir\StringsManager

Открытые методы

Метод Описание
__construct ( zephir\Config $config, zephir\Logger $logger, BaseBackend $backend ) Compiler constructor
addClassDefinition ( CompilerFileAnonymous $file, ClassDefinition $classDefinition ) Inserts an anonymous class definition in the compiler
addExternalDependency ( string $namespace, string $location ) Adds an external dependency to the compiler
addFunction ( zephir\FunctionDefinition $func, array $statement = null ) Adds a function to the function definitions
api ( Zephir\Commands\CommandInterface $command, boolean $fromGenerate = false ) Generate a HTML API
build ( Zephir\Commands\CommandInterface $command ) Compiles and installs the extension
buildDev ( Zephir\Commands\CommandInterface $command ) Compiles and installs the extension in development mode (debug symbols and no optimizations)
calculateDependencies ( $files, $_dependency = null )
checkIfPhpized ( ) : boolean Check if the project must be phpized again
clean ( Zephir\Commands\CommandInterface $command ) Clean the extension directory
compile ( Zephir\Commands\CommandInterface $command, boolean $development = false ) Compiles the extension without installing it
compileParser ( ) Compile the parser PHP extension
createConfigFiles ( string $project ) : boolean Create config.m4 and config.w32 for the extension
createProjectFiles ( string $project ) : boolean Create project.c and project.h according to the current extension
fullClean ( Zephir\Commands\CommandInterface $command ) Clean the extension directory
generate ( Zephir\Commands\CommandInterface $command ) : boolean Generates the C sources from Zephir without compiling them
generateFunctionInformation ( )
generatePackageDependenciesM4 ( $contentM4 ) : string Generate package-dependencies config for m4
getClassDefinition ( string $className ) : ClassDefinition | false Returns class the class definition from a given class name
getConfig ( ) : zephir\Config Returns the internal config
getConstant ( string $name ) Returns a Zephir Constant by its name
getCurrentVersion ( ) : string Returns the current version + the ident if available
getExtensionGlobal ( string $name ) : boolean Returns a extension global by its name
getFileSystem ( ) : HardDisk Returns the internal filesystem handler
getGccFlags ( boolean $development = false ) : string Returns GCC flags for current compilation
getInternalClassDefinition ( string $className ) : ClassDefinition Returns class the class definition from a given class name
getLogger ( ) : zephir\Logger Returns the internal logger
getPhpIncludeDirs ( ) : string Returns the php include directories returned by php-config
getShortPath ( string $path ) : string Returns a short path
getShortUserPath ( string $path ) : string Returns a short user path
init ( Zephir\Commands\CommandInterface $command ) Initializes a Zephir extension
install ( Zephir\Commands\CommandInterface $command, boolean $development = false ) Compiles and installs the extension
isBundledClass ( string $className ) : boolean Allows to check if a class is part of PHP
isBundledInterface ( string $className ) : boolean Allows to check if a interface is part of PHP
isClass ( string $className ) : boolean Allows to check if a class is part of the compiled extension
isConstant ( string $name ) : boolean Checks if $name is a Zephir constant
isExtensionGlobal ( string $name ) : boolean Checks if a specific extension global is defined
isInterface ( string $className ) : boolean Allows to check if an interface is part of the compiled extension
loadExternalClass ( string $className, string $location ) : boolean Loads a class definition in an external dependency
preCompileHeaders ( ) Pre-compile headers to speed up compilation
processCodeInjection ( array $entries ) : array Process extension code injection
processExtensionGlobals ( string $namespace ) : array Process extension globals
processExtensionInfo ( ) : string Generates phpinfo() sections showing information about the extension
setExtensionGlobals ( array $globals ) Sets extensions globals
stubs ( Zephir\Commands\CommandInterface $command, boolean $fromGenerate = false ) Generate IDE stubs
test ( Zephir\Commands\CommandInterface $command ) Run tests

Защищенные методы

Метод Описание
checkDirectory ( ) : string Checks if the current directory is a valid Zephir project
checkKernelFile ( string $src, string $dst ) : boolean Checks if a file must be copied
checkKernelFiles ( ) : boolean Checks which files in the base kernel must be copied
checkRequires ( ) Check require extensions orther when build your extension
getGccVersion ( ) : string Returns current GCC version
loadConstantsSources ( array $constantsSources ) Registers C-constants as PHP constants from a C-file
preCompile ( string $filePath ) Pre-compiles classes creating a CompilerFile definition
processAddSources ( array $sources, string $project ) : array Process config.w32 sections
recursiveDeletePath ( string $path, string $mask ) Recursively deletes files in a specified location
recursivePreCompile ( string $path ) Recursively pre-compiles all sources found in the given path
recursiveProcess ( $src, $dest, string $pattern = null, mixed $callback = "copy" ) : boolean Copies the base kernel to the extension destination

Описание методов

__construct() публичный Метод

Compiler constructor
public __construct ( zephir\Config $config, zephir\Logger $logger, BaseBackend $backend )
$config zephir\Config
$logger zephir\Logger
$backend BaseBackend

addClassDefinition() публичный Метод

Inserts an anonymous class definition in the compiler
public addClassDefinition ( CompilerFileAnonymous $file, ClassDefinition $classDefinition )
$file CompilerFileAnonymous
$classDefinition ClassDefinition

addExternalDependency() публичный Метод

Adds an external dependency to the compiler
public addExternalDependency ( string $namespace, string $location )
$namespace string
$location string

addFunction() публичный Метод

Adds a function to the function definitions
public addFunction ( zephir\FunctionDefinition $func, array $statement = null )
$func zephir\FunctionDefinition
$statement array

api() публичный Метод

Generate a HTML API
public api ( Zephir\Commands\CommandInterface $command, boolean $fromGenerate = false )
$command Zephir\Commands\CommandInterface
$fromGenerate boolean

build() публичный Метод

Compiles and installs the extension
public build ( Zephir\Commands\CommandInterface $command )
$command Zephir\Commands\CommandInterface

buildDev() публичный Метод

Compiles and installs the extension in development mode (debug symbols and no optimizations)
public buildDev ( Zephir\Commands\CommandInterface $command )
$command Zephir\Commands\CommandInterface

calculateDependencies() публичный Метод

public calculateDependencies ( $files, $_dependency = null )

checkDirectory() защищенный Метод

Checks if the current directory is a valid Zephir project
protected checkDirectory ( ) : string
Результат string

checkIfPhpized() публичный Метод

Check if the project must be phpized again
public checkIfPhpized ( ) : boolean
Результат boolean

checkKernelFile() защищенный Метод

Checks if a file must be copied
protected checkKernelFile ( string $src, string $dst ) : boolean
$src string
$dst string
Результат boolean

checkKernelFiles() защищенный Метод

Checks which files in the base kernel must be copied
protected checkKernelFiles ( ) : boolean
Результат boolean

checkRequires() защищенный Метод

Check require extensions orther when build your extension
protected checkRequires ( )

clean() публичный Метод

Clean the extension directory
public clean ( Zephir\Commands\CommandInterface $command )
$command Zephir\Commands\CommandInterface

compile() публичный Метод

Compiles the extension without installing it
public compile ( Zephir\Commands\CommandInterface $command, boolean $development = false )
$command Zephir\Commands\CommandInterface
$development boolean

compileParser() публичный Метод

Compile the parser PHP extension
public compileParser ( )

createConfigFiles() публичный Метод

Create config.m4 and config.w32 for the extension
public createConfigFiles ( string $project ) : boolean
$project string
Результат boolean true if need to run configure TODO: move this to backend?

createProjectFiles() публичный Метод

Create project.c and project.h according to the current extension
public createProjectFiles ( string $project ) : boolean
$project string
Результат boolean TODO: Move the part of the logic which depends on templates (backend-specific) to backend?

fullClean() публичный Метод

Clean the extension directory
public fullClean ( Zephir\Commands\CommandInterface $command )
$command Zephir\Commands\CommandInterface

generate() публичный Метод

Generates the C sources from Zephir without compiling them
public generate ( Zephir\Commands\CommandInterface $command ) : boolean
$command Zephir\Commands\CommandInterface
Результат boolean

generateFunctionInformation() публичный Метод

generatePackageDependenciesM4() публичный Метод

Generate package-dependencies config for m4
public generatePackageDependenciesM4 ( $contentM4 ) : string
$contentM4
Результат string TODO: Move the template depending part to backend?

getClassDefinition() публичный Метод

Returns class the class definition from a given class name
public getClassDefinition ( string $className ) : ClassDefinition | false
$className string
Результат ClassDefinition | false returns false if no class definition is found

getConfig() публичный Метод

Returns the internal config
public getConfig ( ) : zephir\Config
Результат zephir\Config

getConstant() публичный Метод

Returns a Zephir Constant by its name
public getConstant ( string $name )
$name string

getCurrentVersion() публичный статический Метод

Returns the current version + the ident if available
public static getCurrentVersion ( ) : string
Результат string

getExtensionGlobal() публичный Метод

Returns a extension global by its name
public getExtensionGlobal ( string $name ) : boolean
$name string
Результат boolean

getFileSystem() публичный Метод

Returns the internal filesystem handler
public getFileSystem ( ) : HardDisk
Результат Zephir\FileSystem\HardDisk

getGccFlags() публичный Метод

Returns GCC flags for current compilation
public getGccFlags ( boolean $development = false ) : string
$development boolean
Результат string

getGccVersion() защищенный Метод

Returns current GCC version
protected getGccVersion ( ) : string
Результат string

getInternalClassDefinition() публичный Метод

Returns class the class definition from a given class name
public getInternalClassDefinition ( string $className ) : ClassDefinition
$className string
Результат ClassDefinition

getLogger() публичный Метод

Returns the internal logger
public getLogger ( ) : zephir\Logger
Результат zephir\Logger

getPhpIncludeDirs() публичный Метод

Returns the php include directories returned by php-config
public getPhpIncludeDirs ( ) : string
Результат string

getShortPath() публичный статический Метод

Returns a short path
public static getShortPath ( string $path ) : string
$path string
Результат string

getShortUserPath() публичный статический Метод

Returns a short user path
public static getShortUserPath ( string $path ) : string
$path string
Результат string

init() публичный Метод

Initializes a Zephir extension
public init ( Zephir\Commands\CommandInterface $command )
$command Zephir\Commands\CommandInterface

install() публичный Метод

Compiles and installs the extension
public install ( Zephir\Commands\CommandInterface $command, boolean $development = false )
$command Zephir\Commands\CommandInterface
$development boolean

isBundledClass() публичный Метод

Allows to check if a class is part of PHP
public isBundledClass ( string $className ) : boolean
$className string
Результат boolean

isBundledInterface() публичный Метод

Allows to check if a interface is part of PHP
public isBundledInterface ( string $className ) : boolean
$className string
Результат boolean

isClass() публичный Метод

Allows to check if a class is part of the compiled extension
public isClass ( string $className ) : boolean
$className string
Результат boolean

isConstant() публичный Метод

Checks if $name is a Zephir constant
public isConstant ( string $name ) : boolean
$name string
Результат boolean

isExtensionGlobal() публичный Метод

Checks if a specific extension global is defined
public isExtensionGlobal ( string $name ) : boolean
$name string
Результат boolean

isInterface() публичный Метод

Allows to check if an interface is part of the compiled extension
public isInterface ( string $className ) : boolean
$className string
Результат boolean

loadConstantsSources() защищенный Метод

Registers C-constants as PHP constants from a C-file
protected loadConstantsSources ( array $constantsSources )
$constantsSources array

loadExternalClass() публичный Метод

Loads a class definition in an external dependency
public loadExternalClass ( string $className, string $location ) : boolean
$className string
$location string
Результат boolean

preCompile() защищенный Метод

Pre-compiles classes creating a CompilerFile definition
protected preCompile ( string $filePath )
$filePath string

preCompileHeaders() публичный Метод

Pre-compile headers to speed up compilation
public preCompileHeaders ( )

processAddSources() защищенный Метод

Process config.w32 sections
protected processAddSources ( array $sources, string $project ) : array
$sources array
$project string
Результат array

processCodeInjection() публичный Метод

Process extension code injection
public processCodeInjection ( array $entries ) : array
$entries array
Результат array

processExtensionGlobals() публичный Метод

Process extension globals
public processExtensionGlobals ( string $namespace ) : array
$namespace string
Результат array

processExtensionInfo() публичный Метод

Generates phpinfo() sections showing information about the extension
public processExtensionInfo ( ) : string
Результат string

recursiveDeletePath() защищенный Метод

Recursively deletes files in a specified location
protected recursiveDeletePath ( string $path, string $mask )
$path string
$mask string

recursivePreCompile() защищенный Метод

Recursively pre-compiles all sources found in the given path
protected recursivePreCompile ( string $path )
$path string

recursiveProcess() защищенный Метод

Copies the base kernel to the extension destination
protected recursiveProcess ( $src, $dest, string $pattern = null, mixed $callback = "copy" ) : boolean
$src
$dest
$pattern string
$callback mixed
Результат boolean

setExtensionGlobals() публичный Метод

Sets extensions globals
public setExtensionGlobals ( array $globals )
$globals array

stubs() публичный Метод

Generate IDE stubs
public stubs ( Zephir\Commands\CommandInterface $command, boolean $fromGenerate = false )
$command Zephir\Commands\CommandInterface
$fromGenerate boolean

test() публичный Метод

Run tests
public test ( Zephir\Commands\CommandInterface $command )
$command Zephir\Commands\CommandInterface

Описание свойств

$anonymousFiles защищенное свойство

protected array|string[] $anonymousFiles
Результат array | string[]

$backend публичное свойство

public BaseBackend,zephir $backend
Результат BaseBackend

$compiledFiles защищенное свойство

protected array|string[] $compiledFiles
Результат array | string[]

$config защищенное свойство

protected Config,zephir $config
Результат zephir\Config

$constants защищенное свойство

protected $constants

$currentVersion защищенное статическое свойство

protected static string $currentVersion
Результат string

$definitions защищенное свойство

protected ClassDefinition[],zephir $definitions
Результат ClassDefinition[]

$externalDependencies защищенное свойство

External dependencies
protected array $externalDependencies
Результат array

$extraFiles защищенное свойство

protected array $extraFiles
Результат array

$fcallManager защищенное свойство

protected FcallManager,Zephir\Backends\ZendEngine3|FcallManager,Zephir\Backends\ZendEngine2 $fcallManager
Результат Zephir\Backends\ZendEngine3\FcallManager | Zephir\Backends\ZendEngine2\FcallManager

$files защищенное свойство

protected CompilerFile[],zephir $files
Результат CompilerFile[]

$functionDefinitions публичное свойство

public FunctionDefinition[],zephir $functionDefinitions
Результат zephir\FunctionDefinition[]

$globals защищенное свойство

Extension globals
protected array $globals
Результат array

$internalDefinitions защищенное статическое свойство

protected static ReflectionClass[] $internalDefinitions
Результат ReflectionClass[]

$internalInitializers защищенное свойство

Additional initializer code used for static property initialization
protected array $internalInitializers
Результат array

$loadedPrototypes защищенное статическое свойство

protected static bool $loadedPrototypes
Результат boolean

$logger защищенное свойство

protected Logger,zephir $logger
Результат zephir\Logger

$parserCompiled публичное свойство

public $parserCompiled

$stringManager защищенное свойство

protected StringsManager,zephir $stringManager
Результат zephir\StringsManager