transform method

@param array|Collection $data

@return mixed
350000
protected function transform($data)
    {
        $items = [
            'byref'       => (bool)$data[ '@attributes.by_reference' ],
            'types'       => explode('|', $this->createString($data[ 'type' ])),
            'description' => '',
        ];

        $this->copy([ 'name', 'default' ], $data, $items);
        //$data['default']
        return $items;
    }
20883
public function reverseTransform($data)
    {
        if (is_array($data)) {
            $id = current($data);
            $document = $this->objectManager->find($this->documentClass, $id);

            return $this->entityDbMapper->fromEntityToDb($document);
        }

        return null;
    }
635003
protected function toArrayRecursive($data)
    {

        if ($data instanceof RecordFieldValue) {
            return $data->toArrayRecursive($data);
        } else {
            return parent::toArrayRecursive($data);
        }
    }
781794
private static function convertFromMongo(array $data)
    {
        // Move the Mongo _id field into an 'id' field.
        if (isset($data['_id'])) {
            $data['id'] = $data['_id'];
            unset($data['_id']);
        }

        foreach ($data as $name => &$value) {
            if (is_array($value)) {
                // Inner documents are converted too.
                $value = self::convertFromMongo($value);
            } elseif (is_object($value)) {
                switch (get_class($value)) {
                    case 'MongoId':
                        $value = $value->__toString();
                        break;
                    case 'MongoDate':
                        $value = new \DateTime('@' . $value->sec);
                        break;
                }
            }
        }

        return $data;
    }
1078026
public function transformCollection($collection, $meta = [])
    {
        return $this->getFractalFactory()->makeCollection($collection, $meta, $this->getTransformer());
    }
865630
public function transform($data)
    {
        if (self::MODE_TO_PUBLIC === (self::MODE_TO_PUBLIC & $this->mode)) {
            return $this->map($data, UrlMapperInterface::MODE_INTERNAL_TO_PUBLIC);
        } else {
            return $data;
        }
    }
988619
public function transform($data)
    {
        if (empty($data))
            return null;

        $data = array_merge(array(
            'id' => null,
            "sender" => null,
            "recipients" => array(),
            "subject" => null,
            "source" => null,
            "size" => null,
            "type" => null,
            "created_at" => null,
            "formats" => array()
        ), $data);

        $data['created_at'] = $data['created_at'] === null ? null : new \DateTime($data['created_at']);
        $data['sender'] = $data['sender'] === null ? null : $this->addressTransformer->transform($data['sender']);

        $recipients = array();
        foreach ($data['recipients'] as $recipient) {
            $recipients[] = $this->addressTransformer->transform($recipient);
        }
        $data['recipients'] = $recipients;

        return new Message($data);
    }
1160346
public function transform(array $data)
    {
        $frontMatter = new FrontMatter;

        foreach ($data as $key => $value) {
            if ($taxonomy = $this->getTaxonomyByKey($key)) {
                $terms = $this->getTerms($taxonomy, $value);
                $frontMatter->addTerms($terms);
            }

            if ($isProperty = $this->keyIsFrontMatterProperty($frontMatter, $key)) {
                $setter = 'set'.ucfirst($key);
                if ('date' === $key) {
                    $value = $this->convertToDateTime($value);
                }
                $frontMatter->$setter($value);
            }

            # Metadata is arbitrary data an author wants
            # to have available in the view as a variable.
            $isMetadata = is_null($taxonomy) && false === $isProperty;
            if ($isMetadata) {
                $frontMatter->setMeta($key, $value);
            }
        }

        return $frontMatter;
    }
793177
protected function extractData(array $data)
    {
        $converted = array();

        foreach ($data as $value) {

            if ($value instanceof Result) {

                $converted[$value->getId()] = $value->getData();
            }
        }

        return $converted;
    }
1155761
public function transform($collection)
    {
        if (null === $collection) {
            return [];
        }

        if (!$collection instanceof Collection) {
            throw new UnexpectedTypeException($collection, 'Doctrine\Common\Collections\Collection');
        }

        return $collection->toArray();
    }
757283
protected function transform($data)
    {

        $items = [
            'name'       => $data[ 'name' ],
            'final'      => $this->boolValue($data[ '@attributes.final' ]),
            'abstract'   => $this->boolValue($data[ '@attributes.abstract' ]),
            'static'     => $this->boolValue($data[ '@attributes.static' ]),
            'line'       => (int)$data[ '@attributes.line' ],
            'visibility' => $data[ '@attributes.visibility' ],
            'namespace'  => $data[ '@attributes.namespace' ],
            'package'    => $data[ '@attributes.package' ],

            'description'      => $this->createDescription($data[ 'docblock.description' ]),
            'long-description' => $this->createDescription($data[ 'docblock.long-description' ]),

            'returns' => [],
            'throws'  => [],

            'tags'      => [],
            'arguments' => [],
        ];


        $tags = $data->get('docblock.tag');
        if ( $tags !== null ) {
            // if only 1 tag
            if ( $data->has('docblock.tag.@attributes') ) {
                $tags = Collection::make([ $data->get('docblock.tag') ]);
            }
            $returnTag = $tags->where('@attributes.name', 'return');
            if ( $returnTag !== null ) {
                $returnType         = $returnTag->get('*.type', $returnTag->get('*.@attributes.type', []));
                $items[ 'returns' ] = is_array($returnType->first()) ? $returnType->first() : $returnType->toArray();
            }

            $throwsTags = $tags->where('@attributes.name', 'throws');
            if ( $throwsTags !== null ) {
                $throwsTags->each(function ($tag) use (&$items) {
                    $items[ 'throws' ][] = $tag[ 'type' ];
                });
            }
        }


        if ( $data[ 'name' ] = '' ) {
            $desc = $data->get('docblock.description', 'asdf ' . str_random(5));
            if ( is_array($desc) ) {
                $desc = implode("\n", $desc);
            }
            $data[ 'name' ] = camel_case(last(explode(' ', $desc)));
        }

        $items[ 'full_name' ]  = $data->get('full_name', $this->belongsTo[ 'class_name' ] . '::' . $data[ 'name' ]);
        $items[ 'class_name' ] = head(explode('::', $items[ 'full_name' ]));
        $items[ 'inherited' ]  = $this->belongsTo[ 'full_name' ] !== $items[ 'class_name' ];


        $this->items          = $items;
        $items[ 'tags' ]      = $this->structures('docblock.tag', Tag::class, $data);
        $items[ 'arguments' ] = $this->structures('argument', Argument::class, $data);

        foreach ( $items[ 'arguments' ] as $i => $argument ) {
            /** @var $argument Argument */
            $tag = $items[ 'tags' ]->where('variable', $argument[ 'name' ])->first();
            if ( $tag !== null ) {
                $items[ 'arguments' ][ $i ][ 'description' ] = $tag[ 'description' ];
            }
        }

        return $items;
    }
1239098
protected function transform($data)
    {
        if (!$data instanceof GetSchema\Schema) {
            throw new Exception('Data is not a Schema.');
        }

        $definition = $data->getTableDefinition($this->table);
        $defSchema = $definition->getSchema();

        $returnData = [];
        $row = [
            self::KEY_TABLE => $definition->getName(),
            0 => $definition->getName(),
            self::KEY_CREATE_TABLE => $defSchema,
            1 => $defSchema,
        ];
        $returnData[] = $row;

        return $returnData;
    }
564230
private function convertObjectToArray($data)
    {
        $converted = [];
        foreach($data as $key => $value) {
            if(is_object($value)) {
                $converted[$key] = $this->convertObjectToArray($value);
            } else {
                $converted[$key] = $value;
            }
        }

        return $converted;
    }
528201
protected function transform($data)
    {
        if (!$data instanceof GetSchema\Schema) {
            throw new Exception('Data is not a Schema.');
        }

        $definition = $data->getTableDefinition($this->fromExpr);
        $defSchema = $definition->getSchema();
        $parser = new PHPSQLParser(false, false, [Options::CONSISTENT_SUB_TREES => true]);
        $query = new CreateQuery(new Query($defSchema, $parser->parse($defSchema)));
        $createExpr = $query->getObjectExpression();
        $indices = $createExpr->getIndices();

        $returnData = [];

        /* @var  $index Query\IndexExpression */
        foreach ($indices as $index) {
            foreach ($index->getColumns() as $columnIndex => $column) {
                $row = self::$tplData;
                $row[self::KEY_TABLE] = $row[0] = $definition->getName();
                $row[self::KEY_NON_UNIQUE] = $row[1] = $index->getNonUnique();
                $row[self::KEY_NAME] = $row[2] = $index->getKeyName();
                $row[self::KEY_SEQ_IN_INDEX] = $row[3] = $columnIndex + 1;
                $row[self::KEY_COLUMN_NAME] = $row[4] = $column->getColumnName();
                $row[self::KEY_NULL] = $row[9] = $column->getColumnType()->isNullable() ? 'YES' : '';

                $returnData[] = $row;
            }
        }

        return $returnData;
    }
270245
public function transformGetToPut($data)
    {
        // Fix ridiculous klipfolio GET/PUT difference
        foreach ($data[ClientResource::FIELD_RESOURCES] as &$resource) {
            if (in_array($resource['name'], $this->map)) {
                $resource['name'] = array_search($resource['name'], $this->map);
            }
        }
        return $data;
    }
121803
public function transform($groups)
    {
        $value = array();

        if ($groups instanceof Collection) {
            foreach($groups as $group) {
                $value[$group->getId()] = array('group' => true);
            }
        }

        return array('groups_collection' => $value);
    }
111489
private function convertArrayObjects($data)
    {
        if ($data instanceof \ArrayObject || $data instanceof \stdClass) {
            $data = (array) $data;
        }
        if (\is_array($data)) {
            foreach ($data as $k => $v) {
                $data[$k] = $this->convertArrayObjects($v);
            }
        }

        return $data;
    }