• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP PhpGenerator\ClassType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Nette\PhpGenerator\ClassType的典型用法代码示例。如果您正苦于以下问题:PHP ClassType类的具体用法?PHP ClassType怎么用?PHP ClassType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: afterCompile

 public function afterCompile(ClassType $class)
 {
     if (!$this->enabled) {
         return;
     }
     $config = $this->getConfig($this->defaults);
     $initialize = $class->getMethod('initialize');
     // AppName and license
     if (isset($config['appName']) && !is_array($config['appName'])) {
         $initialize->addBody('\\VrtakCZ\\NewRelic\\Tracy\\Bootstrap::setup(?, ?);', [$config['appName'], isset($config['license']) ? $config['license'] : NULL]);
     } elseif (isset($config['appName']) && is_array($config['appName'])) {
         if (!isset($config['appName']['*'])) {
             throw new \RuntimeException('Missing default app name as "*"');
         }
         $initialize->addBody('\\VrtakCZ\\NewRelic\\Tracy\\Bootstrap::setup(?, ?);', [$config['appName']['*'], isset($config['license']) ? $config['license'] : NULL]);
     }
     // Logger
     $initialize->addBody('\\Tracy\\Debugger::setLogger(new \\VrtakCZ\\NewRelic\\Tracy\\Logger(?));', [array_unique($config['logLevel'])]);
     $this->setupCustom($initialize);
     // Options
     if ($config['rum']['enabled'] !== 'auto') {
         $initialize->addBody('newrelic_disable_autorum();');
     }
     $initialize->addBody("ini_set('newrelic.transaction_tracer.enabled', ?);", [(string) $config['transactionTracer']['enabled']]);
     $initialize->addBody("ini_set('newrelic.transaction_tracer.detail', ?);", [(string) $config['transactionTracer']['detail']]);
     $initialize->addBody("ini_set('newrelic.transaction_tracer.record_sql', ?);", [(string) $config['transactionTracer']['recordSql']]);
     $initialize->addBody("ini_set('newrelic.transaction_tracer.slow_sql', ?);", [(string) $config['transactionTracer']['slowSql']]);
     $initialize->addBody("ini_set('newrelic.transaction_tracer.threshold', ?);", [(string) $config['transactionTracer']['threshold']]);
     $initialize->addBody("ini_set('newrelic.transaction_tracer.stack_trace_thresholdshow', ?);", [(string) $config['transactionTracer']['stackTraceThreshold']]);
     $initialize->addBody("ini_set('newrelic.transaction_tracer.explain_threshold', ?);", [(string) $config['transactionTracer']['explainThreshold']]);
     $initialize->addBody("ini_set('newrelic.error_collector.enabled', ?);", [(string) $config['errorCollector']['enabled']]);
     $initialize->addBody("ini_set('newrelic.error_collector.record_database_errors', ?);", [(string) $config['errorCollector']['recordDatabaseErrors']]);
     $initialize->addBody('newrelic_capture_params(?);', [$config['parameters']['capture']]);
     $initialize->addBody("ini_set('newrelic.ignored_params', ?);", [implode(',', $config['parameters']['ignored'])]);
 }
开发者ID:vrtak-cz,项目名称:newrelic-nette,代码行数:35,代码来源:Extension.php


示例2: afterCompile

 public function afterCompile(Code\ClassType $class)
 {
     $init = $class->getMethod('initialize');
     $originalInitialize = $init->getBody();
     $init->setBody('Doctrine\\Common\\Annotations\\AnnotationRegistry::registerLoader("class_exists");' . "\n");
     $init->addBody($originalInitialize);
 }
开发者ID:kdyby,项目名称:annotations,代码行数:7,代码来源:AnnotationsExtension.php


示例3: afterCompile

 public function afterCompile(ClassType $class)
 {
     if ($this->isCli()) {
         return;
     }
     $class->getMethod('initialize')->addBody('header(?);', ['X-Clacks-Overhead: GNU Terry Pratchett']);
 }
开发者ID:lookyman,项目名称:pratchett,代码行数:7,代码来源:PratchettExtension.php


示例4: afterCompile

 public function afterCompile(Nette\PhpGenerator\ClassType $class)
 {
     $initialize = $class->getMethod('initialize');
     $builder = $this->getContainerBuilder();
     $options = $this->config;
     unset($options['bar'], $options['blueScreen']);
     if (isset($options['logSeverity'])) {
         $res = 0;
         foreach ((array) $options['logSeverity'] as $level) {
             $res |= is_int($level) ? $level : constant($level);
         }
         $options['logSeverity'] = $res;
     }
     foreach ($options as $key => $value) {
         if ($value !== NULL) {
             $key = ($key === 'fromEmail' ? 'getLogger()->' : '$') . $key;
             $initialize->addBody($builder->formatPhp('Tracy\\Debugger::' . $key . ' = ?;', Nette\DI\Compiler::filterArguments([$value])));
         }
     }
     $logger = $builder->getDefinition($this->prefix('logger'));
     if ($logger->getFactory()->getEntity() !== 'Tracy\\Debugger::getLogger') {
         $initialize->addBody($builder->formatPhp('Tracy\\Debugger::setLogger(?);', [$logger]));
     }
     if ($this->debugMode) {
         foreach ((array) $this->config['bar'] as $item) {
             $initialize->addBody($builder->formatPhp('$this->getService(?)->addPanel(?);', Nette\DI\Compiler::filterArguments([$this->prefix('bar'), is_string($item) ? new Nette\DI\Statement($item) : $item])));
         }
         if (!$this->cliMode) {
             $initialize->addBody('if ($tmp = $this->getByType("Nette\\Http\\Session", FALSE)) { $tmp->start(); Tracy\\Debugger::dispatch(); };');
         }
     }
     foreach ((array) $this->config['blueScreen'] as $item) {
         $initialize->addBody($builder->formatPhp('$this->getService(?)->addPanel(?);', Nette\DI\Compiler::filterArguments([$this->prefix('blueScreen'), $item])));
     }
 }
开发者ID:manGoweb,项目名称:mnamGo,代码行数:35,代码来源:TracyExtension.php


示例5: afterCompile

 public function afterCompile(Nette\PhpGenerator\ClassType $class)
 {
     $methods = $class->getMethods();
     $init = $methods['initialize'];
     $init->addBody('vojtabiberle\\MediaStorage\\Bridges\\Nette\\Forms\\Controls\\SingleSelectFileChoicer::register();');
     $init->addBody('vojtabiberle\\MediaStorage\\Bridges\\Nette\\Forms\\Controls\\MultiSelectFileChoicer::register();');
 }
开发者ID:vojtabiberle,项目名称:MediaStorage,代码行数:7,代码来源:Extension.php


示例6: afterCompile

 public function afterCompile(ClassType $class)
 {
     $initialize = $class->getMethod('initialize');
     $initialize->addBody('$moduleManager = $this->getService(?);', [$this->getContainerBuilder()->getByType(ModuleManager::class)]);
     $initialize->addBody('foreach ($this->findByType(\'' . IModule::class . '\') as $module) {' . "\n" . '   $moduleManager->registerModule($this->getService($module));' . "\n" . '}');
     $initialize->addBody('$moduleManager->prepareModules();');
 }
开发者ID:phoenixcms,项目名称:modules,代码行数:7,代码来源:ModulesExtension.php


示例7: afterCompile

 public function afterCompile(ClassType $class)
 {
     $config = $this->getConfig($this->defaults);
     if ($config['enabled']) {
         $init = $class->getMethod('initialize');
         $init->addBody(Debugger::class . '::setLogger(new ' . SlackLogger::class . '(?, $this->getService(?), ?));', [$config['slackUrl'], $this->prefix('messageFactory'), $config['timeout']]);
     }
 }
开发者ID:greeny,项目名称:nette-slack-logger,代码行数:8,代码来源:SlackLoggerExtension.php


示例8: afterCompile

 public function afterCompile(ClassType $class)
 {
     $builder = $this->getContainerBuilder();
     $init = $class->getMethod('initialize');
     if ($builder->hasDefinition($this->prefix('bar'))) {
         $init->addBody('$this->getByType(?)->addPanel($this->getService(?));', array('Tracy\\Bar', $this->prefix('bar')));
     }
 }
开发者ID:stekycz,项目名称:cronner,代码行数:8,代码来源:CronnerExtension.php


示例9: afterCompile

 public function afterCompile(Nette\PhpGenerator\ClassType $class)
 {
     $init = $class->getMethods()['initialize'];
     $config = $this->validateConfig($this->defaults);
     if ($config['paginatorTemplate']) {
         $init->addBody('?::$defaultPaginationTemplate = ?;', [Settings::class, $config['paginatorTemplate']]);
     }
 }
开发者ID:WebChemistry,项目名称:filter,代码行数:8,代码来源:FilterExtension.php


示例10: afterCompile

 /**
  * Adjusts DI container compiled to PHP class. Intended to be overridden by descendant.
  *
  * @param Nette\PhpGenerator\ClassType $class
  */
 public function afterCompile(Nette\PhpGenerator\ClassType $class)
 {
     $initialize = $class->getMethod('initialize');
     $builder = $this->getContainerBuilder();
     if ($builder->parameters['debugMode'] && $builder->hasDefinition(self::TRACY_PANEL)) {
         $initialize->addBody($builder->formatPhp('?;', [new Nette\DI\Statement('@Tracy\\Bar::addPanel', ['@' . self::TRACY_PANEL, self::TRACY_PANEL])]));
     }
 }
开发者ID:sw2eu,项目名称:load-common,代码行数:13,代码来源:LoadExtension.php


示例11: afterCompile

 /**
  * @param Nette\PhpGenerator\ClassType $class
  */
 public function afterCompile(Nette\PhpGenerator\ClassType $class)
 {
     $methods = $class->getMethods();
     $init = $methods['initialize'];
     if ($this->getContainerBuilder()->hasDefinition($this->prefix('bar'))) {
         $init->addBody('if ($this->parameters["debugMode"]) Tracy\\Debugger::getBar()->addPanel($this->getService(?));', [$this->prefix('bar')]);
     }
 }
开发者ID:webchemistry,项目名称:parameters,代码行数:11,代码来源:ParametersExtension.php


示例12: afterCompile

 /**
  * @param ClassType $class
  */
 public function afterCompile(ClassType $class)
 {
     $config = $this->validateConfig($this->defaults);
     if ($config['auto'] === TRUE) {
         $method = $class->getMethod('initialize');
         $method->addBody('?::bind($this->getService(?));', [new PhpLiteral(FormBinder::class), $this->prefix('providerFactory')]);
     }
 }
开发者ID:minetro,项目名称:seznamcaptcha,代码行数:11,代码来源:SeznamCaptchaExtension.php


示例13: afterCompile

 public function afterCompile(PhpGenerator\ClassType $class)
 {
     $config = $this->getConfig(self::$configDefaults);
     $initialize = $class->getMethod('initialize');
     // response syntax highlighting in debug mode
     if ($config['debugMode'] == TRUE) {
         $initialize->addBody('$this->getService(?)->onResponse[] = [new Tripomatic\\NetteApi\\Application\\ResponseProcessors\\ResponseDecorator, "process"];', ['application.application']);
     }
 }
开发者ID:tripomatic,项目名称:nette-api,代码行数:9,代码来源:ApiExtension.php


示例14: afterCompile

 /**
  * Register UUID type into doctrine.
  * @param ClassType  $container
  */
 public function afterCompile(ClassType $container)
 {
     $initialize = $container->getMethod('initialize');
     $builder = $this->getContainerBuilder();
     $initialize->addBody('?::addType(?, ?);', [Type::class, 'uuid', UuidType::class]);
     foreach ($builder->findByType(Connection::class) as $name => $connection) {
         $initialize->addBody('$this->getService(?)->getDatabasePlatform()->registerDoctrineTypeMapping(?, ?);', [$name, 'uuid', 'uuid']);
     }
 }
开发者ID:juniwalk,项目名称:juniwalk.cz,代码行数:13,代码来源:UuidDoctrineExtension.php


示例15: afterCompile

 /**
  * @param ClassType $class
  * @return void
  */
 public function afterCompile(ClassType $class)
 {
     $config = $this->validateConfig($this->defaults);
     if ($config['siteKey'] != NULL) {
         $method = $class->getMethod('initialize');
         $method->addBody(sprintf('%s::bind(?);', ReCaptchaBinding::class), [$config['siteKey']]);
         $method->addBody(sprintf('%s::factory(?);', ReCaptchaHolder::class), [$config['siteKey']]);
     }
 }
开发者ID:minetro,项目名称:recaptcha,代码行数:13,代码来源:ReCaptchaExtension.php


示例16: afterCompile

 public function afterCompile(ClassType $class)
 {
     $initialize = $class->getMethod('initialize');
     $initialize->addBody('$this->getService("tracy.bar")->addPanel($this->getService("l10n_nette_translator.panel"));');
     $initialize->addBody('$response = $this->getService("l10n_nette_translator.processor")->run();');
     $initialize->addBody('if($response instanceof Nette\\Application\\IResponse) {');
     $initialize->addBody(' $response->send($this->getByType("Nette\\Http\\IRequest"), $this->getByType("Nette\\Http\\IResponse"));');
     $initialize->addBody(' exit();');
     $initialize->addBody('}');
 }
开发者ID:zemistr,项目名称:l10n-nette-translator,代码行数:10,代码来源:Extension.php


示例17: afterCompile

 public function afterCompile(Nette\PhpGenerator\ClassType $class)
 {
     if ($this->getConfig()['registerDefaultUrl']) {
         $url = $this->getConfig($this->defaults)['url'];
         $initializeMethod = $class->getMethod('initialize');
         $initializeMethod->addBody('Kdyby\\TranslationControl\\DI\\TranslationControlExtension::registerRoute(
             $this->getService("router"), "' . $url . '"
         );');
     }
 }
开发者ID:Kdyby,项目名称:TranslationControl,代码行数:10,代码来源:TranslationControlExtension.php


示例18: afterCompile

 public function afterCompile(ClassType $class)
 {
     $config = $this->getConfig($this->defaults);
     Validators::assertField($config, 'enabled', 'boolean');
     if ($config['enabled']) {
         Validators::assertField($config, 'slackUrl', 'string');
         Validators::assertField($config, 'logUrl', 'string');
         $init = $class->getMethod('initialize');
         $init->addBody(Debugger::class . '::setLogger(new ' . SlackLogger::class . '(?, ?));', [$config['slackUrl'], $config['logUrl']]);
     }
 }
开发者ID:vysinsky,项目名称:nette-slack-logger,代码行数:11,代码来源:SlackLoggerExtension.php


示例19: afterCompile

 public function afterCompile(Nette\PhpGenerator\ClassType $class)
 {
     $initialize = $class->getMethod('initialize');
     $config = $this->getConfig();
     $name = $this->prefix('session');
     if ($config['autoStart'] === 'smart') {
         $initialize->addBody('$this->getService(?)->exists() && $this->getService(?)->start();', array($name, $name));
     } elseif ($config['autoStart']) {
         $initialize->addBody('$this->getService(?)->start();', array($name));
     }
 }
开发者ID:VasekPurchart,项目名称:khanovaskola-v3,代码行数:11,代码来源:SessionExtension.php


示例20: afterCompile

 public function afterCompile(Nette\PhpGenerator\ClassType $class)
 {
     if (!empty($this->config['cache'])) {
         $method = $class->getMethod(Nette\DI\Container::getMethodName($this->prefix('router')));
         try {
             $router = serialize(eval($method->getBody()));
         } catch (\Exception $e) {
             throw new Nette\DI\ServiceCreationException('Unable to cache router due to error: ' . $e->getMessage(), 0, $e);
         }
         $method->setBody('return unserialize(?);', [$router]);
     }
 }
开发者ID:richard-ejem,项目名称:application,代码行数:12,代码来源:RoutingExtension.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP PhpGenerator\Helpers类代码示例发布时间:2022-05-23
下一篇:
PHP Mail\Message类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap