\PhalApi_ApiFactory

Api Factory Class

  • factory method to craete controller objects
  • separate creation and usage, simplify client development
  • only be responsible for complicate creation


Usage:

     // create and init service by request(?service=XXX.XXX)
     $api = PhalApi_ApiFactory::generateService();

Summary

Methods
Properties
Constants
generateService()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

generateService()

generateService(\boolen  $isInitialize = TRUE) : \PhalApi_Api

Generate service according the service name and method name request from client; throw related custom exception when fail

The main process is as follows:

    1. check whether miss controller name or method name
    1. make sure that both controller file and controller class exists
    1. whether method is callable or not
    1. whether succeed to intitailze controller

Parameters

\boolen $isInitialize

whether try to initialize after creation

Throws

\PhalApi_Exception_BadRequest

非法请求下返回400

Returns

\PhalApi_Api

Api implements