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


PHP ClassReflection::getProperties方法代码示例

本文整理汇总了PHP中Zend\Code\Reflection\ClassReflection::getProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassReflection::getProperties方法的具体用法?PHP ClassReflection::getProperties怎么用?PHP ClassReflection::getProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Code\Reflection\ClassReflection的用法示例。


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

示例1: addContent

 /**
  * Generate view content
  *
  * @param string          $moduleName
  * @param ClassReflection $loadedEntity
  */
 protected function addContent($moduleName, ClassReflection $loadedEntity)
 {
     // prepare some params
     $moduleIdentifier = $this->filterCamelCaseToUnderscore($moduleName);
     $entityName = $loadedEntity->getShortName();
     $entityParam = lcfirst($entityName);
     $listParam = lcfirst(str_replace('Entity', '', $entityName)) . 'List';
     $moduleRoute = $this->filterCamelCaseToDash($moduleName);
     // set action body
     $body = [];
     $body[] = 'use ' . $loadedEntity->getName() . ';';
     $body[] = '';
     $body[] = '$this->h1(\'' . $moduleIdentifier . '_title_index\');';
     $body[] = '?>';
     $body[] = '<table class="table table-bordered table-striped">';
     $body[] = '    <thead>';
     $body[] = '    <tr>';
     foreach ($loadedEntity->getProperties() as $property) {
         $body[] = '        <th><?php echo $this->translate(\'' . $moduleIdentifier . '_label_' . $this->filterCamelCaseToUnderscore($property->getName()) . '\'); ?></th>';
     }
     $body[] = '        <th width="95">';
     $body[] = '            <a class="btn btn-default btn-xs" href="<?php echo $this->url(\'' . $moduleRoute . '/create\'); ?>" title="<?php echo $this->translate(\'' . $moduleIdentifier . '_action_create\'); ?>">';
     $body[] = '                <i class="fa fa-plus"></i>';
     $body[] = '            </a>';
     $body[] = '        </th>';
     $body[] = '    </tr>';
     $body[] = '    </thead>';
     $body[] = '    <tbody>';
     $body[] = '    <?php /** @var ' . $entityName . ' $' . $entityParam . ' */ ?>';
     $body[] = '    <?php foreach ($this->' . $listParam . ' as $' . $entityParam . '): ?>';
     $body[] = '        <tr>';
     foreach ($loadedEntity->getProperties() as $property) {
         $methodName = 'get' . ucfirst($property->getName());
         $body[] = '            <td><?php echo $' . $entityParam . '->' . $methodName . '() ?></td>';
     }
     $body[] = '            <td>';
     $body[] = '                <a class="btn btn-default btn-xs" href="<?php echo $this->url(\'' . $moduleRoute . '/show\', [\'id\' => $' . $entityParam . '->getIdentifier()]); ?>" title="<?php echo $this->translate(\'' . $moduleIdentifier . '_action_show\'); ?>">';
     $body[] = '                    <i class="fa fa-search"></i>';
     $body[] = '                </a>';
     $body[] = '                <a class="btn btn-default btn-xs" href="<?php echo $this->url(\'' . $moduleRoute . '/update\', [\'id\' => $' . $entityParam . '->getIdentifier()]); ?>" title="<?php echo $this->translate(\'' . $moduleIdentifier . '_action_update\'); ?>">';
     $body[] = '                    <i class="fa fa-pencil"></i>';
     $body[] = '                </a>';
     $body[] = '                <a class="btn btn-default btn-xs" href="<?php echo $this->url(\'' . $moduleRoute . '/delete\', [\'id\' => $' . $entityParam . '->getIdentifier()]); ?>" title="<?php echo $this->translate(\'' . $moduleIdentifier . '_action_delete\'); ?>">';
     $body[] = '                    <i class="fa fa-trash"></i>';
     $body[] = '                </a>';
     $body[] = '            </td>';
     $body[] = '        </tr>';
     $body[] = '    <?php endforeach; ?>';
     $body[] = '    </tbody>';
     $body[] = '</table>';
     $body = implode(AbstractGenerator::LINE_FEED, $body);
     // add method
     $this->setContent($body);
 }
开发者ID:zfrapid,项目名称:zf2rapid,代码行数:60,代码来源:IndexActionViewGenerator.php

示例2: fromReflection

 /**
  * Build a Code Generation Php Object from a Class Reflection
  *
  * @param  ClassReflection $classReflection
  * @return TraitGenerator
  */
 public static function fromReflection(ClassReflection $classReflection)
 {
     // class generator
     $cg = new static($classReflection->getName());
     $cg->setSourceContent($cg->getSourceContent());
     $cg->setSourceDirty(false);
     if ($classReflection->getDocComment() != '') {
         $cg->setDocBlock(DocBlockGenerator::fromReflection($classReflection->getDocBlock()));
     }
     // set the namespace
     if ($classReflection->inNamespace()) {
         $cg->setNamespaceName($classReflection->getNamespaceName());
     }
     $properties = array();
     foreach ($classReflection->getProperties() as $reflectionProperty) {
         if ($reflectionProperty->getDeclaringClass()->getName() == $classReflection->getName()) {
             $properties[] = PropertyGenerator::fromReflection($reflectionProperty);
         }
     }
     $cg->addProperties($properties);
     $methods = array();
     foreach ($classReflection->getMethods() as $reflectionMethod) {
         $className = $cg->getNamespaceName() ? $cg->getNamespaceName() . '\\' . $cg->getName() : $cg->getName();
         if ($reflectionMethod->getDeclaringClass()->getName() == $className) {
             $methods[] = MethodGenerator::fromReflection($reflectionMethod);
         }
     }
     $cg->addMethods($methods);
     return $cg;
 }
开发者ID:Flesh192,项目名称:magento,代码行数:36,代码来源:TraitGenerator.php

示例3: findProperties

 protected function findProperties(ClassReflection $class)
 {
     $result = array();
     foreach ($class->getProperties() as $property) {
         $result[] = $property;
     }
     return $result;
 }
开发者ID:nickvkaam,项目名称:SpraySerializer,代码行数:8,代码来源:AnnotationBackedPropertyInfo.php

示例4: testPropertyReturns

 public function testPropertyReturns()
 {
     $reflectionClass = new ClassReflection('ZendTest\\Code\\Reflection\\TestAsset\\TestSampleClass2');
     $propertyByName = $reflectionClass->getProperty('_prop1');
     $this->assertInstanceOf('Zend\\Code\\Reflection\\PropertyReflection', $propertyByName);
     $propertiesAll = $reflectionClass->getProperties();
     $this->assertEquals(2, count($propertiesAll));
     $firstProperty = array_shift($propertiesAll);
     $this->assertEquals('_prop1', $firstProperty->getName());
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:10,代码来源:ClassReflectionTest.php

示例5: addContent

 /**
  * Generate view content
  *
  * @param string          $moduleName
  * @param ClassReflection $loadedEntity
  */
 protected function addContent($moduleName, ClassReflection $loadedEntity)
 {
     // prepare some params
     $moduleIdentifier = $this->filterCamelCaseToUnderscore($moduleName);
     $entityName = $loadedEntity->getShortName();
     $entityParam = lcfirst($entityName);
     $formParam = lcfirst(str_replace('Entity', '', $loadedEntity->getShortName())) . 'DeleteForm';
     $moduleRoute = $this->filterCamelCaseToDash($moduleName);
     $deleteMessage = $moduleRoute . '_message_' . $moduleRoute . '_deleting_possible';
     // set action body
     $body = [];
     $body[] = 'use ' . $loadedEntity->getName() . ';';
     $body[] = '';
     $body[] = '/** @var ' . $entityName . ' $' . $entityParam . ' */';
     $body[] = '$' . $entityParam . ' = $this->' . $entityParam . ';';
     $body[] = '';
     $body[] = '$this->h1(\'' . $moduleIdentifier . '_title_delete\');';
     $body[] = '';
     $body[] = '$this->' . $formParam . '->setAttribute(\'action\', $this->url(\'' . $moduleRoute . '/delete\', [\'id\' => $' . $entityParam . '->getIdentifier()]));';
     $body[] = '';
     $body[] = '?>';
     $body[] = '<div class="well">';
     $body[] = '    <table class="table">';
     $body[] = '        <tbody>';
     foreach ($loadedEntity->getProperties() as $property) {
         $methodName = 'get' . ucfirst($property->getName());
         $body[] = '            <tr>';
         $body[] = '                <th class="col-sm-2 text-right"><?php echo $this->translate(\'' . $moduleIdentifier . '_label_' . $this->filterCamelCaseToUnderscore($property->getName()) . '\'); ?></th>';
         $body[] = '                <td class="col-sm-10"><?php echo $' . $entityParam . '->' . $methodName . '() ?></td>';
         $body[] = '            </tr>';
     }
     $body[] = '            <tr>';
     $body[] = '                <th class="col-sm-2 text-right">&nbsp;</th>';
     $body[] = '                <td class="col-sm-10"><?php echo $this->form($this->' . $formParam . '); ?></td>';
     $body[] = '            </tr>';
     $body[] = '        </tbody>';
     $body[] = '    </table>';
     $body[] = '</div>';
     $body[] = '<p>';
     $body[] = '    <a class="btn btn-primary" href="<?php echo $this->url(\'' . $moduleRoute . '\'); ?>">';
     $body[] = '        <i class="fa fa-table"></i>';
     $body[] = '        <?php echo $this->translate(\'' . $moduleIdentifier . '_action_index\'); ?>';
     $body[] = '    </a>';
     $body[] = '</p>';
     $body = implode(AbstractGenerator::LINE_FEED, $body);
     // add method
     $this->setContent($body);
 }
开发者ID:zfrapid,项目名称:zf2rapid,代码行数:54,代码来源:DeleteActionViewGenerator.php

示例6: addContent

 /**
  * Generate view content
  *
  * @param string          $moduleName
  * @param ClassReflection $loadedEntity
  */
 protected function addContent($moduleName, ClassReflection $loadedEntity)
 {
     // prepare some params
     $moduleIdentifier = $this->filterCamelCaseToUnderscore($moduleName);
     $entityName = $loadedEntity->getShortName();
     $entityParam = lcfirst($entityName);
     $moduleRoute = $this->filterCamelCaseToDash($moduleName);
     // set action body
     $body = [];
     $body[] = 'use ' . $loadedEntity->getName() . ';';
     $body[] = '';
     $body[] = '/** @var ' . $entityName . ' $' . $entityParam . ' */';
     $body[] = '$' . $entityParam . ' = $this->' . $entityParam . ';';
     $body[] = '';
     $body[] = '$this->h1(\'' . $moduleIdentifier . '_title_show\');';
     $body[] = '?>';
     $body[] = '<table class="table table-bordered">';
     $body[] = '    <tbody>';
     foreach ($loadedEntity->getProperties() as $property) {
         $methodName = 'get' . ucfirst($property->getName());
         $body[] = '        <tr>';
         $body[] = '            <th><?php echo $this->translate(\'' . $moduleIdentifier . '_label_' . $this->filterCamelCaseToUnderscore($property->getName()) . '\'); ?></th>';
         $body[] = '            <td><?php echo $' . $entityParam . '->' . $methodName . '() ?></td>';
         $body[] = '        </tr>';
     }
     $body[] = '    </tbody>';
     $body[] = '</table>';
     $body[] = '<p>';
     $body[] = '    <a class="btn btn-primary" href="<?php echo $this->url(\'' . $moduleRoute . '\'); ?>">';
     $body[] = '        <i class="fa fa-table"></i>';
     $body[] = '        <?php echo $this->translate(\'' . $moduleIdentifier . '_action_index\'); ?>';
     $body[] = '    </a>';
     $body[] = '</p>';
     $body = implode(AbstractGenerator::LINE_FEED, $body);
     // add method
     $this->setContent($body);
 }
开发者ID:zfrapid,项目名称:zf2rapid,代码行数:43,代码来源:ShowActionViewGenerator.php

示例7: fromReflection

 /**
  * fromReflection() - build a Code Generation Php Object from a Class Reflection
  *
  * @param ReflectionClass $classReflection
  * @return ClassGenerator
  */
 public static function fromReflection(ClassReflection $classReflection)
 {
     // class generator
     $cg = new static($classReflection->getName());
     $cg->setSourceContent($cg->getSourceContent());
     $cg->setSourceDirty(false);
     if ($classReflection->getDocComment() != '') {
         $cg->setDocblock(DocblockGenerator::fromReflection($classReflection->getDocblock()));
     }
     $cg->setAbstract($classReflection->isAbstract());
     // set the namespace
     if ($classReflection->inNamespace()) {
         $cg->setNamespaceName($classReflection->getNamespaceName());
     }
     /* @var $parentClass \Zend\Code\Reflection\ReflectionClass */
     if ($parentClass = $classReflection->getParentClass()) {
         $cg->setExtendedClass($parentClass->getName());
         $interfaces = array_diff($classReflection->getInterfaces(), $parentClass->getInterfaces());
     } else {
         $interfaces = $classReflection->getInterfaces();
     }
     $interfaceNames = array();
     foreach ($interfaces as $interface) {
         /* @var $interface \Zend\Code\Reflection\ReflectionClass */
         $interfaceNames[] = $interface->getName();
     }
     $cg->setImplementedInterfaces($interfaceNames);
     $properties = array();
     foreach ($classReflection->getProperties() as $reflectionProperty) {
         /* @var $reflectionProperty \PropertyReflection\Code\Reflection\ReflectionProperty */
         if ($reflectionProperty->getDeclaringClass()->getName() == $cg->getName()) {
             $properties[] = PropertyGenerator::fromReflection($reflectionProperty);
         }
     }
     $cg->setProperties($properties);
     $methods = array();
     foreach ($classReflection->getMethods() as $reflectionMethod) {
         /* @var $reflectionMethod \MethodReflection\Code\Reflection\ReflectionMethod */
         if ($reflectionMethod->getDeclaringClass()->getName() == $cg->getName()) {
             $methods[] = MethodGenerator::fromReflection($reflectionMethod);
         }
     }
     $cg->setMethods($methods);
     return $cg;
 }
开发者ID:brikou,项目名称:zend_code,代码行数:51,代码来源:ClassGenerator.php

示例8: _addClassAttributes

 /**
  * Generate map of public class attributes
  *
  * @param  string $typename type name
  * @param  DOMElement $typexml target XML element
  * @return void
  */
 protected function _addClassAttributes($typename, \DOMElement $typexml)
 {
     // Do not try to autoload here because _phpTypeToAS should
     // have already attempted to load this class
     if (!class_exists($typename, false)) {
         return;
     }
     $rc = new ClassReflection($typename);
     foreach ($rc->getProperties() as $prop) {
         if (!$prop->isPublic()) {
             continue;
         }
         $propxml = $this->_xml->createElement('property');
         $propxml->setAttribute('name', $prop->getName());
         $type = $this->_registerType($this->_getPropertyType($prop));
         $propxml->setAttribute('type', $type);
         $typexml->appendChild($propxml);
     }
 }
开发者ID:nevvermind,项目名称:zf2,代码行数:26,代码来源:Introspector.php

示例9: fromReflection

 /**
  * Build a Code Generation Php Object from a Class Reflection
  *
  * @param  ClassReflection $classReflection
  * @return ClassGenerator
  */
 public static function fromReflection(ClassReflection $classReflection)
 {
     $cg = new static($classReflection->getName());
     $cg->setSourceContent($cg->getSourceContent());
     $cg->setSourceDirty(false);
     if ($classReflection->getDocComment() != '') {
         $cg->setDocBlock(DocBlockGenerator::fromReflection($classReflection->getDocBlock()));
     }
     $cg->setAbstract($classReflection->isAbstract());
     // set the namespace
     if ($classReflection->inNamespace()) {
         $cg->setNamespaceName($classReflection->getNamespaceName());
     }
     /* @var \Zend\Code\Reflection\ClassReflection $parentClass */
     $parentClass = $classReflection->getParentClass();
     $interfaces = $classReflection->getInterfaces();
     if ($parentClass) {
         $cg->setExtendedClass($parentClass->getName());
         $interfaces = array_diff($interfaces, $parentClass->getInterfaces());
     }
     $interfaceNames = array();
     foreach ($interfaces as $interface) {
         /* @var \Zend\Code\Reflection\ClassReflection $interface */
         $interfaceNames[] = $interface->getName();
     }
     $cg->setImplementedInterfaces($interfaceNames);
     $properties = array();
     foreach ($classReflection->getProperties() as $reflectionProperty) {
         if ($reflectionProperty->getDeclaringClass()->getName() == $classReflection->getName()) {
             $properties[] = PropertyGenerator::fromReflection($reflectionProperty);
         }
     }
     $cg->addProperties($properties);
     $constants = array();
     foreach ($classReflection->getConstants() as $name => $value) {
         $constants[] = array('name' => $name, 'value' => $value);
     }
     $cg->addConstants($constants);
     $methods = array();
     foreach ($classReflection->getMethods() as $reflectionMethod) {
         $className = $cg->getNamespaceName() ? $cg->getNamespaceName() . "\\" . $cg->getName() : $cg->getName();
         if ($reflectionMethod->getDeclaringClass()->getName() == $className) {
             $methods[] = MethodGenerator::fromReflection($reflectionMethod);
         }
     }
     $cg->addMethods($methods);
     return $cg;
 }
开发者ID:vrann,项目名称:magento2-from-vendor,代码行数:54,代码来源:ClassGenerator.php

示例10: getClassProperties

 private function getClassProperties($entity)
 {
     $properties = array();
     $reflectedAuditedEntity = new ClassReflection($entity);
     // Get mapping from metadata
     foreach ($reflectedAuditedEntity->getProperties() as $property) {
         $property->setAccessible(true);
         $value = $property->getValue($entity);
         // If a property is an object we probably are not mapping that to
         // a field.  Do no special handing...
         if ($value instanceof PersistentCollection) {
         }
         // Set values to getId for classes
         if (gettype($value) == 'object' and method_exists($value, 'getId')) {
             $value = $value->getId();
         }
         $properties[$property->getName()] = $value;
     }
     return $properties;
 }
开发者ID:TomHAnderson,项目名称:SoliantEntityAudit,代码行数:20,代码来源:LogRevision.php

示例11: __construct

 function registerRoutes()
 {
     // Auto-register routes.
     if (!isset($this->classLoader->getPrefixesPsr4()[$this->config->namespacePrefix . '\\'])) {
         throw new Exception(sprintf('Namespace prefix "%s" defined in the config was not found in the autoloader.', $this->config->namespacePrefix));
     }
     $sourcePath = array_pop($this->classLoader->getPrefixesPsr4()[$this->config->namespacePrefix . '\\']);
     $routes = [];
     $app = $this->app;
     $formatNegotiator = $this->formatNegotiator;
     $serializer = $this->serializer;
     $config = $this->config;
     foreach ($this->getWebServiceClasses($this->config->namespacePrefix, $sourcePath) as $webServiceClass) {
         // Need to get methods and DTOs from class
         $classReflection = new ClassReflection($webServiceClass);
         $httpMethodNames = $this->config->httpMethodNames;
         $httpMethodReflections = array_filter($classReflection->getMethods(), function ($methodReflection) use($httpMethodNames) {
             return in_array($methodReflection->name, $httpMethodNames);
         });
         // @todo add a check to make sure DTOs are unique. This might happen implicitly when registering routes.
         // Call for each http method/DTO in web service
         /** @var MethodReflection $httpMethodReflection */
         foreach ($httpMethodReflections as $httpMethodReflection) {
             // This assumes that the first argument of the HTTP method is a DTO.
             $httpMethodReflectionPrototype = $httpMethodReflection->getPrototype();
             $requestDtoClass = array_shift($httpMethodReflectionPrototype['arguments'])['type'];
             $requestDtoClassReflection = new ClassReflection($requestDtoClass);
             $requestDtoProperties = $requestDtoClassReflection->getProperties();
             $returnDtoClass = $httpMethodReflection->getReturnType();
             $returnDtoProperties = (new ClassReflection($returnDtoClass))->getProperties();
             $requestMethod = $httpMethodReflectionPrototype['name'];
             $route = '/' . $this->config->baseUrl . '/' . $requestDtoClassReflection->getShortName();
             $routes[] = new class($route, $requestDtoClass, $requestDtoProperties, $returnDtoClass, $returnDtoProperties)
             {
                 public $path;
                 public $requestDto;
                 public $requestDtoParameters;
                 public $returnDto;
                 public $returnDtoProperties;
                 public function __construct(string $path, string $requestDto, array $requestDtoParameters, string $returnDto, array $returnDtoProperties)
                 {
                     $this->path = $path;
                     $this->requestDto = $requestDto;
                     $this->requestDtoParameters = $requestDtoParameters;
                     $this->returnDto = $returnDto;
                     $this->returnDtoProperties = $returnDtoProperties;
                 }
             };
             $app->get($route, function () use($app, $formatNegotiator, $serializer, $config, $webServiceClass, $requestDtoClass, $requestMethod) {
                 /** @var Request $httpRequest */
                 $httpRequest = $app['request'];
                 // Convert request parameters to the request DTO.
                 $params = $serializer->serialize($httpRequest->query->all(), 'json');
                 $requestDto = $serializer->deserialize($params, $requestDtoClass, 'json');
                 // Get the response DTO by calling the HTTP method of the web service class, with the request DTO.
                 $responseDto = (new $webServiceClass())->{$requestMethod}($requestDto);
                 // Content negotiation
                 $format = $formatNegotiator->getBestFormat(implode(',', $httpRequest->getAcceptableContentTypes()), $config->contentNegotiation->priorities);
                 return new Response($serializer->serialize($responseDto, $format), 200, array('Content-Type' => $app['request']->getMimeType($format)));
             });
         }
     }
     /**
      * Register custom _routes meta route
      */
     $app->get($config->baseUrl . '/_routes', function () use($app, $formatNegotiator, $serializer, $config, $routes) {
         $httpRequest = $app['request'];
         $format = $formatNegotiator->getBestFormat(implode(',', $httpRequest->getAcceptableContentTypes()), $config->contentNegotiation->priorities);
         $serializedData = $serializer->serialize($routes, $format);
         $responseCode = Response::HTTP_OK;
         if ($serializedData === false) {
             $serializedData = '';
             $responseCode = Response::HTTP_INTERNAL_SERVER_ERROR;
         }
         return new Response($serializedData, $responseCode, array('Content-Type' => $app['request']->getMimeType($format)));
     });
 }
开发者ID:ethanhann,项目名称:fizzy,代码行数:77,代码来源:App.php

示例12: getGeneratorFromReflection

 /**
  * Copied from ClassGenerator::fromReflection and tweaked slightly
  * @param ClassReflection $classReflection
  *
  * @return ClassGenerator
  */
 public function getGeneratorFromReflection(ClassReflection $classReflection)
 {
     // class generator
     $cg = new ClassGenerator($classReflection->getName());
     $cg->setSourceContent($cg->getSourceContent());
     $cg->setSourceDirty(false);
     if ($classReflection->getDocComment() != '') {
         $docblock = DocBlockGenerator::fromReflection($classReflection->getDocBlock());
         $docblock->setIndentation(Generator::$indentation);
         $cg->setDocBlock($docblock);
     }
     $cg->setAbstract($classReflection->isAbstract());
     // set the namespace
     if ($classReflection->inNamespace()) {
         $cg->setNamespaceName($classReflection->getNamespaceName());
     }
     /* @var \Zend\Code\Reflection\ClassReflection $parentClass */
     $parentClass = $classReflection->getParentClass();
     if ($parentClass) {
         $cg->setExtendedClass('\\' . ltrim($parentClass->getName(), '\\'));
         $interfaces = array_diff($classReflection->getInterfaces(), $parentClass->getInterfaces());
     } else {
         $interfaces = $classReflection->getInterfaces();
     }
     $interfaceNames = array();
     foreach ($interfaces as $interface) {
         /* @var \Zend\Code\Reflection\ClassReflection $interface */
         $interfaceNames[] = $interface->getName();
     }
     $cg->setImplementedInterfaces($interfaceNames);
     $properties = array();
     foreach ($classReflection->getProperties() as $reflectionProperty) {
         if ($reflectionProperty->getDeclaringClass()->getName() == $classReflection->getName()) {
             $property = PropertyGenerator::fromReflection($reflectionProperty);
             $property->setIndentation(Generator::$indentation);
             $properties[] = $property;
         }
     }
     $cg->addProperties($properties);
     $methods = array();
     foreach ($classReflection->getMethods() as $reflectionMethod) {
         $className = $cg->getNamespaceName() ? $cg->getNamespaceName() . "\\" . $cg->getName() : $cg->getName();
         if ($reflectionMethod->getDeclaringClass()->getName() == $className) {
             $method = MethodGenerator::fromReflection($reflectionMethod);
             $method->setBody(preg_replace("/^\\s+/m", '', $method->getBody()));
             $method->setIndentation(Generator::$indentation);
             $methods[] = $method;
         }
     }
     $cg->addMethods($methods);
     return $cg;
 }
开发者ID:i-am-ains-ly,项目名称:sdk,代码行数:58,代码来源:ClassDiff.php


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