private function populateQMatches(Category $category, $strategy) { $matchList = array(); uksort($strategy, function ($k1, $k2) { preg_match('/(?<group>\\d+):(?<litra>\\d+[AB]*)/', $k1, $v1); preg_match('/(?<group>\\d+):(?<litra>\\d+[AB]*)/', $k2, $v2); if ($v1["group"] == $v2["group"]) { return $v1["litra"] - $v2["litra"]; } return $v1["group"] - $v2["group"]; }); foreach ($strategy as $key => $matches) { preg_match('/(?<classification>\\d+):(?<litra>\\d+[AB]*)/', $key, $group); foreach ($matches as $match) { if ($category->getTrophys() < 3 && $group['classification'] == Group::$BRONZE) { continue; } $qmp = new QMatchPlan(); $qmp->setClassification($group['classification']); $qmp->setLitra($group['litra']); preg_match('/(?<classification>\\d+):(?<litra>\\d+)(?<branch>[AB]*)r(?<rank>\\d+)/', $match[0], $team); $qmp->setRelA(new QRelation($team['classification'], $team['litra'], $team['rank'], isset($team['branch']) ? $team['branch'] : '')); preg_match('/(?<classification>\\d+):(?<litra>\\d+)(?<branch>[AB]*)r(?<rank>\\d+)/', $match[1], $team); $qmp->setRelB(new QRelation($team['classification'], $team['litra'], $team['rank'], isset($team['branch']) ? $team['branch'] : '')); $qmp->setFixed(false); $matchList[] = $qmp; } } return $matchList; }