Tournament Generator

Importer

Basic importer

Importer uses exported data and creates a new tournament objects from it.

Tags
author

Tomáš Vojík vojik@wboy.cz

since
0.5

Table of Contents

$categories  : array<string|int, mixed>
$games  : array<string|int, mixed>
$groups  : array<string|int, mixed>
$root  : Base|null
$rounds  : array<string|int, mixed>
$teams  : array<string|int, mixed>
import()  : Base
Processes an input array of data and creates necessary objects from it
importJson()  : Base
Processes a JSON input and creates necessary objects from it
addIds()  : void
Log an object as parent to other object
createCategories()  : void
Create category objects
createGames()  : void
Create all game objects
createGroups()  : void
Create group objects
createProgressions()  : void
Create all progressions
createRounds()  : void
Create round objects
createTeams()  : void
Create all team objects
createTournament()  : void
Creates a tournament object
logAllIds()  : void
Log all set ids and objects into helper arrays
setGroup()  : void
Setup a group with all its settings
setPoints()  : void
Set points setting to an object
setSkip()  : void
Set skip setting to an object
setTiming()  : void
Set timing setting to a tournament object
setTournament()  : void
Setup a tournament with all its settings

Properties

$categories

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

$games

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

$groups

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

$rounds

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

$teams

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

Methods

import()

Processes an input array of data and creates necessary objects from it

public static import(array<string|int, mixed> $data) : Base
Parameters
$data : array<string|int, mixed>
Tags
throws
InvalidImportDataException
throws
Exception
Return values
Base

Imported root object or null if nothing was created

addIds()

Log an object as parent to other object

protected static addIds(array<string|int, mixed> &$group, Base $object, array<string|int, mixed> $ids[, bool $multiple = false ]) : void

Adds an $id => $object pairs for each id into $group.

Parameters
$group : array<string|int, mixed>

Group to log the object into

$object : Base

Object to log

$ids : array<string|int, mixed>

List of child object ids

$multiple : bool = false
Return values
void

createCategories()

Create category objects

protected static createCategories(array<string|int, mixed> $categories) : void
Parameters
$categories : array<string|int, mixed>
Return values
void

createGames()

Create all game objects

protected static createGames( $games, array<string|int, mixed> $allTeams) : void
Parameters
$games :
$allTeams : array<string|int, mixed>
Return values
void

createGroups()

Create group objects

protected static createGroups(array<string|int, mixed> $groups, array<string|int, mixed> &$allGroups) : void
Parameters
$groups : array<string|int, mixed>
$allGroups : array<string|int, mixed>
Tags
throws
Exception
Return values
void

createProgressions()

Create all progressions

protected static createProgressions(array<string|int, mixed> $progressions, array<string|int, mixed> $allGroups) : void
Parameters
$progressions : array<string|int, mixed>
$allGroups : array<string|int, mixed>
Return values
void

createRounds()

Create round objects

protected static createRounds(array<string|int, mixed> $rounds) : void
Parameters
$rounds : array<string|int, mixed>
Return values
void

createTeams()

Create all team objects

protected static createTeams(array<string|int, mixed> $teams, array<string|int, mixed> &$allTeams) : void
Parameters
$teams : array<string|int, mixed>
$allTeams : array<string|int, mixed>
Return values
void

createTournament()

Creates a tournament object

protected static createTournament(array<string|int, mixed> $setting) : void
Parameters
$setting : array<string|int, mixed>
Return values
void

logAllIds()

Log all set ids and objects into helper arrays

protected static logAllIds(array<string|int, mixed> $setting, Base $object) : void

Adds an $id => $object pair for each id and group. Sets an game autoincrement value to the lowest possible game id if the object is root.

Parameters
$setting : array<string|int, mixed>

Object's settings

$object : Base

Object that is logged

Tags
see
Importer::addIds()
Return values
void

setGroup()

Setup a group with all its settings

protected static setGroup(Group $group, array<string|int, mixed> $setting) : void
Parameters
$group : Group
$setting : array<string|int, mixed>
Tags
throws
Exception
Return values
void

setPoints()

Set points setting to an object

protected static setPoints(Group $object, array<string|int, mixed> $setting) : void
Parameters
$object : Group
$setting : array<string|int, mixed>
Return values
void

setSkip()

Set skip setting to an object

protected static setSkip(WithSkipSetters $category, array<string|int, mixed> $setting) : void
Parameters
$category : WithSkipSetters
$setting : array<string|int, mixed>
Return values
void

setTiming()

Set timing setting to a tournament object

protected static setTiming(Tournament $object, array<string|int, mixed> $setting) : void
Parameters
$object : Tournament
$setting : array<string|int, mixed>
Return values
void

setTournament()

Setup a tournament with all its settings

protected static setTournament(Tournament $tournament, array<string|int, mixed> $setting) : void
Parameters
$tournament : Tournament
$setting : array<string|int, mixed>
Return values
void

Search results