| Conditions | 4 |
| Paths | 3 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 31 | public function getParameters($permalink) |
||
| 32 | { |
||
| 33 | $parameters = explode('/', $permalink); |
||
| 34 | |||
| 35 | if (count($parameters) > 2 || count($parameters) == 0) { |
||
| 36 | throw new \InvalidArgumentException('wrong permalink format'); |
||
| 37 | } |
||
| 38 | |||
| 39 | if (false === strpos($permalink, '/')) { |
||
| 40 | $collection = null; |
||
| 41 | $slug = $permalink; |
||
| 42 | } else { |
||
| 43 | list($collection, $slug) = $parameters; |
||
| 44 | } |
||
| 45 | |||
| 46 | return array( |
||
| 47 | 'collection' => $collection, |
||
| 48 | 'slug' => $slug, |
||
| 49 | ); |
||
| 50 | } |
||
| 51 | } |
||
| 52 |