1 | <?php |
||
22 | class Rando |
||
23 | { |
||
24 | /** |
||
25 | * @var string |
||
26 | * @access protected |
||
27 | */ |
||
28 | protected static $packagesDirectory = __DIR__ . '/packages'; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | * @access protected |
||
33 | */ |
||
34 | protected static $commonNamespace = __NAMESPACE__.'\\Packages'; |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | * @access protected |
||
39 | */ |
||
40 | protected static $commonInterface = 'Samshal\\Rando\\Packages\\PackageableInterface'; |
||
41 | |||
42 | /** |
||
43 | * Magic method for calling packages, treats supplied package methods |
||
44 | * as methods and retrieves their __toString values |
||
45 | * |
||
46 | * @access public |
||
47 | * @return string |
||
48 | */ |
||
49 | public function __call($method, $parameters) |
||
53 | |||
54 | /** |
||
55 | * Magic method for calling static packages. A variation of the __call magic |
||
56 | * method |
||
57 | * |
||
58 | * @access public |
||
59 | * @return string |
||
60 | */ |
||
61 | public static function __callStatic($method, $parameters) |
||
65 | |||
66 | /** |
||
67 | * @param $method string |
||
68 | * @param $parameters array |
||
69 | * |
||
70 | * Performs the instantiation of a class and returns |
||
71 | * the generated random string value |
||
72 | * |
||
73 | * @access public |
||
74 | * @return string |
||
75 | */ |
||
76 | private static function processInstruction($method, $parameters) |
||
82 | |||
83 | /** |
||
84 | * @param $packageName string |
||
85 | * |
||
86 | * Searches the directories containing package namespaces |
||
87 | * for the $packageName parameter and then returns an instance |
||
88 | * of the class when it finds it or throws an exception if it cant be found. |
||
89 | * |
||
90 | * @access private |
||
91 | * @return PackagesInterface instance |
||
92 | * @throws Samshal\Rando\Exceptions\RequestedClassNotFoundExcption |
||
93 | */ |
||
94 | private static function instantiatePackage($packageName) |
||
108 | |||
109 | /** |
||
110 | * @param class PackagesInterface |
||
111 | * @param parameter array |
||
112 | * |
||
113 | * Returns a randomly generated string |
||
114 | * |
||
115 | * @access private |
||
116 | * @return string |
||
117 | * @throws Samshal\Rando\Exceptions\InterfaceNotImplementedException |
||
118 | */ |
||
119 | private static function getRandoString($class, $parameters) |
||
129 | } |
||
130 |