ecom
E-commerce cms
 All Data Structures Namespaces Files Functions Variables
Public Member Functions | Private Attributes
RestfullController Class Reference
Inheritance diagram for RestfullController:
AController

Public Member Functions

 __construct ($context, $params, $encode_fnc=null)
 
 start ()
 
 run ()
 
- Public Member Functions inherited from AController
 __construct ($context, $params)
 
 start ()
 

Private Attributes

 $encode_fnc
 

Additional Inherited Members

- Protected Attributes inherited from AController
 $params
 
 $context
 

Detailed Description

Abstract Controller

Definition at line 8 of file ARestfullController.php.

Constructor & Destructor Documentation

__construct (   $context,
  $params,
  $encode_fnc = null 
)

Definition at line 12 of file ARestfullController.php.

13  {
14  if (!\Entity\Config::getConfig(null, "restfullEnabled", false))
15  throw new \Exception\Error404();
16  parent::__construct($context, $params);
17  if ($encode_fnc === null)
18  $encode_fnc = array("method" => json_encode, "mime" => "application/json");
19  $this->encode_fnc = $encode_fnc;
20  }

Member Function Documentation

run ( )
abstract
start ( )

Definition at line 22 of file ARestfullController.php.

23  {
24  //TODO call some hooks
25  header("Content-Type: {$this->encode_fnc["mime"]}");
26  echo $this->encode_fnc["method"]($this->run());
27  //TODO call some hooks
28  }

Field Documentation

$encode_fnc
private

Definition at line 10 of file ARestfullController.php.


The documentation for this class was generated from the following file: