/** * @param string $type * * @return string[] */ private function getIncludePathsByType($type) { // if include paths are set in params use them otherwise use default include paths from schema $includePaths = $this->parameters->getIncludePaths(); if (empty($includePaths) === false) { $typePaths = $includePaths; } else { $schema = $this->container->getSchemaByResourceType($type); $typePaths = $schema->getIncludePaths(); } return $typePaths; }
/** * @param object|array|Iterator|null $data * @param DataAnalyzerInterface $analyzer * @param EncodingParametersInterface|null $parameters * * @return EncodingParametersInterface */ private function getEncodingParameters($data, DataAnalyzerInterface $analyzer, $parameters = null) { /** @var bool $isDataEmpty */ /** @var SchemaProviderInterface $schema */ list($isDataEmpty, , $schema) = $analyzer->analyze($data); if ($isDataEmpty === true) { return $this->factory->createEncodingParameters(); } elseif ($parameters !== null && $parameters->getIncludePaths() !== null) { return $parameters; } else { $includePaths = $schema->getIncludePaths(); $fieldSets = $parameters === null ? null : $parameters->getFieldSets(); return $this->factory->createEncodingParameters($includePaths, $fieldSets); } }
/** * @param array|object|null $data * @param EncodingParametersInterface|null $parameters * * @return EncodingParametersInterface */ private function getEncodingParameters($data, EncodingParametersInterface $parameters = null) { if (empty($data) === true && $parameters === null) { return $this->parametersFactory->createEncodingParameters(); } elseif ($parameters !== null && $parameters->getIncludePaths() !== null) { return $parameters; } else { $schema = $this->container->getSchema(is_array($data) ? $data[0] : $data); $includePaths = $schema->getIncludePaths(); $fieldSets = $parameters === null ? null : $parameters->getFieldSets(); return $this->parametersFactory->createEncodingParameters($includePaths, $fieldSets); } }