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


PHP PresenterComponentReflection::parseAnnotation方法代碼示例

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


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

示例1: checkRequirements

 /**
  * This allows me to implement a basic access control for presenters.
  *
  * This method is called for every presenter run,
  * once it's created before the presenter startup,
  * and for every other lifecycle methods, like render, action and signals.
  */
 public function checkRequirements($element)
 {
     $user = PresenterComponentReflection::parseAnnotation($element, 'User');
     if ($user === FALSE) {
         return;
         // not protected
     }
     if (!$this->getUser()->isLoggedIn()) {
         $this->forbiddenAccess();
     }
 }
開發者ID:martinmayer,項目名稱:notejam,代碼行數:18,代碼來源:BasePresenter.php

示例2: getPersistentComponents

 /**
  * Returns array of persistent components.
  * This default implementation detects components by class-level annotation @persistent(cmp1, cmp2).
  * @return array
  */
 public static function getPersistentComponents()
 {
     return (array) PresenterComponentReflection::parseAnnotation(new \ReflectionClass(get_called_class()), 'persistent');
 }
開發者ID:voda,項目名稱:application,代碼行數:9,代碼來源:Presenter.php

示例3: getPersistentParams

 /**
  * Returns array of classes persistent parameters. They have public visibility and are non-static.
  * This default implementation detects persistent parameters by annotation @persistent.
  * @return array
  */
 public static function getPersistentParams()
 {
     $rc = new \ReflectionClass(get_called_class());
     $params = array();
     foreach ($rc->getProperties(\ReflectionProperty::IS_PUBLIC) as $rp) {
         if (!$rp->isStatic() && PresenterComponentReflection::parseAnnotation($rp, 'persistent')) {
             $params[] = $rp->getName();
         }
     }
     return $params;
 }
開發者ID:jave007,項目名稱:test,代碼行數:16,代碼來源:PresenterComponent.php


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