Solar_Path_Stack::set()

public void Solar_Path_Stack::set ( array|string $path )

Clears the stack and adds one or more directories.

Parameters

  • (array|string) $path: The directories to add to the stack after clearing it.

Returns

  • (void)

Description

Clears the stack and adds one or more directories.

<?php
$stack = Solar::factory('Solar_Path_Stack');
$stack->add('path/1');
$stack->add('path/2');
$stack->add('path/3');

// $stack->get() reveals that the directory search order is
// 'path/3/', 'path/2/', 'path/1/'.

$stack->set('another/path');

// $stack->get() is now 'another/path'.


Local