[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 3 /* 4 * This file is part of the symfony package. 5 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 6 * (c) 2004-2006 Sean Kerr. 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12 /** 13 * sfActionStack keeps a list of all requested actions and provides accessor 14 * methods for retrieving individual entries. 15 * 16 * @package symfony 17 * @subpackage action 18 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 19 * @author Sean Kerr <skerr@mojavi.org> 20 * @version SVN: $Id: sfActionStack.class.php 3198 2007-01-08 20:36:20Z fabien $ 21 */ 22 class sfActionStack 23 { 24 protected 25 $stack = array(); 26 27 /** 28 * Adds an entry to the action stack. 29 * 30 * @param string A module name 31 * @param string An action name 32 * @param sfAction An sfAction implementation instance 33 * 34 * @return sfActionStackEntry sfActionStackEntry instance 35 */ 36 public function addEntry($moduleName, $actionName, $actionInstance) 37 { 38 // create our action stack entry and add it to our stack 39 $actionEntry = new sfActionStackEntry($moduleName, $actionName, $actionInstance); 40 41 $this->stack[] = $actionEntry; 42 43 return $actionEntry; 44 } 45 46 /** 47 * Retrieves the entry at a specific index. 48 * 49 * @param int An entry index 50 * 51 * @return sfActionStackEntry An action stack entry implementation. 52 */ 53 public function getEntry($index) 54 { 55 $retval = null; 56 57 if ($index > -1 && $index < count($this->stack)) 58 { 59 $retval = $this->stack[$index]; 60 } 61 62 return $retval; 63 } 64 65 /** 66 * Removes the entry at a specific index. 67 * 68 * @param int An entry index 69 * 70 * @return sfActionStackEntry An action stack entry implementation. 71 */ 72 public function popEntry() 73 { 74 return array_pop($this->stack); 75 } 76 77 /** 78 * Retrieves the first entry. 79 * 80 * @return mixed An action stack entry implementation or null if there is no sfAction instance in the stack 81 */ 82 public function getFirstEntry() 83 { 84 $retval = null; 85 86 if (isset($this->stack[0])) 87 { 88 $retval = $this->stack[0]; 89 } 90 91 return $retval; 92 } 93 94 /** 95 * Retrieves the last entry. 96 * 97 * @return mixed An action stack entry implementation or null if there is no sfAction instance in the stack 98 */ 99 public function getLastEntry() 100 { 101 $count = count($this->stack); 102 $retval = null; 103 104 if (isset($this->stack[0])) 105 { 106 $retval = $this->stack[$count - 1]; 107 } 108 109 return $retval; 110 } 111 112 /** 113 * Retrieves the size of this stack. 114 * 115 * @return int The size of this stack. 116 */ 117 public function getSize() 118 { 119 return count($this->stack); 120 } 121 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |