PHP Класс Eloquent\Phony\Mock\Builder\MockBuilder

Показать файл Открыть проект

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

Метод Описание
__clone ( ) Clone this builder.
__construct ( mixed $types, MockFactory $factory, HandleFactory $handleFactory, InvocableInspector $invocableInspector, FeatureDetector $featureDetector ) Construct a new mock builder.
addConstant ( string $name, mixed $value ) Add a custom class constant.
addMethod ( string $name, callable | null $callback = null ) Add a custom method.
addProperty ( string $name, mixed $value = null ) Add a custom property.
addStaticMethod ( string $name, callable | null $callback = null ) Add a custom static method.
addStaticProperty ( string $name, mixed $value = null ) Add a custom static property.
build ( boolean $createNew = false ) : ReflectionClass Generate and define the mock class.
className ( boolean $createNew = false ) : string Generate and define the mock class, and return the class name.
definition ( ) : MockDefinition Get the mock definitions.
factory ( ) : MockFactory Get the factory.
featureDetector ( ) : FeatureDetector Get the feature detector.
finalize ( ) Finalize the mock builder.
full ( ) : Eloquent\Phony\Mock\Mock Create a new full mock.
get ( ) : Eloquent\Phony\Mock\Mock Get a mock.
handleFactory ( ) : HandleFactory Get the handle factory.
invocableInspector ( ) : InvocableInspector Get the invocable inspector.
isBuilt ( ) : boolean Returns true if the mock class has been built.
isFinalized ( ) : boolean Returns true if this builder is finalized.
like ( mixed $type ) Add classes, interfaces, or traits.
named ( string | null $className = null ) Set the class name.
partial ( ) : Eloquent\Phony\Mock\Mock Create a new partial mock.
partialWith ( Arguments | array | null $arguments = [] ) : Eloquent\Phony\Mock\Mock Create a new partial mock.
source ( MockGenerator $generator = null ) : string Get the generated source code of the mock class.
types ( ) : ReflectionClass>\array Get the types.

Приватные методы

Метод Описание
define ( $definition )
normalizeDefinition ( )
resolveInternalInterface ( $interface, $preferred, $alternate )

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

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

Clone this builder.
public __clone ( )

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

Each value in $types can be either a class name, or an ad hoc mock definition. If only a single type is being mocked, the class name or definition can be passed without being wrapped in an array.
public __construct ( mixed $types, MockFactory $factory, HandleFactory $handleFactory, InvocableInspector $invocableInspector, FeatureDetector $featureDetector )
$types mixed The types to mock.
$factory Eloquent\Phony\Mock\MockFactory The factory to use.
$handleFactory Eloquent\Phony\Mock\Handle\HandleFactory The handle factory to use.
$invocableInspector Eloquent\Phony\Invocation\InvocableInspector The invocable inspector.
$featureDetector Eloquent\Phony\Reflection\FeatureDetector The feature detector to use.

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

Add a custom class constant.
public addConstant ( string $name, mixed $value )
$name string The name.
$value mixed The value.

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

Add a custom method.
public addMethod ( string $name, callable | null $callback = null )
$name string The name.
$callback callable | null The callback.

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

Add a custom property.
public addProperty ( string $name, mixed $value = null )
$name string The name.
$value mixed The value.

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

Add a custom static method.
public addStaticMethod ( string $name, callable | null $callback = null )
$name string The name.
$callback callable | null The callback.

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

Add a custom static property.
public addStaticProperty ( string $name, mixed $value = null )
$name string The name.
$value mixed The value.

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

Calling this method will finalize the mock builder.
public build ( boolean $createNew = false ) : ReflectionClass
$createNew boolean True if a new class should be created even when a compatible one exists.
Результат ReflectionClass The class.

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

Calling this method will finalize the mock builder.
public className ( boolean $createNew = false ) : string
$createNew boolean True if a new class should be created even when a compatible one exists.
Результат string The class name.

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

Calling this method will finalize the mock builder.
public definition ( ) : MockDefinition
Результат MockDefinition The mock definition.

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

Get the factory.
public factory ( ) : MockFactory
Результат Eloquent\Phony\Mock\MockFactory The factory.

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

Get the feature detector.
public featureDetector ( ) : FeatureDetector
Результат Eloquent\Phony\Reflection\FeatureDetector The feature detector.

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

Finalize the mock builder.
public finalize ( )

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

This method will always create a new mock, and will replace the current mock. Calling this method will finalize the mock builder.
public full ( ) : Eloquent\Phony\Mock\Mock
Результат Eloquent\Phony\Mock\Mock The mock instance.

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

This method will return the current mock, only creating a new mock if no existing mock is available. If no existing mock is available, the created mock will be a full mock. Calling this method will finalize the mock builder.
public get ( ) : Eloquent\Phony\Mock\Mock
Результат Eloquent\Phony\Mock\Mock The mock instance.

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

Get the handle factory.
public handleFactory ( ) : HandleFactory
Результат Eloquent\Phony\Mock\Handle\HandleFactory The handle factory.

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

Get the invocable inspector.
public invocableInspector ( ) : InvocableInspector
Результат Eloquent\Phony\Invocation\InvocableInspector The invocable inspector.

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

Returns true if the mock class has been built.
public isBuilt ( ) : boolean
Результат boolean True if the mock class has been built.

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

Returns true if this builder is finalized.
public isFinalized ( ) : boolean
Результат boolean True if finalized.

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

Each value in $types can be either a class name, or an ad hoc mock definition. If only a single type is being mocked, the class name or definition can be passed without being wrapped in an array.
public like ( mixed $type )
$type mixed A type, or types to add.

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

Set the class name.
public named ( string | null $className = null )
$className string | null The class name, or null to use a generated name.

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

This method will always create a new mock, and will replace the current mock. Calling this method will finalize the mock builder.
public partial ( ) : Eloquent\Phony\Mock\Mock
Результат Eloquent\Phony\Mock\Mock The mock instance.

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

This method will always create a new mock, and will replace the current mock. Calling this method will finalize the mock builder. This method supports reference parameters.
public partialWith ( Arguments | array | null $arguments = [] ) : Eloquent\Phony\Mock\Mock
$arguments Eloquent\Phony\Call\Arguments | array | null The constructor arguments, or null to bypass the constructor.
Результат Eloquent\Phony\Mock\Mock The mock instance.

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

Calling this method will finalize the mock builder.
public source ( MockGenerator $generator = null ) : string
$generator Eloquent\Phony\Mock\MockGenerator The mock generator to use.
Результат string The source code.

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

Get the types.
public types ( ) : ReflectionClass>\array
Результат ReflectionClass>\array