Index

GitHubRepository

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

class

GitHubRepository

GitHubRepository.php:44

A GitHub project, or a repository's issues, as a repository of mmo.client's kanban entities: one KanbanBoard, its KanbanTickets, and their KanbanComments. mmo.client's KanbanController reads and saves a board through it as it does through a JsonRepository.

class MMO\git\helpers\GitHubRepository extends MMO\core\entities\Repository
Namespace
MMO\git\helpers
Extends
Repository
```php \MMO\app([ 'kanban' => ['$' => GitHubRepository::class, 'project' => 'https://github.com/users/<login>/projects/<n>', 'collections' => ['boards' => KanbanBoard::class, 'tickets' => KanbanTicket::class, 'comments' => KanbanComment::class]], \MMO\client\controllers\KanbanController::class => ['repositories' => ['main' => ['$' => '#kanban']]], ]); ``` - It reads GitHub the first time something asks for one of its collections, through [`ProjectBoard`](https://mcp.mmoframework.fr/documentation/mmo.git/php/helpers/ProjectBoard.md#projectboard) (a `project`) or [`IssueBoard`](https://mcp.mmoframework.fr/documentation/mmo.git/php/helpers/IssueBoard.md#issueboard) (the issues of `repository`, or of GitHubAPI's). The board is named [`$board`](https://mcp.mmoframework.fr/documentation/mmo.git/php/helpers/GitHubRepository.md#githubrepository-board). - A ticket's comments are read the first time a query asks for them by ticket (`['ticket' => '12']`): GitHub answers them issue by issue ([`IssueDiscussion`](https://mcp.mmoframework.fr/documentation/mmo.git/php/helpers/IssueDiscussion.md#issuediscussion)). - `\MMO\commit()` writes the changes: the board's and its tickets' through the board's `save()`, which changes only what differs from what was read; a new ticket gets its id there (an issue's number, `d<n>` for a project's draft). A comment is added, changed or deleted on GitHub (only the token owner's). - What GitHub has no place for -- the icons, the colours it does not keep ([`aBoard::keepsColor`](https://mcp.mmoframework.fr/documentation/mmo.git/php/classes/aBoard.md#aboard-keepscolor)), a status's type set in the board's settings -- is kept in [`$looks`](https://mcp.mmoframework.fr/documentation/mmo.git/php/helpers/GitHubRepository.md#githubrepository-looks). - It needs mmo.client, whose entities it holds, and a token for anything but a public repository's issues.
$repository = \MMO\get('kanban'); $ticket = $repository->getCollectionByClass(KanbanTicket::class)->getById('12'); $ticket->set('statusId', 'done'); \MMO\commit($this); // closes the issue #12

Index

LOOKS
api
board
cacheTtl
discussed
github
looks
made
project
repository
snapshot
source
applyLooks($data)
cacheFile()
collectionOf($class)
commentData($ticket, $comment)
createEntity($class, $data, $collection)Same as Repository::createEntity, but a new entity's id is a placeholder until GitHub gives it its own: a number could be an issue's already.
discuss($ticket)Read a ticket's comments, once.
discussion($ticket)
dropCache()Forget what GitHub answered: the next request reads it again.
executeQuery($query, $opts)Same as Repository::executeQuery, reading first the comments of the tickets a query of comments names.
fetch()Read the board from GitHub, and keep what it answered for the next requests.
fromCache()
getApi()
getCollection($name)
getCollectionByClass($entityClass, $allowChildClass)
getCollections()
getSource()
getViewer()
isWritable()
keepLooks($data)Keep what the board's data gives that GitHub does not keep: the icons, the colours of aBoard::keepsColor, and a status's type when it is not the one the board works out.
made($entity)an entity read from GitHub is not a new one
onCommit($commit)Write to GitHub the changes of its entities: the board's and the tickets' first, then the comments'.
read()Read the board from GitHub into its collections, once.
readLooks()
reload()Forget the board as it was read, and what GitHub answered: what is asked next is read from GitHub again (what it kept of a change, the ids it gave).
remember($after)
saveBoard()Save the board and its tickets as they are now: the board's save() compares them with $snapshot.
saveComment($comment, $removed)Add, change or delete a comment on GitHub.
setApi($api)Talk to GitHub through another client than GitHubAPI::Shared(): before anything is read.
uid()
__construct($collections, $project, $repository, $board, $looks, $cacheTtl)

Constants1

LOOKS

const LOOKS = […3 items]

Properties11

api

#[MMO\core\attributes\Serialize(false)] protected ?MMO\git\GitHubAPI $api = null
Type
null | GitHubAPI

board

string $board = 'main'
Type
string

cacheTtl

int $cacheTtl = 60
Type
int

discussed

#[MMO\core\attributes\Serialize(false)] protected array $discussed = []
Type
array

github

#[MMO\core\attributes\Serialize(false)] protected ?array $github = null
Type
null | array

made

#[MMO\core\attributes\Serialize(false)] protected int $made = 0
Type
int

repository

?string $repository = null
Type
null | string

snapshot

#[MMO\core\attributes\Serialize(false)] protected ?array $snapshot = null
Type
null | array

source

#[MMO\core\attributes\Serialize(false)] protected ?MMO\git\classes\aBoard $source = null
Type
null | aBoard

Methods30

applyLooks($data)

GitHubRepository.php:466
protected function applyLooks(array $data): array
$dataarraythe board's data, as GitHub has it
returnsarrayit, with the looks kept for it

cacheFile()

GitHubRepository.php:370
protected function cacheFile(): ?string
returnsnull | stringthe file keeping it: by board and by token, which may not see the same things; null without

createEntity($class, $data, $collection)

GitHubRepository.php:245

Same as Repository::createEntity, but a new entity's id is a placeholder until GitHub gives it its own: a number could be an issue's already.

function createEntity( string $class, array $data = [], ?MMO\core\interfaces\iCollection $collection = null ): MMO\core\interfaces\iEntity
$classstring
$data = []array
$collection = nullnull | iCollection
returnsiEntity

fetch()

GitHubRepository.php:389

Read the board from GitHub, and keep what it answered for the next requests.

protected function fetch(): array
returnsarraythe board's data, as GitHub has it

fromCache()

GitHubRepository.php:376
protected function fromCache(): ?array
returnsnull | arraythe board's data GitHub answered last, when it is recent enough; the board's state set back

getCollectionByClass($entityClass, $allowChildClass)

GitHubRepository.php:154
function getCollectionByClass(string $entityClass, bool $allowChildClass = true): ?MMO\core\interfaces\iCollection
$entityClassstring
$allowChildClass = truebool
returnsnull | iCollection

getSource()

GitHubRepository.php:124
function getSource(): MMO\git\classes\aBoard
returnsaBoardthe board GitHub has: a project's, or a repository's issues

getViewer()

GitHubRepository.php:135
function getViewer(): ?array
returnsnull | arraystring, name: string, avatar: string, url: string}|null the token's owner, who writes

keepLooks($data)

GitHubRepository.php:438

Keep what the board's data gives that GitHub does not keep: the icons, the colours of aBoard::keepsColor, and a status's type when it is not the one the board works out.

protected function keepLooks(array $data): void
$dataarraythe board's data
returnsvoid

onCommit($commit)

GitHubRepository.php:258

Write to GitHub the changes of its entities: the board's and the tickets' first, then the comments'.

function onCommit(MMO\core\events\Commit $commit): void
$commitCommit
returnsvoid
throwswhen GitHub refuses a change: the ones made before it are made

read()

GitHubRepository.php:181

Read the board from GitHub into its collections, once.

protected function read(): void
returnsvoid
throwswhen GitHub refuses

reload()

GitHubRepository.php:406

Forget the board as it was read, and what GitHub answered: what is asked next is read from GitHub again (what it kept of a change, the ids it gave). The entities held are dropped from their collections, unsaved changes with them.

function reload(): void
returnsvoid

remember($after)

GitHubRepository.php:322
protected function remember(array $after): array
$afterarraythe data just saved
returnsarrayit, with what GitHub had of each ticket and the data does not tell (a project's item and content)

saveBoard()

GitHubRepository.php:277

Save the board and its tickets as they are now: the board's save() compares them with $snapshot.

protected function saveBoard(): array
returnsarraytrue> the tickets removed

saveComment($comment, $removed)

GitHubRepository.php:336

Add, change or delete a comment on GitHub.

protected function saveComment(MMO\client\entities\KanbanComment $comment, array $removed): void
$commentKanbanComment
$removedarray
returnsvoid
Inherited members (26)
PropertiesDeclared byDescription
collectionsaRepository
MethodsDeclared byDescription
addCollection($name, $collection)aRepositoryAdd collection
createCollection($name, $entityClass, $collectionId)aRepositoryCreate and register a plain Collection for entities of $entityClass.
createLog($type, $origin, $collection, $data, $filters, $sorts, $limit, $offset)aRepositoryBuild (but not dispatch) a LogQuery entity describing a data-mutating operation, stored in the repository's LogQuery collection (if one is registered).
debugName()aRepository
dropCollection($collection)RepositoryNOTE: this used to just return $this->hasCollection($collection); -- reporting whether the collection exists, but never actually removing it from aRepository::$collections.
forceCommit($origin, $entities)aRepository
generateId($collection)Repository
getCollectionName($collection)aRepository
getDistinct($collection, $key)aRepositoryEvery value one property takes across a collection, once each, in ascending order.
getEntities()aRepository
getIterator()aRepository\IteratorAggregate::getIterator -- iterates name => iCollection
hasCollection($collection)aRepository
hideLogData($collection, $data)aRepositoryWhat a repository logs is what it wrote (mmo.pdo's row, mmo.mongodb's document or its changes), hidden properties (ArrayProperty::isHidden) included, and a log is exported…
logDelete($origin, $collection, $data, $filters, $sorts, $limit, $offset)aRepositoryLog and dispatch a DELETE operation.
logInsert($origin, $collection, $data, $filters, $sorts, $limit, $offset)aRepositoryLog and dispatch an INSERT operation.
logStatus($origin, $collection, $data, $filters, $sorts, $limit, $offset)aRepositoryLog and dispatch a STATUS-change operation.
logUpdate($origin, $collection, $data, $filters, $sorts, $limit, $offset)aRepositoryLog and dispatch an UPDATE operation.
offsetExists($key)aRepository\ArrayAccess::offsetExists
offsetGet($key)aRepository\ArrayAccess::offsetGet
offsetSet($key, $value)aRepository\ArrayAccess::offsetSet -- equivalent to addCollection
offsetUnset($key)aRepository\ArrayAccess::offsetUnset
onFetch($event)aRepositoryListener for Fetch: resolves a repository-uid/collection-id#id (or repository-uid/collection-id#id/nested/path for an embedded value) URL, what Ent…
searchText($query, $text)aRepositoryFull-text search. Not implemented at this level -- a concrete repository backed by a search-capable store should override this.
setCollections($cols)aRepositoryRegister a batch of collections at once, e.g.
__wakeup()aRepositoryRegister this repository's onCommit / onFetch as listeners on the global