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

Class: Tple_Exports

Source Location: /web_site/tple_exports.class.php

Class Tple_Exports

Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From Tangra_Class

Tangra_Class::get_class_name()
Alias of get_class(). Exist because of historical reasons.
Tangra_Class::__set()
Overides PHP built-in method and just throws exception if called. Purpose - to "forbid" autosetting of nonexisting class properties.

[ Top ]
Property Summary
unknown_type   $pairs   Array of variables and their values

[ Top ]
Method Summary
Tple_Exports   __construct()   Constructor
void   add_pair()   Adds new variable and value
array   &get_pairs()   Returns all variable-value pairs
mixed   get_pair_value()   Gets value of pair
boolean   key_exists()   Checks if there is already added pair with key $key
void   merge()   Merges variables of current TPLE_Exports with those provided by $exports
void   update_pair_value()   Changes value for pair

[ Top ]
Properties
unknown_type   $pairs = array() [line 39]

Array of variables and their values

API Tags:
Internal:  
Access:  private


[ Top ]
Methods
Constructor __construct  [line 46]

  Tple_Exports __construct( )

Constructor



[ Top ]
add_pair  [line 60]

  void add_pair( string $var_name, mixed $value  )

Adds new variable and value

Will throw TE_Var_Already_Exists if variable with same name already exists

Parameters:
string   $var_name:  Variable name
mixed   $value:  Variable value

API Tags:
Access:  public

Information Tags:
Throws:  TE_Var_Already_Exists

[ Top ]
get_pairs  [line 87]

  array &get_pairs( )

Returns all variable-value pairs


API Tags:
Access:  public


[ Top ]
get_pair_value  [line 122]

  mixed get_pair_value( string $key, [boolean $forgiving = true]  )

Gets value of pair

If $forgiving is set to false will throw exception TE_Key_Not_Exists if such key does not exist. If $forgiving is set to true will return NULL if such key does not exist.

Parameters:
string   $key: 
boolean   $forgiving: 

API Tags:
Access:  public

Information Tags:
Throws:  TE_Key_Not_Exists

[ Top ]
key_exists  [line 143]

  boolean key_exists( string $key  )

Checks if there is already added pair with key $key

Parameters:
string   $key: 

API Tags:
Access:  public


[ Top ]
merge  [line 74]

  void merge( Tple_Exports $exports  )

Merges variables of current TPLE_Exports with those provided by $exports

Parameters:
Tple_Exports   $exports: 

API Tags:
Access:  public


[ Top ]
update_pair_value  [line 102]

  void update_pair_value( string $var_name, mixed $value  )

Changes value for pair

Please note that if you need this function it is indicator that there is something wrong with your code - it is not normal to add variable and later to need to change its value. Design your code in a way that exports (add_pair()) are added just before parsing the template

Parameters:
string   $var_name:  Variable name
mixed   $value:  Variable value

API Tags:
Access:  public


[ Top ]