Conditions | 5 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | public static function checkCollision($driverName) |
||
20 | { |
||
21 | $CONSTANT_NAME = __NAMESPACE__ . '\MEMCACHE_DRIVER_USED'; |
||
22 | |||
23 | if ($driverName && is_string($driverName)) { |
||
24 | if (!defined($CONSTANT_NAME)) { |
||
25 | define($CONSTANT_NAME, $driverName); |
||
26 | |||
27 | return true; |
||
28 | } else if (constant($CONSTANT_NAME) !== $driverName) { |
||
29 | trigger_error('Memcache collision detected, you used both Memcache and Memcached driver in your script, this may leads to unexpected behaviours', |
||
30 | E_USER_WARNING); |
||
31 | |||
32 | return false; |
||
33 | } |
||
34 | |||
35 | return true; |
||
36 | } |
||
37 | |||
38 | return false; |
||
39 | } |
||
40 | } |