| Conditions | 5 |
| Paths | 5 |
| Total Lines | 25 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public static function factory($config) |
||
| 17 | { |
||
| 18 | switch ($config['save.handler']) { |
||
| 19 | |||
| 20 | case 'file': |
||
| 21 | return new Xhgui_Saver_File($config['save.handler.filename']); |
||
| 22 | |||
| 23 | case 'upload': |
||
| 24 | $timeout = 3; |
||
| 25 | if (isset($config['save.handler.upload.timeout'])) { |
||
| 26 | $timeout = $config['save.handler.upload.timeout']; |
||
| 27 | } |
||
| 28 | return new Xhgui_Saver_Upload( |
||
| 29 | $config['save.handler.upload.uri'], |
||
| 30 | $timeout |
||
| 31 | ); |
||
| 32 | |||
| 33 | case 'mongodb': |
||
| 34 | default: |
||
| 35 | $mongo = new MongoClient($config['db.host'], $config['db.options']); |
||
| 36 | $collection = $mongo->{$config['db.db']}->results; |
||
| 37 | $collection->findOne(); |
||
| 38 | return new Xhgui_Saver_Mongo($collection); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | } |
||
| 42 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.