Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
32 | public static function factory( $type ) { |
||
33 | $type = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $type ) ) ); |
||
34 | |||
35 | $class = __NAMESPACE__ . '\\' . $type . '_Datastore'; |
||
36 | |||
37 | if ( ! class_exists( $class ) ) { |
||
38 | Incorrect_Syntax_Exception::raise( 'Unknown data store type "' . $type . '".' ); |
||
39 | } |
||
40 | |||
41 | $field = new $class(); |
||
42 | |||
43 | return $field; |
||
44 | } |
||
45 | |||
55 |