|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2009 Christopher Hlubek <hlubek@networkteam.com> 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * 00017 * This script is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * This copyright notice MUST APPEAR in all copies of the script! 00023 ***************************************************************/ 00024 00025 /** 00026 * Extended version of the ReflectionMethod 00027 * 00028 * @package Extbase 00029 * @subpackage Reflection 00030 * @version $Id: MethodReflection.php 1052 2009-08-05 21:51:32Z sebastian $ 00031 */ 00032 class Tx_Extbase_Reflection_MethodReflection extends ReflectionMethod { 00033 00034 /** 00035 * @var Tx_Extbase_Reflection_DocCommentParser: An instance of the doc comment parser 00036 */ 00037 protected $docCommentParser; 00038 00039 /** 00040 * The constructor, initializes the reflection class 00041 * 00042 * @param string $className Name of the method's class 00043 * @param string $methodName Name of the method to reflect 00044 * @return void 00045 */ 00046 public function __construct($className, $methodName) { 00047 parent::__construct($className, $methodName); 00048 } 00049 00050 /** 00051 * Returns the declaring class 00052 * 00053 * @return Tx_Extbase_Reflection_ClassReflection The declaring class 00054 */ 00055 public function getDeclaringClass() { 00056 return new Tx_Extbase_Reflection_ClassReflection(parent::getDeclaringClass()->getName()); 00057 } 00058 00059 /** 00060 * Replacement for the original getParameters() method which makes sure 00061 * that Tx_Extbase_Reflection_ParameterReflection objects are returned instead of the 00062 * orginal ReflectionParameter instances. 00063 * 00064 * @return array of Tx_Extbase_Reflection_ParameterReflection Parameter reflection objects of the parameters of this method 00065 */ 00066 public function getParameters() { 00067 $extendedParameters = array(); 00068 foreach (parent::getParameters() as $parameter) { 00069 $extendedParameters[] = new Tx_Extbase_Reflection_ParameterReflection(array($this->getDeclaringClass()->getName(), $this->getName()), $parameter->getName()); 00070 } 00071 return $extendedParameters; 00072 } 00073 00074 /** 00075 * Checks if the doc comment of this method is tagged with 00076 * the specified tag 00077 * 00078 * @param string $tag Tag name to check for 00079 * @return boolean TRUE if such a tag has been defined, otherwise FALSE 00080 */ 00081 public function isTaggedWith($tag) { 00082 $result = $this->getDocCommentParser()->isTaggedWith($tag); 00083 return $result; 00084 } 00085 00086 /** 00087 * Returns an array of tags and their values 00088 * 00089 * @return array Tags and values 00090 */ 00091 public function getTagsValues() { 00092 return $this->getDocCommentParser()->getTagsValues(); 00093 } 00094 00095 /** 00096 * Returns the values of the specified tag 00097 * 00098 * @param string $tag Tag name to check for 00099 * @return array Values of the given tag 00100 */ 00101 public function getTagValues($tag) { 00102 return $this->getDocCommentParser()->getTagValues($tag); 00103 } 00104 00105 /** 00106 * Returns an instance of the doc comment parser and 00107 * runs the parse() method. 00108 * 00109 * @return Tx_Extbase_Reflection_DocCommentParser 00110 */ 00111 protected function getDocCommentParser() { 00112 if (!is_object($this->docCommentParser)) { 00113 $this->docCommentParser = new Tx_Extbase_Reflection_DocCommentParser; 00114 $this->docCommentParser->parseDocComment($this->getDocComment()); 00115 } 00116 return $this->docCommentParser; 00117 } 00118 } 00119 00120 ?>
1.8.0