Solar_Class_Stack::add()

public void Solar_Class_Stack::add ( array|string $list )

Adds one or more classes to the stack.

Parameters

  • (array|string) $list: The classes to add to the stack.

Returns

  • (void)

Description

Adds one or more classes to the stack.

{{code: php

// add by array
$stack = Solar::factory('Solar_Class_Stack');
$stack->add(array('Base1', 'Base2', 'Base3'));
// $stack->get() reveals that the class search order will be
// 'Base1_', 'Base2_', 'Base3_'.

// add by string
$stack = Solar::factory('Solar_Class_Stack');
$stack->add('Base1, Base2, Base3');
// $stack->get() reveals that the class search order will be
// 'Base1_', 'Base2_', 'Base3_'.

// add incrementally -- N.B. THIS IS A SPECIAL CASE
$stack = Solar::factory('Solar_Class_Stack');
$stack->add('Base1');
$stack->add('Base2');
$stack->add('Base3');
// $stack->get() reveals that the directory search order will be
// 'Base3_', 'Base2_', 'Base1_', because the later adds
// override the newer ones.

}}



Local