Code Duplication    Length = 21-21 lines in 2 locations

code/model/Abbreviation.php 1 location

@@ 106-126 (lines=21) @@
103
     * @param string $shortcode the raw shortcode being parsed
104
     * @return String
105
     **/
106
    public static function parse_shortcode($arguments, $content, $parser, $shortcode)
107
    {
108
        if (empty($arguments['id'])) {
109
            return;
110
        }
111
112
        if (array_key_exists('id', $arguments) && $arguments['id']) {
113
            $abbreviation = Abbreviation::get()->byID($arguments['id']);
114
        }
115
116
        if (!$abbreviation) {
117
            return;
118
        }
119
120
        if (array_key_exists('title', $arguments) && $arguments['title']) {
121
            $abbreviation->Title = $arguments['title'];
122
        }
123
124
        $template = new SSViewer('AbbreviationShortcode');
125
        return $template->process($abbreviation);
126
    }
127
128
    /**
129
     * returns a list of fields for editing the shortcode's attributes

code/model/Explanation.php 1 location

@@ 26-46 (lines=21) @@
23
     * @param string $shortcode the raw shortcode being parsed
24
     * @return String
25
     **/
26
    public static function parse_shortcode($arguments, $content, $parser, $shortcode)
27
    {
28
        if (empty($arguments['id'])) {
29
            return;
30
        }
31
32
        if (array_key_exists('id', $arguments) && $arguments['id']) {
33
            $explanation = Explanation::get()->byID($arguments['id']);
34
        }
35
36
        if (!$explanation) {
37
            return;
38
        }
39
40
        if (array_key_exists('title', $arguments) && $arguments['title']) {
41
            $explanation->Title = $arguments['title'];
42
        }
43
44
        $template = new SSViewer('ExplanationShortcode');
45
        return $template->process($explanation);
46
    }
47
48
    /**
49
     * returns a list of fields for editing the shortcode's attributes