@param JsonApiSerializer $serializer
@param array             $fields

@return array
18108
protected static function columns(JsonApiSerializer $serializer, array $fields)
    {
        $filterColumns = [];

        foreach ($serializer->getTransformer()->getMappings() as $mapping) {
            $classAlias = $mapping->getClassAlias();

            if (!empty($fields[$classAlias])) {
                $className = $mapping->getClassName();
                $aliased = $mapping->getAliasedProperties();

                /** @var \Illuminate\Database\Eloquent\Model $model * */
                $model = new $className();
                $columns = $fields[$classAlias];

                if (count($aliased) > 0) {
                    $columns = str_replace(array_values($aliased), array_keys($aliased), $columns);
                }

                foreach ($columns as &$column) {
                    $filterColumns[] = sprintf('%s.%s', $model->getTable(), $column);
                }
                $filterColumns[] = sprintf('%s.%s', $model->getTable(), $model->getKeyName());
            }
        }

        return (count($filterColumns) > 0) ? $filterColumns : ['*'];
    }
811639
public function getSerilizer()
    {
        if (!$this->_serializer instanceof AnDomainSerializerAbstract) {
            if (!$this->_serializer instanceof AnServiceIdentifier) {
                $this->setSerializer($this->_serializer);
            }

            $this->_serializer = $this->getService($this->_serializer);
        }

        return $this->_serializer;
    }
667214
public static function createResourceModelTransformer(SerializerInterface $serializer = null)
    {
        $serializer = self::prepareSerializer($serializer);

        return new ResourceModelTransformer($serializer);
    }
1046807
public function unserialize($serialized)
    {
        $unserialized = unserialize($serialized);
        $this->id = $unserialized['id'];
        $this->username = $unserialized['username'];
        $this->rolesStringAsArray = $unserialized['roles'];
        $this->groups = new ArrayCollection();
    }
628744
def get_serializer_info(self, serializer):
        
        if hasattr(serializer, 'child'):
            # If this is a `ListSerializer` then we want to examine the
            # underlying child serializer instance instead.
            serializer = serializer.child
        return self.get_fields(serializer.fields)
364292
public static function assert(
        JsonApiSerializer $serializer,
        Fields $fields,
        Included $included,
        Sorting $sort,
        ErrorBag $errorBag,
        $className
    ) {
        self::validateQueryParamsTypes($serializer, $fields, 'Fields', $errorBag);
        self::validateIncludeParams($serializer, $included, 'include', $errorBag);

        if (!empty($className) && false === $sort->isEmpty()) {
            self::validateSortParams($serializer, $className, $sort, $errorBag);
        }

        if ($errorBag->count() > 0) {
            throw new QueryException();
        }
    }
164177
public function jsonSerialize()
    {
        $parameters = [];

        if ($this->accessToken) {
            $parameters['access_token'] = $this->accessToken;
        }

        if ($this->userId) {
            $parameters['user_id'] = $this->userId;
        }

        if ($this->entityId) {
            $parameters['entity_id'] = $this->entityId;
        }

        if ($this->expires) {
            $parameters['expires'] = $this->expires;
        }

        return $parameters;
    }
603298
public function register($serializer)
    {
        if (is_array($serializer)) {
            foreach ($serializer as $s) {
                $this->register($s);
            }

            return $this;
        }

        if (is_string($serializer)) {
            if (!class_exists($serializer)) {
                throw new SerializersPoolException("Serializer class '{$serializer}' not found");
            }

            $serializer = new $serializer;
        }

        if (!is_object($serializer)) {
            $serializer_type = gettype($serializer);
            throw new SerializersPoolException("Serializer should be object or class name, scalar '{$serializer_type}' given instead");
        }

        if (!is_subclass_of($serializer, 'AMQPy\Serializers\SerializerInterface')) {
            $serializer_class = get_class($serializer);
            throw new SerializersPoolException("Serializer class '{$serializer_class}' doesn't implement default serializer interface");
        }

        $this->registered[$serializer->getContentType()] = $serializer;

        return $this;
    }
251225
public function serialize(ISerializer $serializer)
    {
        if ($serializer instanceof XmlSerializer) {
            $arr = $this->toArray();

            return $serializer->serialize(
                $arr,
                $this->_serializationProperties
            );
        } else {
            throw new \InvalidArgumentException(Resources::UNKNOWN_SRILZER_MSG);
        }
    }
524759
public static function toJson(ResourceAbstract $resource, $options = 0, $serializer = DataArraySerializer::class)
    {
        $manager = new Manager();
        $manager->setSerializer(new $serializer());
        return $manager->createData($resource)->toJson($options);
    }
472957
protected static function sort(JsonApiSerializer $serializer, Builder $builder, Model $model)
    {
        $mapping = $serializer->getTransformer()->getMappingByClassName(get_class($model));
        $sorts = RequestFactory::create()->getSort()->sorting();

        if (!empty($sorts)) {
            $aliased = $mapping->getAliasedProperties();

            $sortsFields = str_replace(array_values($aliased), array_keys($aliased), array_keys($sorts));
            $sorts = array_combine($sortsFields, array_values($sorts));

            foreach ($sorts as $field => $direction) {
                $builder->orderBy($field, ($direction === 'ascending') ? 'ASC' : 'DESC');
            }
        }

        return $builder;
    }
1013679
public static Serializer<?> serializer( Serializer<?> serializer,
                                            int tupleSize ) {
        if (tupleSize <= 1) return serializer;
        if (tupleSize == 2) return serializer(serializer, serializer);
        if (tupleSize == 3) return serializer(serializer, serializer, serializer);
        if (tupleSize == 4) return serializer(serializer, serializer, serializer, serializer);
        Serializer<?>[] serializers = new Serializer<?>[tupleSize];
        Arrays.fill(serializers, serializer);
        return new TupleNSerializer(serializers);
    }
293693
protected function serializeResource(SerializerAbstract $serializer, $data)
    {
        $includeAttributes = true;
        $resourceKey = $this->resource->getResourceKey();
        if ($this->isRelationships() && $this->isRootScope()) {
            $includeAttributes = false;
        }

        if ($this->resource instanceof Collection) {
            return $serializer->collection($resourceKey, $data, $includeAttributes);
        }

        if ($this->resource instanceof Item) {
            return $serializer->item($resourceKey, $data, $includeAttributes);
        }

        return $serializer->null();
    }
228028
public function addDefaultSerializers(SerializerInterface $jmsSerializer): EntryPoint
    {
        $this->addSerializer(new ArticleHandler($jmsSerializer));
        $this->addSerializer(new OrderHandler($jmsSerializer));
        $this->addSerializer(new CategoryHandler($jmsSerializer));
        $this->addSerializer(new MediaHandler($jmsSerializer));
        $this->addSerializer(new ManufacturerHandler($jmsSerializer));

        return $this;
    }
504551
public static function applySerializers(array $serializers, $data) {
		return array_reduce($serializers, function ($serializedData, $serializer) {
			return $serializer->apply($serializedData);
		}, $data);
	}
1264320
public CacheConfigurationBuilder<K, V> withKeySerializer(Class<? extends Serializer<K>> keySerializerClass) {
    return withSerializer(new DefaultSerializerConfiguration<>(requireNonNull(keySerializerClass, "Null key serializer class"), DefaultSerializerConfiguration.Type.KEY));
  }
1226643
public function getSerializer()
    {
        if (! $this->serializer || ! ($this->serializer instanceof Serializer)) {
            $this->serializer = Serializer::getInstance();
        }

        return $this->serializer;
    }