reborn /heart/reborn/src/Reborn/Cores/Alias.php

Language PHP Lines 97
MD5 Hash 13644bac74097bc816ffd0ffbe4569ab Estimated Cost $993 (why?)
Repository https://bitbucket.org/yelinaung/reborn.git View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php

namespace Reborn\Cores;

/**
 * Class Alias Library for Reborn CMS
 *
 * @package default
 * @author Reborn CMS Development Team
 **/
class Alias
{

	/**
	 * Marking for Reborn's Core Class are alias or not
	 *
	 * @var bool
	 **/
	protected static $coreIsAlias = false;

	/**
	 * Array list for Reborn's Core Class
	 *
	 * @var array
	 **/
	protected static $coreClasses = array(
			'ArrayMethods' => 'Reborn\Cores\Methods_ArrayMethods',
			'Config' => 'Reborn\Cores\Config',
			'Controller' => 'Reborn\Cores\Controller',
			'ControllerContainer' => 'Reborn\Cores\ControllerContainer',
			'DB' => 'Reborn\Cores\DB',
			'Eloquent' => 'Illuminate\Database\Eloquent\Model',
			'Event' => 'Reborn\Cores\Event',
			'RbException' => 'Reborn\Cores\RbException',
			'Redirect' => 'Reborn\Cores\Redirect',
			'Form' => 'Reborn\Cores\Form',
            'Input' => 'Reborn\Cores\Input',
            'Inspector' => 'Reborn\Cores\Inspector',
            'Log' => 'Reborn\Cores\Log',
            'Module' => 'Reborn\Cores\Module',
            'Route' => 'Reborn\Cores\Route',
            'Router' => 'Reborn\Cores\Router',
            'Model' => 'Reborn\Cores\Model',
            'Schema' => 'Reborn\Cores\DB\Schema',
            'Setting' => 'Reborn\Cores\Setting',
            //'Template' => 'Reborn\Cores\Template',
            'Uri' => 'Reborn\Cores\Uri',
            //'View' => 'Reborn\Cores\View',
		);

	/**
	 * Construct method is final, don't allown to override these method.
	 *
	 */
	final function __construct() {}

	/**
	 * Class Alias for Reborn's Cores Class.
	 * This method is call when application started.
	 * But not allow to call after one time.
	 *
	 * @return void
	 */
	public static function coreClassAlias()
	{
		if(! static::$coreIsAlias)
		{
			static::aliasRegister(static::$coreClasses);

			static::$coreIsAlias = true;
		}
	}

	/**
     * Register the class alias.
     * You can use your class (enternal of Reborn's Cores) to alies use this method.
     * <code>
     * 		// If you want to use Products\Libs\Shopper to Shopper
     * 		Alias::aliasRegister(array('Shopper' => 'Products\Libs\Shopper'));
     *
     * 		// Ok, Shopper class is aliased now
     * 		Shopper::calculate();
     * </code>
     *
     * @param array $classes Array data for class alias
     * @return void
     */
    public static function aliasRegister($classes = array())
    {
        foreach($classes as $alias => $class)
        {
            class_alias($class, $alias);
        }
    }

} // END class Alias
Back to Top