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


PHP Inspector::info方法代碼示例

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


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

示例1: get

 public static function get($library, $identifier, array $options = array())
 {
     static::_ensureIndexedLibrary($library);
     $defaults = array('namespaceDoc' => array(), 'language' => 'en');
     $options += $defaults;
     $options['namespaceDoc'] = (array) $options['namespaceDoc'];
     $config = Libraries::get('li3_docs');
     if (isset($config['namespaceDoc'])) {
         $options['namespaceDoc'] = array_merge($options['namespaceDoc'], (array) $config['namespaceDoc']);
     }
     $path = Libraries::path($identifier);
     static::_ensurePathInBase($path);
     if (file_exists($path) && !static::_isClassFile($path)) {
         return static::_file(compact('library', 'path', 'identifier'), $options);
     }
     $data = Inspector::info($identifier);
     $proto = compact('identifier', 'library') + array('name' => null, 'type' => Inspector::type($identifier), 'info' => array(), 'classes' => null, 'methods' => null, 'properties' => null, 'parent' => null, 'children' => null, 'source' => null, 'subClasses' => array(), 'description' => isset($data['description']) ? $data['description'] : null, 'text' => isset($data['text']) ? $data['text'] : null);
     $format = "_{$proto['type']}";
     $data = static::$format($proto, (array) $data, $options);
     if (!$data) {
         return false;
     }
     foreach (array('text', 'description') as $key) {
         $data[$key] = Code::embed($data[$key], compact('library'));
     }
     return $data;
 }
開發者ID:unionofrad,項目名稱:li3_docs,代碼行數:27,代碼來源:Extractor.php

示例2: run

 /**
  * Runs main console application logic. Returns a list of 
  * available exercises by default. Otherwise runs the specified exercise.
  *
  * @param string $command 
  * @return void
  */
 public function run($command = null)
 {
     if ($command == null) {
         $this->out("{:heading}EXERCISES{:end}");
         foreach ($this->_exercises as $key => $exercise) {
             $library = strtok($exercise, '\\');
             $info = Inspector::info($exercise);
             $this->out($this->_pad($key . " {:blue}via {$library}{:end}"), 'heading');
             $this->out($this->_pad($info['description'] == '' ? '(No description)' : $info['description']), 2);
         }
         $this->stop();
     }
     if (isset($this->_exercises[$command])) {
         $className = $this->_exercises[$command];
         $exercise = new $className(array('command' => $this));
         $exercise->run();
     } else {
         $this->out("{:error}The exercise {:end}{:blue}\"{$command}\"{:end}{:error} you specified cannot be found. Please supply a valid exercise name.{:end}");
         $this->out();
         $this->stop(1);
     }
 }
開發者ID:raisinbread,項目名稱:li3_exercises,代碼行數:29,代碼來源:Learn.php

示例3: _definition

 /**
  * Locates original location of closures.
  *
  * @param mixed $reference File or class name to inspect.
  * @param integer $callLine Line number of class reference.
  * @return mixed Returns the line number where the method called is defined.
  */
 protected static function _definition($reference, $callLine)
 {
     if (file_exists($reference)) {
         foreach (array_reverse(token_get_all(file_get_contents($reference))) as $token) {
             if (!is_array($token) || $token[2] > $callLine) {
                 continue;
             }
             if ($token[0] === T_FUNCTION) {
                 return $token[2];
             }
         }
         return;
     }
     list($class, ) = explode('::', $reference);
     if (!class_exists($class)) {
         return;
     }
     $classRef = new ReflectionClass($class);
     $methodInfo = Inspector::info($reference);
     $methodDef = join("\n", Inspector::lines($classRef->getFileName(), range($methodInfo['start'] + 1, $methodInfo['end'] - 1)));
     foreach (array_reverse(token_get_all("<?php {$methodDef} ?>")) as $token) {
         if (!is_array($token) || $token[2] > $callLine) {
             continue;
         }
         if ($token[0] === T_FUNCTION) {
             return $token[2] + $methodInfo['start'];
         }
     }
 }
開發者ID:unionofrad,項目名稱:lithium,代碼行數:36,代碼來源:Debugger.php

示例4: testBadlyClosedDocblock

 /**
  * This docblock has an extra * in the closing element.
  *
  */
 public function testBadlyClosedDocblock()
 {
     $info = Inspector::info(__METHOD__ . '()');
     $description = 'This docblock has an extra * in the closing element.';
     $this->assertEqual($description, $info['description']);
     $this->assertEqual('', $info['text']);
 }
開發者ID:nilamdoc,項目名稱:KYCGlobal,代碼行數:11,代碼來源:DocblockTest.php

示例5: api

 /**
  * Get the api for the class.
  *
  * @param string $class fully namespaced class in dot notation
  * @param string $type method|property
  * @param string $name the name of the method or property
  * @return array
  */
 public function api($class = null, $type = null, $name = null)
 {
     $class = str_replace(".", "\\", $class);
     switch ($type) {
         default:
             $info = Inspector::info($class);
             $result = array('class' => array('name' => Inflector::classify($info['shortName']), 'description' => $info['description']));
             break;
         case 'method':
             $result = $this->_methods($class, compact('name'));
             break;
         case 'property':
             $result = $this->_properties($class, compact('name'));
             break;
     }
     $this->_render($result);
 }
開發者ID:EHER,項目名稱:chegamos,代碼行數:25,代碼來源:Help.php

示例6: testIdentifierIntrospection

 /**
  * Tests getting reflection information based on a string identifier.
  */
 public function testIdentifierIntrospection()
 {
     $result = Inspector::info(__METHOD__);
     $this->assertEqual(array('public'), $result['modifiers']);
     $this->assertEqual(__FUNCTION__, $result['name']);
     $this->assertNull(Inspector::info('\\lithium\\util'));
     $info = Inspector::info('\\lithium\\analysis\\Inspector');
     $result = str_replace('\\', '/', $info['file']);
     $this->assertNotEmpty(strpos($result, '/analysis/Inspector.php'));
     $this->assertEqual('lithium\\analysis', $info['namespace']);
     $this->assertEqual('Inspector', $info['shortName']);
     $result = Inspector::info('\\lithium\\analysis\\Inspector::$_methodMap');
     $this->assertEqual('_methodMap', $result['name']);
     $expected = 'Maps reflect method names to result array keys.';
     $this->assertEqual($expected, $result['description']);
     $this->assertEqual(array('var' => 'array'), $result['tags']);
     $result = Inspector::info('\\lithium\\analysis\\Inspector::info()', array('modifiers', 'namespace', 'foo'));
     $this->assertEqual(array('modifiers', 'namespace'), array_keys($result));
     $this->assertNull(Inspector::info('\\lithium\\analysis\\Inspector::$foo'));
     $this->assertNull(Inspector::info('\\lithium\\core\\Foo::$foo'));
 }
開發者ID:fedeisas,項目名稱:lithium,代碼行數:24,代碼來源:InspectorTest.php

示例7: _renderCommands

 /**
  * Output the formatted available commands.
  *
  * @return void
  */
 protected function _renderCommands()
 {
     $commands = Libraries::locate('command', null, array('recursive' => false));
     foreach ($commands as $key => $command) {
         $library = strtok($command, '\\');
         if (!$key || strtok($commands[$key - 1], '\\') != $library) {
             $this->out("{:heading}COMMANDS{:end} {:blue}via {$library}{:end}");
         }
         $info = Inspector::info($command);
         $name = strtolower(Inflector::slug($info['shortName']));
         $this->out($this->_pad($name), 'heading');
         $this->out($this->_pad($info['description']), 2);
     }
     $message = 'See `{:command}li3 help COMMAND{:end}`';
     $message .= ' for more information on a specific command.';
     $this->out($message, 2);
 }
開發者ID:fedeisas,項目名稱:lithium,代碼行數:22,代碼來源:Help.php

示例8: getProtectedValue

 /**
  * This is a helper method for testStorageMechanism to fetch a private
  * property of the Inflector class.
  *
  * @param string $property
  * @return string The value of the property.
  */
 private function getProtectedValue($property)
 {
     $info = Inspector::info("lithium\\util\\Inflector::{$property}");
     return $info['value'];
 }
開發者ID:nashadalam,項目名稱:lithium,代碼行數:12,代碼來源:InflectorTest.php

示例9: _parseClass

 public function _parseClass($class)
 {
     $data = array();
     // $methods = Inspector::methods($class, null, array('public' => false));
     $methods = get_class_methods($class);
     $properties = array_keys(get_class_vars($class));
     $ident = $class;
     $info = Inspector::info($ident);
     $info = Docblock::comment($info['comment']);
     $data = $this->_merge($data, array('id' => $info['description'], 'comments' => array($ident)));
     $this->_merge($data, array('id' => $info['text'], 'comments' => array($class)));
     foreach ($methods as $method) {
         $ident = "{$class}::{$method}()";
         $info = Inspector::info($ident);
         $info = Docblock::comment($info['comment']);
         $this->_merge($data, array('id' => $info['description'], 'comments' => array($ident)));
         $this->_merge($data, array('id' => $info['text'], 'comments' => array($ident)));
         if (isset($info['tags']['return'])) {
             $this->_merge($data, array('id' => $info['tags']['return'], 'comments' => array($ident)));
         }
         foreach (Set::extract($info, '/tags/params/text') as $text) {
             $this->_merge($data, array('id' => $text, 'comments' => array($ident)));
         }
     }
     foreach ($properties as $property) {
         $ident = "{$class}::\${$property}";
         $info = Inspector::info($ident);
         $info = Docblock::comment($info['comment']);
         $data = $this->_merge($data, array('id' => $info['description'], 'comments' => array($ident)));
         $data = $this->_merge($data, array('id' => $info['text'], 'comments' => array($ident)));
     }
     return $data;
 }
開發者ID:rmarscher,項目名稱:li3_docs,代碼行數:33,代碼來源:Docs.php


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