title = $title; return $this; } /** * Return the tooltip text for the badge * * @return string */ public function getTitle() { return $this->title; } /** * Set the state identifier to use * * @param string $state * * @return $this */ public function setState($state) { $this->state = $state; return $this; } /** * Return the state identifier to use * * @return string */ public function getState() { return $this->state; } /** * Return the amount of items represented by the badge * * @return int */ abstract public function getCount(); /** * Render the given navigation item as HTML anchor with a badge * * @param NavigationItem $item * * @return string */ public function render(NavigationItem $item = null) { return $this->renderBadge() . parent::render($item); } /** * Render the badge * * @return string */ protected function renderBadge() { if (($count = $this->getCount()) > 0) { return sprintf( '