MMOframework
Pourquoi l'IA Playground Bibliothèques Développeurs Agence
FR EN
Créer un projet en direct
Index

State

MMO\git\helpers · 1 symbole · générée le 30 Nov 2026

class

State

State.php:17

What git says about one repository -- a library, a project, a module --, read once and frozen: its branch, how far it is from its remote, its uncommitted files.

class MMO\git\helpers\State implements JsonSerializable
Espace de noms
MMO\git\helpers
Implémente
JsonSerializable
Read only, on purpose: nothing here calls `pull`, `push`, `commit` or `checkout`. Reading it costs several `git` subprocesses: a page asks for it on a route of its own, once it is on screen (the root hub's library cards, a monitoring hub's local project).
$state = \MMO\git\helpers\State::Of('/home/me/dev/MMO/master/libs/core');

Index

ahead readonly
behind readonly
branch readonly
changes readonly
commit readonly
detached readonly
error readonly
moduleStatus readonly
upstream readonly
isClean()
isDirty()
jsonSerialize()
Of($folder) staticRead one repository's state.
__construct($data) final

Propriétés9

ahead

readonly
readonly int $ahead
Type
int

behind

readonly
readonly int $behind
Type
int

branch

readonly
readonly string $branch
Type
string

changes

readonly
readonly array $changes
Type
array

commit

readonly
readonly string $commit
Type
string

detached

readonly
readonly bool $detached
Type
bool

error

readonly
readonly ?string $error
Type
null | string

moduleStatus

readonly
readonly ?string $moduleStatus
Type
null | string

upstream

readonly
readonly ?string $upstream
Type
null | string

Méthodes5

isClean()

State.php:103
function isClean(): bool
retournebooltrue when there is nothing to commit, nothing to push and nothing to pull

isDirty()

State.php:98
function isDirty(): bool
retournebooltrue when the working copy has uncommitted changes

Of($folder)

staticState.php:68

Read one repository's state.

static function Of(string $folder): staticA library that is not a git clone at all (a fresh folder, a submodule that was never initialised) is not an error worth stopping a page for: it comes back as a state carrying [`$error`](https://mmoframework.fr/documentation/mmo.git/php/helpers/State.md#state-error), which the card shows instead of a branch.
$folderstringthe repository's folder
retournestatic

__construct($data)

finalState.php:46
final protected function __construct(array $data)
$dataarray