Solar_Path_Stack::add()

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

Adds one or more directories to the stack.

Parameters

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

Returns

  • (void)

Description

Adds one or more directories to the stack.

Converts Unix path- and directory-separator characters to Windows separators when on Windows.

<?php
$stack = Solar::factory('Solar_Path_Stack');
$stack->add(array('path/1', 'path/2', 'path/3'));
// $stack->get() reveals that the directory search order will be
// 'path/1/', 'path/2/', 'path/3/'.

$stack = Solar::factory('Solar_Path_Stack');
$stack->add('path/1:path/2:path/3');
// $stack->get() reveals that the directory search order will be
// 'path/1/', 'path/2/', 'path/3/', because this is the way the
// filesystem expects a path definition to work.

$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 will be
// 'path/3/', 'path/2/', 'path/1/', because the later adds
// override the newer ones.


Local