Book/componere-Phpdoc专题

Componere

目录

简介

This final abstract represents a class entry, and should not be used by the programmer.

类摘要

Componere\Abstract\Definition

final <span class="modifier">abstract class Componere\Abstract\Definition {

/* 方法 */

public <span class="type">Definition <span class="methodname">addInterface ( <span class="type">string $interface )

public <span class="type">Definition addMethod ( string $name , <span class="type">Componere\Method $method )

public <span class="type">Definition addTrait ( string $trait )

public <span class="type">ReflectionClass <span class="methodname">getReflector ( <span class="methodparam">void )

}

Componere\Abstract\Definition::addInterface

Add Interface

说明

public <span class="type">Definition <span class="methodname">Componere\Abstract\Definition::addInterface ( string $interface )

Shall implement the given interface on the current definition

参数

interface
The case insensitive name of an interface

返回值

The current Definition

Exceptions

Warning

Shall throw RuntimeException if <span class="type">Definition was registered

Componere\Abstract\Definition::addMethod

Add Method

说明

public <span class="type">Definition <span class="methodname">Componere\Abstract\Definition::addMethod ( string $name , <span class="type">Componere\Method $method )

Shall create or override a method on the current definition.

参数

name
The case insensitive name for method

method
Componere\Method not previously added to another Definition

返回值

The current Definition

Exceptions

Warning

Shall throw RuntimeException if <span class="type">Definition was registered

Warning

Shall throw RuntimeException if Method was added to another Definition

Componere\Abstract\Definition::addTrait

Add Trait

说明

public <span class="type">Definition <span class="methodname">Componere\Abstract\Definition::addTrait ( string $trait )

Shall use the given trait for the current definition

参数

trait
The case insensitive name of a trait

返回值

The current Definition

Exceptions

Warning

Shall throw RuntimeException if <span class="type">Definition was registered

Componere\Abstract\Definition::getReflector

Reflection

说明

public <span class="type">ReflectionClass <span class="methodname">Componere\Abstract\Definition::getReflector ( void )

Shall create or return a ReflectionClass

返回值

A ReflectionClass for the current definition (cached)

简介

The Definition class allows the programmer to build and register a type at runtime.

Should a Definition replace an existing class, the existing class will be restored when the Definition is destroyed.

类摘要

Componere\Definition

final class Componere\Definition <span class="modifier">extends Componere\Abstract\Definition {

/* Constructors */

public <span class="methodname">__construct ( <span class="methodparam">string $name )

public <span class="methodname">__construct ( <span class="methodparam">string $name , string $parent )

public <span class="methodname">__construct ( <span class="methodparam">string $name , array $interfaces )

public <span class="methodname">__construct ( <span class="methodparam">string $name , string $parent , <span class="type">array $interfaces )

/* 方法 */

public <span class="type">Definition <span class="methodname">addConstant ( <span class="type">string $name , <span class="methodparam">Componere\Value $value )

public <span class="type">Definition <span class="methodname">addProperty ( <span class="type">string $name , <span class="methodparam">Componere\Value $value )

public void register ( <span class="methodparam">void )

public bool isRegistered ( <span class="methodparam">void )

public Closure getClosure ( <span class="methodparam">string $name )

public array getClosures ( <span class="methodparam">void )

/* 继承的方法 */

public <span class="type">Definition <span class="methodname">Componere\Abstract\Definition::addInterface ( string $interface )

public <span class="type">Definition <span class="methodname">Componere\Abstract\Definition::addMethod ( string $name , <span class="type">Componere\Method $method )

public <span class="type">Definition <span class="methodname">Componere\Abstract\Definition::addTrait ( string $trait )

public <span class="type">ReflectionClass <span class="methodname">Componere\Abstract\Definition::getReflector ( void )

}

Componere\Definition::__construct

Definition Construction

说明

public <span class="methodname">Componere\Definition::__construct ( <span class="methodparam">string $name )

public <span class="methodname">Componere\Definition::__construct ( <span class="methodparam">string $name , string $parent )

public <span class="methodname">Componere\Definition::__construct ( <span class="methodparam">string $name , array $interfaces )

public <span class="methodname">Componere\Definition::__construct ( <span class="methodparam">string $name , string $parent , <span class="type">array $interfaces )

参数

name
A case insensitive class name

parent
A case insensitive class name

interfaces
An array of case insensitive class names

Exceptions

Warning

Shall throw InvalidArgumentException if an attempt is made to replace an internal class

Warning

Shall throw InvalidArgumentException if an attempt is made to replace an interface

Warning

Shall throw InvalidArgumentException if an attempt is made to replace a trait

Warning

Shall throw RuntimeException if a class in interfaces cannot be found

Warning

Shall throw RuntimeException if an class in interfaces is not an interface

Componere\Definition::addConstant

Add Constant

说明

public <span class="type">Definition <span class="methodname">Componere\Definition::addConstant ( <span class="methodparam">string $name , Componere\Value $value )

Shall declare a class constant on the current Definition

参数

name
The case sensitive name for the constant

value
The Value for the constant, must not be undefined or static

返回值

The current Definition

Exceptions

Warning

Shall throw RuntimeException if <span class="type">Definition was registered

Warning

Shall throw RuntimeException if name is already declared as a constant

Warning

Shall throw RuntimeException if value is static

Warning

Shall throw RuntimeException if value is undefined

Componere\Definition::addProperty

Add Property

说明

public <span class="type">Definition <span class="methodname">Componere\Definition::addProperty ( <span class="methodparam">string $name , Componere\Value $value )

Shall declare a class property on the current Definition

参数

name
The case sensitive name for the property

value
The default Value for the property

返回值

The current Definition

Exceptions

Warning

Shall throw RuntimeException if <span class="type">Definition was registered

Warning

Shall throw RuntimeException if name is already declared as a property

Componere\Definition::register

Registration

说明

public void Componere\Definition::register ( <span class="methodparam">void )

Shall register the current Definition

Exceptions

Warning

Shall throw RuntimeException if <span class="type">Definition was registered

Componere\Definition::isRegistered

State Detection

说明

public bool Componere\Definition::isRegistered ( void )

Shall detect the registration state of this Definition

返回值

Shall return true if this Definition is registered

Componere\Definition::getClosure

Get Closure

说明

public Closure Componere\Definition::getClosure ( string $name )

Shall return a Closure for the method specified by name

参数

name
The case insensitive name of the method

返回值

A Closure bound to the correct scope

Exceptions

Warning

Shall throw RuntimeException if <span class="type">Definition was registered

Warning

Shall throw RuntimeException if name could not be found

Componere\Definition::getClosures

Get Closures

说明

public array Componere\Definition::getClosures ( void )

Shall return an array of Closures

返回值

Shall return all methods as an array of Closure objects bound to the correct scope

Exceptions

Warning

Shall throw RuntimeException if <span class="type">Definition was registered

简介

The Patch class allows the programmer to change the type of an instance at runtime without registering a new Definition

When a Patch is destroyed it is reverted, so that instances that were patched during the lifetime of the Patch are restored to their formal type.

类摘要

Componere\Patch

final class Componere\Patch <span class="modifier">extends Componere\Abstract\Definition {

/* Constructors */

public <span class="methodname">__construct ( <span class="methodparam">object $instance )

public <span class="methodname">__construct ( <span class="methodparam">object $instance , array $interfaces )

/* 方法 */

public void apply ( <span class="methodparam">void )

public void revert ( <span class="methodparam">void )

public bool isApplied ( <span class="methodparam">void )

public Patch derive ( <span class="type">object $instance )

public Closure getClosure ( <span class="methodparam">string $name )

public array getClosures ( <span class="methodparam">void )

/* 继承的方法 */

public <span class="type">Definition <span class="methodname">Componere\Abstract\Definition::addInterface ( string $interface )

public <span class="type">Definition <span class="methodname">Componere\Abstract\Definition::addMethod ( string $name , <span class="type">Componere\Method $method )

public <span class="type">Definition <span class="methodname">Componere\Abstract\Definition::addTrait ( string $trait )

public <span class="type">ReflectionClass <span class="methodname">Componere\Abstract\Definition::getReflector ( void )

}

Componere\Patch::__construct

Patch Construction

说明

public <span class="methodname">Componere\Patch::__construct ( <span class="methodparam">object $instance )

public <span class="methodname">Componere\Patch::__construct ( <span class="methodparam">object $instance , array $interfaces )

参数

instance
The target for this Patch

interfaces
A case insensitive array of class names

Exceptions

Warning

Shall throw RuntimeException if a class in interfaces cannot be found

Warning

Shall throw RuntimeException if an class in interfaces is not an interface

Componere\Patch::apply

Application

说明

public void Componere\Patch::apply ( <span class="methodparam">void )

Shall apply the current patch

Componere\Patch::revert

Reversal

说明

public void Componere\Patch::revert ( <span class="methodparam">void )

Shall revert the current patch

Componere\Patch::isApplied

State Detection

说明

public bool Componere\Patch::isApplied ( <span class="methodparam">void )

Componere\Patch::derive

Patch Derivation

说明

public Patch Componere\Patch::derive ( <span class="methodparam">object $instance )

Shall derive a Patch for the given instance

参数

instance
The target for the derived Patch

返回值

Patch for instance derived from the current Patch

Exceptions

Warning

Shall throw InvalidArgumentException if instance is not compatible

Componere\Patch::getClosure

Get Closure

说明

public Closure Componere\Patch::getClosure ( <span class="methodparam">string $name )

Shall return a Closure for the method specified by name

参数

name
The case insensitive name of the method

返回值

A Closure bound to the correct scope and object

Exceptions

Warning

Shall throw RuntimeException if name could not be found

Componere\Patch::getClosures

Get Closures

说明

public array Componere\Patch::getClosures ( <span class="methodparam">void )

Shall return an array of Closures

返回值

Shall return all methods as an array of Closure objects bound to the correct scope and object

简介

A Method represents a function with modifiable accessibility flags

类摘要

Componere\Method

final class Componere\Method {

/* Constructor */

public <span class="methodname">__construct ( <span class="methodparam">Closure $closure )

/* 方法 */

public Method setPrivate ( <span class="methodparam">void )

public Method setProtected ( <span class="methodparam">void )

public Method setStatic ( <span class="methodparam">void )

public <span class="type">ReflectionMethod <span class="methodname">getReflector ( <span class="methodparam">void )

}

Componere\Method::__construct

Method Construction

说明

public <span class="methodname">Componere\Method::__construct ( <span class="methodparam">Closure $closure )

参数

closure

Componere\Method::setPrivate

Accessibility Modification

说明

public Method Componere\Method::setPrivate ( <span class="methodparam">void )

返回值

The current Method

Exceptions

Warning

Shall throw RuntimeException if access level was previously set

Componere\Method::setProtected

Accessibility Modification

说明

public Method Componere\Method::setProtected ( <span class="methodparam">void )

返回值

The current Method

Exceptions

Warning

Shall throw RuntimeException if access level was previously set

Componere\Method::setStatic

Accessibility Modification

说明

public Method Componere\Method::setStatic ( <span class="methodparam">void )

返回值

The current Method

Componere\Method::getReflector

Reflection

说明

public <span class="type">ReflectionMethod <span class="methodname">Componere\Method::getReflector ( <span class="methodparam">void )

Shall create or return a ReflectionMethod

返回值

A ReflectionMethod for the current method (cached)

简介

A Value represents a PHP variable of all types, including undefined

类摘要

Componere\Value

final class Componere\Value {

/* Constructor */

public <span class="methodname">__construct ([ $default ] )

/* 方法 */

public Value setPrivate ( <span class="methodparam">void )

public Value setProtected ( <span class="methodparam">void )

public Value setStatic ( <span class="methodparam">void )

public bool isPrivate ( <span class="methodparam">void )

public bool isProtected ( <span class="methodparam">void )

public bool isStatic ( <span class="methodparam">void )

public bool hasDefault ( <span class="methodparam">void )

}

Componere\Value::__construct

Value Construction

说明

public <span class="methodname">Componere\Value::__construct ([ <span class="methodparam"> $default ] )

参数

default

Exceptions

Warning

Shall throw InvalidArgumentException if default does not have a suitable value

Componere\Value::setPrivate

Accessibility Modification

说明

public Value Componere\Value::setPrivate ( <span class="methodparam">void )

返回值

The current Value

Exceptions

Warning

Shall throw RuntimeException if access level was previously set

Componere\Value::setProtected

Accessibility Modification

说明

public Value Componere\Value::setProtected ( <span class="methodparam">void )

返回值

The current Value

Exceptions

Warning

Shall throw RuntimeException if access level was previously set

Componere\Value::setStatic

Accessibility Modification

说明

public Value Componere\Value::setStatic ( <span class="methodparam">void )

返回值

The current Value

Componere\Value::isPrivate

Accessibility Detection

说明

public bool Componere\Value::isPrivate ( <span class="methodparam">void )

Componere\Value::isProtected

Accessibility Detection

说明

public bool Componere\Value::isProtected ( <span class="methodparam">void )

Componere\Value::isStatic

Accessibility Detection

说明

public bool Componere\Value::isStatic ( <span class="methodparam">void )

Componere\Value::hasDefault

Value Interaction

说明

public bool Componere\Value::hasDefault ( <span class="methodparam">void )


本站为非盈利网站,作品由网友提供上传,如无意中有侵犯您的版权,请联系删除