tangra logo
   
[ class tree: tangra_lib ] [ index: tangra_lib ] [ all elements ]
 

Source for file tangra_class.class.php

Documentation is available at tangra_class.class.php

  1. <?php
  2. // *** Tangra (Application Framework and Tools for PHP)
  3. // $Id$
  4. //
  5.  
  6. /**
  7.  * Contains class Tangra_Class
  8.  * @package  tangra_lib
  9.  * @subpackage  core
  10.  */
  11.  
  12. /**
  13.  * Loading exception
  14.  */
  15. require_once(TANGRA_MAIN_DIR.'exceptions/te_no_such_property_exception.class.php');
  16.  
  17.  
  18. /**
  19.  * Base class for all tangra_lib classes
  20.  *
  21.  * Tangra_Class is the basic class inherited by all classes of Tangra library.
  22.  * It's purpose is to "forbid" usage of autosetter method __set, because this is
  23.  * very dangerous feature (you can easily set nonexisting variable by mistake and
  24.  * you will not get any error or warning...).
  25.  * @package  tangra_lib
  26.  * @subpackage  core
  27.  */
  28. abstract class Tangra_Class {
  29.  
  30.     /**
  31.      * Overides PHP built-in method and just throws exception if called. Purpose - to "forbid" autosetting of nonexisting class properties.
  32.      *
  33.      * @param string $name 
  34.      * @param any $val 
  35.      * @throws TE_No_Such_Property_Exception
  36.      */
  37.     public function __set($name$val{
  38.         throw new TE_No_Such_Property_Exception('Attemp to set not existing object property/no access to property: '.$name.'    value:'.$val);
  39.     }
  40.  
  41. /**
  42.  * Alias of get_class(). Exist because of historical reasons.
  43.  *
  44.  * @return string 
  45.  * @deprecated  use PHP's built-in get_class() instead
  46.  */
  47.     public function get_class_name({
  48.         return get_class($this);
  49.     }
  50.  
  51. }