| 1 | <?php |
||
| 19 | class Breadcrumb implements \Iterator, \Countable |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * @var array |
||
| 23 | */ |
||
| 24 | private $items = array(); |
||
| 25 | |||
| 26 | /** |
||
| 27 | * {@inheritdoc} |
||
| 28 | */ |
||
| 29 | 1 | public function current() |
|
| 33 | |||
| 34 | /** |
||
| 35 | * {@inheritdoc} |
||
| 36 | */ |
||
| 37 | 1 | public function next() |
|
| 41 | |||
| 42 | /** |
||
| 43 | * {@inheritdoc} |
||
| 44 | */ |
||
| 45 | 2 | public function key() |
|
| 49 | |||
| 50 | /** |
||
| 51 | * {@inheritdoc} |
||
| 52 | */ |
||
| 53 | 2 | public function valid() |
|
| 57 | |||
| 58 | /** |
||
| 59 | * {@inheritdoc} |
||
| 60 | */ |
||
| 61 | 2 | public function rewind() |
|
| 65 | |||
| 66 | /** |
||
| 67 | * {@inheritdoc} |
||
| 68 | */ |
||
| 69 | public function count() |
||
| 73 | |||
| 74 | /** |
||
| 75 | * Add item. |
||
| 76 | |||
| 77 | * @param string $title |
||
| 78 | * @param string $url |
||
| 79 | * @param bool $truncate |
||
| 80 | */ |
||
| 81 | 2 | public function add($title, $url = null, $truncate = true) |
|
| 88 | |||
| 89 | /** |
||
| 90 | * @param int $key |
||
| 91 | * |
||
| 92 | * @return array|null |
||
| 93 | */ |
||
| 94 | 1 | public function get($key) |
|
| 98 | |||
| 99 | /** |
||
| 100 | * Truncate string. |
||
| 101 | * |
||
| 102 | * @param string $string |
||
| 103 | * @param int $length |
||
| 104 | * @param string $separator |
||
| 105 | * |
||
| 106 | * @return string |
||
| 107 | */ |
||
| 108 | 2 | protected function truncate($string, $length = 30, $separator = '...') |
|
| 117 | } |
||
| 118 |