當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ClassType::getMethod方法代碼示例

本文整理匯總了PHP中Nette\PhpGenerator\ClassType::getMethod方法的典型用法代碼示例。如果您正苦於以下問題:PHP ClassType::getMethod方法的具體用法?PHP ClassType::getMethod怎麽用?PHP ClassType::getMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Nette\PhpGenerator\ClassType的用法示例。


在下文中一共展示了ClassType::getMethod方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


注:本文中的Nette\PhpGenerator\ClassType::getMethod方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。