Move '__clone' to generic trait

This commit is contained in:
Timothy Warren 2012-05-21 12:46:53 -04:00
parent a21a99f10f
commit 6708888579

View File

@ -69,6 +69,19 @@ trait Generic {
return ''; return '';
} }
} }
// --------------------------------------------------------------------------
/**
* PHP magic method that is called when an object is treated as a function
*
* @param array $args
*/
public static function __invoke($args = [])
{
$class = __CLASS__;
return new $class($args);
}
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@ -116,19 +129,6 @@ trait JSObject {
return call_user_func_array($this->$name, $params); return call_user_func_array($this->$name, $params);
} }
} }
// --------------------------------------------------------------------------
/**
* PHP magic method that is called when an object is treated as a function
*
* @param array $args
*/
public static function __invoke($args = [])
{
$class = __CLASS__;
return new $class($args);
}
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------