StackFormation\PrefixedTemplate::getDecodedJson PHP Метод

getDecodedJson() публичный Метод

public getDecodedJson ( )
    public function getDecodedJson()
    {
        if ($this->prefix) {
            if (!$this->cache->has(__METHOD__)) {
                $array = parent::getDecodedJson();
                foreach ($array as $topLevelKey => $topLevelData) {
                    if (is_array($topLevelData)) {
                        $prefixedData = [];
                        foreach ($topLevelData as $key => $value) {
                            $prefixedData[$this->prefix . $key] = $value;
                        }
                        $array[$topLevelKey] = $prefixedData;
                    }
                }
                $this->cache->set(__METHOD__, $array);
            }
            return $this->cache->get(__METHOD__);
        } else {
            return parent::getDecodedJson();
        }
    }