Added traits
This commit is contained in:
parent
d71fe56630
commit
bcfc97a2c3
@ -15,12 +15,12 @@
|
|||||||
/**
|
/**
|
||||||
* Parent class of base class, contains much of the magic
|
* Parent class of base class, contains much of the magic
|
||||||
*/
|
*/
|
||||||
class JSObject{
|
trait JSObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for creating the objects
|
* Constructor for creating the objects
|
||||||
*/
|
*/
|
||||||
function __construct($members = array())
|
public function __construct($members = array())
|
||||||
{
|
{
|
||||||
// Add the passed parameters to the object
|
// Add the passed parameters to the object
|
||||||
foreach($members as $name => $value)
|
foreach($members as $name => $value)
|
||||||
@ -35,7 +35,7 @@ class JSObject{
|
|||||||
* @param string $name
|
* @param string $name
|
||||||
* @param array $args
|
* @param array $args
|
||||||
*/
|
*/
|
||||||
function __call($name, $args)
|
public function __call($name, $args)
|
||||||
{
|
{
|
||||||
if(is_callable($this->$name))
|
if(is_callable($this->$name))
|
||||||
{
|
{
|
||||||
@ -66,7 +66,7 @@ class JSObject{
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
if(ENVIRONMENT == 'DEVELOPMENT')
|
if(ENVIRONMENT == 'DEVELOPMENT')
|
||||||
{
|
{
|
||||||
@ -113,7 +113,7 @@ class JSObject{
|
|||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*/
|
*/
|
||||||
function __get($name)
|
public function __get($name)
|
||||||
{
|
{
|
||||||
$path = SYS_PATH."{$name}.php";
|
$path = SYS_PATH."{$name}.php";
|
||||||
$class = "{$name}";
|
$class = "{$name}";
|
||||||
@ -152,7 +152,9 @@ class JSObject{
|
|||||||
*
|
*
|
||||||
* @extends JSObject
|
* @extends JSObject
|
||||||
*/
|
*/
|
||||||
class miniMVC extends JSObject{
|
class miniMVC {
|
||||||
|
|
||||||
|
use JSObject;
|
||||||
|
|
||||||
private static $instance;
|
private static $instance;
|
||||||
private static $count;
|
private static $count;
|
||||||
@ -160,7 +162,7 @@ class miniMVC extends JSObject{
|
|||||||
/**
|
/**
|
||||||
* Constructor - Any classes loaded here become subclasses of miniMVC
|
* Constructor - Any classes loaded here become subclasses of miniMVC
|
||||||
*/
|
*/
|
||||||
function __construct()
|
protected function __construct()
|
||||||
{
|
{
|
||||||
self::$instance =& $this;
|
self::$instance =& $this;
|
||||||
}
|
}
|
||||||
@ -171,7 +173,7 @@ class miniMVC extends JSObject{
|
|||||||
* @param string $name
|
* @param string $name
|
||||||
* @param array $args
|
* @param array $args
|
||||||
*/
|
*/
|
||||||
function __call($name, $args)
|
public function __call($name, $args)
|
||||||
{
|
{
|
||||||
if(is_callable(self::$instance->$name))
|
if(is_callable(self::$instance->$name))
|
||||||
{
|
{
|
||||||
@ -227,7 +229,7 @@ class miniMVC extends JSObject{
|
|||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*/
|
*/
|
||||||
function load_class($name, $type='class')
|
public function load_class($name, $type='class')
|
||||||
{
|
{
|
||||||
switch($type)
|
switch($type)
|
||||||
{
|
{
|
||||||
@ -278,7 +280,7 @@ class miniMVC extends JSObject{
|
|||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*/
|
*/
|
||||||
function unload($name)
|
public function unload($name)
|
||||||
{
|
{
|
||||||
if(isset($this->$name))
|
if(isset($this->$name))
|
||||||
{
|
{
|
||||||
@ -291,7 +293,7 @@ class miniMVC extends JSObject{
|
|||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*/
|
*/
|
||||||
function load_config($name)
|
public function load_config($name)
|
||||||
{
|
{
|
||||||
$path = APP_PATH . "config/{$name}.php";
|
$path = APP_PATH . "config/{$name}.php";
|
||||||
|
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for displaying output and setting http headers
|
* Class for displaying output and setting http headers
|
||||||
*
|
|
||||||
* @extends JSObject
|
|
||||||
*/
|
*/
|
||||||
class Output extends JSObject{
|
class Output{
|
||||||
|
|
||||||
|
use JSObject;
|
||||||
|
|
||||||
private $buffer, $headers;
|
private $buffer, $headers;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user