/** * Response returned to the LayoutView and rendered * * @return string */ public function response() { $id = $this->pub->getId(); $name = $this->pub->getName(); $address = $this->pub->getAddress(); $webpageURL = $this->pub->getWebpageURL(); $html = "<div class='row'>\n <div class='col-md-4'>\n <h2>{$name}</h2>\n <address>{$address}</address>\n <a href='{$webpageURL}'>Gå till hemsidan</a>\n </div>\n <div class='col-md-8'>\n <h3>Öl-sortiment</h3>\n <div class='table-responsive'>\n <table class='table'>\n\n " . $this->getBeerTableRows() . "\n </table>\n </div>\n\n </div>\n </div>"; return $html; }
/** * @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; }
public function isSame(\model\Pub $other) { return $this->id === $other->getId(); }