You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
772 B
63 lines
772 B
<?php
|
|
|
|
namespace Coffee;
|
|
|
|
/**
|
|
* Class Table
|
|
*
|
|
* @package Coffee
|
|
*/
|
|
class Table {
|
|
|
|
|
|
/**
|
|
* @var Spot[]
|
|
*/
|
|
private $spots = [];
|
|
|
|
/**
|
|
* Table constructor.
|
|
*
|
|
* @param Spot|Spot[] $spots
|
|
*/
|
|
public function __construct($spots = null) {
|
|
if ($spots instanceof Spot) {
|
|
$this->addSpot($spots);
|
|
}
|
|
|
|
if (is_array($spots)) {
|
|
foreach ($spots as $spot) {
|
|
$this->addSpot($spot);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
* @param Spot $spot
|
|
* @return bool
|
|
*/
|
|
public function addSpot(Spot $spot) {
|
|
if (is_null($spot)) {
|
|
return false;
|
|
}
|
|
|
|
$this->spots[] = $spot;
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @return Spot[]
|
|
*/
|
|
public function getSpots() {
|
|
return $this->spots;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getSpotsCount() {
|
|
return count($this->spots);
|
|
}
|
|
|
|
} |