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


PHP Application::__construct方法代码示例

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


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

示例1: __construct

 /**
  * App constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $this->match('/', function () {
         return '/';
     });
     /**
      * process messages
      */
     $this->match('update', function () {
         $telegram = new Client(BOT_TOKEN);
         $handler = new Handler($telegram);
         return $handler->handle();
     });
     /**
      * update hook settings/api
      */
     $this->match('hook', function () {
         $telegram = new Api(BOT_TOKEN);
         $telegram->removeWebhook();
         if (USE_WEBHOOK) {
             $telegram->setWebhook(WEBHOOK, '../server-setup/files/cert/nginx.crt');
             return 'hook set';
         }
         return 'hook-removed';
     });
 }
开发者ID:antoniomadonna,项目名称:rome-bus-bot,代码行数:30,代码来源:App.php

示例2: __construct

 /**
  * @param array       $basePath
  * @param Environment $environment
  */
 public function __construct($basePath, Environment $environment)
 {
     parent::__construct();
     $this['path'] = $basePath;
     $this['env'] = $environment;
     $this->bindPathsInApplicationContainer();
     $this->bindConfiguration();
     // Routes...
     $this->register(new RouteServiceProvider());
     // Services...
     $this->register(new SessionServiceProvider());
     $this->register(new FormServiceProvider());
     $this->register(new UrlGeneratorServiceProvider());
     $this->register(new ControllerResolverServiceProvider());
     $this->register(new ServiceControllerServiceProvider());
     $this->register(new DatabaseServiceProvider());
     $this->register(new ValidatorServiceProvider());
     $this->register(new TranslationServiceProvider());
     $this->register(new SwiftmailerServiceProvider(), ['swiftmailer.options' => ['host' => $this->config('mail.host'), 'port' => $this->config('mail.port'), 'username' => $this->config('mail.username'), 'password' => $this->config('mail.password'), 'encryption' => $this->config('mail.encryption'), 'auth_mode' => $this->config('mail.auth_mode')]]);
     $this->register(new SentryServiceProvider());
     $this->register(new TwigServiceProvider());
     $this->register(new HtmlPurifierServiceProvider());
     $this->register(new SpotServiceProvider());
     $this->register(new ImageProcessorProvider());
     // Application Services...
     $this->register(new ApplicationServiceProvider());
 }
开发者ID:AaronMuslim,项目名称:opencfp,代码行数:31,代码来源:Application.php

示例3: __construct

 /**
  * @param array $values
  */
 public function __construct(array $values = array())
 {
     $values['bolt_version'] = '2.2.10';
     $values['bolt_name'] = '';
     $values['bolt_released'] = true;
     // `true` for stable releases, `false` for alpha, beta and RC.
     /** @internal Parameter to track a deprecated PHP version */
     $values['deprecated.php'] = version_compare(PHP_VERSION, '5.4.0', '<');
     parent::__construct($values);
     $this->register(new PathServiceProvider());
     // Initialize the config. Note that we do this here, on 'construct'.
     // All other initialisation is triggered from bootstrap.php
     // Warning!
     // One of a valid ResourceManager ['resources'] or ClassLoader ['classloader']
     // must be defined for working properly
     if (!isset($this['resources'])) {
         $this['resources'] = new Configuration\ResourceManager($this);
         $this['resources']->compat();
     } else {
         $this['classloader'] = $this['resources']->getClassLoader();
     }
     $this['resources']->setApp($this);
     $this->initConfig();
     $this->initSession();
     $this['resources']->initialize();
     $this['debug'] = $this['config']->get('general/debug', false);
     $this['debugbar'] = false;
     // Initialize the 'editlink' and 'edittitle'.
     $this['editlink'] = '';
     $this['edittitle'] = '';
     // Initialise the JavaScipt data gateway
     $this['jsdata'] = array();
 }
开发者ID:uwfsae,项目名称:team-website,代码行数:36,代码来源:Application.php

示例4: __construct

 /**
  * 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($values);
     $this['debug'] = true;
     $this->get('/', function () {
         return 'Welcome at home';
     });
     $this->get('/welcome/{name}', function ($name) {
         return sprintf('Welcome %s at home', $name);
     });
     $this->get('/dirs', 'Cpyree\\Controller\\DirectoryController::getDirectories');
     $this->get('/dir-content', 'Cpyree\\Controller\\DirectoryController::getContentDir');
     $this->get('/dir-genre', 'Cpyree\\Controller\\DirectoryController::getGenreDir');
     $this->get('/set-matadata', 'Cpyree\\Controller\\DirectoryController::setMetadata');
     $this->get('/move', 'Cpyree\\Controller\\DirectoryController::move');
     $this->get('/delete', 'Cpyree\\Controller\\DirectoryController::delete');
     //Security issue, disalow stream on all
     $this->get('/stream', function (Request $request) {
         if ($request->query->has('file')) {
             $stream = new Streamer();
             return $stream->start($request->query->get('file'));
         }
         die;
     });
 }
开发者ID:Pyrex-FWI,项目名称:silex-directory,代码行数:32,代码来源:SaparDirectoryApp.php

示例5: __construct

 public function __construct(array $values = array())
 {
     $values['bolt_version'] = '2.0.0';
     $values['bolt_name'] = 'almost beta';
     parent::__construct($values);
     // Initialize the config. Note that we do this here, on 'construct'.
     // All other initialisation is triggered from bootstrap.php
     // Warning!
     // One of a valid ResourceManager ['resources'] or ClassLoader ['classloader']
     // must be defined for working properly
     if (!isset($this['resources'])) {
         $this['resources'] = new Configuration\ResourceManager($this['classloader']);
         $this['resources']->compat();
     } else {
         $this['classloader'] = $this['resources']->getClassLoader();
     }
     $this['resources']->setApp($this);
     $this->initConfig();
     $this['resources']->initialize();
     $this['debug'] = $this['config']->get('general/debug', false);
     $this['debugbar'] = false;
     // Initialize the 'editlink' and 'edittitle'..
     $this['editlink'] = '';
     $this['edittitle'] = '';
 }
开发者ID:ArdKuijpers,项目名称:bolt,代码行数:25,代码来源:Application.php

示例6: __construct

 public function __construct($values = array())
 {
     parent::__construct();
     static::$app = $this;
     foreach ($values as $key => $value) {
         $this[$key] = $value;
     }
     Facade::setFacadeApplication($this);
     // register the configserviceprovider so we can access the config
     $this->register(new ConfigServiceProvider());
     // grab the providers from the config and load them
     $providers = $this['config']->get('app/providers');
     foreach ($providers as $provider) {
         $this->register(new $provider());
     }
     // set the locale (https://github.com/silexphp/Silex/issues/983)
     $locale = $values['locale'];
     if ($this['translator']) {
         $this['translator']->setlocale($locale);
     }
     // register fieldtypes from config
     $fieldTypesConfig = $this['config']->get('fieldtypes');
     if ($fieldTypesConfig) {
         $this['fieldtypes'] = $this['fieldtypes.factory']->fromConfig($fieldTypesConfig);
     }
     // register contenttypes from config
     $contentTypeConfig = $this['config']->get('contenttypes');
     if ($contentTypeConfig) {
         $this['contenttypes'] = $this['contenttypes.factory']->fromConfig($contentTypeConfig);
     }
 }
开发者ID:vespakoen,项目名称:bolt-core,代码行数:31,代码来源:App.php

示例7: __construct

 public function __construct(array $values = [])
 {
     parent::__construct($values);
     $this->registerProviders($this);
     $this->registerServices($this);
     $this->registerRoutes($this);
 }
开发者ID:abaklanov,项目名称:email-app,代码行数:7,代码来源:App.php

示例8: __construct

 public function __construct(array $values = [])
 {
     parent::__construct($values);
     $this['serializer'] = SerializerBuilder::create()->build();
     BreweryBuilder::mountProviderIntoApplication($this->baseRouteApi, $this);
     BeerBuilder::mountProviderIntoApplication($this->baseRouteApi, $this);
 }
开发者ID:rodrigogattermann,项目名称:curso-api-php-silex,代码行数:7,代码来源:Application.php

示例9: __construct

 public function __construct($rootDir, $debug = true, array $values = [])
 {
     parent::__construct(['root_dir' => $rootDir, 'debug' => $debug] + $values);
     $this->register(new ExceptionServiceProvider());
     $this->register(new RoutingServiceProvider());
     $this->register(new TackerServiceProvider());
 }
开发者ID:flint,项目名称:brick,代码行数:7,代码来源:Application.php

示例10: __construct

 public function __construct(array $values = array())
 {
     parent::__construct($values);
     $this['config'] = $this->share(function ($this) {
         return new ConfigService($this);
     });
 }
开发者ID:nhagemann,项目名称:anycontent-cms-construction-kit-php,代码行数:7,代码来源:Application.php

示例11: __construct

 public function __construct(array $values = [])
 {
     parent::__construct($values);
     $this->register(new Provider\ServiceControllerServiceProvider());
     $this->setupServices();
     $this->setupRouting();
 }
开发者ID:xrstf,项目名称:oeis-api,代码行数:7,代码来源:Application.php

示例12: __construct

 public function __construct(array $config = array())
 {
     parent::__construct();
     $this->values = array_merge($this->values, $config);
     $this->register(new TwigServiceProvider(), array('twig.path' => __DIR__ . '/../../app/views'));
     $this->register(new ServiceControllerServiceProvider());
 }
开发者ID:chrisdkemper,项目名称:sample-neo4j-php-application,代码行数:7,代码来源:Application.php

示例13: __construct

 /**
  * @constructor
  *
  * @param EnvironmentInterface $environment
  * @param Injector             $injector
  * @param array                $configuration
  */
 public function __construct(EnvironmentInterface $environment, Injector $injector, array $configuration)
 {
     $this->environment = $environment;
     $this->injector = $injector;
     $this->configuration = $configuration;
     parent::__construct([]);
 }
开发者ID:j7mbo,项目名称:aurex,代码行数:14,代码来源:Aurex.php

示例14: __construct

 public function __construct(array $values = [])
 {
     $this->defaultScope = self::SCOPE_PUBLIC;
     parent::__construct($values);
     $this->defaultScope = self::SCOPE_PRIVATE;
     $this->currentScope = self::SCOPE_PUBLIC;
 }
开发者ID:mlebkowski,项目名称:silex-private-scope,代码行数:7,代码来源:ScopedApplication.php

示例15: __construct

 /**
  * @param array       $basePath
  * @param Environment $environment
  */
 public function __construct($basePath, Environment $environment)
 {
     parent::__construct();
     $this['path'] = $basePath;
     $this['env'] = $environment;
     $this->bindPathsInApplicationContainer();
     $this->bindConfiguration();
     // Register Gateways...
     $this->register(new WebGatewayProvider());
     $this->register(new ApiGatewayProvider());
     $this->register(new OAuthGatewayProvider());
     // Services...
     $this->register(new SessionServiceProvider());
     $this->register(new FormServiceProvider());
     $this->register(new UrlGeneratorServiceProvider());
     $this->register(new ControllerResolverServiceProvider());
     $this->register(new DatabaseServiceProvider());
     $this->register(new ValidatorServiceProvider());
     $this->register(new TranslationServiceProvider());
     $this->register(new MonologServiceProvider(), ['monolog.logfile' => $this->config('log.path') ?: "{$basePath}/log/app.log", 'monolog.name' => 'opencfp', 'monlog.level' => strtoupper($this->config('log.level') ?: 'debug')]);
     $this->register(new SwiftmailerServiceProvider(), ['swiftmailer.options' => ['host' => $this->config('mail.host'), 'port' => $this->config('mail.port'), 'username' => $this->config('mail.username'), 'password' => $this->config('mail.password'), 'encryption' => $this->config('mail.encryption'), 'auth_mode' => $this->config('mail.auth_mode')]]);
     $this->register(new SentryServiceProvider());
     $this->register(new TwigServiceProvider());
     $this->register(new HtmlPurifierServiceProvider());
     $this->register(new SpotServiceProvider());
     $this->register(new ImageProcessorProvider());
     $this->register(new ResetEmailerServiceProvider());
     // Application Services...
     $this->register(new ApplicationServiceProvider());
     $this->registerGlobalErrorHandler($this);
     if ($timezone = $this->config('application.date_timezone')) {
         date_default_timezone_set($timezone);
     }
 }
开发者ID:cgrandval,项目名称:opencfp,代码行数:38,代码来源:Application.php


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