Noherczeg\Breadcrumb\Breadcrumb::disable PHP Метод

disable() публичный Метод

Segment will still remain, but won't be translated, and will be handled specially in the building process. Supports method chaining.
public disable ( integer $pos = null ) : Breadcrumb
$pos integer Position of the element
Результат Breadcrumb
    public function disable($pos = null)
    {
        if ($pos === null || !in_array($pos, array_keys($this->segments))) {
            throw new OutOfRangeException('Refering to non existent Segment position!');
        } else {
            $selectedSegment = $this->segments[$pos];
            $selectedSegment->disable();
        }
        return $this;
    }

Usage Example

Пример #1
0
 /**
  * @Test
  */
 public function testIsDisableSegment()
 {
     $this->bread->append('testelement', 'left', false, false);
     $this->bread->disable(0);
     $seg = $this->bread->segment(0);
     $this->assertEquals(true, $seg->get('disabled'));
 }