Completed
Push — master ( 8d7e95...31ef2d )
by Gordon
18:00 queued 02:04
created

GistShortCodeHandler::parse_gist()   B

Complexity

Conditions 3
Paths 3

Size

Total Lines 24
Code Lines 10

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 24
rs 8.9713
cc 3
eloc 10
nc 3
nop 3
1
<?php
2
3
class GistShortCodeHandler
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
{
5
    public static function parse_gist($arguments, $caption = null, $parser = null)
0 ignored issues
show
Unused Code introduced by
The parameter $parser is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Coding Style introduced by
Method name "GistShortCodeHandler::parse_gist" is not in camel caps format
Loading history...
6
    {
7
        // first things first, if we dont have a Gist ID, then we don't need to
8
        // go any further
9
        if (empty($arguments['id'])) {
10
            return;
11
        }
12
13
        if (!empty($caption)) {
14
        	$arguments['Caption'] = $caption;
15
        }
16
17
        $customise = array();
18
        $customise['GistID'] = $arguments['id'];
19
20
        //overide the defaults with the arguments supplied
21
        $customise = array_merge($customise, $arguments);
22
23
        //get our GIST template
24
        $template = new SSViewer('GithubGist');
25
26
        //return the customised template
27
        return $template->process(new ArrayData($customise));
28
    }
29
}
30