@param $data
@param Wiki|null $wiki

@return Wiki - The deserialized wiki object
483650
public function deserialize($data, Wiki $wiki = null, array $options = [])
    {
        if (empty($wiki)) {
            $wiki = new Wiki();
        }

        if (!in_array(Options::REFRESH_UUID, $options)) {
            $this->sipe('id', 'setUuid', $data, $wiki);
        }

        if (isset($data['mode'])) {
            $wiki->setMode($this->getModeIntValue($data['mode']));
        }
        if (isset($data['display']['sectionNumbers'])) {
            $wiki->setDisplaySectionNumbers($data['display']['sectionNumbers']);
        }
        if (isset($data['display']['contents'])) {
            $wiki->setDisplayContents($data['display']['contents']);
        }

        return $wiki;
    }
701206
public function setOldAttribute($data = null) {
        if (is_null($data)) {
            $data = $this->getAttribute();
        }
        $this->isNewRecord = false;
        $this->__oldAttributes = array_merge($this->__oldAttributes, $data);
        return $this;
    }
376916
public function get_plugin_data( $key = null ) {
		return empty( $key ) ? $this->_plugin_data : $this->_plugin_data[ $key ];
	}
247139
public function create($data)
    {
        /* ACCESS CHECK */
        if (!$this->isAllowed(ResourceName::RESOURCE_SITES, 'admin')) {
            $this->getResponse()->setStatusCode(Response::STATUS_CODE_401);

            return $this->getResponse();
        }
        /* */

        $inputFilter = new SiteInputFilter();
        $inputFilter->setData($data);

        if (!$inputFilter->isValid()) {
            return new ApiJsonModel(
                [],
                1,
                'Some values are missing or invalid.',
                $inputFilter->getMessages()
            );
        }

        $data = $inputFilter->getValues();

        $siteManager = $this->getSiteManager();
        $userId = $this->getCurrentUserId();

        $data = $siteManager->prepareSiteData($data);
        /** @var \Rcm\Repository\Domain $domainRepo */
        $domainRepo = $this->getEntityManager()->getRepository(
            \Rcm\Entity\Domain::class
        );

        $data['domain'] = $domainRepo->createDomain(
            $data['domainName'],
            $userId,
            'Create new domain in ' . get_class($this)
        );

        /** @var \Rcm\Entity\Site $newSite */
        $newSite = new Site(
            $userId,
            'Create new site in ' . get_class($this)
        );

        $newSite->populate($data);
        // make sure we don't have a siteId
        $newSite->setSiteId(null);

        $newSite = $siteManager->createSite($newSite);

        return new ApiJsonModel($newSite, 0, 'Success');
    }
660410
public function execute($data = null)
    {
        $this->controller->setResponse(new HtmlResponse(
            '',
            $data->response->getStatusCode(),
            $data->response->getHeaders()
        ));

        $result = $this->next->execute($data);

        $this->controller->setRedirect(null);

        return $result;
    }
531303
public function load($data)
    {
        foreach ($data as $row) {
            $this->put($row['id'], RequestEntity::createExisting($row));
        }

        return $this;
    }
61727
public function make($data = null)
    {
        if (is_null($data)) {
            return new NullResource();
        } elseif (is_array($data)) {
            return static::makeFromArray($data);
        }

        $method = static::getMakeMethod($data);

        return static::$method($data);
    }
850702
public function getData($key = null)
    {
        if (!$key) {
            return $this->data;
        } else if ($this->hasKey($key)) {
            return $this->data[$key] ?? null;
        }

        return null;
    }
1007671
public function serialize($data)
    {
        $serializer = $this->_serializer;

        //https://github.com/wikimedia/php-session-serializer/blob/master/src/Wikimedia/PhpSessionSerializer.php
        if ($serializer === 'php') {
            $r = '';
            foreach ($data as $key => $value) {
                $v = serialize($value);
                $r .= "$key|$v";
            }
            return $r;
        } elseif ($serializer === 'php_binary') {
            $r = '';
            foreach ($data as $key => $value) {
                $r .= chr(strlen($key)) . $key . serialize($value);
            }
            return $r;
        } elseif ($serializer === 'php_serialize') {
            return $this->serialize($data);
        } elseif ($serializer === 'json') {
            return json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
        } elseif ($serializer === 'igbinary') {
            return igbinary_serialize($data);
        } elseif ($serializer === 'wddx') {
            return wddx_serialize_value($data);
        } else {
            throw new InvalidOptionException(['`:serializer` serializer is not support', 'serializer' => $serializer]);
        }
    }
230388
protected function createResponse($data = null)
    {
        $view = new View();
        $view->setData($data);

        $context = $view->getSerializationContext();
        if ($this->serialization->isCheckDepth()) {
            $context->enableMaxDepthChecks();
        }
        $context->setGroups($this->serialization->getGroups());

        $view->setSerializationContext($context);

        return $this->handleView($view);
    }
128275
public function embedData($data, $name, $contentType = null)
    {
        $embed = $this->createEmbedViaData($data, $name, $contentType);

        return $this->getSwiftMessage()->embed($embed);
    }
696302
static function smartUnserialize(string $data)
    {
        try {
            $value = @unserialize($data);
        } catch (\Throwable $e) {
            throw new DeserializationFailedException('An exception was thrown during unserialization', 0, $e);
        }

        // distinguish between "false on error" and a serialized FALSE value
        if ($value === false && $data !== self::getSerializedFalse()) {
            throw new DeserializationFailedException('Unserialization failed - data possibly malformed');
        }

        return $value;
    }
384067
final public static function getInstance($data=null)
    {
        $class = get_called_class();
        if (empty($class)) return null;

        if (empty($data)){
            $classID = $class;

        } elseif(is_array($data)){
            $classID = $class.md5(implode('', array_keys($data)));

        } else {
            $classID = $class.md5($data);
        }

        if (!isset(self::$_instances[$classID])){
            self::$_instances[$classID] = new $class($data);
        }

        return self::$_instances[$classID];
    }
821160
public function serialize($data, $group = null)
    {
        $context = new SerializationContext();

        if ($group) {
            $context->setGroups($group);
        }

        return $this->serializer->serialize($data, 'json', $context);
    }
1048118
public static function load( Wiki &$wikiClass ) {

		if( !array_key_exists( 'SiteMatrix', $wikiClass->get_extensions() ) ) {
			throw new DependencyError( "SiteMatrix" );
		}

		$SMres = $wikiClass->apiQuery(
			array(
				'action' => 'sitematrix',
			)
		);

		$wikis = $SMres['sitematrix'];
		//return $wikis;

		$retarray = array(
			'raw'      => $wikis,
			'urls'     => array(),
			'langs'    => array(),
			'names'    => array(),
			'privates' => array()
		);

		foreach( $wikis as $site ){
			if( is_array( $site ) ) {
				if( isset( $site['site'] ) ) {

					$retarray['langs'][] = $site['code'];
					$retarray['names'][$site['code']] = $site['name'];

					foreach( $site['site'] as $site2 ){
						$retarray['urls'][] = $site2['url'];

						if( isset( $site2['private'] ) ) $retarray['privates'][] = $site2;
					}
				} else {
					foreach( $site as $site2 ){
						$sites2['urls'][] = $site2['url'];

						if( isset( $site2['private'] ) ) $retarray['privates'][] = $site2;
					}
				}
			}
		}

		return $retarray;

	}
472446
public function update($data = null)
    {
        if ($this->hasMethod('__update') && is_callable([$this, '__update'])) {
            return $this->__update($data);
        }

        // notify observers about new data
        $this->notify();
    }
1287465
protected function addData($key, $data = null)
    {
        $this->data[self::RS_KEY_DATA]->{$key} = $data;
    }