| Conditions | 3 |
| Paths | 3 |
| Total Lines | 24 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3 |
| 1 | <?php |
||
| 5 | 3 | public static function parse_gist($arguments, $caption = null, $parser = null) |
|
| 6 | { |
||
| 7 | // first things first, if we dont have a Gist ID, then we don't need to |
||
| 8 | // go any further |
||
| 9 | 3 | if (empty($arguments['id'])) { |
|
| 10 | 1 | return; |
|
| 11 | } |
||
| 12 | |||
| 13 | 2 | if (!empty($caption)) { |
|
| 14 | 1 | $arguments['Caption'] = $caption; |
|
| 15 | 1 | } |
|
| 16 | |||
| 17 | 2 | $customise = array(); |
|
| 18 | 2 | $customise['GistID'] = $arguments['id']; |
|
| 19 | |||
| 20 | //overide the defaults with the arguments supplied |
||
| 21 | 2 | $customise = array_merge($customise, $arguments); |
|
| 22 | |||
| 23 | //get our GIST template |
||
| 24 | 2 | $template = new SSViewer('GithubGist'); |
|
| 25 | |||
| 26 | //return the customised template |
||
| 27 | 2 | return $template->process(new ArrayData($customise)); |
|
| 28 | } |
||
| 29 | } |
||
| 30 |
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.