Adds a crumb to the internal array.
public addCrumb ( 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. |
/** * Tests whether `Breadcrumbs::isEmpty()` works correctly. */ public function testIsEmpty() { $b = new Breadcrumbs(); $this->assertTrue($b->isEmpty()); $b->addCrumb('foo', 'bar'); $this->assertFalse($b->isEmpty()); }
/** * Tests whether `Breadcrumbs::isEmpty()` works correctly. */ public function testIsEmpty() { $b = new Breadcrumbs(); Assert::true($b->isEmpty()); $b->addCrumb('foo', 'bar'); Assert::false($b->isEmpty()); }