Converts a given entity to its array representation.

@param FormatOptions $formatOptions

@return array
433000
private function entityToArray(FormatOptions $formatOptions)
    {
        return [
            'cropX' => $formatOptions->getCropX(),
            'cropY' => $formatOptions->getCropY(),
            'cropWidth' => $formatOptions->getCropWidth(),
            'cropHeight' => $formatOptions->getCropHeight(),
        ];
    }
304998
public function to($format, array $options = []) {
		$default = ['indexed' => true];
		$options += $default;
		$options['internal'] = !$options['indexed'];
		unset($options['indexed']);

		$this->offsetGet(null);
		if (!$options['internal'] && !is_scalar(current($this->_index))) {
			$options['internal'] = true;
		}
		return parent::to($format, $options);
	}
1093350
protected function xmlizeOptions($formalOpts = array(), $recursive = false){
        $returnValue = (string) '';
        if(!is_array($formalOpts)){
            throw new InvalidArgumentException('formalOpts must be an array, '.gettype($formalOpts).' given');
        }

        $options = (!$recursive) ? $this->getAttributeValues() : $formalOpts;
        foreach($options as $key => $value){
            if(is_string($value) || is_numeric($value)){
                // str_replace is unicode safe...
                $returnValue .= ' '.$key.'="'.str_replace(array(
                            '&',
                            '<',
                            '>',
                            '\'',
                            '"'
                                ), array(
                            '&amp;',
                            '&lt;',
                            '&gt;',
                            '&apos;',
                            '&quot;'
                                ), $value).'"';
            }
            if(is_bool($value)){
                $returnValue .= ' '.$key.'="'.(($value) ? 'true' : 'false').'"';
            }
            if(is_array($value)){
                if(count($value) > 0){
                    $keys = array_keys($value);
                    if(is_int($keys[0])){ // repeat the attribute key
                        $returnValue .= ' '.$key.'="'.implode(' ', array_values($value)).'"';
                    }else{
                        $returnValue .= $this->xmlizeOptions($value, true);
                    }
                }
            }
        }

        return (string) $returnValue;
    }
969744
protected function initArrayCallbackOption($options)
    {
        if (!isset($options['callback']) && !isset($options['groups']) && \is_callable($options)) {
            $options = ['callback' => $options];
        }

        return $options;
    }
418958
function toArray($route = null,array $parameters = array(),$format = null) {
        if($format === null){
            $format = $this->defaultFormat;
        }
        if(in_array($format, $this->formatArray)){
            $method = 'formatToArray'.ucfirst($format);
            return $this->$method($route,$parameters);
        }
    }
324989
public static function createXmlDocument($docOptions = 0)
    {
        $xmldoc = new DOMDocument(self::XML_VERSION, self::XML_ENCODING);
        $xmldoc->preserveWhiteSpace =
            ($docOptions & XMLUTIL_OPT_DONT_PRESERVE_WHITESPACE) != XMLUTIL_OPT_DONT_PRESERVE_WHITESPACE
        ;
        $xmldoc->formatOutput = false;
        if (($docOptions & XMLUTIL_OPT_FORMAT_OUTPUT) == XMLUTIL_OPT_FORMAT_OUTPUT) {
            $xmldoc->preserveWhiteSpace = false;
            $xmldoc->formatOutput = true;
        }
        XmlUtil::$xmlNsPrefix[spl_object_hash($xmldoc)] = array();
        return $xmldoc;
    }
410816
public static function toArray($cookies, $options = [])
    {
        $data = [];
        foreach ($cookies as $name => $cookie) {
            $data[$name][] = $cookie->data();
        }
        return $data;
    }
814116
protected function transformLegacyFormatting(array &$editorOptions)
    {

        if (isset($editorOptions['formatting']['u'])) {
            $editorOptions['formatting']['underline'] = $editorOptions['formatting']['u'];
            unset($editorOptions['formatting']['u']);
        }
        if (isset($editorOptions['formatting']['del'])) {
            $editorOptions['formatting']['strikethrough'] = $editorOptions['formatting']['del'];
            unset($editorOptions['formatting']['del']);
        }
    }
771366
public function get($decodeOptions = [])
    {
        $media = $this->_classes['media'];
        $format = $this->format();
        return $format ? $media::decode($format, $this->_stream->toString(), $decodeOptions, $this) : $this->_stream->toString();
    }
156340
public static function formatResultData(AjaxChoiceListFormatterInterface $formatter, ChoiceListView $choiceListView)
    {
        $result = [];

        foreach ($choiceListView->choices as $i => $choiceView) {
            if ($choiceView instanceof ChoiceGroupView) {
                $group = $formatter->formatGroupChoice($choiceView);

                foreach ($choiceView->choices as $j => $subChoiceView) {
                    $group = $formatter->addChoiceInGroup($group, $subChoiceView);
                }

                if (!$formatter->isEmptyGroup($group)) {
                    $result[] = $group;
                }
            } else {
                $result[] = $formatter->formatChoice($choiceView);
            }
        }

        return $result;
    }
565554
protected function optionsToRaw(array $options)
    {
        $collections = [];

        foreach ($options as $lang => $labels) {
            $finalWithTranslations = [];
            foreach ($labels as $label) {
                if ($label->isPlain) {
                    $collections[$label->value] = $label->text;
                } else {
                    $collections[$label->lang][$label->value] = $label->text;
                }
            }
        }

        $finals = [];

        foreach ($collections as $value => $collection) {
            $finals[$value] = is_array($collection) ? (object) $collection : $collection;
        }

        return (object) $finals;
    }
874120
public function getFormatsFromOperation(string $resourceClass, string $operationName, string $operationType): array
    {
        $resourceMetadata = $this->resourceMetadataFactory->create($resourceClass);

        if (!$formats = $resourceMetadata->getTypedOperationAttribute($operationType, $operationName, 'formats', [], true)) {
            return $this->configuredFormats;
        }

        if (!\is_array($formats)) {
            throw new InvalidArgumentException(sprintf("The 'formats' attributes must be an array, %s given for resource class '%s'.", \gettype($formats), $resourceClass));
        }

        return $this->getOperationFormats($formats);
    }
9725
public static function toJSON($formato, $datos)
    {
        return json_encode(self::toArray($formato, $datos), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
    }
23630
protected function parseOptions(array $options): array
    {
        $this->setTransformer(new StringToBooleanTransformer());

        $options = parent::parseOptions($options);

        // Set some default CSS classes if chosen theme is "bootstrap".
        if (isset($options['theme']) && 'bootstrap' === $options['theme']) {
            $options['attributes']['class'] = isset($options['attributes']['class']) ?
                'form-check-input '.$options['attributes']['class'] : 'form-check-input';
            $options['label_attr']['class'] = isset($options['label_attr']['class']) ?
                'form-check-label '.$options['label_attr']['class'] : 'form-check-label';
        }

        return $options;
    }
921692
protected function parseOptions($options)
    {
        return collect(explode(';', $options))->mapWithKeys(function ($option) {
            $data = explode('=', $option, 2);

            return [$data[0] => $data[1] ?? true];
        })->all();
    }
491346
public function getOptions(array $defaultOptions = []): array
    {
        $options = $this->options;
        $options['TTL'] = array_key_exists('TTL', $options) ? $options['TTL'] : $defaultOptions['TTL'];
        $options['urgency'] = array_key_exists('urgency', $options) ? $options['urgency'] : $defaultOptions['urgency'];
        $options['topic'] = array_key_exists('topic', $options) ? $options['topic'] : $defaultOptions['topic'];

        return $options;
    }
1012535
public function transform($fieldOptions)
    {
        $result = array();
        if (is_array($fieldOptions)) {
            foreach ($fieldOptions as $fieldOption) {
                if($fieldOption instanceof FieldOptionInterface) {
                    $result[$fieldOption->getKey()] = $fieldOption->getValue();
                }
            }
        }

        return $result;
    }