svn: /pear2/Templates_Savant/trunk/src/Templates/Savant/ ObjectProxy.php

From: Date: Thu, 22 Apr 2010 17:01:12 +0000
Subject: svn: /pear2/Templates_Savant/trunk/src/Templates/Savant/ ObjectProxy.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-9377@lists.php.net to get a copy of this message
saltybeagle Thu, 22 Apr 2010 17:01:12 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=298338 Log: Implement the Countable interface. Auto-escape return values of methods. Changed paths: U pear2/Templates_Savant/trunk/src/Templates/Savant/ObjectProxy.php Modified: pear2/Templates_Savant/trunk/src/Templates/Savant/ObjectProxy.php =================================================================== --- pear2/Templates_Savant/trunk/src/Templates/Savant/ObjectProxy.php 2010-04-22 16:59:41 UTC (rev 298337) +++ pear2/Templates_Savant/trunk/src/Templates/Savant/ObjectProxy.php 2010-04-22 17:01:12 UTC (rev 298338) @@ -28,7 +28,7 @@ * @link http://svn.php.net/repository/pear2/PEAR2_Templates_Savant */ namespace pear2\Templates\Savant; -class ObjectProxy +class ObjectProxy implements Countable { /** * The internal object @@ -90,6 +90,17 @@ } /** + * Allows direct access to the entire object for situations where the proxy + * interferes. + * + * @return mixed The raw object + */ + function getRawObject() + { + return $this->object; + } + + /** * Allows access to the raw member variables of the internal object. * * @return mixed @@ -135,7 +146,7 @@ */ function __call($name, $arguments) { - return call_user_func_array(array($this->object, $name), $arguments); + return $this->filterVar(call_user_func_array(array($this->object, $name), $arguments)); } /** @@ -177,4 +188,15 @@ } throw new BadMethodCallException('Object of class '.$this->__getClass().' could not be converted to string'); } + + /** + * Returns the number of elements if the object has implemented Countable, + * otherwise 1 is returned. + * + * @return int + */ + function count() + { + return count($this->object); + } } \ No newline at end of file

« previous php.pear.core (#9377) next »