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


PHP ClassType::getMethods方法代碼示例

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


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

示例1: injectComponentFactories

 /**
  * @param \Nette\DI\Container $dic
  * @throws MemberAccessException
  * @internal
  */
 public function injectComponentFactories(Nette\DI\Container $dic)
 {
     if (!$this instanceof Nette\Application\UI\PresenterComponent && !$this instanceof Nette\Application\UI\Component) {
         throw new MemberAccessException('Trait ' . __TRAIT__ . ' can be used only in descendants of PresenterComponent.');
     }
     $this->autowireComponentFactoriesLocator = $dic;
     $storage = $dic->hasService('autowired.cacheStorage') ? $dic->getService('autowired.cacheStorage') : $dic->getByType('Nette\\Caching\\IStorage');
     $cache = new Nette\Caching\Cache($storage, 'Kdyby.Autowired.AutowireComponentFactories');
     if ($cache->load($presenterClass = get_class($this)) !== NULL) {
         return;
     }
     $ignore = class_parents('Nette\\Application\\UI\\Presenter') + ['ui' => 'Nette\\Application\\UI\\Presenter'];
     $rc = new ClassType($this);
     foreach ($rc->getMethods() as $method) {
         if (in_array($method->getDeclaringClass()->getName(), $ignore, TRUE) || !Strings::startsWith($method->getName(), 'createComponent')) {
             continue;
         }
         foreach ($method->getParameters() as $parameter) {
             if (!($class = $parameter->getClassName())) {
                 // has object type hint
                 continue;
             }
             if (!$this->findByTypeForFactory($class) && !$parameter->allowsNull()) {
                 throw new MissingServiceException("No service of type {$class} found. Make sure the type hint in {$method} is written correctly and service of this type is registered.");
             }
         }
     }
     $files = array_map(function ($class) {
         return ClassType::from($class)->getFileName();
     }, array_diff(array_values(class_parents($presenterClass) + ['me' => $presenterClass]), $ignore));
     $files[] = ClassType::from($this->autowireComponentFactoriesLocator)->getFileName();
     $cache->save($presenterClass, TRUE, [$cache::FILES => $files]);
 }
開發者ID:kdyby,項目名稱:autowired,代碼行數:38,代碼來源:AutowireComponentFactories.php

示例2: loadGettersSetters

 protected function loadGettersSetters()
 {
     $methods = [];
     foreach ($this->reflection->getMethods() as $method) {
         $methods[strtolower($method->name)] = $method;
     }
     foreach ($this->metadata->getProperties() as $name => $property) {
         $getter = 'getter' . strtolower($name);
         if (isset($methods[$getter])) {
             $property->hasGetter = TRUE;
         }
         $setter = 'setter' . strtolower($name);
         if (isset($methods[$setter])) {
             $property->hasSetter = TRUE;
         }
     }
 }
開發者ID:Vyki,項目名稱:orm,代碼行數:17,代碼來源:MetadataParser.php

示例3: startup

 public function startup()
 {
     parent::startup();
     $classReflection = new Nette\Reflection\ClassType('Helpers');
     $methods = $classReflection->getMethods();
     foreach ($methods as $method) {
         $this->template->registerHelper($method->getName(), 'Helpers::' . $method->getName());
     }
     $this->template->kategorie = $this->kategorie->getMenu();
     $this->template->aktuality = $this->clanky->getClanky(5, 0, "aktuality", null, true);
 }
開發者ID:stanley89,項目名稱:piratskelisty,代碼行數:11,代碼來源:BasePresenter.php

示例4: getSubscribedEvents

 /**
  * @return array
  */
 public final function getSubscribedEvents()
 {
     $list = [];
     $ref = new ClassType($this);
     foreach ($ref->getMethods() as $method) {
         if ($method->getAnnotation('subscribe')) {
             $list[] = $method->name;
         }
     }
     return $list;
 }
開發者ID:VasekPurchart,項目名稱:khanovaskola-v3,代碼行數:14,代碼來源:Badge.php

示例5: classToMD

 /**
  * Generates markdown output for a specified class
  * @param string $class e.g. `PDO` or a user class like `diversen\markdownDocs`
  * @return void the method adds to $output
  */
 public function classToMD($class, $options = [])
 {
     $r = new ClassType($class);
     $this->output .= $this->sectionHeader('Class: ' . $r->getName(), 3);
     // Class description
     $this->output .= $r->getDescription() . $this->getNL();
     // Get methods and props
     $methods = $r->getMethods();
     $props = $r->getDefaultProperties();
     // Parse properties
     $this->output .= $this->sectionHeader("Properties");
     $this->generatePropsMD($r, $props, $options);
     // Parse methods
     $this->output .= $this->sectionHeader("Methods");
     $this->generateMethodMD($methods, $options);
 }
開發者ID:diversen,項目名稱:php-markdown-docs,代碼行數:21,代碼來源:markdownDocs.php

示例6: addTasks

 /**
  * Adds task case to be processed when cronner runs. If tasks
  * with name which is already added are given then throws
  * an exception.
  *
  * @param object $tasks
  * @return \stekycz\Cronner\Cronner
  * @throws \stekycz\Cronner\InvalidArgumentException
  */
 public function addTasks($tasks)
 {
     $tasksId = $this->createIdFromObject($tasks);
     if (in_array($tasksId, $this->registeredTaskObjects)) {
         throw new InvalidArgumentException("Tasks with ID '" . $tasksId . "' have been already added.");
     }
     $reflection = new ClassType($tasks);
     $methods = $reflection->getMethods(ReflectionMethod::IS_PUBLIC);
     foreach ($methods as $method) {
         if (!Strings::startsWith($method->getName(), '__') && $method->hasAnnotation(Parameters::TASK)) {
             $task = new Task($tasks, $method, $this->timestampStorage);
             if (array_key_exists($task->getName(), $this->tasks)) {
                 throw new DuplicateTaskNameException('Cannot use more tasks with the same name "' . $task->getName() . '".');
             }
             $this->tasks[$task->getName()] = $task;
         }
     }
     $this->registeredTaskObjects[] = $tasksId;
     return $this;
 }
開發者ID:MartkCz,項目名稱:Cronner,代碼行數:29,代碼來源:Cronner.php


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