| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 10 /** 11 * A special kind of tools that always returns some predefined result from each method 12 * Created for testing purposes mostly 13 * Example of usage: 14 * <code> 15 * $tools = new lmbStaticTools(array('getUser' => $mock_user, 'getDbConnection' => $mock_db_connection)); 16 * lmbToolkit :: merge($tools); 17 * </code> 18 * @package toolkit 19 * @version $Id: lmbStaticTools.class.php 5945 2007-06-06 08:31:43Z pachanga $ 20 */ 21 class lmbStaticTools implements lmbToolkitTools 22 { 23 /** 24 * @var array Array of method results 25 */ 26 protected $call_results; 27 28 /** 29 * Constructor 30 * @param array Array of method results that should be returned in response to these methods calls 31 */ 32 function __construct($call_results) 33 { 34 $this->call_results = $call_results; 35 } 36 37 /** 38 * @see lmbToolkitTools :: getToolsSignatures() 39 */ 40 function getToolsSignatures() 41 { 42 $signatures = array(); 43 foreach(array_keys($this->call_results) as $method) 44 { 45 $signatures[$method] = $this; 46 } 47 return $signatures; 48 } 49 50 /** 51 * Magic caller. Simply returns result from {@link $call_results} attribute 52 * @param string Method name 53 * @param array Method arguments 54 * @return mixed 55 */ 56 function __call($method, $args) 57 { 58 return $this->call_results[$method]; 59 } 60 } 61 62 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Tue Dec 2 03:54:09 2008 | Cross-referenced by PHPXref 0.7 |