Code Duplication    Length = 16-17 lines in 2 locations

Features/TinyMce/functions.php 2 locations

@@ 44-59 (lines=16) @@
41
    return $toolbars;
42
});
43
44
function getToolbarsFromJson()
45
{
46
    $options = Feature::getOptions('flynt-tiny-mce');
47
    if (isset($options[0]) && isset($options[0]['toolbarsConfigPath'])) {
48
        $configPath = $options[0]['paths']['toolbarsConfigPath'];
49
    } else {
50
        $configPath = 'config/toolbars.json';
51
    }
52
53
    $filePath = Asset::requirePath('/Features/TinyMce/' . $configPath);
54
    if (file_exists($filePath)) {
55
        return json_decode(file_get_contents($filePath), true);
56
    } else {
57
        return false;
58
    }
59
}
60
61
function getBlockFormats($options)
62
{
@@ 82-98 (lines=17) @@
79
    }
80
}
81
82
function getStyleFormats($options)
83
{
84
    if (isset($options[0]) && isset($options[0]['styleformatsConfigPath'])) {
85
        $configPath = $options[0]['paths']['styleformatsConfigPath'];
86
    } else {
87
        $configPath = 'config/styleformats.json';
88
    }
89
90
    $filePath = Asset::requirePath('/Features/TinyMce/' . $configPath);
91
    if (file_exists($filePath)) {
92
        // Get contents as JSON string first and convert it to array for sending it to style_formats as true js array
93
        $loadedStyle = json_decode(file_get_contents($filePath), true);
94
        return json_encode($loadedStyle);
95
    } else {
96
        return false;
97
    }
98
}
99