GistShortCodeHandler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 27
ccs 11
cts 11
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B parse_gist() 0 24 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 3
    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 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