Ejemplo n.º 1
0
 /**
  * @param Pub $toBeAdded
  * @throws \PubAlreadyExistsException
  */
 public function add(\model\Pub $toBeAdded)
 {
     foreach ($this->pubs as $pub) {
         if ($toBeAdded->isSame($pub)) {
             throw new \PubAlreadyExistsException("Pub already exists");
         }
     }
     $this->pubs[$toBeAdded->getId()] = $toBeAdded;
 }
Ejemplo n.º 2
0
 /**
  * @return string
  */
 private function getBeerTableRows()
 {
     $beers = $this->pub->getBeers();
     $html = "<thead><tr><th>Namn</th><th>Bryggeri</th><th>Pris</th></thead>";
     foreach ($beers as $beer) {
         $html .= "<tr>";
         $html .= "<td><a href='" . $this->navView->getURLToBeer($beer->getID()) . "'>" . $beer->getName() . "</a>";
         $html .= "<td>" . $beer->getBrewery() . "</td>";
         $html .= "<td>" . $beer->getPrice() . "</td>";
         $html .= "</tr>";
     }
     return $html;
 }
Ejemplo n.º 3
0
 public function isSame(\model\Pub $other)
 {
     return $this->id === $other->getId();
 }