当前位置: 首页>>代码示例>>PHP>>正文


PHP static::application方法代码示例

本文整理汇总了PHP中static::application方法的典型用法代码示例。如果您正苦于以下问题:PHP static::application方法的具体用法?PHP static::application怎么用?PHP static::application使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在static的用法示例。


在下文中一共展示了static::application方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createApplication

 public function createApplication($namespace = 'Staq\\Core\\Ground', $baseUri = NULL, $platform = NULL)
 {
     if (empty($baseUri)) {
         $baseUri = $this->getDefaultBaseUri();
     }
     if (empty($platform)) {
         $platform = 'prod';
         if (\Staq\Util::isCli()) {
             if (!isset($argv[1])) {
                 echo 'You must specify a platform.' . PHP_EOL;
                 echo 'Ex: ' . $argv[0] . ' local' . PHP_EOL;
                 die;
             }
             $platform = $argv[1];
         }
     }
     $extensions = $this->findExtensions($namespace);
     if (!is_null(static::$autoloader)) {
         spl_autoload_unregister(array(static::$autoloader, 'autoload'));
     }
     static::$autoloader = new \Staq\Autoloader($extensions);
     spl_autoload_register(array(static::$autoloader, 'autoload'));
     static::$application = new \Stack\Application($extensions, $baseUri, $platform);
     static::$application->initialize();
     return static::$application;
 }
开发者ID:pixel418,项目名称:staq,代码行数:26,代码来源:Server.php

示例2: init

 public static function init()
 {
     // Load the user-defined test configuration file, if it exists; otherwise, load
     if (is_readable(__DIR__ . '/TestConfig.php')) {
         $testConfig = (include __DIR__ . '/TestConfig.php');
     } else {
         $testConfig = (include __DIR__ . '/TestConfig.php.dist');
     }
     $zf2ModulePaths = array();
     if (isset($testConfig['module_listener_options']['module_paths'])) {
         $modulePaths = $testConfig['module_listener_options']['module_paths'];
         foreach ($modulePaths as $modulePath) {
             if ($path = static::findParentPath($modulePath)) {
                 $zf2ModulePaths[] = $path;
             }
         }
     }
     $zf2ModulePaths = implode(PATH_SEPARATOR, $zf2ModulePaths) . PATH_SEPARATOR;
     $zf2ModulePaths .= getenv('ZF2_MODULES_TEST_PATHS') ?: (defined('ZF2_MODULES_TEST_PATHS') ? ZF2_MODULES_TEST_PATHS : '');
     static::initAutoloader();
     // use ModuleManager to load this module and it's dependencies
     $baseConfig = array('module_listener_options' => array('module_paths' => explode(PATH_SEPARATOR, $zf2ModulePaths)));
     $config = ArrayUtils::merge($baseConfig, $testConfig);
     $application = \Zend\Mvc\Application::init($config);
     // build test database
     $entityManager = $application->getServiceManager()->get('doctrine.entitymanager.orm_default');
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($entityManager);
     $schemaTool->createSchema($entityManager->getMetadataFactory()->getAllMetadata());
     static::$application = $application;
 }
开发者ID:VOONWerbeagentur,项目名称:SoliantEntityAudit,代码行数:30,代码来源:Bootstrap.php

示例3: init

 public static function init()
 {
     // Define application environment (production|staging|testing|development)
     defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APP_ENV') ? getenv('APP_ENV') : 'testing');
     // Load the user-defined test configuration file, if it exists; otherwise, load
     if (is_readable(__DIR__ . '/TestConfig.php')) {
         $testConfig = (include __DIR__ . '/TestConfig.php');
     } else {
         $testConfig = (include __DIR__ . '/TestConfig.php.dist');
     }
     $zf2ModulePaths = array();
     if (isset($testConfig['module_listener_options']['module_paths'])) {
         $modulePaths = $testConfig['module_listener_options']['module_paths'];
         foreach ($modulePaths as $modulePath) {
             if ($path = static::findParentPath($modulePath)) {
                 $zf2ModulePaths[] = $path;
             }
         }
     }
     $zf2ModulePaths = implode(PATH_SEPARATOR, $zf2ModulePaths) . PATH_SEPARATOR;
     $zf2ModulePaths .= getenv('ZF2_MODULES_TEST_PATHS') ?: (defined('ZF2_MODULES_TEST_PATHS') ? ZF2_MODULES_TEST_PATHS : '');
     static::initAutoloader();
     // use ModuleManager to load this module and it's dependencies
     $baseConfig = array('module_listener_options' => array('module_paths' => explode(PATH_SEPARATOR, $zf2ModulePaths)));
     $config = ArrayUtils::merge($baseConfig, $testConfig);
     $serviceManager = new ServiceManager(new ServiceManagerConfig(isset($config['service_manager']) ? $config['service_manager'] : array()));
     $serviceManager->setService('ApplicationConfig', $config);
     $serviceManager->get('ModuleManager')->loadModules();
     static::$application = $serviceManager->get('Application');
 }
开发者ID:Waldz,项目名称:ExampleZF2Application,代码行数:30,代码来源:Bootstrap.php

示例4: setUp

 /**
  * Set up test
  */
 public function setUp()
 {
     static::$kernel = static::createKernel();
     static::$kernel->boot();
     static::$application = new Application(static::$kernel);
     static::$application->setAutoExit(false);
 }
开发者ID:sovaalexandr,项目名称:OpenExchangeRatesBundle,代码行数:10,代码来源:OpenExchangeRatesServiceTest.php

示例5: bootstrapApplication

 protected static function bootstrapApplication()
 {
     $kernel = new \AppKernel(static::$environment, static::$debug);
     $kernel->boot();
     static::$application = new Application($kernel);
     static::$application->setAutoExit(false);
 }
开发者ID:noregression,项目名称:test-bundle,代码行数:7,代码来源:IsolatedTestTrait.php

示例6: bootstrap

 public function bootstrap($event)
 {
     // Register a "render" event, at high priority (so it executes prior
     // to the view attempting to render)
     $app = $event->getParam('application');
     static::$application = $app;
     $app->events()->attach('render', array($this, 'registerTwigStrategy'), 100);
 }
开发者ID:rikaix,项目名称:ZeTwig,代码行数:8,代码来源:Module.php

示例7: setUp

 /**
  *
  */
 public function setUp()
 {
     static::$kernel = static::createKernel();
     static::$kernel->boot();
     static::$application = new Application(static::$kernel);
     static::addDoctrineCommands();
     static::rebuildDatabase();
 }
开发者ID:rvanlaarhoven,项目名称:LexikTranslationBundle,代码行数:11,代码来源:ImportTranslationsCommandTest.php

示例8: createApplication

 /**
  * Create CBLib Application if not already created, and returns it for chaining
  *
  * @param  string                            $type    [optional] 'Web' or 'Cli'
  * @param  array|object|InputInterface|null  $input   (array_merge(get, post) or argv if cli)
  * @param  Config|callable|null              $config  The Config to use (or a closure returning it)
  * @return Application
  */
 public static function createApplication($type = 'Web', $input = null, $config = null)
 {
     if (!static::$application) {
         // Define $app Containers 'Application' and 'Cms':
         $application = Application::createApplication($type);
         static::$application = $application;
         // Define $app Container 'Config':
         $application->set('Config', function () use($config, $application) {
             return Config::setMainConfig($config, $application);
         }, true, true);
         // Define $app Container 'DatabaseDriverInterface':
         $application->set('CBLib\\Database\\DatabaseDriverInterface', function (ApplicationContainerInterface $di) {
             return Database::createDatabaseDriver($di->getCms());
         }, true)->alias('CBLib\\Database\\DatabaseDriverInterface', 'Database');
         // Define $app Container 'Input':
         $application->set('CBLib\\Input\\InputInterface', function (ApplicationContainerInterface $di) use($type, $input) {
             // return static::getMainInput( static::$app, $type, $input );
             return $di->getCms()->getInput($di, $type, $input);
         }, true)->alias('CBLib\\Input\\InputInterface', 'Input');
         // Define $app Container 'Output':
         /** @noinspection PhpUnusedParameterInspection */
         $application->set('CBLib\\Output\\OutputInterface', function (ApplicationContainerInterface $di, array $parameters) {
             return Output::createNew('html', $parameters);
             //TODO json+xml
         }, true)->alias('CBLib\\Output\\OutputInterface', 'Output');
         // 'Router' and CBLib\Controller\RouterInterface service providers are defined in specific Cms constructor.
         // Define $app Container 'Session':
         $application->set('CBLib\\Session\\SessionInterface', '\\CBLib\\Session\\Session')->alias('CBLib\\Session\\SessionInterface', 'Session');
         // Define $app Container 'SessionState':
         $application->set('CBLib\\Session\\SessionStateInterface', '\\CBLib\\Session\\SessionState')->alias('CBLib\\Session\\SessionStateInterface', 'SessionState');
         // Define $app Container 'User':
         $application->set('CBLib\\Entity\\User\\User', function (ApplicationContainerInterface $di, array $parameters) {
             if (count($parameters) === 0) {
                 throw new \UnexpectedValueException('Application::MyUser() called without a parameter');
             }
             return User::getInstanceForContainerOnly($parameters[0], $di->getCms(), $di->getConfig());
         })->alias('CBLib\\Entity\\User\\User', 'User');
         $application->set('MyUser', function (ApplicationContainerInterface $di, array $parameters) {
             if (count($parameters) !== 0) {
                 throw new \UnexpectedValueException('Application::User() called with a parameter');
             }
             return User::getInstanceForContainerOnly(null, $di->getCms(), $di->getConfig());
         });
         // Define Language and translations, as well as the translations logger interface:
         $application->set('Language', 'CBLib\\Language\\CBTxt', true);
         $application->set('CBLib\\Language\\TranslationsLoggerInterface', function (ApplicationContainerInterface $di) {
             // Creates the logger:
             $translationsLogger = new TranslationsLogger();
             // Registers after-render event to add the translations log at the end of the html body:
             $di->getCms()->registerOnAfterRenderBodyFilter(function ($body) use($translationsLogger) {
                 return $translationsLogger->appendToBodyUsedStrings($body);
             });
             return $translationsLogger;
         }, true);
     }
     return static::$application;
 }
开发者ID:ankaau,项目名称:GathBandhan,代码行数:65,代码来源:CBLib.php

示例9: getApplication

 protected static function getApplication()
 {
     if (!static::$application) {
         $options = static::$options;
         static::$client = static::createClient($options);
         static::$application = new Application(static::$client->getKernel());
         static::$application->setAutoExit(false);
     }
     return static::$application;
 }
开发者ID:mapbender,项目名称:fom,代码行数:10,代码来源:SharedApplicationWebTestCase.php

示例10: setUp

 /**
  * Setup
  */
 public function setUp()
 {
     static::$kernel = static::createKernel();
     static::$kernel->boot();
     static::$application = new Application(static::$kernel);
     static::$application->setAutoExit(false);
     $this->client = static::createClient();
     static::$application->run(new ArrayInput(array('command' => 'doctrine:database:drop', '--no-interaction' => true, '--force' => true, '--quiet' => true)));
     static::$application->run(new ArrayInput(array('command' => 'doctrine:database:create', '--no-interaction' => true, '--quiet' => true)));
     static::$application->run(new ArrayInput(array('command' => 'doctrine:schema:create', '--no-interaction' => true, '--quiet' => true)));
 }
开发者ID:raizeta,项目名称:ControllerExtraBundle,代码行数:14,代码来源:AbstractWebTestCase.php

示例11: setUp

 /**
  * Set up
  */
 public function setUp()
 {
     try {
         $this->client = self::$_client = parent::createClient($this->getKernelOptions(), $this->getServerParameters());
         static::$application = new Application(static::$kernel);
         static::$application->setAutoExit(false);
         $this->container = static::$kernel->getContainer();
     } catch (Exception $e) {
         throw new RuntimeException(sprintf('Unable to start the application: %s', get_class($e) . ':' . $e->getMessage()));
     }
     $this->createSchema();
 }
开发者ID:alexislefebvre,项目名称:axstrad-test-bundle,代码行数:15,代码来源:WebTestCase.php

示例12: setUpBeforeClass

 /**
  * Set up before class.
  *
  * @throws RuntimeException unable to start the application
  */
 public static function setUpBeforeClass()
 {
     try {
         static::$kernel = static::createKernel();
         static::$kernel->boot();
         static::$application = new Application(static::$kernel);
         static::$application->setAutoExit(false);
         static::$container = static::$kernel->getContainer();
     } catch (Exception $e) {
         throw new RuntimeException(sprintf('Unable to start the application: %s', $e->getMessage()), $e->getCode(), $e);
     }
     static::createSchema();
 }
开发者ID:VictorMateo,项目名称:elcodi,代码行数:18,代码来源:WebTestCase.php

示例13: setUp

 /**
  * Set up
  */
 public function setUp()
 {
     gc_collect_cycles();
     try {
         static::$kernel = static::createKernel();
         static::$kernel->boot();
         static::$application = new Application(static::$kernel);
         static::$application->setAutoExit(false);
         $this->container = static::$kernel->getContainer();
     } catch (\Exception $e) {
         echo $e->getMessage();
         die;
     }
     $this->createSchema();
 }
开发者ID:hd-deman,项目名称:elcodi,代码行数:18,代码来源:WebTestCase.php

示例14: setUpBeforeClass

 /**
  * Setup the laravel application and run migrations when we first start
  */
 public static function setUpBeforeClass()
 {
     ini_set('memory_limit', '-1');
     $unitTesting = true;
     $testEnvironment = 'testing';
     $GLOBALS['manuallyRequireDeviseRoutes'] = true;
     if (!static::$setup) {
         $loader = (require __DIR__ . '/../vendor/autoload.php');
         $loader->setPsr4("App\\", __DIR__ . "/integrated/app/");
         static::$application = (require __DIR__ . '/integrated/bootstrap/app.php');
         static::$application->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
         Config::set('database.default', 'sqlite');
         static::setUpFixtures();
         static::runMigrations();
         Artisan::call('db:seed', array('--class' => 'DeviseSeeder'));
         Artisan::call('db:seed', array('--class' => 'DeviseTestsOnlySeeder'));
         static::manuallyRequireRoutes();
         Mail::pretend(true);
         static::$setup = true;
     }
     return static::$application;
 }
开发者ID:alpas29,项目名称:cms,代码行数:25,代码来源:DeviseTestCase.php

示例15: kernelBootstrap

 /**
  * @param string $env
  */
 public static function kernelBootstrap($env = AppKernel::ENV_DEV)
 {
     static::$application = static::getApplication($env);
     static::$application->boot();
 }
开发者ID:JanHuang,项目名称:framework,代码行数:8,代码来源:FrameworkTestCase.php


注:本文中的static::application方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。