lithium\storage\session\strategy\Encrypt::read()

public method

Read encryption method.

Parameters

  • array $data

    the Data being read.

  • array $options

    Options for this method.

Returns

mixed

Returns the decrypted key or the dataset.

Source

	public function read($data, array $options = []) {
		$class = $options['class'];

		$encrypted = $class::read(null, ['strategies' => false]);
		$key = isset($options['key']) ? $options['key'] : null;

		if (!isset($encrypted['__encrypted']) || !$encrypted['__encrypted']) {
			return isset($encrypted[$key]) ? $encrypted[$key] : null;
		}

		$current = $this->_decrypt($encrypted['__encrypted']);

		if ($key) {
			return isset($current[$key]) ? $current[$key] : null;
		} else {
			return $current;
		}
	}