Create a new ArrayType from an array of data

@param string $name

@return ArrayType
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;
    }
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;
    }
475256
protected function createHeader($name)
    {
        $new = clone $this;

        $normalized = strtolower($name);

        $name = HeaderHelper::normalizeHeaderName($name);

        $new->headerNames[$normalized] = $name;
        $new->headers[$name] = [];

        return $new;
    }
1256490
public function create(array $data)
    {
        $data = $this->client->post(Inflector::pluralize($this->getResourceName()), [$this->getResourceName() => $data]);

        return $this->fromArray(reset($data));
    }
959076
public static function newInstance($name, $data = null)
  {
    if (!is_array($data)) {
      $data = array();
    }

    $config = self::getInstance($name);
    $config->_data = $data;

    return $config;
  }
222133
public function dataStore($name)
    {
        if (gettype($name) == "string") {
            if (!isset($this->dataStores[$name])) {
                $this->dataStores[$name] = new DataStore;
            }
            return $this->dataStores[$name];
        } else {
            //$name's type is different from string
            //return everything for further process
            return $name;
        }
    }
33
public function getInArray($name, array $array)
    {
        $value = $this->get($name);
        return in_array($value, $array) ? $value : $array[key($array)];
    }
352672
public static function buildFeature($name, array $data = array())
    {
        $values = [];

        $value = null;
        if (isset($data['values'])) {
            foreach ($data['values'] as $value) {

                $filter = $isFeature = null;
                if (isset($value['filters']) && !empty($value['filters'])) {
                    $filter = self::buildFilterBag($value['filters']);
                }
                if (isset($value['is_feature'])) {
                    $isFeature = (bool) $value['is_feature'];
                }

                $values[] = new Value($value['value'], $filter, $isFeature);
            }
            $value = new ValueBag($values);
        }

        $filter = null;
        if (isset($data['filters']) && !empty($data['filters'])) {
            $filter = self::buildFilterBag($data['filters']);
        }

        $breaker = null;
        if (isset($data['breaker']) && !empty($data['breaker'])) {
            $breaker = self::buildFilterBag($data['breaker']);
        }

        $feature = new Feature($name, $filter, $breaker, $value);

        if (isset($data['enabled']) && !$data['enabled']) {
            $feature->setEnabled(false);
        }

        return $feature;
    }
1202589
protected function createArrayType($array)
    {
        $type = new ArrayAccessType;

        foreach ($array as $key=>$value) {
            $type[$key] = $this->toType($value);
        }

        return $type;
    }
708716
public static function make( $name, array $body )
    {
        /** @var AbstractResponseFormatter $obj */
        $obj = null;

        list( $type, $method ) = explode( '/', $name );

        if ( !is_null( $obj = static::create( $type ) ) ) {
            return $obj->{$method}( $body );
        }

        return $body;
    }
470933
public static function createFromArray(array $array): self
    {
        $activeElements = [];
        foreach (($array['active_elements'] ?? []) as $activeElement) {
            $activeElements[] = is_array($activeElement)
                ? Counter::createFromArray($activeElement)
                : $activeElement;
        }

        $aggregation = new self(
            $array['name'],
            (int) ($array['application_type'] ?? Filter::AT_LEAST_ONE),
            (int) ($array['total_elements'] ?? 0),
            []
        );
        $aggregation->activeElements = $activeElements;
        $counters = array_map(function (array $counter) {
            return Counter::createFromArray($counter);
        }, $array['counters'] ?? []);
        foreach ($counters as $counter) {
            $aggregation->counters[$counter->getId()] = $counter;
        }

        $aggregation->highestActiveLevel = $array['highest_active_level'] ?? 0;

        return $aggregation;
    }
568607
final public function getPropertyType($name) {

		if (in_array($name, ['db', 'loadedFromDb', 'typeList', 'errors'])) {
			$type = NULL;
		} else if (array_key_exists($name, $this->typeList)) {
			$type = $this->typeList[$name];
		} else {
			$type = 'string';
		}

		return $type;
	
	}
507255
public function create_data( $data = [] ) {
		if ( is_object( $data ) && method_exists( $data, 'to_array' )  ) {
			return $data->to_array();
		}

		return is_array( $data ) ? $data : [];
	}
526237
public static function init($name)
    {
        if (empty(self::$instance[$name]) || !self::$instance[$name] instanceof self) {
            self::$instance[$name]        = new self();
            self::$instance[$name]->queue = new \SplQueue();
        }
        return self::$instance[$name];
    }
11956
public function getFieldType($name)
    {
        return $this->checkFieldExist($name)->types[$name] != null
            ? rtrim($this->types[$name], '[]')
            : null;
    }
87319
public static function createFromArray($name, array $data = [])
    {
        $type = parent::createFromArray($name, $data);
        \assert($type instanceof self);

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

                    break;
                case 'maximum':
                    $type->setMaximum($value);

                    break;
                case 'format':
                    $type->setFormat($value);

                    break;
                case 'multipleOf':
                    $type->setMultipleOf($value);

                    break;
            }
        }

        return $type;
    }
846007
public function field($name)
    {
        foreach($this->data as $post)
        {
            $fieldType = get_field_object($name, $post->ID)['type'];

            if(in_array($fieldType, ['text']))
            {
                $post->$name = get_field($name, $post->ID);
            }
            elseif(in_array($fieldType, ['image']))
            {
                $post->$name = Data::arrayToObject(get_field($name, $post->ID));
            }
        }

        return $this->data;
    }