1 | <?php |
||
11 | class Stencil_Subclass_Factory { |
||
12 | const CLASS_FORMAT = '%s_%s'; |
||
13 | |||
14 | /** |
||
15 | * Create Null object |
||
16 | * |
||
17 | * @param string $prefix Prefix for the Class to use (directory). |
||
18 | * |
||
19 | * @return mixed |
||
20 | * @throws InvalidArgumentException When something else but a non-empty string is passed. |
||
21 | */ |
||
22 | public static function create_null( $prefix ) { |
||
31 | |||
32 | /** |
||
33 | * Create a new class if it exists |
||
34 | * |
||
35 | * @param string $class Class name. |
||
36 | * @param string $prefix Prefix of the class (directory). |
||
37 | * |
||
38 | * @return null |
||
39 | * @throws InvalidArgumentException For invalid class or prefix parameters. |
||
40 | */ |
||
41 | public static function create_if_exists( $class, $prefix ) { |
||
59 | |||
60 | /** |
||
61 | * Create new class or Null object if it does not exist |
||
62 | * |
||
63 | * @param string $class Name of the class. |
||
64 | * @param string $prefix Prefix of the class. |
||
65 | * |
||
66 | * @return null |
||
67 | */ |
||
68 | public static function create_or_null( $class, $prefix ) { |
||
77 | |||
78 | /** |
||
79 | * Uniform class name |
||
80 | * |
||
81 | * Class format: UpperCaseWords |
||
82 | * |
||
83 | * @param string $source Class name to format. |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | private static function format_class_name( $source ) { |
||
114 | |||
115 | /** |
||
116 | * Replace ' {alphanum}' with uppercase of alphanum |
||
117 | * |
||
118 | * Example: 'stencil example' => 'stencilExample' |
||
119 | * |
||
120 | * @param array $matches Matched items in string. |
||
121 | * |
||
122 | * @return string |
||
123 | */ |
||
124 | private function camel_case_callback( $matches ) { |
||
127 | } |
||
128 |