Converts raw data into a Cloze question entity.

@param array         $data
@param ClozeQuestion $clozeQuestion
@param array         $options

@return ClozeQuestion
760312
public function deserialize($data, ClozeQuestion $clozeQuestion = null, array $options = [])
    {
        if (empty($clozeQuestion)) {
            $clozeQuestion = new ClozeQuestion();
        }
        $this->sipe('text', 'setText', $data, $clozeQuestion);

        $this->deserializeHoles($clozeQuestion, $data['holes'], $data['solutions'], $options);

        return $clozeQuestion;
    }
1304043
protected function _prepareMessage($data, array $options)
    {
        $attributes = [];

        $options += [
            'silent' => false,
            'compress' => true,
            'serializer' => extension_loaded('msgpack') ? 'msgpack' : 'json',
            'delivery_mode' => 1
        ];

        switch ($options['serializer']) {
            case 'json':
                $data = json_encode($data);
                $attributes['content_type'] = 'application/json';
                break;

            case 'text':
                $attributes['content_type'] = 'application/text';
                break;

            default:
                throw new RuntimeException('Unknown serializer: ' . $options['serializer']);
        }

        if (!empty($options['compress'])) {
            $data = gzcompress($data);
            $attributes += ['content_encoding' => 'gzip'];
        }

        if (!empty($options['delivery_mode'])) {
            $attributes['delivery_mode'] = $options['delivery_mode'];
        }

        return [$data, $attributes, $options];
    }
610981
public function initialize(array $data, array $options = []): NodeInterface
    {
        if (!isset($data['id']) || !is_string($data['id']) || $data['id'] === '') {
            throw ValidationException::create('Field "id" must be a non-empty string.');
        }

        if (!preg_match('/^[0-9a-z\_]+$/i', $data['id'])) {
            throw ValidationException::create(
                'Field "id" must have only characters 0-9, a-z, A-Z or "_". Received: '.$data['id']
            );
        }

        $this->setId($data['id']);

        $this->addSubscriber($this);

        if (isset($data['name'])) {
            if (!is_string($data['name']) || $data['name'] === '') {
                throw ValidationException::create('Field "name" must be a non-empty string.');
            }

            $this->setName($data['name']);
        }

        if (isset($data['type'])) {
            if (!is_string($data['type']) || $data['type'] === '') {
                throw ValidationException::create('Field "type" must be a non-empty string.');
            }

            if (!preg_match('/^[0-9a-z\_]+$/i', $data['type'])) {
                throw ValidationException::create(
                    'Field "type" must have only characters 0-9, a-z, A-Z or "_". Received: '.$data['type']
                );
            }

            $this->setType($data['type']);
        }


        if (isset($data['metadata'])) {
            if (!is_array($data['metadata'])) {
                throw ValidationException::create('Field "metadata" must be an array.');
            }

            $this->setMetadata($data['metadata']);
        }

        if (isset($data['parent'])) {
            if (!is_object($data['parent'])
                || !($data['parent'] instanceof NodeInterface)
            ) {
                throw ValidationException::create(
                    'Field "parent" must be an instance of NodeInterface.'
                );
            }

            $this->addParent($data['parent']);
        }

        if (isset($data['children'])) {
            if (!is_array($data['children'])) {
                throw ValidationException::create('Field "children" must be an array.');
            }

            foreach ($data['children'] as $node) {
                if (!is_object($node) || !($node instanceof NodeInterface)) {
                    throw ValidationException::create(
                        'Field "children" must be an array of NodeInterface instances.'
                    );
                }

                $node->addParent($this);

                $this->addChild($node);
            }
        }

        return $this;
    }
386843
protected function buildStringResponse($content, $headers = [], $options = 0)
    {
        $headers = array_merge($headers, $this->headers);

        $data = [
            'data' => $content,
        ];

        $response = new JsonResponse($data, $this->getStatusCode(), $headers, $options);

        return $response;
    }
207674
public static final function gzipDecode($data, array $options = null): array
    {
        $encoder = new GzipEncoder($options);

        return [$encoder->decode($data), $encoder->hasError()
            ? new EncoderException('GZip Error: '. $encoder->getError()) : null];
    }
1089753
public function save($data = null, array $options = []) {
        if ($data) {
            $this->data($data);
        }

        return $this->getRepository()->save($this, $options);
    }
787340
public function insert(array $data, $options = [])
    {
        // 分析并处理数据
        $data = $this->parseData($data, $options);
        $bulk = new BulkWrite;
        if ($insertId = $bulk->insert($data)) {
            $this->insertId = $insertId;
        }
        $this->log('insert', $data, $options);
        return $bulk;
    }
1323036
public function update($data, $options)
    {
        $set  = [];
        $data = $this->parseData($data, $options);
        if (empty($data)) {
            return '';
        }
        foreach ($data as $key => $val) {
            $set[] = $key . '=' . $val;
        }

        $sql = str_replace(
            ['%TABLE%', '%SET%', '%JOIN%', '%WHERE%', '%ORDER%', '%LIMIT%', '%LOCK%', '%COMMENT%'],
            [
                $this->parseTable($options['table'], $options),
                implode(',', $set),
                $this->parseJoin($options['join'], $options),
                $this->parseWhere($options['where'], $options),
                $this->parseOrder($options['order'], $options),
                $this->parseLimit($options['limit']),
                $this->parseLock($options['lock']),
                $this->parseComment($options['comment']),
            ], $this->updateSql);

        return $sql;
    }
1206431
public static function Encrypt ($data, $key, $options = []) {
		$options = static::_AdjustOptions($options);
		return openssl_encrypt($data, $options['method'], $key, $options['openssl_options'], $options['iv']);
	}
1002788
public function deserialize($data, Keyword $keyword = null, array $options = [])
    {
        if (empty($keyword)) {
            $keyword = new Keyword();
        }
        $cleanedText = trim(strip_tags(html_entity_decode($data['text'])));
        $keyword->setText($cleanedText);

        $this->sipe('caseSensitive', 'setCaseSensitive', $data, $keyword);
        $this->sipe('score', 'setScore', $data, $keyword);
        $this->sipe('feedback', 'setFeedback', $data, $keyword);

        return $keyword;
    }
147216
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;
		}
	}
1153203
public function deserialize(array $data, Item $item = null, array $options = [])
    {
        return $this->serializer->deserialize($data, $item, $options);
    }
550275
protected function openSslEncrypt(
        string $data,
        string $method,
        string $password,
        int $options,
        string $initializationVector
    ): string {
        $encrypted = $this->openSslEncryptImpl($data, $method, $password, $options, $initializationVector);

        $message = $this->getErrorMessage();
        $encrypted !== false ?: $this->throwException(new CryptException($message));

        return $encrypted;
    }
484507
public function deserialize($data, BooleanQuestion $question = null, array $options = [])
    {
        if (empty($question)) {
            $question = new BooleanQuestion();
        }

        $this->deserializeChoices($question, $data['choices'], $data['solutions'], $options);

        return $question;
    }
1139368
public function  convert($data=false,$options= false){
		if (!$data) {
			return $data;
		};
		if (!isset($data[0])) {
			$data = array($data);
		}
					
		
		
		 		
		$this->scan($data);

	}
441820
public function ask(string $question, array $options): int
	{
		$options = array_values($options);

		$this->output->writeLn(trim($question));

		$this->output->write($this->buildOptionsList($options));

		$key = (int) $this->input->read() - 1;

		if(isset($options[$key]))
		{
			return $key;
		}

		return $this->ask($question, $options);
	}
765469
public function keyword($title, $content, $options = [])
    {
        $data = array_merge([
            'title'   => $title, 
            'content' => $content
        ], $options);

        return $this->send('keyword', $data);
    }