-
Notifications
You must be signed in to change notification settings - Fork 0
Creating bracket
Daniel Dolejška edited this page Jan 29, 2018
·
4 revisions
use BracketGenerator\Bracket;
$bracket = Bracket::create($count, $settings);-
$countis number of participants. -
$settingsis array of library settings. More about settings...
Static function Bracket::create will create bracket layout based on participant count.
use BracketGenerator\Bracket;
$bracket = Bracket::createFromList($match_list, $l, $r, $settings);-
$match_listisarrayof eitherarraysorobjectscontaining required data. -
$lis$match_listitem's property referencing to required match for the first participant (left subtree). -
$ris$match_listitem's property referencing to required match for the second participant (right subtree). -
$settingsisarrayof library settings. More about settings...
Example values:
$match_list = [
30 => [
'p1' => 'Player 1', // name of the first participant
's1' => 0, // first participant's score
'l' => 29, // reference to match 29
'p2' => 'Player 2',
's2' => 0,
'r' => 34,
],
29 => [
'p1' => 'Player 1',
's1' => 1,
'l' => null,
'p2' => 'Player 4',
's2' => 0,
'r' => null,
],
34 => [
'p1' => 'Player 2',
's1' => 1,
'l' => null,
'p2' => 'Player 3',
's2' => 0,
'r' => null,
],
];
$l = 'l';
$r = 'r';This bracket will be generated by the library:
After filling, this is what you will end up with:
Brackets created from match list can also be immediatelly filled - instead of using createFromList you can use createFromListAndFill:
use BracketGenerator\Bracket;
$bracket = Bracket::createFromListAndFill($match_list, $n1, $s1, $l, $n2, $s2 $r, $settings);-
$match_listisarrayof eitherarraysorobjectscontaining required data. -
$n1is$match_listitem's property containing first participant's name -
$s1is$match_listitem's property containing first participant's score -
$lis$match_listitem's property referencing to required match for the first participant (left subtree). -
$n2is$match_listitem's property containing second participant's name -
$s2is$match_listitem's property containing second participant's score -
$ris$match_listitem's property referencing to required match for the second participant (right subtree). -
$settingsisarrayof library settings. More about settings...
Example values:
Other example values can be taken from example above.
$n1 = 'p1';
$s1 = 's1';
$n2 = 'p2';
$s2 = 's2';TBA
- Homepage
- Usage example
- Requirements
- Creating/Editing
- Customizing
- Behind the scenes

