예제 #1
0
 /**
  * @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);
     }
 }
예제 #2
0
 /**
  * @return array
  */
 protected function analyzeCurrentData()
 {
     $relationship = $this->stack->end()->getRelationship();
     $data = $relationship->isShowData() === true ? $relationship->getData() : null;
     return $this->dataAnalyzer->analyze($data);
 }