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

Class: Web_Context

Source Location: /web_site/web_context.class.php

Class Web_Context

Class Overview

Container for all PHP predefined variables

Web_Context class populates itself with all superglobal external variables as $_POST, $_GET, etc. Purpose of this is to isolate application from external world. That way classes within the application can be tested against "artificial" Web_Context - i.e. manually prepared versions of Web_Context used for automated testing.

For each superglobal variable there is coresponding internal variable with the same name Exception is "PI" which stands for Path info.

Located in /web_site/web_context.class.php [line 46]

Tangra_Class
   |
   --Context
      |
      --Web_Context

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From Context

Context::$vars

Inherited From Context

Context::__construct()
Constructor
Context::add_var()
Adds new variable.
Context::get_var()
Gets variable as reference. Use this function if you intend to change the value.
Context::query_var()
Query variable. Similar to get_var() but returns copy of the variable, not reference. Use this function instead of get_var() if you are not intending to change the value.
Context::set_var()
Sets variable.
Context::vars_exists()
Checks if var exists (it is already set)
Context::_set_var()
Actual set of the variable

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 ]
Method Summary
Web_Context   __construct()   Constructor
void   capture_context()   Captures content of superglobal variables
boolean   exists_in_cookie()   Checks if variable exists in COOKIE
boolean   exists_in_env()   Checks if variable exists in ENV
boolean   exists_in_get()   Checks if variable exists in GET
boolean   exists_in_pi()   Checks if variable exists in PI (Path_Info)
boolean   exists_in_post()   Checks if variable exists in POST
boolean   exists_in_server()   Checks if variable exists in SERVER
boolean   exists_in_session()   Checks if variable exists in SESSIOn
mixed   &get_from_cookie()   Returns reference to variable in COOKIE
mixed   &get_from_env()   Returns reference to variable in ENV
mixed   &get_from_get()   Returns reference to variable in GET
mixed   &get_from_pi()   Returns reference to variable in PI
mixed   &get_from_post()   Returns reference to variable in POST
mixed   &get_from_server()   Returns reference to variable in SERVER
mixed   &get_from_session()   Returns reference to variable in SESSIOn
array   parse_path_info()   Parses PATH_INFO variable in server
array   path_info_split_key_value()   Splits key from values from PATD_INFO
mixed   query_from_cookie()   Returns variable from COOKIE
mixed   query_from_env()   Returns variable from ENV
mixed   query_from_get()   Returns variable from GET
mixed   query_from_pi()   Returns variable from PI
mixed   query_from_post()   Returns variable from POST
mixed   query_from_server()   Returns variable from SERVER
mixed   query_from_session()   Returns variable from SESSION

[ Top ]
Methods
Constructor __construct  [line 52]

  Web_Context __construct( )

Constructor



Redefinition of:
Context::__construct()
Constructor

[ Top ]
capture_context  [line 74]

  void capture_context( )

Captures content of superglobal variables


API Tags:
Access:  public


[ Top ]
exists_in_cookie  [line 146]

  boolean exists_in_cookie( string $key  )

Checks if variable exists in COOKIE

Parameters:
string   $key:  Name of the variable

API Tags:
Access:  public


[ Top ]
exists_in_env  [line 182]

  boolean exists_in_env( string $key  )

Checks if variable exists in ENV

Parameters:
string   $key:  Name of the variable

API Tags:
Access:  public


[ Top ]
exists_in_get  [line 93]

  boolean exists_in_get( string $key  )

Checks if variable exists in GET

Parameters:
string   $key:  Name of the variable

API Tags:
Access:  public


[ Top ]
exists_in_pi  [line 110]

  boolean exists_in_pi( string $key  )

Checks if variable exists in PI (Path_Info)

Parameters:
string   $key:  Name of the variable

API Tags:
Access:  public


[ Top ]
exists_in_post  [line 128]

  boolean exists_in_post( string $key  )

Checks if variable exists in POST

Parameters:
string   $key:  Name of the variable

API Tags:
Access:  public


[ Top ]
exists_in_server  [line 164]

  boolean exists_in_server( string $key  )

Checks if variable exists in SERVER

Parameters:
string   $key:  Name of the variable

API Tags:
Access:  public


[ Top ]
exists_in_session  [line 200]

  boolean exists_in_session( string $key  )

Checks if variable exists in SESSIOn

Parameters:
string   $key:  Name of the variable

API Tags:
Access:  public


[ Top ]
get_from_cookie  [line 282]

  mixed &get_from_cookie( string $key  )

Returns reference to variable in COOKIE

Parameters:
string   $key:  Variable name

API Tags:
Access:  public

Information Tags:
Throws:  TE_Var_Not_Exists

[ Top ]
get_from_env  [line 324]

  mixed &get_from_env( string $key  )

Returns reference to variable in ENV

Parameters:
string   $key:  Variable name

API Tags:
Access:  public

Information Tags:
Throws:  TE_Var_Not_Exists

[ Top ]
get_from_get  [line 219]

  mixed &get_from_get( string $key  )

Returns reference to variable in GET

Parameters:
string   $key:  Variable name

API Tags:
Access:  public

Information Tags:
Throws:  TE_Var_Not_Exists

[ Top ]
get_from_pi  [line 240]

  mixed &get_from_pi( string $key  )

Returns reference to variable in PI

Parameters:
string   $key:  Variable name

API Tags:
Access:  public

Information Tags:
Throws:  TE_Var_Not_Exists

[ Top ]
get_from_post  [line 261]

  mixed &get_from_post( string $key  )

Returns reference to variable in POST

Parameters:
string   $key:  Variable name

API Tags:
Access:  public

Information Tags:
Throws:  TE_Var_Not_Exists

[ Top ]
get_from_server  [line 303]

  mixed &get_from_server( string $key  )

Returns reference to variable in SERVER

Parameters:
string   $key:  Variable name

API Tags:
Access:  public

Information Tags:
Throws:  TE_Var_Not_Exists

[ Top ]
get_from_session  [line 345]

  mixed &get_from_session( string $key  )

Returns reference to variable in SESSIOn

Parameters:
string   $key:  Variable name

API Tags:
Access:  public

Information Tags:
Throws:  TE_Var_Not_Exists

[ Top ]
parse_path_info  [line 512]

  array parse_path_info( )

Parses PATH_INFO variable in server


API Tags:
Internal:  
Access:  private


[ Top ]
path_info_split_key_value  [line 538]

  array path_info_split_key_value( string $str  )

Splits key from values from PATD_INFO

Parameters:
string   $str: 

API Tags:
Internal:  
Access:  private


[ Top ]
query_from_cookie  [line 429]

  mixed query_from_cookie( string $key  )

Returns variable from COOKIE

Parameters:
string   $key:  Variable name

API Tags:
Access:  public

Information Tags:
Throws:  TE_Var_Not_Exists

[ Top ]
query_from_env  [line 471]

  mixed query_from_env( string $key  )

Returns variable from ENV

Parameters:
string   $key:  Variable name

API Tags:
Access:  public

Information Tags:
Throws:  TE_Var_Not_Exists

[ Top ]
query_from_get  [line 366]

  mixed query_from_get( string $key  )

Returns variable from GET

Parameters:
string   $key:  Variable name

API Tags:
Access:  public

Information Tags:
Throws:  TE_Var_Not_Exists

[ Top ]
query_from_pi  [line 387]

  mixed query_from_pi( string $key  )

Returns variable from PI

Parameters:
string   $key:  Variable name

API Tags:
Access:  public

Information Tags:
Throws:  TE_Var_Not_Exists

[ Top ]
query_from_post  [line 408]

  mixed query_from_post( string $key  )

Returns variable from POST

Parameters:
string   $key:  Variable name

API Tags:
Access:  public

Information Tags:
Throws:  TE_Var_Not_Exists

[ Top ]
query_from_server  [line 450]

  mixed query_from_server( string $key  )

Returns variable from SERVER

Parameters:
string   $key:  Variable name

API Tags:
Access:  public

Information Tags:
Throws:  TE_Var_Not_Exists

[ Top ]
query_from_session  [line 492]

  mixed query_from_session( string $key  )

Returns variable from SESSION

Parameters:
string   $key:  Variable name

API Tags:
Access:  public

Information Tags:
Throws:  TE_Var_Not_Exists

[ Top ]