public add ( string $name = '', string $href = '', boolean $hrefIsFullUrl = false ) | ||
$name | string | The name of this breadcrumb, which will be seen by the users. |
$href | string | If this parameter begins with a forward slash, it will be treated as a full URL, and the `$hrefIsFullUrl` parameter will be forced to `true`, regardless of its value. |
$hrefIsFullUrl | boolean | Whether the `$href` argument is a full URL or just a segment. The difference is that segments will be built upon previous breadcrumbs, while full URLs will be returned as they are inputted. This can be automatically forced to `true`, depending on the `$href` argument - read its description for details. |
public function add($name = '', $href = '', $hrefIsFullUrl = false)
{
return $this->addCrumb($name, $href, $hrefIsFullUrl);
}
/** * @testdox Is able to enchain `add` method * @depends testIsAbleToEnchainAddCrumbMethod * @dataProvider crumbsProvider */ public function testIsAbleToEnchainAddMethod($crumbs) { $b = new Breadcrumbs(); $n = count($crumbs); switch ($n) { case 1: $b->add($crumbs[0]); break; case 2: $b->add($crumbs[0])->add($crumbs[1]); break; case 3: $b->add($crumbs[0])->add($crumbs[1])->add($crumbs[2]); break; case 4: $b->add($crumbs[0])->add($crumbs[1])->add($crumbs[2])->add($crumbs[3]); break; case 5: $b->add($crumbs[0])->add($crumbs[1])->add($crumbs[2])->add($crumbs[3])->add($crumbs[4]); break; default: throw new Exception('Test does not handle more than 5 breadcrumbs.'); break; } $this->assertCount($n, $b->getBreadcrumbs()); }