| | |
| | | 'class' => 'team', |
| | | ], |
| | | 'cup' => [ |
| | | 'number' => '#75', |
| | | 'number' => '#76', |
| | | 'name' => '5on5 Open Cup', |
| | | ], |
| | | 'team' => [ |
| | |
| | | if (!in_array($class, $this->allowedStripeClasses)) |
| | | { |
| | | throw new \InvalidArgumentException("Given class " . $class . " not allowed. Allowed classes: " . implode(', ', $this->allowedStripeClasses)); |
| | | } |
| | | |
| | | if ($class === 'simple') |
| | | { |
| | | $this->setSimpleStripe(); |
| | | } |
| | | |
| | | $this->state['stripe']['class'] = $class; |
| | |
| | | //FIXME: védő és támadó operátorok külön |
| | | throw new \InvalidArgumentException("Given operator not allowed: " . $operator . " Allowed operators: " . implode(', ', $this->allowedOperators)); |
| | | } |
| | | |
| | | if (isset($this->state['team'][$team_color]['ban']) && count($this->state['team'][$team_color]['ban']) > 1) |
| | | { |
| | | throw new \InvalidArgumentException("Team " . $team_color . " already has 2 operators."); |
| | | } |
| | | |
| | | $this->state['team'][$team_color]['ban'][] = $operator; |
| | | } |
| | | |
| | | public function __get($name) |
| | |
| | | return isset($this->state[$name]); |
| | | } |
| | | |
| | | public function loadJson(string $json) |
| | | public function loadFromJson(string $json) |
| | | { |
| | | $state = json_decode($json); |
| | | $this->loadFromArray($state); |
| | | } |
| | | |
| | | public function loadFromArray(array $state) |
| | | { |
| | | |
| | | unset($this->state); |
| | | $this->state = []; |
| | |
| | | return json_encode($this->state); |
| | | } |
| | | |
| | | public function getOperators() { |
| | | public function getOperators() |
| | | { |
| | | return $this->allowedOperators; |
| | | } |
| | | |
| | | public function getState() |
| | | { |
| | | return $this->state; |
| | | } |
| | | } |