root/components/codeReflection/example/test1.php
Author: blaine
File Size: 1.14 KB
(February 25, 2009 15:30 UTC) About 3 years ago
first version of the codetodiagram in fact. Problems with constructors with parameters. Problems with not static methods called static mode. Problems with classes what are used in the same file when are declared. Parameters of methods without parameters name. Unabled to debug functions yet. Unabled to generated xml outputs. To see working open the test.php inside the public folder.
<?
require_once( "_start.php" );
/**
* This example will consist into change the content of some methods using the debug reflection
* and namespaces.
*
*/
class exampleFirst{}
class exampleSecond{}
interface exampleInterfaceOne{}
interface exampleInterfaceTwo{}
class ExampleCodeReflecion extends exampleFirst implements exampleInterfaceOne, exampleInterfaceTwo
{
/**
* @something else
*
* @var string
*/
private $strName;
static protected $arrParadas = array();
/**
* Will do something cool
*
* @return string
*/
final public function doSomethingCool( $strName = "hi" , exampleSecond $obSecond = null , exampleSecond $objLastOne = null )
{
$this->strName = $strName;
print "i change the name to " . $this->strName;
$this->doNothing();
}
private static function doNothing()
{
// empty...
}
public function hardWork()
{
for( $i = 0 ; $i < 20 ; $i++ )
{
$this->doSomethingCool( $i );
}
}
};
$oReflectionCode = new CodeReflectionClass( "ExampleCodeReflecion" );
$strNewCode = $oReflectionCode->getCode();
CorujaDebug::debug( $strNewCode, true, "php" );
?> |