You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.3 KiB
PHP
73 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Artmark\BreadCrumbs;
|
|
|
|
/**
|
|
* Description of Crumb
|
|
*
|
|
* @author Andrey Pokidov <pokidov@e-traffic.ru>
|
|
*/
|
|
class Crumb implements CrumbInterface
|
|
{
|
|
/**
|
|
*
|
|
* @var string
|
|
*/
|
|
private $url;
|
|
|
|
/**
|
|
*
|
|
* @var string
|
|
*/
|
|
private $label;
|
|
|
|
/**
|
|
*
|
|
* @var string
|
|
*/
|
|
private $icon;
|
|
|
|
public function __construct(string $url, string $label, string $icon = '')
|
|
{
|
|
$this->url = trim($url);
|
|
$this->label = trim($label);
|
|
$this->icon = trim($icon);
|
|
}
|
|
|
|
/**
|
|
* URL ссылки элемента хлебных крошек
|
|
* @return string
|
|
*/
|
|
public function url()
|
|
{
|
|
return $this->url;
|
|
}
|
|
|
|
/**
|
|
* Текст элемента хлебных крошек
|
|
* @return string
|
|
*/
|
|
public function label()
|
|
{
|
|
return $this->label;
|
|
}
|
|
|
|
/**
|
|
* Задана или нет иконка для элемента хлебных крошек
|
|
* @return boolean
|
|
*/
|
|
public function hasIcon()
|
|
{
|
|
return !empty($this->icon);
|
|
}
|
|
|
|
/**
|
|
* Возвращает URL иконки
|
|
* @return string
|
|
*/
|
|
public function icon()
|
|
{
|
|
return $this->icon;
|
|
}
|
|
}
|