Index

Targets

MMO\admin\helpers · 1 symbol · generated 5 Oct 2026

class

Targets

Targets.php:28

Selecting which targets a command acts on -- a thin, deliberately boring facade over Store's targets collection.

class MMO\admin\helpers\Targets implements IteratorAggregate, Countable
Namespace
MMO\admin\helpers
Implements
IteratorAggregate, Countable
Boring is the requirement. Every interesting failure of a fleet tool is a selection failure: the command was right and it ran somewhere else, or it ran everywhere, or it ran nowhere and said nothing. So: - **Nothing is implicit.** An empty selection returns nothing. The previous production script defaulted to "every client" when given no argument, which made a mistyped restore a fleet-wide event. - **A selection that matches nothing is an error**, not an empty success. `--tags=prod` on a file where the tag is spelled `production` used to exit 0 having deployed to no one. - **An explicitly named disabled target is an error**, not a silent omission. `--targets=oldclient` used to be filtered out by the `enabled` check and report nothing at all. Being named is an explicit decision; being matched by a tag is not, so tags still skip disabled targets quietly.
$targets->select(['demo']); // explicit names $targets->select([], ['staging']); // everything tagged 'staging' $targets->selectAll(); // only ever from an explicit --all

Properties1

targets

protected array $targets = []
Type
array

Methods12

all()

Targets.php:59
function all(): array
returnsarrayevery declared target, including disabled ones.

FromFile($filename)

staticTargets.php:51
static function FromFile(string $filename): static
$filenamestringa deploy.json, resolved through filename.
returnsstatic
throwsif the file does not exist.

select($names, $tags, $includeDisabled)

Targets.php:97

Resolve an explicit selection.

function select( array|string $names = [], array|string $tags = [], bool $includeDisabled = false ): array
$names = []array | stringtarget names (or a single comma-separated string).
$tags = []array | stringadditionally include every ENABLED target carrying one of these tags.
$includeDisabled = falseboolalso accept disabled targets, by name and by tag.
returnsarray
throwsif a requested name does not exist.
throwsif a non-empty request selected nothing at all.

selectAll($includeDisabled)

Targets.php:135
function selectAll(bool $includeDisabled = false): array
$includeDisabled = falsebool
returnsarrayevery enabled target -- only ever reached through an explicit --all.

__construct($targets)

Targets.php:35
function __construct(MMO\core\entities\Collection|array $targets = [])
$targets = []Collection | arraythe store's targets collection, or a plain list of Target.