| Conditions | 4 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4.0312 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php namespace Comodojo\Cache\Components; |
||
| 44 | 22 | public function setNamespace($namespace=null) { |
|
| 45 | |||
| 46 | 22 | if ( empty($namespace) ) { |
|
| 47 | |||
| 48 | 6 | $this->cache_namespace = "GLOBAL"; |
|
| 49 | |||
| 50 | 22 | } else if ( preg_match('/^[0-9a-zA-Z]+$/', $namespace) && strlen($namespace) <= 64 ) { |
|
| 51 | |||
| 52 | 22 | $this->cache_namespace = strtoupper($namespace); |
|
| 53 | |||
| 54 | 22 | } else { |
|
| 55 | |||
| 56 | throw new CacheException("Invalid namespace"); |
||
| 57 | |||
| 58 | } |
||
| 59 | |||
| 60 | 22 | return $this; |
|
| 61 | |||
| 62 | } |
||
| 63 | |||
| 65 |