Beispiel #1
0
 public function __construct(array $settings = [])
 {
     parent::__construct();
     $this['settings'] = function () use($settings) {
         return new Settings($settings);
     };
 }
 public function __construct()
 {
     parent::__construct();
     $this['Request'] = $this->factory(function () {
         return new Request();
     });
 }
 /**
  * {@inheritdoc}
  */
 public function __construct(array $values = array())
 {
     parent::__construct($values);
     $this['app_name'] = 'UNKNOWN';
     $this['app_version'] = 'UNKNOWN';
     $this['config_file'] = '{base}/config.json';
     $this['config_defaults'] = array();
     $this['working_directory_sub_folder'] = '.console-kit';
     $this['working_directory'] = function ($c) {
         $working_directory = new WorkingDirectory($c['working_directory_sub_folder']);
         return $working_directory->get();
     };
     $this['config_editor'] = function ($c) {
         return new ConfigEditor(str_replace('{base}', $c['working_directory'], $c['config_file']), $c['config_defaults']);
     };
     $this['input'] = function () {
         return new ArgvInput();
     };
     $this['output'] = function () {
         return new ConsoleOutput();
     };
     $this['io'] = function ($c) {
         return new ConsoleIO($c['input'], $c['output'], $c['helper_set']);
     };
     // Would be replaced with actual HelperSet from extended Application class.
     $this['helper_set'] = function () {
         return new HelperSet();
     };
     $this['container_helper'] = function ($c) {
         return new ContainerHelper($c);
     };
 }
Beispiel #4
0
 /**
  * Instantiate the container.
  *
  * Objects and parameters can be passed as argument to the constructor.
  *
  * @param array $values The parameters or objects.
  */
 public function __construct(array $values = array())
 {
     parent::__construct($values);
     $this['config_options'] = array();
     $this['config'] = function ($c) {
         return new Config($c['config_options']);
     };
     $this['annotation_manager'] = function () {
         $annotation_manager = new AnnotationManager();
         $annotation_manager->cache = new AnnotationCache(sys_get_temp_dir());
         return $annotation_manager;
     };
     $this['url_factory'] = function () {
         return new UrlFactory();
     };
     $this['url_normalizer'] = function ($c) {
         /** @var Config $config */
         $config = $c['config'];
         return new Normalizer($config->getOption('base_url'));
     };
     $this['page_locator'] = function ($c) {
         /** @var Config $config */
         $config = $c['config'];
         return new DefaultPageLocator((array) $config->getOption('page_namespace_prefix'));
     };
     $this['page_url_matcher_registry'] = function ($c) {
         $page_url_matcher_registry = new PageUrlMatcherRegistry($c['annotation_manager']);
         /** @var Config $config */
         $config = $c['config'];
         foreach ($config->getOption('page_url_matchers') as $matcher_class) {
             $page_url_matcher_registry->add(new $matcher_class());
         }
         return $page_url_matcher_registry;
     };
 }
Beispiel #5
0
 /**
  * Class constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $this['debug'] = true;
     $this['logger'] = function ($app) {
         return new Logger('app', [new StreamHandler('php://stdout')]);
     };
     $this['console'] = function ($app) {
         return new Console();
     };
     $this['dispatcher'] = function ($app) {
         $dispatcher = new Dispatcher();
         $dispatcher->setLogger($app['logger']);
         $dispatcher->addLayer(new RouteMiddlewareLayer('route', $app));
         $dispatcher->addLayer(new MiddlewareLayer('default'));
         return $dispatcher;
     };
     $this['server'] = function ($app) {
         $server = new Server();
         $server->setLogger($app['logger']);
         $server->setDispatcher($app['dispatcher']);
         return $server;
     };
     $this['request'] = function ($app) {
         return $app['server']->getRequest();
     };
     $this['route'] = null;
 }
 /**
  * @param array  $settings
  * @param string $environment
  */
 public function __construct(array $settings = [], $environment = self::ENV_DEVELOPMENT)
 {
     parent::__construct();
     if (!defined('INFUSE_BASE_DIR')) {
         die('INFUSE_BASE_DIR has not been defined!');
     }
     /* Load Configuration */
     $configWithDirs = ['dirs' => ['app' => INFUSE_BASE_DIR . '/app', 'assets' => INFUSE_BASE_DIR . '/assets', 'public' => INFUSE_BASE_DIR . '/public', 'temp' => INFUSE_BASE_DIR . '/temp', 'views' => INFUSE_BASE_DIR . '/views']];
     $settings = array_replace_recursive(static::$baseConfig, $configWithDirs, $settings);
     $config = new Config($settings);
     $this['config'] = $config;
     $this['environment'] = $environment;
     /* Base URL */
     $this['base_url'] = function () use($config) {
         $url = ($config->get('app.ssl') ? 'https' : 'http') . '://';
         $url .= $config->get('app.hostname');
         $port = $config->get('app.port');
         $url .= (!in_array($port, [0, 80, 443]) ? ':' . $port : '') . '/';
         return $url;
     };
     /* Services  */
     foreach ($config->get('services') as $name => $class) {
         $this[$name] = new $class($this);
     }
     // set the last created app instance
     self::$default = $this;
 }
Beispiel #7
0
 public function __construct(array $values)
 {
     parent::__construct($values);
     $this['apiService'] = function ($c) {
         return new ApiService($c);
     };
     $this['etkinlikService'] = function ($c) {
         return new EtkinlikService($c);
     };
     $this['mekanService'] = function ($c) {
         return new MekanService($c);
     };
     $this['ilceService'] = function ($c) {
         return new IlceService($c);
     };
     $this['kategoriService'] = function ($c) {
         return new KategoriService($c);
     };
     $this['sehirService'] = function ($c) {
         return new SehirService($c);
     };
     $this['semtService'] = function ($c) {
         return new SemtService($c);
     };
     $this['turService'] = function ($c) {
         return new TurService($c);
     };
 }
 public function __construct($baseUrl = null, array $config = array())
 {
     parent::__construct();
     $this['base_url'] = $baseUrl;
     $this['output'] = null;
     $this['client'] = function () {
         return new Client(['allow_redirects' => false]);
     };
     $this['queue'] = function () {
         if (isset($this['doctrine'])) {
             return new DoctrineRequestQueue($this['doctrine']);
         }
         return new ArrayRequestQueue();
     };
     $this['datastore'] = function () {
         if (isset($this['doctrine'])) {
             return new DoctrineRequestDataStore($this['doctrine']);
         }
         return new ArrayRequestDataStore();
     };
     $this['logger'] = function () {
         return new NullLogger();
     };
     $this['redispatcher'] = function () {
         return new HtmlRedispatcher();
     };
     $this['initial_requests'] = function () {
         return [new Request('GET', $this['base_url'])];
     };
     $this['loggers'] = [];
     $this['discoverers'] = [];
     $this['recursors'] = [];
     $this->configure($config);
 }
Beispiel #9
0
 /**
  * The current globally available container (if any).
  *
  * @var static
  */
 function __construct(array $values = [])
 {
     parent::__construct($values);
     // var_dump ( $this );
     // exit ();
     $this->registerDefaultServices();
 }
Beispiel #10
0
 public function __construct(array $values = array())
 {
     parent::__construct($values);
     if (is_null(static::$container)) {
         static::$container = $this;
     }
 }
Beispiel #11
0
 public function __construct(array $values = array())
 {
     parent::__construct();
     $this['debug'] = false;
     $this['logger'] = null;
     $this['migration.directories'] = new \ArrayObject();
     $this['autoload.aliases'] = new \ArrayObject(array('' => 'Biz'));
     $this['autoload.object_maker.service'] = function ($biz) {
         return function ($namespace, $name) use($biz) {
             $class = "{$namespace}\\Service\\Impl\\{$name}Impl";
             return new $class($biz);
         };
     };
     $this['autoload.object_maker.dao'] = function ($biz) {
         return function ($namespace, $name) use($biz) {
             $class = "{$namespace}\\Dao\\Impl\\{$name}Impl";
             return new DaoProxy($biz, new $class($biz));
         };
     };
     $this['autoloader'] = function ($biz) {
         return new ContainerAutoloader($biz, $biz['autoload.aliases'], array('service' => $biz['autoload.object_maker.service'], 'dao' => $biz['autoload.object_maker.dao']));
     };
     $this['dispatcher'] = function ($biz) {
         return new EventDispatcher();
     };
     $this['callback_resolver'] = function ($biz) {
         return new CallbackResolver($biz);
     };
     foreach ($values as $key => $value) {
         $this[$key] = $value;
     }
 }
 /**
  * Add service providers and application options.
  *
  * @param array $values
  */
 public function __construct(array $values = [])
 {
     parent::__construct($values);
     $this->register(new DoctrineServiceProvider());
     $this->register(new TwigServiceProvider());
     $this->register(new HexagonalServiceProvider());
     $this->register(new EwalletConsoleServiceProvider());
 }
Beispiel #13
0
 /**
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->_middleware = new \ArrayObject();
     $this->_routeMap = new RouteMap();
     $this->_request = ServerRequestFactory::fromGlobals();
     $this->_response = new Response();
 }
 /**
  * Add service providers and application options.
  *
  * @param array $values
  * @param Slim $app
  */
 public function __construct(array $values = [], Slim $app)
 {
     parent::__construct($values);
     $this->register(new DoctrineServiceProvider());
     $this->register(new TwigServiceProvider());
     $this->register(new FormsServiceProvider());
     $this->register(new EwalletWebServiceProvider($app));
 }
Beispiel #15
0
 public function __construct($root_directory)
 {
     //init Pimple
     parent::__construct();
     //make sure root has a trailing slash
     if (substr($root_directory, -1) !== '/') {
         $root_directory .= '/';
     }
     $this->root_directory = $root_directory;
     $this['config.cache'] = function () {
         $cache_file = $this->root_directory . 'storage/cache/config-' . $this->env . '.php';
         return new ConfigCache($cache_file);
     };
     $this['config'] = function () {
         $this->env_locked = true;
         if ($this->cache_enabled) {
             $cache = $this['config.cache'];
             if ($cache->isSaved()) {
                 return $cache->getConfig();
             }
         }
         $manager = $this['config.manager'];
         //load configuration for each module
         foreach ($this->modules as $module) {
             $module->loadConfig($manager);
         }
         //then for the application (default is config/neptune.yml).
         $this->loadConfig($manager);
         $config = $manager->getConfig();
         if ($this->cache_enabled) {
             $cache->save($config, $manager->getCacheMessage());
         }
         return $config;
     };
     $this['config.manager'] = function ($neptune) {
         $manager = new ConfigManager();
         $manager->addLoader(new Loader\YamlLoader());
         $manager->addLoader(new Loader\JsonLoader());
         $manager->addLoader(new Loader\PhpLoader());
         $manager->addProcessor(new Processor\OptionsProcessor());
         $manager->addProcessor(new Processor\EnvironmentProcessor($neptune));
         $manager->addProcessor(new Processor\ReferenceProcessor());
         return $manager;
     };
     $this['dispatcher'] = function () {
         $dispatcher = new EventDispatcher();
         foreach ($this->getTaggedServices('neptune.dispatcher.subscribers') as $subscriber) {
             $dispatcher->addSubscriber($subscriber);
         }
         return $dispatcher;
     };
     $this['request_stack'] = function () {
         return new RequestStack();
     };
     $this['kernel'] = function () {
         return new HttpKernel($this['dispatcher'], $this['resolver'], $this['request_stack']);
     };
 }
Beispiel #16
0
 public function __construct(CKFinder $app)
 {
     parent::__construct();
     $this->app = $app;
     $this->config = $app['config'];
     $this->backendFactory = $app['backend_factory'];
     $this->thumbnailRepository = $app['thumbnail_repository'];
     $this->resizedImageRepository = $app['resized_image_repository'];
 }
Beispiel #17
0
 function __construct($default_level = 40, $default_snitches = 'standard')
 {
     $this->default_level = $default_level;
     $this->default_snitches = $default_snitches;
     /* Create a default plain jane logger */
     $this->channel('default', $default_snitches, $default_level);
     /* Call pimple's construct() */
     parent::__construct();
 }
Beispiel #18
0
 public function __construct($rootDir, $debug = false)
 {
     $this['root_dir'] = $rootDir;
     $this->register(new ApplicationServiceProvider());
     $this->register(new FacadesServiceProvider());
     $this->register(new ViewServiceProvider());
     AbstractFacade::setContainer($this);
     parent::__construct();
 }
Beispiel #19
0
 /**
  * Instantiate the container.
  *
  * Objects and parameters can be passed as argument to the constructor.
  *
  * @param array $values The parameters or objects.
  */
 public function __construct(array $values = array())
 {
     parent::__construct($values);
     $this['event_dispatcher'] = function () {
         return new EventDispatcher();
     };
     $this['session_factory'] = function () {
         return new SessionFactory();
     };
     $this['session_strategy_factory'] = function ($c) {
         $session_strategy_factory = new SessionStrategyFactory();
         $session_strategy_factory->setApplication($c['application']);
         return $session_strategy_factory;
     };
     $this['session_strategy_manager'] = function ($c) {
         return new SessionStrategyManager($c['session_strategy_factory']);
     };
     $this['isolated_session_strategy'] = $this->factory(function ($c) {
         $session_strategy = new IsolatedSessionStrategy($c['session_factory']);
         $session_strategy->setEventDispatcher($c['event_dispatcher']);
         return $session_strategy;
     });
     $this['shared_session_strategy'] = $this->factory(function ($c) {
         $session_strategy = new SharedSessionStrategy($c['isolated_session_strategy']);
         $session_strategy->setEventDispatcher($c['event_dispatcher']);
         return $session_strategy;
     });
     $this['remote_url'] = function () {
         return new RemoteUrl();
     };
     $this['remote_coverage_helper'] = function ($c) {
         return new RemoteCoverageHelper($c['remote_url']);
     };
     $this['test_suite_factory'] = function ($c) {
         $test_suite_factory = new TestSuiteFactory($c['session_strategy_manager'], $c['browser_configuration_factory'], $c['remote_coverage_helper']);
         $test_suite_factory->setApplication($c['application']);
         return $test_suite_factory;
     };
     $this['regular_test_suite'] = $this->factory(function ($c) {
         $test_suite = new RegularTestSuite();
         $test_suite->setEventDispatcher($c['event_dispatcher']);
         return $test_suite;
     });
     $this['browser_test_suite'] = $this->factory(function ($c) {
         $test_suite = new BrowserTestSuite();
         $test_suite->setEventDispatcher($c['event_dispatcher']);
         return $test_suite;
     });
     $this['browser_configuration_factory'] = function ($c) {
         $browser_configuration_factory = new BrowserConfigurationFactory();
         $browser_configuration_factory->register(new BrowserConfiguration($c['event_dispatcher']));
         $browser_configuration_factory->register(new SauceLabsBrowserConfiguration($c['event_dispatcher'], $browser_configuration_factory));
         $browser_configuration_factory->register(new BrowserStackBrowserConfiguration($c['event_dispatcher'], $browser_configuration_factory));
         return $browser_configuration_factory;
     };
 }
Beispiel #20
0
 /**
  * Instantiate a new Application.
  *
  * Objects and parameters can be passed as argument to the constructor.
  *
  * @param array $values The parameters or objects.
  */
 public function __construct(array $values = array())
 {
     parent::__construct();
     $app = $this;
     $this['routes'] = function () {
         return new RouteCollection();
     };
     $this['controllers'] = function () use($app) {
         return $app['controllers_factory'];
     };
     $this['controllers_factory'] = $this->factory(function () use($app) {
         return new ControllerCollection($app['route_factory']);
     });
     $this['route_class'] = 'Silex\\Route';
     $this['route_factory'] = $this->factory(function () use($app) {
         return new $app['route_class']();
     });
     $this['exception_handler'] = function () use($app) {
         return new ExceptionHandler($app['debug']);
     };
     $this['dispatcher_class'] = 'Symfony\\Component\\EventDispatcher\\EventDispatcher';
     $this['dispatcher'] = function () use($app) {
         $dispatcher = new $app['dispatcher_class']();
         if (isset($app['exception_handler'])) {
             $dispatcher->addSubscriber($app['exception_handler']);
         }
         $dispatcher->addSubscriber(new ResponseListener($app['charset']));
         $dispatcher->addSubscriber(new MiddlewareListener($app));
         $dispatcher->addSubscriber(new ConverterListener($app['routes'], $app['callback_resolver']));
         $dispatcher->addSubscriber(new StringToResponseListener());
         return $dispatcher;
     };
     $this['callback_resolver'] = function () use($app) {
         return new CallbackResolver($app);
     };
     $this['resolver'] = function () use($app) {
         return new ControllerResolver($app, $app['logger']);
     };
     $this['kernel'] = function () use($app) {
         return new HttpKernel($app['dispatcher'], $app['resolver'], $app['request_stack']);
     };
     $this['request_stack'] = function () use($app) {
         return new RequestStack();
     };
     $this['request.http_port'] = 80;
     $this['request.https_port'] = 443;
     $this['debug'] = false;
     $this['charset'] = 'UTF-8';
     $this['logger'] = null;
     $this->register(new RoutingServiceProvider());
     foreach ($values as $key => $value) {
         $this[$key] = $value;
     }
 }
Beispiel #21
0
 /**
  * Instantiate a new Application.
  *
  * @param array $values Parameters or objects.
  */
 public function __construct(array $values = array())
 {
     parent::__construct();
     $this['debug'] = false;
     $this['charset'] = 'UTF-8';
     $this['logger'] = null;
     $this->register(new HttpKernelServiceProvider());
     $this->register(new RoutingServiceProvider());
     foreach ($values as $key => $value) {
         $this[$key] = $value;
     }
 }
 public function __construct()
 {
     $that = $this;
     $this['config.path'] = function ($c) {
         $filename = 'cliframework.ini';
         $configAtCurrentDirectory = getcwd() . DIRECTORY_SEPARATOR . $filename;
         $configAtHomeDirectory = getenv('HOME') . DIRECTORY_SEPARATOR . $filename;
         if (file_exists($configAtCurrentDirectory)) {
             return $configAtCurrentDirectory;
         }
         if (file_exists($configAtHomeDirectory)) {
             return $configAtHomeDirectory;
         }
         return null;
     };
     $this['event'] = function () {
         return new PhpEvent();
     };
     $this['config'] = function ($c) {
         if (empty($c['config.path']) || !$c['config.path']) {
             return new GlobalConfig(array());
         }
         return new GlobalConfig(parse_ini_file($c['config.path'], true));
     };
     $this['writer'] = function ($c) {
         // return new StreamWriter(STDOUT);
         $output = fopen("php://output", "w");
         return new StreamWriter($output);
     };
     $this['logger'] = function ($c) use($that) {
         return new Logger($that);
     };
     $this['formatter'] = function ($c) {
         return new Formatter();
     };
     $this['console.stty'] = function ($c) use($that) {
         if ($that->isWindows()) {
             // TODO support Windows
             return new NullStty();
         }
         return new UnixStty();
     };
     $this['console'] = function ($c) {
         if (ReadlineConsole::isAvailable()) {
             return new ReadlineConsole($c['console.stty']);
         }
         return new StandardConsole($c['console.stty']);
     };
     $this['command_loader'] = function ($c) {
         return CommandLoader::getInstance();
     };
     parent::__construct();
 }
Beispiel #23
0
 public function __construct(array $config)
 {
     parent::__construct();
     $this['config'] = function () use($config) {
         return new Config($config);
     };
     //init api url
     $this->api = self::BASE_URL . '/' . $this['config']['enterpriseId'] . '/' . $this['config']['appId'] . '/';
     $this->registerCoreProviders();
     $this->registerProviders();
     $this->initializeLogger();
     Log::debug('Configuration:', ['config' => $this['config']]);
 }
Beispiel #24
0
 public function __construct()
 {
     parent::__construct();
     $this['normalizer'] = function () {
         return new Normalizer\FilteringNormalizer(new Normalizer\DefaultNormalizer());
     };
     $this['logger'] = function () {
         return new Logger\ErrorLogLogger(WP_DEBUG ? LogLevel::INFO : LogLevel::ERROR);
     };
     $this['drivers'] = function ($magnify) {
         return new DriverRegistry($magnify['normalizer'], $magnify['logger']);
     };
 }
Beispiel #25
0
 /**
  * @param array $values Optional arguments for container.
  */
 public function __construct($values = array())
 {
     $defaults = array();
     $defaults['tables'] = array('$wp' => function () {
         global $wp;
         if (!$wp instanceof \WP) {
             return array();
         }
         $output = get_object_vars($wp);
         unset($output['private_query_vars']);
         unset($output['public_query_vars']);
         return array_filter($output);
     }, '$wp_query' => function () {
         global $wp_query;
         if (!$wp_query instanceof \WP_Query) {
             return array();
         }
         $output = get_object_vars($wp_query);
         $output['query_vars'] = array_filter($output['query_vars']);
         unset($output['posts']);
         unset($output['post']);
         return array_filter($output);
     }, '$post' => function () {
         $post = get_post();
         if (!$post instanceof \WP_Post) {
             return array();
         }
         return get_object_vars($post);
     });
     $defaults['handler.pretty'] = function ($plugin) {
         $handler = new PrettyPageHandler();
         foreach ($plugin['tables'] as $name => $callback) {
             $handler->addDataTableCallback($name, $callback);
         }
         // Requires Remote Call plugin.
         $handler->addEditor('phpstorm-remote-call', 'http://localhost:8091?message=%file:%line');
         return $handler;
     };
     $defaults['handler.json'] = function () {
         $handler = new Admin_Ajax_Handler();
         $handler->addTraceToOutput(true);
         return $handler;
     };
     $defaults['run'] = function ($plugin) {
         $run = new Run();
         $run->pushHandler($plugin['handler.pretty']);
         $run->pushHandler($plugin['handler.json']);
         return $run;
     };
     parent::__construct(array_merge($defaults, $values));
 }
Beispiel #26
0
 /**
  * Application constructor.
  *
  * @param array $config
  */
 public function __construct($config)
 {
     parent::__construct();
     $this['config'] = function () use($config) {
         return new Config($config);
     };
     if ($this['config']['debug']) {
         error_reporting(E_ALL);
     }
     $this->registerProviders();
     $this->registerBase();
     $this->initializeLogger();
     Log::debug('Current configuration:', $config);
 }
 /**
  * @param array $values
  */
 public function __construct(array $values = [])
 {
     parent::__construct($values);
     $this['name'] = 'PHP Journey Planner';
     $this['version'] = '1.1';
     $this['console'] = function ($container) {
         return new Console($container);
     };
     $this['db'] = $this->createPDO();
     $this['command.plan_journey'] = function ($container) {
         return new PlanJourney($container['provider.station'], $container['provider.schedule']);
     };
     $this['command.assign_clusters'] = function ($container) {
         return new AssignStationClusters($container['db']);
     };
     $this['command.transfer_pattern'] = function ($container) {
         return new FindTransferPatterns($container['provider.station'], $container['provider.schedule'], new ProcessManager(), new ChunkStrategy($container['cpu.cores']), [$this, 'createPDO']);
     };
     $this['provider.station'] = function ($container) {
         return new DatabaseStationProvider($container['db']);
     };
     $this['provider.schedule'] = function ($container) {
         return new CachedProvider($container['db'], $container['cache']);
     };
     $this['logger'] = function () {
         $stream = new StreamHandler('php://stdout');
         $logger = new Logger('php-journey-planner');
         $logger->pushHandler($stream);
         return $logger;
     };
     $this['cpu.cores'] = function () {
         $cpuinfo = file_get_contents('/proc/cpuinfo');
         preg_match_all('/^processor/m', $cpuinfo, $matches);
         return count($matches[0]);
     };
     $this['cache.redis'] = function () {
         $redis = new Redis();
         $redis->connect('127.0.0.1');
         $redis->select(RedisCache::DB_INDEX);
         return $redis;
     };
     $this['cache.memcached'] = function () {
         $memcached = new Memcached();
         $memcached->addServer('127.0.0.1', 11211);
         return $memcached;
     };
     $this['cache'] = function ($container) {
         return new MemcachedCache($container['cache.memcached']);
     };
 }
Beispiel #28
0
 public function __construct($name, BundleAbstract $parent = null, array $params = [])
 {
     parent::__construct($params);
     if ($parent) {
         $this->setParent($parent);
     }
     if ('' == ($name = preg_replace('/[^a-zA-Z0-9_\\.-]+/', '', (string) $name))) {
         throw new \InvalidArgumentException('错误的名字,请仔细检查。');
     }
     $this->name = $name;
     $this->subBundles = new BundleCollection();
     $this['routes'] = function () {
         return new RouteCollection();
     };
 }
Beispiel #29
0
 /**
  * @param array $values
  */
 public function __construct($values = array())
 {
     $defaults = array();
     $class_map = array('core' => 'Core', 'navbar' => 'Navbar', 'post-pagination' => 'Post_Pagination', 'loop-pagination' => 'Loop_Pagination', 'breadcrumb' => 'Breadcrumb', 'comments' => 'Comments', 'gallery' => 'Gallery');
     foreach ($class_map as $key => $name) {
         $defaults[$key] = function () use($name) {
             $class_name = __NAMESPACE__ . '\\' . $name;
             return new $class_name();
         };
     }
     $defaults['meadow'] = function () {
         return new Core();
     };
     parent::__construct(array_merge($defaults, $values));
 }
Beispiel #30
0
 /**
  * 初始化
  * @author Young <*****@*****.**>
  * @date   2016-07-08T10:24:17+0800
  * @param  [type]                   $config [description]
  */
 public function __construct($config)
 {
     parent::__construct();
     $this['config'] = function () use($config) {
         return new Config($config);
     };
     if ($this['config']['debug']) {
         if (class_exists(Debug::class)) {
             Debug::enable(E_ALL ^ E_NOTICE);
         } else {
             ini_set('display_errors', 'on');
             error_reporting(E_ALL ^ E_NOTICE);
         }
     }
     $this->regiestBase();
     $this->regiestProviders();
 }