mirror of
https://github.com/pierre42100/ComunicAPI
synced 2025-06-19 00:25:18 +00:00
Created components class & default userID
This commit is contained in:
34
classes/components.php
Normal file
34
classes/components.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Components unificator
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
class Components {
|
||||
|
||||
/**
|
||||
* A static table that contains all the object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $objects = array();
|
||||
|
||||
/**
|
||||
* Public constructor
|
||||
*/
|
||||
public function __construct(){
|
||||
//Transform static object into dynamic object
|
||||
foreach(self::$objects as $name=>$object)
|
||||
$this->{$name} = $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class registration
|
||||
*
|
||||
* @param String $className The name of the class to register
|
||||
* @param Object $object The object to register
|
||||
*/
|
||||
public static function register($className, $object){
|
||||
self::$objects[$className] = $object;
|
||||
}
|
||||
}
|
21
classes/components/accountImage.php
Normal file
21
classes/components/accountImage.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Account image class
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
class accountImage{
|
||||
/**
|
||||
* Public constructor
|
||||
*/
|
||||
public function __construct(){
|
||||
//Nothing now
|
||||
}
|
||||
|
||||
public function test(){
|
||||
return "test";
|
||||
}
|
||||
}
|
||||
|
||||
//Register class
|
||||
Components::register("accountImage", new accountImage());
|
Reference in New Issue
Block a user