root/components/codeReflection/CodeReflectionParameter.class.php

User picture

Author: blaine

Revision: 262 («Previous)


File Size: 1.61 KB

(April 30, 2009 21:14 UTC) About 3 years ago

phpdoc change. separating the package notation of the class notation to make easy to the doxygen generate the phpdoc html description

 
Show/hide line numbers
<?php
/**
 * CodeReflectionParameter - to get the code reflection of the parameter
 * @package CodeReflection
 */

/**
 * Code Reflection Parameter
 *
 * Implements the code reflection parameters of the parameter reflection
 *
 * @author Thiago Henrique Ramos da Mata <thiago.henrique.mata@gmail.com>
 */
class CodeReflectionParameter extends ExtendedReflectionParameter
{
	/**
	 * Get the code from the parameter
	 *
	 * @return String
	 */
	public function getCode()
	{
		$strCode = "";
		
		/**
		 * @fixme http://bugs.php.net/bug.php?id=33312
		 */
/*
        if( $this->getClass() != null )
		{
			$strCode .= $this->getClass()->getClassName() . " ";
		}
*/
		$strCode .= '$' . $this->getName();

		if( $this->isOptional() )
		{
			$strCode .= " = " . var_export( $this->getDefaultValue() , 1 );
		}
		return $strCode;
	}

    protected function createExtendedReflectionClass( ReflectionClass $objOriginalReflectionClass )
	{
		return new CodeReflectionClass( $objOriginalReflectionClass->getName() );
	}

	protected function createExtendedReflectionMethod( ReflectionMethod $objOriginalReflectionMethod )
	{
		return new CodeReflectionMethod( $this->getName() , $objOriginalReflectionMethod->getName() );
	}

	protected function createExtendedReflectionFunction( ReflectionFunction $objOriginalReflectionFunction )
	{
		if( $objOriginalReflectionFunction instanceof ReflectionMethod )
		{
			return new CodeReflectionMethod( $objOriginalReflectionFunction->getName() );
		}
		else
		{
			return new CodeReflectionFunction( $objOriginalReflectionFunction->getName() );
		}
	}
}

?>