Skip to content

Commit

Permalink
change to namespace & add Object-Manage
Browse files Browse the repository at this point in the history
  • Loading branch information
sursir committed Oct 29, 2015
1 parent 7ed5a51 commit 3c7c7da
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* eol=lf
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# local workspace
*.sublime-workspace
12 changes: 6 additions & 6 deletions application/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@
* 这些方法, 都接受一个参数:Yaf_Dispatcher $dispatcher
* 调用的次序, 和申明的次序相同
*/
class Bootstrap extends Yaf_Bootstrap_Abstract{
class Bootstrap extends Yaf\Bootstrap_Abstract{

public function _initConfig() {
//把配置保存起来
$arrConfig = Yaf_Application::app()->getConfig();
$arrConfig = Yaf\Application::app()->getConfig();
Yaf_Registry::set('config', $arrConfig);
}

public function _initPlugin(Yaf_Dispatcher $dispatcher) {
public function _initPlugin(Yaf\Dispatcher $dispatcher) {
//注册一个插件
$objSamplePlugin = new SamplePlugin();
$dispatcher->registerPlugin($objSamplePlugin);
}

public function _initRoute(Yaf_Dispatcher $dispatcher) {
public function _initRoute(Yaf\Dispatcher $dispatcher) {
//在这里注册自己的路由协议,默认使用简单路由
}
public function _initView(Yaf_Dispatcher $dispatcher){

public function _initView(Yaf\Dispatcher $dispatcher){
//在这里注册自己的view控制器,例如smarty,firekylin
}
}
4 changes: 2 additions & 2 deletions application/controllers/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* @see http://www.php.net/manual/en/yaf-dispatcher.catchexception.php
* @author young-pc\young
*/
class ErrorController extends Yaf_Controller_Abstract {
class ErrorController extends Yaf\Controller_Abstract {

//从2.1开始, errorAction支持直接通过参数获取异常
public function errorAction($exception) {
//1. assign to view engine
$this->getView()->assign("exception", $exception);
//5. render by Yaf
//5. render by Yaf
}
}
2 changes: 1 addition & 1 deletion application/controllers/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @desc 默认控制器
* @see http://www.php.net/manual/en/class.yaf-controller-abstract.php
*/
class IndexController extends Yaf_Controller_Abstract {
class IndexController extends Yaf\Controller_Abstract {

/**
* 默认动作
Expand Down
14 changes: 7 additions & 7 deletions application/plugins/Sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
* @see http://www.php.net/manual/en/class.yaf-plugin-abstract.php
* @author young-pc\young
*/
class SamplePlugin extends Yaf_Plugin_Abstract {
class SamplePlugin extends Yaf\Plugin_Abstract {

public function routerStartup(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) {
public function routerStartup(Yaf\Request_Abstract $request, Yaf\Response_Abstract $response) {
}

public function routerShutdown(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) {
public function routerShutdown(Yaf\Request_Abstract $request, Yaf\Response_Abstract $response) {
}

public function dispatchLoopStartup(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) {
public function dispatchLoopStartup(Yaf\Request_Abstract $request, Yaf\Response_Abstract $response) {
}

public function preDispatch(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) {
public function preDispatch(Yaf\Request_Abstract $request, Yaf\Response_Abstract $response) {
}

public function postDispatch(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) {
public function postDispatch(Yaf\Request_Abstract $request, Yaf\Response_Abstract $response) {
}

public function dispatchLoopShutdown(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) {
public function dispatchLoopShutdown(Yaf\Request_Abstract $request, Yaf\Response_Abstract $response) {
}
}
8 changes: 8 additions & 0 deletions doglive.sublime-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"folders":
[
{
"path": "."
}
]
}
4 changes: 1 addition & 3 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
/** APP 根目录 指向public上一级 */
define('APP_PATH', __DIR__);
$app = new Yaf_Application(APP_PATH . '/conf/application.ini');
$app = new Yaf\Application(APP_PATH . '/conf/application.ini');

$app->run();
echo "\n";
echo __DIR__;

0 comments on commit 3c7c7da

Please sign in to comment.