Serializes the profile configuration.

@param array $options

@return array
542503
public function serialize(array $options = [])
    {
        $facets = $this->repository
            ->findVisibleFacets($this->tokenStorage->getToken(), in_array(Options::REGISTRATION, $options));

        return array_map(function (Facet $facet) {
            return $this->facetSerializer->serialize($facet, [Options::PROFILE_SERIALIZE]);
        }, $facets);
    }
103617
public function getIdFromOptions(array $options) : string
    {
        $optionsResolver = new OptionsResolver();
        $optionsResolver->setRequired('id');

        $options = $optionsResolver->resolve($options);

        return $options['id'];
    }
5748
public function serialize(Step $step, array $options = [])
    {
        $serialized = [
            'id' => $step->getUuid(),
            'parameters' => $this->serializeParameters($step),
            'picking' => $this->serializePicking($step),
            'items' => $this->serializeItems($step, $options),
        ];

        if (!empty($step->getTitle())) {
            $serialized['title'] = $step->getTitle();
        }
        if (!empty($step->getDescription())) {
            $serialized['description'] = $step->getDescription();
        }

        return $serialized;
    }
850463
public function apiSerialize($object, $options = [])
    {
        if (!empty($object)) {
            return $this->serializerProvider->serialize($object, $options);
        }

        return $object;
    }
452320
public function prepareAttributes($options)
    {
        if (!$options) {
            return null;
        }

        $attributes = [];

        foreach ($options as $name => $option) {
            if ($option !== null) {
                $name = is_numeric($name) ? $option : $name;
                $attributes[] = $name.'="'.$option.'" ';
            }
        }

        return join('', $attributes);
    }
850873
public function getData(Options $options = null)
    {
        if ($options === null) {
            // Take store global/default options
            $options = $this->store->getOptions();
        }

        // TODO - TEST database connection charset !!!
        //

        ini_set('default_charset', 'UTF-8');

        if (PHP_VERSION_ID < 50600) {
            iconv_set_encoding('internal_encoding', 'UTF-8');
        }

        /*
          $backup_encoding = iconv_get_encoding("internal_encoding");
          iconv_set_encoding("internal_encoding", "UTF-8");
          iconv_set_encoding("input_encoding", "UTF-8");
          iconv_set_encoding("output_encoding", "UTF-8");
          mb_internal_encoding("UTF-8");
         */

        $internal_encoding = strtoupper(ini_get('default_charset'));
        $charset = strtoupper($this->options['charset']);

        $csv = '';

        // Get unformatted data when using csv writer
        $options->getHydrationOptions()->disableFormatters();
        $data = $this->store->getData($options)->toArray();

        if (strtoupper($this->options['charset']) !== $charset && !function_exists('iconv')) {
            throw new Exception\RuntimeException('CSV writer requires iconv extension');
        }

        $iconv_output_charset = $this->options['charset'];
        if ($this->options['ignore_translit_error']) {
            $iconv_output_charset .= '//TRANSLIT//IGNORE';
        }

        if (count($data) === 0) {
            $columns = $this->store->getColumnModel()->getColumns();
            $header_line = implode($this->options['field_separator'], array_keys((array) $columns));
            $csv .= $header_line . $this->options['line_separator'];
        } else {
            $header_line = implode($this->options['field_separator'], array_keys($data[0]));
            $csv .= $header_line . $this->options['line_separator'];

            foreach ($data as $row) {
                switch ($this->options['field_separator']) {
                    case self::SEPARATOR_TAB:
                        array_walk($row, [$this, 'escapeTabDelimiter']);
                        break;
                    default:
                        array_walk($row, [$this, 'escapeFieldDelimiter']);
                }

                array_walk($row, [$this, 'escapeLineDelimiter']);

                if ($this->options['enclosure'] !== '') {
                    array_walk($row, [$this, 'addEnclosure']);
                }

                $line = implode($this->options['field_separator'], $row);

                if ($charset !== $internal_encoding) {
                    $l = (string) $line;
                    if ($l !== '') {
                        $l = @iconv($internal_encoding, $iconv_output_charset, $l);
                        if ($l === false || strlen($l) === 0) {
                            throw new Exception\CharsetConversionException("Cannot convert the charset to '" . $this->options['charset'] . "' from charset '$internal_encoding', using '$iconv_output_charset' value: '$line'.");
                        } else {
                            $line = $l;
                        }
                    }
                }

                $csv .= $line . $this->options['line_separator'];
            }
        }

        return $csv;
    }
1357624
public function serialize(User $user, array $options = [])
    {
        $serialized = [
            'id' => $user->getUuid(),
            'name' => trim($user->getFirstName().' '.$user->getLastName()),
            'picture' => $this->serializePicture($user),
            'firstName' => $user->getFirstName(),
            'lastName' => $user->getLastName(),
            'username' => $user->getUsername(),
            'publicUrl' => $user->getPublicUrl(),
        ];

        if (!in_array(Transfer::MINIMAL, $options)) {
            $serialized['email'] = $user->getEmail();
        }

        return $serialized;
    }
845538
public function serialize(Location $location, array $options = [])
    {
        return [
            'autoId' => $location->getId(),
            'id' => $location->getUuid(),
            'name' => $location->getName(),
            'meta' => [
                'type' => $location->getType(),
            ],
            'street' => $location->getStreet(),
            'boxNumber' => $location->getBoxNumber(),
            'streetNumber' => $location->getStreetNumber(),
            'zipCode' => $location->getPc(),
            'town' => $location->getTown(),
            'country' => $location->getCountry(),
            'phone' => $location->getPhone(),
            'gps' => [
                'latitude' => $location->getLatitude(),
                'longitude' => $location->getLongitude(),
            ],
        ];
    }
249733
public function deserialize(array $data, Options $options = null)
    {
        if (empty($options)) {
            $options = $this->optionsRepo->findOneBy(['id' => $data['id']]);
        }
        if (empty($options)) {
            $options = new Options();
        }
        if (isset($data['user'])) {
            $user = isset($data['user']['id']) ? $this->userRepo->findOneBy(['uuid' => $data['user']['id']]) : null;
            $options->setUser($user);
        }
        if (isset($data['data'])) {
            $options->setOptions($data['data']);
        }

        return $options;
    }
1203793
public function setJsonOptions($options)
    {
        $this->encodingOptions = (int) $options;

        return $this->setData($this->getData());
    }
1188034
protected function prepareConfiguration(array $options=null)
    {
        $configuration = clone $this->configuration;
        if (is_array($options)) {
            $options = array_replace($configuration->all(), $options);
            $configuration = new Configuration($options);
        }
        return $configuration;
    }
34782
public function download(array $options)
    {
        $requestUrl = null;
        $requestOptions = [
            'headers' => [
                'Authorization' => $this->authToken,
            ],
            'sink' => isset($options['SaveAs']) ? $options['SaveAs'] : null,
        ];

        if (isset($options['FileId'])) {
            $requestOptions['query'] = ['fileId' => $options['FileId']];
            $requestUrl = $this->downloadUrl.'/b2api/v1/b2_download_file_by_id';
        } else {
            if (!isset($options['BucketName']) && isset($options['BucketId'])) {
                $options['BucketName'] = $this->getBucketNameFromId($options['BucketId']);
            }

            $requestUrl = sprintf('%s/file/%s/%s', $this->downloadUrl, $options['BucketName'], $options['FileName']);
        }

        $this->authorizeAccount();

        $response = $this->client->request('GET', $requestUrl, $requestOptions, false);

        return isset($options['SaveAs']) ? true : $response;
    }
1368013
public function toArray(array $options = [])
    {
        $childrenIds = [];

        /** @var NodeInterface $child */
        foreach ($this->getChildren() as $child) {
            $childrenIds[] = $child->getId();
        }

        return [
            'id'                => $this->getId(),
            'name'              => $this->getName(),
            'type'              => $this->getType(),
            'metadata'          => $this->getMetadata()->getData(),
            'parentId'          => $this->getParent() ?
                $this->getParent()->getId() :
                null,
            'childrenIds'       => $childrenIds
        ];
    }
448025
public function serialize(AdminTool $tool, array $options = [])
    {
        $serialized = [
            'id' => $tool->getUuid(),
            'icon' => $tool->getClass(),
            'name' => $tool->getName(),
        ];

        return $serialized;
    }
1100844
public function getData(array $options)
    {
        $clientIDs = preg_split("/[[:space:]]+/isu", $this->options['clientId']);

        foreach ($clientIDs as $clientID) {
            if (! $clientID) {
                continue;
            }

            $client = new Google_Client([
                'client_id' => $clientID
            ]);

            $payload = $client->verifyIdToken($this->idToken);
            if ($payload) {
                break;
            }
        }

        if (! $payload) {
            throw new Exception("idToken verification failed");
        }

        $photoUrl = $payload['picture'];
        if ($photoUrl) {
            $photoUrl = $this->setSizeParam($photoUrl, 640);
        }

        return new Result([
            'externalId' => $payload['sub'],
            'name'       => $payload['name'],
            'profileUrl' => '',
            'photoUrl'   => $photoUrl,
            'location'   => '',
            'language'   => $payload['locale'],
            'email'      => $payload['email']
        ]);
    }
242961
public function serialize($value, array $options=[])
    {

        $serialized = json_encode(
            $value,
            $this->bitmask($options),
            $this->getDepth($options)
        );

        return $serialized;

    }
636672
public function normalizeOptions(array $options)
    {
        $options['useSsl'] = (bool) ($options['useSsl'] == 'SSL');
        $options['useStartTls'] = (bool) ($options['useStartTls'] == 'TLS');
        $options['accountCanonicalForm'] = $this->accountCanonicalFormMap[ $options['accountCanonicalForm'] ];

        return $options;
    }