Source for file CallWrapper.php

Documentation is available at CallWrapper.php

  1. <?php
  2. /**
  3.  * CallWrapper.php
  4.  *
  5.  * PHP version 5
  6.  *
  7.  * LICENSE: This program is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU General Public License as published
  9.  * by the Free Software Foundation.
  10.  *
  11.  * @package            FreeNAC
  12.  * @author            Seiler Thomas (contributer)
  13.  * @copyright            2007 FreeNAC
  14.  * @license            http://www.gnu.org/copyleft/gpl.html   GNU Public License Version 2
  15.  * @version            SVN: $Id$
  16.  * @link            http://www.freenac.net
  17.  */
  18.  
  19. /**
  20.  * This class creates proxy-objects, that wrap other objects, and log:
  21.  *  - The methods that were called
  22.  *  - The parameters of the calls
  23.  *  - The return values.
  24.  *
  25.  * This is the core of the logging / debugging and regression testing.
  26.  * This class extends the {@link Common} class.
  27. */ 
  28. class CallWrapper extends Common {
  29.    protected $object;
  30.     
  31.    /**
  32.    * We save a reference to the real object in the constructor
  33.    */
  34.    public function __construct($object{
  35.       parent::__construct();
  36.       $this->object = $object;
  37.    }
  38.     
  39.    /**
  40.    * Here we log the return value of each method that is called in policy.inc.php
  41.    * @param mixed $methodName     The function to call and log
  42.    * @param mixed $parameters     Parameters passed to the called function
  43.    * @return mixed         The return value of the called function
  44.    */
  45.    public function __call($methodName$parameters{
  46.       $value call_user_func_array(array$this->object$methodName )$parameters);
  47.  
  48.       $this->logger->debugget_class($this->object."->"$methodName ."("join(",",$parameters).") = "$value ."\n",2)
  49.  
  50.       return $value;
  51.    }
  52. }
  53.  
  54. ?>

Documentation generated on Mon, 01 Dec 2008 01:10:19 +0100 by phpDocumentor 1.4.0