Cecil

Vocabulary extends Collection implements ItemInterface

Vocabulary class.

Represents a collection of terms, allowing for the addition and retrieval of terms by their ID.

Table of Contents

Interfaces

ItemInterface
Item interface.

Properties

$id  : string
Collection's identifier.
$items  : array<string|int, mixed>
Collection's items.

Methods

__construct()  : mixed
__toString()  : string
Returns the collection ID.
add()  : CollectionInterface
Adds a term to a Vocabulary collection.
count()  : int
Implements Countable.
filter()  : CollectionInterface
Filters items using a callback function.
first()  : ItemInterface|null
Retrieves the first item.
get()  : Term
Retrieves an item or throw an exception if not exists.
getId()  : string
Returns the collection's identifier.
getIterator()  : ArrayIterator
Implements \IteratorAggregate.
getPosition()  : int
Retrieves an item position or throw an exception if not exists.
has()  : bool
Does the item $id exists?
keys()  : array<string|int, mixed>
Retrieves all keys.
last()  : ItemInterface|null
{@inheritdoc}
map()  : CollectionInterface
Applies a callback to items.
offsetExists()  : bool
Implements \ArrayAccess.
offsetGet()  : CollectionInterface|ItemInterface|null
Implements \ArrayAccess.
offsetSet()  : void
Implements \ArrayAccess.
offsetUnset()  : void
Implements \ArrayAccess.
remove()  : CollectionInterface
Removes an item or throw an exception if not exists.
replace()  : CollectionInterface
Replaces an item or throw an exception if not exists.
reverse()  : CollectionInterface
Reverse items order.
setId()  : BaseInterface
Set the collection's identifier.
toArray()  : array<string|int, mixed>
Returns collection as array.
toJson()  : string
Returns a JSON string of items.
usort()  : CollectionInterface
Implements usort.
searchItem()  : array<string|int, mixed>|null
Search an item by ID.

Properties

$id

Collection's identifier.

protected string $id

$items

Collection's items.

protected array<string|int, mixed> $items = []

Methods

__construct()

public __construct(string $id[, array<string|int, mixed> $items = [] ]) : mixed
Parameters
$id : string
$items : array<string|int, mixed> = []

__toString()

Returns the collection ID.

public __toString() : string
Return values
string

count()

Implements Countable.

public count() : int
Return values
int

get()

Retrieves an item or throw an exception if not exists.

public get(string $id) : Term
Parameters
$id : string
Return values
Term

getId()

Returns the collection's identifier.

public getId() : string
Return values
string

getIterator()

Implements \IteratorAggregate.

public getIterator() : ArrayIterator
Return values
ArrayIterator

getPosition()

Retrieves an item position or throw an exception if not exists.

public getPosition(string $id) : int
Parameters
$id : string
Tags
throws
DomainException
Return values
int

has()

Does the item $id exists?

public has(string $id) : bool
Parameters
$id : string
Return values
bool

keys()

Retrieves all keys.

public keys() : array<string|int, mixed>
Return values
array<string|int, mixed>

offsetExists()

Implements \ArrayAccess.

public offsetExists(string $offset) : bool
Parameters
$offset : string
Attributes
#[ReturnTypeWillChange]
Return values
bool

offsetSet()

Implements \ArrayAccess.

public offsetSet(mixed $offset, ItemInterface $value) : void
Parameters
$offset : mixed
$value : ItemInterface
Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Attributes
#[ReturnTypeWillChange]

offsetUnset()

Implements \ArrayAccess.

public offsetUnset(string $offset) : void
Parameters
$offset : string
Attributes
#[ReturnTypeWillChange]

toArray()

Returns collection as array.

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

toJson()

Returns a JSON string of items.

public toJson() : string
Return values
string

searchItem()

Search an item by ID.

protected searchItem(string $id) : array<string|int, mixed>|null
Parameters
$id : string
Return values
array<string|int, mixed>|null
 
On this page

Search results