Overview

Namespaces

  • None
  • Wei
    • Validator

Classes

  • Apc
  • App
  • ArrayCache
  • Asset
  • Base
  • BaseCache
  • BaseController
  • Bicache
  • Cache
  • Config
  • Cookie
  • Couchbase
  • Counter
  • Db
  • DbCache
  • E
  • Env
  • Error
  • FileCache
  • Gravatar
  • Http
  • Lock
  • Logger
  • Memcache
  • Memcached
  • MongoCache
  • Password
  • PhpError
  • PhpFileCache
  • Pinyin
  • Record
  • Redis
  • Request
  • Response
  • Router
  • SafeUrl
  • Session
  • Soap
  • T
  • Ua
  • Upload
  • Url
  • Uuid
  • Validate
  • View
  • WeChatApp
  • Wei
  • Overview
  • Namespace
  • Class

Class App

A service to build an MVC application

Wei\Base
Extended by Wei\App
Namespace: Wei
Author: Twin Huang twinhuang@qq.com
Located at App.php
Methods summary
public
# __invoke( array $options = array() )

Startup an MVC application

Startup an MVC application

Parameters

$options

Returns


$this

Throws

RuntimeException
public array|Wei\Response
# dispatch( string $controller, null|string $action = null, array $params = array(), boolean $throwException = true )

Dispatch by specified controller and action

Dispatch by specified controller and action

Parameters

$controller
The name of controller
$action
The name of action
$params
The request parameters
$throwException
Whether throw exception when application not found

Returns

array|Wei\Response
protected RuntimeException
# buildException( array $notFound )

Build 404 exception from notFound array

Build 404 exception from notFound array

Parameters

$notFound

Returns

RuntimeException
protected Wei\Response
# execute( Wei\Base $instance, string $action )

Execute action with middleware

Execute action with middleware

Parameters

$instance
$action

Returns

Wei\Response
protected array
# getMiddleware( Wei\Base $instance, string $action )

Returns middleware for specified action

Returns middleware for specified action

Parameters

$instance
$action

Returns

array
public Wei\Response
# handleResponse( mixed $response )

Handle the response variable returned by controller action

Handle the response variable returned by controller action

Parameters

$response

Returns

Wei\Response

Throws

InvalidArgumentException
public string
# getNamespace( )

Returns the name of the application

Returns the name of the application

Returns

string
public
# setNamespace( string $namespace )

Set namespace

Set namespace

Parameters

$namespace

Returns


$this
public string
# getController( )

Get the of name controller

Get the of name controller

Returns

string
The name of controller
public string
# setController( string $controller )

Set the name of controller

Set the name of controller

Parameters

$controller
The name of controller

Returns

string
public string
# getAction( )

Get the name of action

Get the name of action

Returns

string
public string
# setAction( string $action )

Set the name of action

Set the name of action

Parameters

$action
The name of action

Returns

string
public string
# getControllerAction( )

Returns the URI that contains controller and action

Returns the URI that contains controller and action

Returns

string
public array
# getControllerClasses( string $controller )

Return the controller class names by controllers (without validate if the class exists)

Return the controller class names by controllers (without validate if the class exists)

Parameters

$controller
The name of controller

Returns

array
public
# setControllerMap( array $controllerMap )
protected Wei\Base
# getControllerInstance( string $class )

Get the controller instance, if not found, return false instead

Get the controller instance, if not found, return false instead

Parameters

$class
The class name of controller

Returns

Wei\Base
public boolean
# isActionAvailable( object $object, string $action )

Check if action name is available

Check if action name is available

Returns false when 1. method is not found 2. method is not public 3. method letters case error 4. method is starts with "_"

Parameters

$object
The object of controller
$action
The name of action

Returns

boolean
public
# preventPreviousDispatch( )

Throws a exception to prevent the previous dispatch process

Throws a exception to prevent the previous dispatch process

Throws

RuntimeException
public string
# getDefaultTemplate( )

Get default template file according to the controller, action and file extension provided by the view engine

Get default template file according to the controller, action and file extension provided by the view engine

Returns

string
public
# forward( string $controller, null|string $action = null )

Forwards to the given controller and action

Forwards to the given controller and action

Parameters

$controller
The name of controller
$action
The name of action
Methods inherited from Wei\Base
__call(), __construct(), __get(), getOption(), setOption()
Constants summary
integer FORWARD

The exception code for forward action

The exception code for forward action

# 1302
Properties summary
protected string $controllerFormat

The format of controller class

The format of controller class

# 'controllers\%controller%'
protected string $defaultController

The default controller name

The default controller name

# 'index'
protected string $defaultAction

The default action name

The default action name

# 'index'
protected string $namespace

The name of current application

The name of current application

#
protected string $controller

The name of controller

The name of controller

#
protected string $action

The name of action

The name of action

#
protected array $controllerInstances

The instanced controller objects

The instanced controller objects

# array()
protected array $controllerMap

An array that stores predefined controller class, the key is controller name and value is controller class name

An array that stores predefined controller class, the key is controller name and value is controller class name

# array()
Properties inherited from Wei\Base
$providers, $wei
Magic properties summary
public Wei\Router $router

A service that parse the URL to request data

public Wei\Request $request

A service that handles the HTTP request data

public Wei\Response $response

A service that handles the HTTP response data

public Wei\View $view

A service that use to render PHP template

Wei Framework API documentation generated by ApiGen