-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathFactory.php
More file actions
36 lines (30 loc) · 813 Bytes
/
Copy pathFactory.php
File metadata and controls
36 lines (30 loc) · 813 Bytes
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
<?php
/**
* @author BreathLess
* @type Library
* @description: Abstract Factory
* @package Evil
* @subpackage Core
* @version 0.1
* @date 30.10.10
* @time 13:42
*/
class Evil_Factory
{
private static $_classes = array();
public static function make($className, $args = null)
{
return new $className($args);
}
public static function singletone($className, $args = null)
{
if (isset(self::$_classes[$className]))
return self::$_classes[$className];
else
return self::$_classes[$className] = new $className($args);
}
public static function makeFunc($fn, $args)
{
return $fn($args);
}
}