@param string $data

@return DataSet
@throws ParserRuntimeException
194955
protected function getDataSetFromString(string $data) : DataSet
    {
        if (strpos($data, "\n") === false) {
            throw new ParserRuntimeException('The data could not be parsed (no pattern found).', 1459589758);
        }

        if (strpos($data, "\r\n") !== false) {
            // if the source file was created under windows, replace the line endings
            $data = str_replace("\r\n", "\n", $data);
        }

        // Prepare the data from the data set
        list($pattern, $properties) = explode("\n", $data, 2);
        $pattern = substr($pattern, 1, -1);

        $properties = @parse_ini_string($properties);
        if ($properties === false) {
            throw new ParserRuntimeException(
                "The data could not be parsed (invalid properties for pattern '$pattern').",
                1459589759
            );
        }

        $dataSet = new DataSet($pattern);
        $dataSet->setProperties($properties);

        return $dataSet;
    }
1290433
public function process($data = array())
    {
        try {
            return $this->twig->render($this->_source, $data);
        } catch (Twig_Error $exp) {
            throw new Exception\ParserException(
                "Error Processing Request: " . $exp->getMessage()
            );

        }
    }
329287
public function set($data)
    {
        $this->error = [];
        $result = null;
        switch ($this->format) {
            case 'nvp':
                parse_str($data, $this->data);
                $result = !empty($this->data);
                break;

            case 'json':
            default:
                $this->data = empty($data) ? [] : (json_decode($data, true) ?: []);
                $result = json_last_error() == JSON_ERROR_NONE;
                if (empty ($result)) {
                    $this->error = [
                        'error' => json_last_error(),
                        'msg'   => json_last_error_msg(),
                    ];
                }
                break;
        }

        return $result;
    }
655845
public function decode(string $data): array
    {
        $decoded = $json = json_decode($data, true);

        if (JSON_ERROR_NONE !== json_last_error()) {
            throw DeserializerRuntimeException::createNotParsable($this->getContentType(), json_last_error_msg());
        }

        if (!is_array($decoded)) {
            throw DeserializerRuntimeException::createNotParsable($this->getContentType(), 'Not an object');
        }

        return $decoded;
    }
1149138
protected function dataToXml($data)
    {
        if (!is_string($data)) {
            throw SanitizerException::create(SanitizerException::ERROR_FAILED_TO_PARSE_XML);
        }
        $xml = new DOMDocument();
        $error = null;
        try {
            $loaded = $xml->loadXML($data, $this->getLoadFlags());
        } catch (Exception $x) {
            $error = $x;
        } catch (Throwable $x) {
            $error = $x;
        }
        if ($error !== null || $loaded === false) {
            throw SanitizerException::create(SanitizerException::ERROR_FAILED_TO_PARSE_XML, $error ? $error->getMessage() : '');
        }

        return $xml;
    }
1204097
public function decode(string $data): array
    {
        try {
            $decoded = Yaml::parse($data);
        } catch (ParseException $e) {
            throw DeserializerRuntimeException::createNotParsable($this->getContentType());
        }

        if (!is_array($decoded)) {
            throw DeserializerRuntimeException::createNotParsable($this->getContentType());
        }

        return $decoded;
    }
874694
private function deserializeData($data)
    {
        $result = $this->get('jms_serializer')->deserialize(
            $data,
            $this->getTargetGroupRepository()->getClassName(),
            'json',
            DeserializationContext::create()
                ->setSerializeNull(true)
        );

        return $result;
    }
466281
public function setContents($data)
	{
		$level = error_reporting(0);
		$result = file_put_contents($this->getPathname(), $data);
		error_reporting($level);

		if (false === $result)
		{
			$error = error_get_last();
			throw new RuntimeException($error['message']);
		}

		return $result;
	}
1025124
public static function fromData(array $data)
    {
        $group = new static(array_map(function ($data) {
            return $data['class']::fromData($data['params']);
        }, $data['constraints']));

        return $group->logicalOperator($data['logicalOperator']);
    }
307014
public function setData(array $data)
    {
        $this->data = $this->parseData($data);

        $this->setRules($this->initialRules);

        return $this;
    }
89482
public function create($data)
    {
        if (! $data instanceof ExampleTag) {
            throw new \InvalidArgumentException(
                'The ExampleAssembler expected an ExampleTag object to base the descriptor on'
            );
        }

        $descriptor = new ExampleDescriptor($data->getName());
        $descriptor->setFilePath((string) $data->getFilePath());
        $descriptor->setStartingLine($data->getStartingLine());
        $descriptor->setLineCount($data->getLineCount());
        $descriptor->setDescription($data->getDescription());
        $descriptor->setExample($this->finder->find($descriptor));

        return $descriptor;
    }
777611
public function convertFrom(string $data): DataProviderInterface
    {
        $data = json_decode($data, true);

        if (!isset($data['data'], $data['class'])) {
            throw new ConverterException('Data have wrong format to convert (No class or data field)');
        }

        $provider = $data['class'];

        $provider = $this->createDataProvider($provider);
        $provider->fromArray($data['data']);

        return $provider;
    }
603811
protected function parseSet($data) {
        $result   =  array();
        foreach ($data as $key=>$val){
            if(is_array($val)) {
                switch($val[0]) {
                    case 'inc':
                        $result['$inc'][$key]  =  (int)$val[1];
                        break;
                    case 'set':
                    case 'unset':
                    case 'push':
                    case 'pushall':
                    case 'addtoset':
                    case 'pop':
                    case 'pull':
                    case 'pullall':
                        $result['$'.$val[0]][$key] = $val[1];
                        break;
                    default:
                        $result['$set'][$key] =  $val;
                }
            }else{
                $result['$set'][$key]    = $val;
            }
        }
        return $result;
    }
205075
protected function renderDataRecursive($data)
    {
        if (!is_array($data) && !($data instanceof Traversable)) {
            throw new InvalidArgumentException('The renderable data must be iterable.');
        }

        if (!$this->form() instanceof ObjectContainerInterface) {
            throw new RuntimeException(sprintf(
                'The [%s] widget has no data model.',
                static::CLASS
            ));
        }

        foreach ($data as $key => $val) {
            if (is_string($val)) {
                $data[$key] = $this->renderData($val);
            } elseif (is_array($val) || ($val instanceof Traversable)) {
                $data[$key] = $this->renderDataRecursive($val);
            } else {
                continue;
            }
        }

        return $data;
    }
717439
protected function parseData($data=null)
    {
        if (!$data) $data = $this->def['data'];
        
        if (is_array($data)) {
            foreach ($data as $k => $v) {
                if (strpos($v, '@') === 0 && class_exists('\CURLFile')) {
                    $v = ltrim($v, '@');
                    $data[$k] = new \CURLFile($v);
                }
            }
        }
        
        return $data;
    }
899015
public function create($data)
    {
        $methodDescriptor = new MethodDescriptor();
        $methodDescriptor->setNamespace(
            substr(
                (string) $data->getFqsen(),
                0,
                -strlen($data->getName()) - 4
            )
        );
        $this->mapReflectorToDescriptor($data, $methodDescriptor);

        $this->assembleDocBlock($data->getDocBlock(), $methodDescriptor);
        $this->addArguments($data, $methodDescriptor);
        $this->addVariadicArgument($data, $methodDescriptor);

        return $methodDescriptor;
    }
1165327
public static function create($data)
    {
        if (!$data) {
            return new self(self::COLLECTION_NAME);
        }

        $type = null;
        if (isset($data[self::COLLECTION_NAME])) {
            $type = self::COLLECTION_NAME;
        } elseif (isset($data[self::CONDITION_NAME])) {
            $type = self::CONDITION_NAME;
        }
        if (null === $type) {
            throw new ContainerException(
                sprintf('Invalid container type. Use %s', implode(' or ', self::ALLOWED_TYPES))
            );
        }
        if (!is_array($data[$type])) {
            throw new ContainerException(sprintf('Parameter "%s" must be array', $type));
        }
        /** @var Container $mainContainer */
        $mainContainer = new self($type);
        if (isset($data[self::AND_OR_OPERATOR_NAME])) {
            $mainContainer->setAndOr($data[self::AND_OR_OPERATOR_NAME]);
        }
        if (self::COLLECTION_NAME === $type) {
            foreach ($data[$type] as $datum) {
                $mainContainer->addToCollection(self::create($datum));
            }
        } elseif (self::CONDITION_NAME === $type) {
            $mainContainer->getCondition()->setData($data[$type]);
        }

        return $mainContainer;
    }