コード例 #1
0
ファイル: ClassTest.php プロジェクト: lortnus/zf1
    public function testToString()
    {
        $codeGenClass = new ZendL_Tool_CodeGenerator_Php_Class(array('abstract' => true, 'name' => 'SampleClass', 'extendedClass' => 'ExtendedClassName', 'implementedInterfaces' => array('Iterator', 'Traversable')));
        $expectedOutput = <<<EOS
abstract class SampleClass extends ExtendedClassName implements Iterator, Traversable
{


}

EOS;
        $this->assertEquals($codeGenClass->toString(), $expectedOutput);
    }
コード例 #2
0
ファイル: File.php プロジェクト: lortnus/zf1
 public function setClass($class)
 {
     if (is_array($class)) {
         $class = new ZendL_Tool_CodeGenerator_Php_Class($class);
         $className = $class->getName();
     } elseif ($class instanceof ZendL_Tool_CodeGenerator_Php_Class) {
         $className = $class->getName();
     } else {
         require_once 'ZendL/Tool/CodeGenerator/Php/Exception.php';
         throw new ZendL_Tool_CodeGenerator_Php_Exception('Expecting either an array or an instance of ZendL_Tool_CodeGenerator_Php_Class');
     }
     // @todo check for dup here
     $this->_classes[$className] = $class;
     return $this;
 }