init() 정적인 공개 메소드

If you add services, don't forget to also edit config/.phpstorm.meta.php
static public init ( Pimple\Container $pimple = null )
$pimple Pimple\Container
예제 #1
0
 /**
  * @covers \Pressbooks\Container::get
  * @covers \Pressbooks\Container::set
  */
 public function test_getSet()
 {
     Container::init(new FakePimpleContainer());
     Container::set('test1', function () {
         return 'test1';
     });
     Container::set('test2', function () {
         return 'test2';
     }, 'factory');
     Container::set('test3', function () {
         return 'test3';
     }, 'protect');
     $var1 = Container::get('test1');
     $var2 = Container::get('test2');
     $var3 = Container::get('test3');
     $this->assertTrue('test1' == $var1);
     $this->assertTrue('test2' == $var2);
     $this->assertTrue(is_object($var3) && $var3 instanceof Closure);
     $this->assertTrue('test3' == $var3());
 }
예제 #2
0
파일: hooks.php 프로젝트: cumi/pressbooks
require PB_PLUGIN_DIR . 'includes/pb-redirect.php';
require PB_PLUGIN_DIR . 'includes/pb-sanitize.php';
require PB_PLUGIN_DIR . 'includes/pb-taxonomy.php';
require PB_PLUGIN_DIR . 'includes/pb-media.php';
require PB_PLUGIN_DIR . 'includes/pb-editor.php';
require PB_PLUGIN_DIR . 'symbionts/pb-latex/pb-latex.php';
PressBooks\Utility\include_plugins();
// -------------------------------------------------------------------------------------------------------------------
// Initialize services
// -------------------------------------------------------------------------------------------------------------------
require PB_PLUGIN_DIR . 'symbionts/pimple/Container.php';
require PB_PLUGIN_DIR . 'symbionts/pimple/ServiceProviderInterface.php';
if (!empty($GLOBALS['PB_PIMPLE_OVERRIDE'])) {
    \PressBooks\Container::init($GLOBALS['PB_PIMPLE_OVERRIDE']);
} else {
    \PressBooks\Container::init();
}
// -------------------------------------------------------------------------------------------------------------------
// Login screen branding
// -------------------------------------------------------------------------------------------------------------------
add_action('login_head', '\\PressBooks\\Admin\\Branding\\custom_login_logo');
add_filter('login_headerurl', '\\PressBooks\\Admin\\Branding\\login_url');
add_filter('login_headertitle', '\\PressBooks\\Admin\\Branding\\login_title');
// -------------------------------------------------------------------------------------------------------------------
// Custom Metadata plugin
// -------------------------------------------------------------------------------------------------------------------
add_filter('custom_metadata_manager_wysiwyg_args_field_pb_custom_copyright', '\\PressBooks\\Editor\\metadata_manager_default_editor_args');
add_filter('custom_metadata_manager_wysiwyg_args_field_pb_about_unlimited', '\\PressBooks\\Editor\\metadata_manager_default_editor_args');
// -------------------------------------------------------------------------------------------------------------------
// Languages
// -------------------------------------------------------------------------------------------------------------------
예제 #3
0
 /**
  * Override
  */
 public function tearDown()
 {
     Container::init();
     // Reset
     parent::tearDown();
 }