Social\Plugin\AddThisWidget::mergeConfigWithJsonConfig PHP Метод

mergeConfigWithJsonConfig() защищенный Метод

Merge the Add this settings with that given using JSON format
protected mergeConfigWithJsonConfig ( string $appendString, array $addthisConfig, string $jsonConfig ) : string
$appendString string The string to build and return the script
$addthisConfig array The setting array for add this config
$jsonConfig string The JSON String
Результат string The string to build and return the script
    protected function mergeConfigWithJsonConfig($appendString, $addthisConfig, $jsonConfig)
    {
        if (!empty($jsonConfig)) {
            $addthisconfigJsonList = json_decode($jsonConfig, true);
            if (!empty($addthisconfigJsonList) and !empty($addthisConfig)) {
                foreach ($addthisconfigJsonList as $keyJson => $valueJson) {
                    $addthisConfig[$keyJson] = $valueJson;
                }
            }
        }
        if (!empty($addthisConfig)) {
            $appendString .= 'var addthis_config = ' . json_encode($addthisConfig) . ';';
        }
        return $appendString;
    }