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


PHP Inspector::properties方法代码示例

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


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

示例1: getMap

 private function getMap($class)
 {
     $properties = Inspector::properties($class, array('public' => false));
     //parse out fields
     $fields = array();
     /** @var \ReflectionProperty $p */
     foreach ($properties as $p) {
         if (($p->getModifiers() & \ReflectionProperty::IS_PROTECTED) == \ReflectionProperty::IS_PROTECTED) {
             $name = $p->getName();
             if ($name[0] != '_') {
                 $fields[$name] = Docblock::comment($p->getDocComment());
             }
         }
     }
     //Parse out types
     $ret = array();
     foreach ($fields as $field => $data) {
         if (isset($data['tags']['var'])) {
             $ret[$field] = $this->dynamicType($data['tags']['var']);
         }
     }
     return $ret;
 }
开发者ID:splitice,项目名称:radical-db,代码行数:23,代码来源:Instance.php

示例2: _class

 protected static function _class(array $object, array $data, array $options = array())
 {
     $identifier = $object['identifier'];
     $proto = array('parent' => get_parent_class($identifier), 'methods' => Inspector::methods($identifier, null, array('public' => false)), 'properties' => Inspector::properties($identifier, array('public' => false)));
     $classes = Libraries::find($object['library'], array('recursive' => true));
     $proto['subClasses'] = array_filter($classes, function ($class) use($identifier) {
         if (preg_match('/\\\\(libraries)\\\\|\\\\(mocks)\\\\|\\\\(tests)\\\\/', $class)) {
             return false;
         }
         try {
             return get_parent_class($class) == $identifier;
         } catch (Exception $e) {
             return false;
         }
     });
     sort($proto['subClasses']);
     return $proto + $object + array('tags' => isset($data['tags']) ? $data['tags'] : array());
 }
开发者ID:rapzo,项目名称:li3_docs,代码行数:18,代码来源:Extractor.php

示例3: _properties

 /**
  * Get the properties for the class
  *
  * @param string $class
  * @param array $options
  * @return array
  */
 protected function _properties($class, $options = array())
 {
     $defaults = array('name' => null);
     $options += $defaults;
     $properties = Inspector::properties($class);
     $results = array();
     foreach ($properties as &$property) {
         $comment = Docblock::comment($property['docComment']);
         $description = trim($comment['description']);
         $type = isset($comment['tags']['var']) ? strtok($comment['tags']['var'], ' ') : null;
         $name = str_replace('_', '-', Inflector::underscore($property['name']));
         $usage = $type == 'boolean' ? "-{$name}" : "--{$name}=" . strtoupper($name);
         $results[$name] = compact('name', 'description', 'type', 'usage');
         if ($name == $options['name']) {
             return array($name => $results[$name]);
         }
     }
     return $results;
 }
开发者ID:EHER,项目名称:chegamos,代码行数:26,代码来源:Help.php

示例4: testGetClassProperties

 /**
  * Tests getting static and non-static properties from various types of classes.
  */
 public function testGetClassProperties()
 {
     $result = array_map(function ($property) {
         return $property['name'];
     }, Inspector::properties(__CLASS__));
     $expected = array('test', 'test2');
     $this->assertEqual($expected, $result);
     $result = array_map(function ($property) {
         return $property['name'];
     }, Inspector::properties(__CLASS__, array('public' => false)));
     $expected = array('test', 'test2', '_test');
     $this->assertEqual($expected, $result);
     $result = Inspector::properties(__CLASS__);
     $expected = array(array('modifiers' => array('public'), 'docComment' => false, 'name' => 'test', 'value' => null), array('modifiers' => array('public', 'static'), 'docComment' => false, 'name' => 'test2', 'value' => 'bar'));
     $this->assertEqual($expected, $result);
     $result = array_map(function ($property) {
         return $property['name'];
     }, Inspector::properties('lithium\\action\\Controller'));
     $this->assertTrue(in_array('request', $result));
     $this->assertTrue(in_array('response', $result));
     $this->assertFalse(in_array('_render', $result));
     $this->assertFalse(in_array('_classes', $result));
     $result = array_map(function ($property) {
         return $property['name'];
     }, Inspector::properties('lithium\\action\\Controller', array('public' => false)));
     $this->assertTrue(in_array('request', $result));
     $this->assertTrue(in_array('response', $result));
     $this->assertTrue(in_array('_render', $result));
     $this->assertTrue(in_array('_classes', $result));
     $this->assertNull(Inspector::properties('\\lithium\\core\\Foo'));
 }
开发者ID:fedeisas,项目名称:lithium,代码行数:34,代码来源:InspectorTest.php

示例5: testGetClassProperties

 /**
  * Tests getting static and non-static properties from various types of classes.
  *
  * @return void
  */
 public function testGetClassProperties()
 {
     $result = array_map(function ($property) {
         return $property['name'];
     }, Inspector::properties(__CLASS__));
     $expected = array('test', 'test2');
     $this->assertEqual($expected, $result);
     $result = array_map(function ($property) {
         return $property['name'];
     }, Inspector::properties(__CLASS__, array('public' => false)));
     $expected = array('test', 'test2', '_test');
     $this->assertEqual($expected, $result);
     $result = Inspector::properties(__CLASS__);
     $expected = array(array('modifiers' => array('public'), 'docComment' => false, 'name' => 'test', 'value' => null), array('modifiers' => array('public', 'static'), 'docComment' => false, 'name' => 'test2', 'value' => 'bar'));
     $this->assertEqual($expected, $result);
 }
开发者ID:EHER,项目名称:chegamos,代码行数:21,代码来源:InspectorTest.php


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