| Conditions | 5 |
| Paths | 12 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 47 | 1 | function getChain($uri) |
|
| 48 | {
|
||
| 49 | 1 | $chain = explode('/', $uri);
|
|
| 50 | 1 | foreach($chain as $k => $v) {
|
|
| 51 | 1 | if(!$v) {
|
|
| 52 | 1 | unset($chain[$k]); |
|
| 53 | } |
||
| 54 | } |
||
| 55 | |||
| 56 | 1 | $chain = array_values($chain); |
|
| 57 | |||
| 58 | 1 | if(!count($chain)) {
|
|
| 59 | 1 | $chain[] = 'index'; |
|
| 60 | } |
||
| 61 | |||
| 62 | 1 | if(count($chain) == 1) {
|
|
| 63 | 1 | $chain[] = 'index'; |
|
| 64 | } |
||
| 65 | |||
| 66 | 1 | return $chain; |
|
| 67 | } |
||
| 68 | } |
||
| 69 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.