/** * @return bool|null */ public function isSelected() { if (!is_null($this->selected)) { if (is_callable($this->selected)) { return call_user_func($this->selected, $this); } return $this->selected; } if (!empty($this->flag)) { if (\TAO::isIterable($this->flag)) { foreach ($this->flag as $flag) { if ($this->isFlag($flag)) { return $this->selected = true; } } } elseif (is_string($this->flag) && $this->isFlag($this->flag)) { return $this->selected = true; } } if (\TAO\Urls::isCurrent($this->url)) { return $this->selected = true; } if (!empty($this->match) && is_string($this->match)) { if ($this->match == '*') { if (\TAO\Urls::isCurrentStartsWith($this->url)) { return $this->selected = true; } } elseif (mb_substr($this->match, mb_strlen($this->match) - 1) == '*') { $m = mb_substr($this->match, 0, mb_strlen($this->match) - 1); if (\TAO\Urls::isCurrentStartsWith($m)) { return $this->selected = true; } } } foreach ($this->links() as $link) { if ($link->isSelected()) { return $this->selected = true; } } return $this->selected = false; }