PackagesCollection
extends ArrayObject
in package
The list of packages found in the lock file.
Tags
Table of Contents
Properties
- $indexedBy : array<string, mixed>
Methods
- getByName() : Package
- Gets the package by it's name.
- getByNamespace() : Package
- Finds a package by it's namespace.
- hasByName() : bool
- Checks if a package exists by that name.
- hasByNamespace() : bool
- Checks if a package exists by that namespace.
- offsetSet() : void
- Adds a package to the index.
- resetIndex() : void
- reset the indexedBy array.
- getIndexedByName() : array<string, mixed>
- Gets the list of packages indexed by their name.
- getIndexedByNamespace() : array<string, mixed>
- Gets the list of packages indexed by their namespace.
Properties
$indexedBy
private
array<string, mixed>
$indexedBy
= ['name' => [], 'namespace' => []]
Either indexed by the name, or namespace
Methods
getByName()
Gets the package by it's name.
public
getByName(string $name) : Package
Parameters
- $name : string
-
The name of the package to look for
Tags
Return values
Package —The package for the name
getByNamespace()
Finds a package by it's namespace.
public
getByNamespace(string $namespace) : Package
Parameters
- $namespace : string
-
The namespace of the package to look for.
Tags
Return values
Package —The package for the namenamespace
hasByName()
Checks if a package exists by that name.
public
hasByName(string $name) : bool
Parameters
- $name : string
Return values
boolhasByNamespace()
Checks if a package exists by that namespace.
public
hasByNamespace(string $namespace) : bool
Parameters
- $namespace : string
Return values
booloffsetSet()
Adds a package to the index.
public
offsetSet(mixed $index, Package $package) : void
Parameters
- $index : mixed
-
The index to set with this package.
- $package : Package
-
The Package to add to the indexed array.
resetIndex()
reset the indexedBy array.
public
resetIndex() : void
Mainly used for testing.
getIndexedByName()
Gets the list of packages indexed by their name.
private
getIndexedByName() : array<string, mixed>
Return values
array<string, mixed> —The listed of packages indexed by their name.
getIndexedByNamespace()
Gets the list of packages indexed by their namespace.
private
getIndexedByNamespace() : array<string, mixed>
Return values
array<string, mixed> —The listed of packages indexed by their namespace.