@param array|EntityInterface $data
@param string                $name
@param string                $type

@return array
344323
protected function recurse(&$data, $name = null, $type = null)
    {
        if (is_scalar($data)) {
            $this->makeScalarDefinition($data, $name, $type);

            return;
        }

        if ($this->maxDepth > 0 && $this->depth >= $this->maxDepth) {
            $this->out[] = "{$this->makeDefinition($type, null, $name)} " .
            "<em style='color:#999;'>... depth limit reached</em>";

            return;
        }

        if ($this->isCircularReference($data)) {
            $this->out[] = "{$this->makeDefinition($type, null, $name)} " .
            "<em style='color:#999;'>... cirular reference omitted</em>";

            return;
        }

        $this->registerObject($data);

        $iterable = $data;
        $lpad     = str_repeat($this->indentWith, $this->depth);

        if (is_array($iterable)) {
            $len  = count($iterable);
            $type = $type ? : 'array';

            $this->out[] = "{$this->makeDefinition($type, $len, $name)} {";

            $this->depth++;

            foreach ($iterable as $key => $val) {
                $valType = gettype($val);
                if ($val instanceof EntityInterface) {
                    $valType = $val->calledClassName();
                }
                elseif (is_object($val)) {
                    $valType = get_class($val);
                }

                $this->recurse($val, $key, $valType);
            }

            $this->depth--;

            $this->out[] = "{$lpad}}";
        }
        elseif (is_object($iterable)) {
            $len  = count($iterable);
            $type = $type ? : get_class($iterable);
            
            if (!($iterable instanceof Traversable)) {
                $iterable = get_object_vars($data);
            }

            $this->out[] = "{$this->makeDefinition($type, $len, $name)} {";

            $this->depth++;

            foreach ($iterable as $key => $val) {
                if (!isset($iterable->$key) && !isset($iterable[$key])) {
                    continue;
                }

                $valType = $iterable instanceof EntityInterface ? $iterable->typeof($key) : null;
                $this->recurse($val, $key, $valType);
            }

            $this->depth--;

            $this->out[] = "{$lpad}}";
        }

        $this->deregisterObject($data);
    }
203149
protected function getMorphs($name, $type, $id)
    {
        $type = $type ?: $name.'_type';

        $id = $this->getkeyname();

        return array($type, $id);
    }
1285936
public function createFromArray(array $data, $name = null)
    {
        $preloadOids = $itemList = array();
        $menu        = $this->_createFromArray($data, $name, $itemList, $preloadOids);

        if ($preloadOids && $this->aclProvider) {
            //preload all acls for menu items
            try {
                $this->aclProvider->findAcls($preloadOids);
            } catch(AclNotFoundException $e) {
            }
        }

        foreach ($itemList as $item) {
            $this->setContext($item[0], $item[1], $item[2]);
        }

        return $menu;
    }
1105586
public static function toArray($data, array $propertyNameMapper = []): array
    {
        if (is_object($data)) {
            return self::entityToArray($data, $propertyNameMapper);
        }

        if (is_array($data)) {
            return self::arrayToArray($data, $propertyNameMapper);
        }

        return [$data];
    }
203495
protected function setParam(array $data, $name, $required = true, $type = 'string')
    {
        if (!isset($data[$name]) || ($required && gettype($data[$name]) !== $type)) {
            throw new Exception\DomainException(
                sprintf(
                    '%s expects the annotation %s parameter to define a %s; received "%s"',
                    get_class($this),
                    $name,
                    $type,
                    gettype($data[$name])
                )
            );
        }

        $this->$name = $data[$name];
    }
1088635
public function newEntityCollection(array $data): array {
		if (empty($this->entityType)) {
			throw new EntityFactoryException("Cannot produce entity without type.", EntityFactoryException::UNSET_ENTITY_TYPE);
		}
		
		$entities = [];
		foreach ($data as $datum) {
			$entities[] = $this->newEntity($datum);
		}
		
		return $entities;
	}
1166118
protected function _renderNode($type, $name, $data)
    {
        $typeAlias = str_replace(' ', '-', strtolower($type));
        ?>
        <li class="jbchild">
            <div class="jbelement">
                <span class="jbname"><?php echo $name; ?></span>
                (<span class="jbtype jbtype-<?php echo $typeAlias; ?>"><?php echo $type; ?></span>)
                <span class="jbvalue"><?php echo $data; ?></span>
            </div>
        </li>
    <?php
    }
642407
public function factoryFromArray(array $data, $type = null)
    {
        if ($type === null) {
            if (array_key_exists('type', $data)) {
                $type = $data['type'];
                unset($data['type']);
            } else {
                throw new \InvalidArgumentException(
                    'Parameter type not specified in ConfirmationFactory.factoryFromArray()'
                );
            }
        }
        $confirmation = $this->factory($type);
        foreach ($data as $key => $value) {
            if ($confirmation->offsetExists($key)) {
                $confirmation->offsetSet($key, $value);
            }
        }

        return $confirmation;
    }
640126
public function meta($type, $data, $names = null)
    {
        $result = [];
        $names = $names ? (array) $names : array_keys($data);
        foreach ($names as $name) {
            $value = isset($data[$name]) ? $data[$name] : null;
            if ($value && $meta = $this->_meta($type, $name, $value)) {
                $result[] = $meta;
            }
        }
        return join(' ', $result);
    }
967660
public static function createFromArray($name, array $data = [])
    {
        $type = parent::createFromArray($name, $data);
        \assert($type instanceof self);
        $pos = \strpos($type->getType(), '[]');
        if ($pos !== false) {
            $type->setItems(\substr($type->getType(), 0, $pos));
        }
        $type->setType('array');

        foreach ($data as $key => $value) {
            switch ($key) {
                case 'uniqueItems':
                    $type->setUniqueItems($value);

                    break;
                case 'items':
                    if (\is_array($value) && isset($value['type'])) {
                        $type->setItems($value['type']);

                        break;
                    }
                    $type->setItems($value);

                    break;
                case 'minItems':
                    $type->setMinItems($value);

                    break;
                case 'maxItems':
                    $type->setMaxItems($value);

                    break;
            }
        }

        return $type;
    }
1155048
public function index($indexName, $type, array $data)
	{
		$index = $this->elasticSearcher->indicesManager()->getRegistered($indexName);

		$params = [
			'index' => $index->getInternalName(),
			'type'  => $type,
			'body'  => $data
		];

		// If an ID exists in the data set, use it, otherwise let elasticsearch generate one.
		if (array_key_exists('id', $data)) {
			$params['id'] = $data['id'];
		}

		return $this->elasticSearcher->getClient()->index($params);
	}
713705
public static function code( $type, $name = null ) 
	{
		$buffer = "";
		
		foreach( static::holder( $name )->get( $type ) as $item )
		{
			$buffer .= call_user_func( array( '\\CCAsset', $type ), $item, $name );
		}
		
		return $buffer;
	}
358964
private function normalizeData($name, $data)
    {
        if (!isset($this->ignoreProcessing[$name])) {
            return array_map('trim', explode(',', $data));
        } else {
            return [$data];
        }
    }
294322
private function convertFromPg($data, TypeInterface $type)
    {
        if ($data === null) {
            return null;
        }

        if ($type instanceof ArrayType) {
            return $this->convertArrayFromPg($data, $type);
        }

        if (isset($this->mappings[(string) $type])) {
            return $this->convertCompositeFromPg($data, $type);
        }

        return $this->convertScalarFromPg($data, $type);
    }
259564
protected function parseSingleIdentityInRelationship($name, array $data)
    {
        list ($type, $idx) = $this->parseTypeAndId($data);

        $isValid = true;
        if (empty($type) === true || is_string($type) === false) {
            $isValid  = false;
            $this->errors->addRelationshipTypeError($name, 'Element should be non empty string.');
        }
        if ($idx === null || is_string($idx) === false) {
            $isValid = false;
            $this->errors->addRelationshipIdError($name, 'Element should be non empty string.');
        }

        $result = $isValid === true ? new ResourceIdentifierObject($type, $idx) : null;

        return $result;
    }
329997
public function get($type, $name)
    {
        return isset($this->clients[$type][$name]) ? $this->clients[$type][$name] : null;
    }
636724
public function createEntity(array $data = [], EntityInterface $parent_entity = null, $apply_default_values = false)
    {
        $implementor = $this->getEntityImplementor();

        if (!class_exists($implementor, true)) {
            throw new InvalidTypeException(
                "Unable to resolve the given entity implementor '$implementor' upon entity creation request."
            );
        }

        return new $implementor($this, $data, $parent_entity, $apply_default_values);
    }