Yaf_Application
PHP Manual

Yaf_Application::bootstrap

(PECL yaf >=1.0.0)

Yaf_Application::bootstrapCall bootstrap

説明

public void Yaf_Application::bootstrap ([ Yaf_Bootstrap_Abstract $bootstrap ] )

Run a Bootstrap, all the methods defined in the Bootstrap and named with prefix "_init" will be called according to their declaration order, if the parameter bootstrap is not supplied, Yaf will look for a Bootstrap under application.directory.

警告

この関数は、 現在のところ詳細な情報はありません。引数のリストのみが 記述されています。

パラメータ

bootstrap

A Yaf_Bootstrap_Abstract instance

返り値

Yaf_Application instance

例1 A Bootstrap()example

<?php
/**
 * This file should be under the APPLICATION_PATH . "/application/"(which was defined in the config passed to Yaf_Application).
 * and named Bootstrap.php,  so the Yaf_Application can find it 
 */
class Bootstrap extends Yaf_Bootstrap_Abstract {
    function 
_initConfig(Yaf_Dispatcher $dispatcher) {
        echo 
"1st called\n";
    }

    function 
_initPlugin($dispatcher) {
        echo 
"2nd called\n";
    }
}
?>

例2 Yaf_Application::bootstrap()example

<?php

defined
('APPLICATION_PATH')                  // APPLICATION_PATH will be used in the ini config file
    
|| define('APPLICATION_PATH'__DIR__)); //__DIR__ was introduced after PHP 5.3

$application = new Yaf_Application(APPLICATION_PATH.'/conf/application.ini');
$application->bootstrap();
?>

上の例の出力は、 たとえば以下のようになります。

1st called
2nd called

参考


Yaf_Application
PHP Manual