DiscordPHP Documentation

Factory
in package

Exposes an interface to build part objects without the other requirements.

Tags
since
4.0.0

Table of Contents

$discord  : Discord
The Discord client.
__construct()  : mixed
Constructs a factory.
create()  : Part|AbstractRepository
Creates an object.
part()  : Part
Creates a part.
repository()  : AbstractRepository
Creates a repository.

Properties

Methods

__construct()

Constructs a factory.

public __construct(Discord $discord) : mixed
Parameters
$discord : Discord

The Discord client.

Return values
mixed

create()

Creates an object.

public create(string $class[, mixed $data = [] ][, bool $created = false ]) : Part|AbstractRepository
Parameters
$class : string

The class to build.

$data : mixed = []

Data to create the object.

$created : bool = false

Whether the object is created (if part).

Tags
throws
Exception
Return values
Part|AbstractRepository

The object.

part()

Creates a part.

public part(string $class[, array<string|int, mixed> $data = [] ][, bool $created = false ]) : Part
Parameters
$class : string

The class to build.

$data : array<string|int, mixed> = []

Data to create the object.

$created : bool = false

Whether the object is created (if part).

Return values
Part

The part.

repository()

Creates a repository.

public repository(string $class[, array<string|int, mixed> $data = [] ]) : AbstractRepository
Parameters
$class : string

The class to build.

$data : array<string|int, mixed> = []

Data to create the object.

Return values
AbstractRepository

The repository.

Search results