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


PHP Zend_Reflection_Class类代码示例

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


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

示例1: routeShutdown

 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     if (!in_array(Zend_Controller_Front::getInstance()->getRouter()->getCurrentRouteName(), array('admin', 'admin_language'))) {
         return;
     }
     $resource = new User_Model_Acl_Resource();
     $resource->getAdminPrivileges();
     if ($resource->admin_privileges) {
         //$actionStack = Zend_Controller_Action_HelperBroker::getStaticHelper('ActionStack');
         $actionStack = new Zend_Controller_Plugin_ActionStack();
         foreach ($resource->admin_privileges as $module => $actions) {
             $class = ucfirst($module) . '_AdminController';
             if (!class_exists($class)) {
                 Zend_Loader::loadFile(APPLICATION_PATH . '/modules/' . $module . '/controllers/AdminController.php');
             }
             $reflection = new Zend_Reflection_Class($class);
             $method = null;
             try {
                 if ($method = $reflection->getMethod('menuAction')) {
                     $actionStack->pushStack(new Zend_Controller_Request_Simple('menu', 'admin', $module, array('admin_actions' => array_flip($actions))));
                 }
             } catch (Exception $e) {
             }
         }
     }
 }
开发者ID:ankuradhey,项目名称:laundry,代码行数:26,代码来源:AdminMenu.php

示例2: testToString

 public function testToString()
 {
     $classReflection = new Zend_Reflection_Class('Zend_Reflection_TestSampleClass6');
     $tag = $classReflection->getMethod('doSomething')->getDocblock()->getTag('descriptionTag');
     $expectedString = "Docblock Tag [ * @descriptionTag ]" . PHP_EOL;
     $this->assertEquals($expectedString, (string) $tag);
 }
开发者ID:travisj,项目名称:zf,代码行数:7,代码来源:TagTest.php

示例3: fromReflection

 /**
  * fromReflection() - build a Code Generation PHP Object from a Class Reflection
  *
  * @param Zend_Reflection_Class $reflectionClass
  * @return dmZendCodeGeneratorPhpClass
  */
 public static function fromReflection(Zend_Reflection_Class $reflectionClass)
 {
     $class = new self();
     $class->setSourceContent($class->getSourceContent());
     $class->setSourceDirty(false);
     if ($reflectionClass->getDocComment() != '') {
         $class->setDocblock(Zend_CodeGenerator_Php_Docblock::fromReflection($reflectionClass->getDocblock()));
     }
     $class->setAbstract($reflectionClass->isAbstract());
     $class->setName($reflectionClass->getName());
     if ($parentClass = $reflectionClass->getParentClass()) {
         $class->setExtendedClass($parentClass->getName());
         $interfaces = array_diff($parentClass->getInterfaces(), $reflectionClass->getInterfaces());
     } else {
         $interfaces = $reflectionClass->getInterfaces();
     }
     $class->setImplementedInterfaces($interfaces);
     $properties = array();
     foreach ($reflectionClass->getProperties() as $reflectionProperty) {
         if ($reflectionProperty->getDeclaringClass()->getName() == $class->getName()) {
             $properties[] = Zend_CodeGenerator_Php_Property::fromReflection($reflectionProperty);
         }
     }
     $class->setProperties($properties);
     $methods = array();
     foreach ($reflectionClass->getMethods(-1, 'dmZendReflectionMethod') as $reflectionMethod) {
         if ($reflectionMethod->getDeclaringClass()->getName() == $class->getName()) {
             $methods[] = dmZendCodeGeneratorPhpMethod::fromReflection($reflectionMethod);
         }
     }
     $class->setMethods($methods);
     return $class;
 }
开发者ID:theolymp,项目名称:diem,代码行数:39,代码来源:Class.php

示例4: getCodeKeys

 public static function getCodeKeys()
 {
     if (null === self::$_codeKeys) {
         $r = new Zend_Reflection_Class(__CLASS__);
         self::$_codeKeys = array_flip($r->getConstants());
     }
     return self::$_codeKeys;
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:8,代码来源:Exception.php

示例5: testInterfaceReturn

 public function testInterfaceReturn()
 {
     $reflectionClass = new Zend_Reflection_Class('Zend_Reflection_TestSampleClass4');
     $interfaces = $reflectionClass->getInterfaces();
     $this->assertEquals(count($interfaces), 1);
     $interface = array_shift($interfaces);
     $this->assertEquals($interface->getName(), 'Zend_Reflection_TestSampleClassInterface');
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:8,代码来源:ClassTest.php

示例6: testNamespaceInParam

 /**
  * @group ZF-8307
  */
 public function testNamespaceInParam()
 {
     $classReflection = new Zend_Reflection_Class('Zend_Reflection_Docblock_Param_WithNamespace');
     $paramTag = $classReflection->getMethod('doSomething')->getDocblock()->getTag('param');
     $this->assertEquals('Zend\\Foo\\Bar', $paramTag->getType());
     $this->assertEquals('$var', $paramTag->getVariableName());
     $this->assertEquals('desc', $paramTag->getDescription());
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:11,代码来源:ParamTest.php

示例7: testDocblockTags

 public function testDocblockTags()
 {
     $classReflection = new Zend_Reflection_Class('Zend_Reflection_TestSampleClass5');
     $this->assertEquals($classReflection->getMethod('doSomething')->getDocblock()->hasTag('return'), true);
     $returnTag = $classReflection->getMethod('doSomething')->getDocblock()->getTag('return');
     $this->assertEquals(get_class($returnTag), 'Zend_Reflection_Docblock_Tag_Return');
     $this->assertEquals($returnTag->getType(), 'mixed');
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:8,代码来源:DocblockTest.php

示例8: __construct

 public function __construct($object)
 {
     if ($object != null) {
         $refl = new Zend_Reflection_Class(get_class($object));
         $this->getReader()->setFile($refl->getFileName());
         $this->_object = $object;
     }
 }
开发者ID:BGCX262,项目名称:zsoc-svn-to-git,代码行数:8,代码来源:Object.php

示例9: _authenticateRequired

 /**
  * Prüft ob der Service einen Account benötigt
  * @param string $classname
  * @param string $methodname
  * @return boolean
  */
 private function _authenticateRequired($classname, $methodname)
 {
     try {
         $reflectionClass = new Zend_Reflection_Class($classname);
         return $reflectionClass->getMethod($methodname)->getDocblock()->hasTag('dragonx_account_authenticate');
     } catch (Exception $exception) {
     }
     return false;
 }
开发者ID:dragonprojects,项目名称:dragonjsonserver,代码行数:15,代码来源:Account.php

示例10: _build

 /**
  * Construção de Objetos para Elementos Internas
  * @param string $name Nome Completo da Classe
  * @return mixed Instância da Classe Solicitada
  * @throws Zend_Controller_Action_Exception Classe Inválida
  */
 private function _build($name, array $params = array())
 {
     if (!(is_string($name) && class_exists($name))) {
         throw new Zend_Controller_Action_Exception('Invalid Class Name');
     }
     // Construção
     $reflect = new Zend_Reflection_Class($name);
     // Retorno da Instância
     return $reflect->newInstance($params);
 }
开发者ID:laiello,项目名称:wanderson,代码行数:16,代码来源:ActionAbstract.php

示例11: _getProperties

 protected function _getProperties()
 {
     $propertyArray = array();
     $class = new Zend_Reflection_Class($this);
     $properties = $class->getProperties();
     foreach ($properties as $property) {
         if ($property->isPublic()) {
             $propertyArray[] = $property->getName();
         }
     }
     return $propertyArray;
 }
开发者ID:ankuradhey,项目名称:laundry,代码行数:12,代码来源:Abstract.php

示例12: _getClassUrl

 /**
  * Returns the URL for the given class' API page 
  * 
  * @param mixed $class 
  * @access protected
  * @return string
  */
 protected function _getClassUrl($class)
 {
     $reflection = new Zend_Reflection_Class($class);
     $docblock = $reflection->getDocblock();
     $url = $this->_zendApiUrl;
     if ($docblock->hasTag('package')) {
         $url .= $docblock->getTag('package')->getDescription();
     }
     if ($docblock->hasTag('subpackage')) {
         $url .= '/' . $docblock->getTag('subpackage')->getDescription();
     }
     $url .= '/' . $class . '.html';
     return $url;
 }
开发者ID:omusico,项目名称:logica,代码行数:21,代码来源:DisplayClass.php

示例13: _getFormReferencia

 /**
  * Captura um Formulário de Determinado Tipo
  * @param string Nome do Formulário
  * @return Local_Form_FormAbstract Elemento Solicitado
  */
 protected function _getFormReferencia($tipo)
 {
     // Filtro de Dados
     $filter = new Zend_Filter();
     $filter->addFilter(new Zend_Filter_StringToLower())->addFilter(new Zend_Filter_Callback('ucfirst'));
     $tipo = $filter->filter($tipo);
     // Verificação
     if (!in_array($tipo, $this->_references)) {
         throw new Zend_Controller_Action_Exception('Invalid Referencia');
     }
     $classname = 'Application_Form_Referencia_' . $tipo;
     $reflect = new Zend_Reflection_Class($classname);
     return $reflect->newInstance(array());
 }
开发者ID:laiello,项目名称:wanderson,代码行数:19,代码来源:ReferenciaController.php

示例14: InjectDependencies

 public function InjectDependencies($object)
 {
     $reflectionClass = new \Zend_Reflection_Class($object);
     //$reflectionProperty = new \Zend_Reflection_Property(null, null);
     foreach ($reflectionClass->getProperties() as $reflectionProperty) {
         /** @var \Zend_Reflection_Property $reflectionProperty */
         $reflectionDocComment = $reflectionProperty->getDocComment();
         if ($reflectionDocComment) {
             if ($reflectionDocComment->hasTag("Inject")) {
                 $reflectionDocCommentTag = $reflectionDocComment->getTag("Inject");
                 $dependencyName = $reflectionDocCommentTag->getDescription();
                 $dependency = $this->kernel->Get($dependencyName);
                 $reflectionProperty->setAccessible(true);
                 $reflectionProperty->setValue($object, $dependency);
             }
         }
     }
     //print_r($reflectionClass);
 }
开发者ID:jo-m,项目名称:ecamp3,代码行数:19,代码来源:Injecter.php

示例15: _callPlugins

 /**
  * Trigger Seotoaster plugins hooks
  *
  * @param $method string Method to trigger
  */
 private function _callPlugins($method)
 {
     $enabledPlugins = Tools_Plugins_Tools::getEnabledPlugins();
     if (is_array($enabledPlugins) && !empty($enabledPlugins)) {
         array_walk($enabledPlugins, function ($plugin, $key, $data) {
             try {
                 $name = ucfirst($plugin->getName());
                 Tools_Factory_PluginFactory::validate($name);
                 $reflection = new Zend_Reflection_Class($name);
                 if ($reflection->hasMethod($data['method'])) {
                     $pluginInstance = Tools_Factory_PluginFactory::createPlugin($plugin->getName(), array(), array('websiteUrl' => $data['websiteUrl']));
                     $pluginInstance->{$data}['method']();
                 }
             } catch (Exceptions_SeotoasterException $se) {
                 error_log($se->getMessage());
                 error_log($se->getTraceAsString());
             }
         }, array('method' => $method, 'websiteUrl' => Zend_Controller_Action_HelperBroker::getStaticHelper('Website')->getUrl()));
     }
 }
开发者ID:PavloKovalov,项目名称:seotoaster,代码行数:25,代码来源:Plugin.php


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