Prepares additional data for render.

@param $data array Additional data, prepared by other classes. Optional.
@return array
196328
public function prepareData($data = [])
    {
        return (array) ($this->data instanceof Closure ? call_user_func($this->data, $this, $data) : $this->data);
    }
350000
protected function transform($data)
    {
        $items = [
            'byref'       => (bool)$data[ '@attributes.by_reference' ],
            'types'       => explode('|', $this->createString($data[ 'type' ])),
            'description' => '',
        ];

        $this->copy([ 'name', 'default' ], $data, $items);
        //$data['default']
        return $items;
    }
584179
public function render($data)
    {
        $in_data = array ('items' => $data);
        return $this->_twig->render($this->_template, $in_data);
    }
1279201
protected function wrap($data, $with = [], $additional = [])
    {
        if ($data instanceof Collection) {
            $data = $data->all();
        }

        if ($this->haveDefaultWrapperAndDataIsUnwrapped($data)) {
            $data = [$this->wrapper() => $data];
        } elseif ($this->haveAdditionalInformationAndDataIsUnwrapped($data, $with, $additional)) {
            $data = [($this->wrapper() ?? 'data') => $data];
        }

        return array_merge_recursive($data, $with, $additional);
    }
638349
protected static function prepareInputBuffer($data)
    {
        if ($data instanceof Buffer) {
            return $data;
        }
        elseif (is_string($data) && ctype_xdigit($data)) {
            return Buffer::fromHex($data);
        }
        elseif (is_string($data)) {
            return new Buffer($data);
        }
        elseif (is_array($data)) {
            // Uint8 provided (serialized data)
            return Buffer::fromUInt8($data);
        }

        return new Buffer((string) $data);
    }
405892
public function unserialize($data)
    {
        $injector = \Injector::inst();

        $extraData = null;

        if (empty(self::$objectConstructorReflectionMethods[__CLASS__])) {
            self::$objectConstructorReflectionMethods[__CLASS__] = new \ReflectionMethod(__CLASS__, '__construct');
        }

        if (empty(self::$classConfigs[__CLASS__])) {
            self::$classConfigs[__CLASS__] = $injector->getConfigLocator()->locateConfigFor(__CLASS__);
        }

        if ($this instanceof ExtraDataInterface) {
            $unserialized = \Heystack\Core\unserialize($data);

            self::$objectConstructorReflectionMethods[__CLASS__]->invoke(
                $this,
                $unserialized[0]
            );

            $extraData = $unserialized[1];
        } else {
            self::$objectConstructorReflectionMethods[__CLASS__]->invoke(
                $this,
                \Heystack\Core\unserialize($data)
            );
        }

        // Ensure that the spec is loaded for the class
        if (self::$classConfigs[__CLASS__]) {
            $injector->load([__CLASS__ => self::$classConfigs[__CLASS__]]);
        }
        
        $injector->inject($this, __CLASS__);
        
        if ($extraData) {
            $this->setExtraData($extraData);
        }
    }
975486
public function render($data)
    {
        if (isset($data['content'])) {
            $this->config(['content' => $data['content']]);
            $content = new MenuContent($this->config(), $this->_here);
            $group = isset($data['group'])? $data['group'] : null;
            $contents = $content->render($group);
            $this->_active = $this->_active || $content->active();
            $this->config('wrapper.wrapper', $contents);
        }

        if ($this->_active) {
            $class = $this->config('wrapper.class') . ' active';
            $this->config('wrapper.class', $class);
        }

        return $this->formatTemplate('wrapper', $this->config('wrapper'));
    }
952290
public function prepend($data) {
        if ($this->exist()) {
            return $this->write($data.$this->read());
        }
        return $this->write($data);
    }
331915
protected function scopedData($data, /*# string */ $scope)/*# : array */
    {
        if (is_array($data) && isset($data['class'])) {
            $data['scope'] = $scope;
        } else {
            $data = ['class' => $data, 'scope' => $scope];
        }
        return $data;
    }
166953
public function decode($data): array
    {
        $result = RequestContext::getServerBean($this->formatHandlerClass)->decode($data);
        if(!is_array($result))
        {
            $result = [];
        }
        return $result;
    }
316022
public function appendSerialized($data)
    {
        try {
            $data = Serializer::unserialize($data);
        } catch (ExceptionInterface $exception) {
            $this->_addException($exception);
        }

        if (is_object($data)) {
            $name = $this->_convertKeyNames(get_class($data));
            $this->appendData($name, $data);
        } elseif (is_array($data)) {
            $this->appendArray($data);
        } else {
            $this->appendData($this->_defaultDataName, $data);
        }

        if ($this->_objectCreation) {
            return $this->_afterAppendDataToNewObject();
        }
        return $this;
    }
1163072
protected static function saveExtraParams(array $data)
    {
        $final_data = array();
        if (count($data) > 0) {
            Logger::log('Saving extra configuration parameters');
            foreach ($data as $key => $value) {
                if (null !== $value || $value !== '') {
                    $final_data[$key] = $value;
                }
            }
        }
        return $final_data;
    }
873825
protected function prepareRawPayload($data)
    {
        $this->clearRequestParams();
        $this->addHeader('Content-Length', strlen($data));
        $this->addOption(CURLOPT_POSTFIELDS, $data);
    }
553740
public function serialize($data)
    {
        if (is_string($data) === true) {
            return $data;
        } else {
            $data = json_encode($data);
            if ($data === '[]') {
                return '{}';
            } else {
                return $data;
            }
        }


    }
299194
public function prepareSiteData(array $data)
    {
        if (!empty($data['languageIso6392t'])) {
            $data['language'] = $this->getLanguage($data['languageIso6392t']);
        }

        if (!empty($data['countryId'])) {
            $data['country'] = $this->getCountry($data['countryId']);
        }

        return $data;
    }
969600
public function transform($data)
    {
        if (is_array($data)) {
            return $data;
        }

        if (is_object($data) && $data instanceof Arrayable) {
            return $data->toArray();
        }

        return (array) $data;
    }
245449
protected function prepareExport($data)
    {
        return [
            'name'         => $this->getName(),
            'info'         => $this->info,
            'hash'         => $this->getHash(),
            'data_wrapper' => get_class($this->getDatawrapper()),
            'data'         => $data
        ];
    }