コード例 #1
0
ファイル: ClassUtilsTest.php プロジェクト: azole/Phifty
 function testClassUtils()
 {
     $obj = ClassUtils::new_class('test_classutils\\foo', array(1, 2, 3, 4, 5));
     ok($obj);
     isa_ok('test_classutils\\foo', $obj);
     is(1, $obj->v1);
     is(2, $obj->v2);
     $obj = ClassUtils::new_class('test_classutils\\bar');
     isa_ok('test_classutils\\bar', $obj);
 }
コード例 #2
0
ファイル: Twig.php プロジェクト: azole/Phifty
/**
 * Rewrite this as an extension.
 *
 * {% set obj = new('InputSystem\\Model\\Patient') %}
 * {% set obj = new('InputSystem\\Model\\PatientSchema') %}
 */
function newObject($class)
{
    $args = func_get_args();
    array_shift($args);
    return ClassUtils::new_class($class, $args);
}