@param string $type
@param array  $options

@throws DataTypeNotFoundException

@return MetadataType
166113
public function createType($type, array $options = [])
    {
        $class = isset($this->mappingTypeList[$type]) ? $this->mappingTypeList[$type] : $type;
        if (!class_exists($class)) {
            throw new DataTypeNotFoundException($type, $class);
        }

        return new MetadataType($class, $options);
    }
980453
private function determineBindingType(array $options)
    {
        if (isset($options['bindings']) && !$this->isAssoc($options['bindings'])) {
            return self::BINDING_POSITIONAL;
        }

        return self::BINDING_NAMED;
    }
41081
protected function getMetadataType($name, $type, array $option = [])
    {
        $obj = $this->getOption($name, $type);

        return new Metadata($name, $this->resolveOptions($obj, $option));
    }
216574
public function create($type, $options = array()) {
        $options = new Values($options);

        $data = Values::of(array(
            'Type' => $type,
            'Configuration.Url' => $options['configurationUrl'],
            'Configuration.Method' => $options['configurationMethod'],
            'Configuration.Filters' => Serialize::map($options['configurationFilters'], function($e) { return $e; }),
            'Configuration.Triggers' => Serialize::map($options['configurationTriggers'], function($e) { return $e; }),
            'Configuration.FlowSid' => $options['configurationFlowSid'],
            'Configuration.RetryCount' => $options['configurationRetryCount'],
        ));

        $payload = $this->version->create(
            'POST',
            $this->uri,
            array(),
            $data
        );

        return new WebhookInstance(
            $this->version,
            $payload,
            $this->solution['serviceSid'],
            $this->solution['channelSid']
        );
    }
224886
protected function createForm($type, $data = null, array $options = array())
    {
        return $this->factory->create($type, $data, $options);
    }
162154
public function denormalise(array $data, array $options = [])
    {
        if (empty($data)) {
            return $data;
        }

        if (!isset($options["entityClass"])) {
            throw new NormalisationException("Cannot denormalise data without knowing the main entity class");
        }
        if (!isset($options["metadataProvider"])) {
            throw new NormalisationException("Cannot denormalise data without a metadata provider");
        }

        /** @var EntityMetadataProviderInterface $metadataProvider */
        $this->metadataProvider = $options["metadataProvider"];
        $metadata = $this->metadataProvider->getEntityMetadata($options["entityClass"]);

        // split fields based on prefix
        $prefixedFields = [];
        foreach ($data[0] as $field => $value) {
            $fieldParts = explode("__", $field);
            // if this field has no prefix, set it to an empty string
            if (count($fieldParts) == 1) {
                array_unshift($fieldParts, "");
            }
            // add the field to the prefix's array
            $prefix = $fieldParts[0];
            if (empty($prefixedFields[$prefix])) {
                $prefixedFields[$prefix] = [];
            }
            $prefixedFields[$prefix][$fieldParts[1]] = $field;
        }

        // handle case where only 1 prefix is present
        if (count($prefixedFields) == 1) {
            $fields = array_pop($prefixedFields);
            $primaryKey = $metadata->getPrimaryKey();
            if (isset($fields[$primaryKey])) {
                $this->primaryKeyFields = [$fields[$primaryKey] => true];
            }
            return $this->denormaliseData($data, $fields);
        }

        // complex result set
        if (!isset($options["entityMap"])) {
            throw new NormalisationException("Cannot denormalise data without an entity map");
        }

        $entityMap = $options["entityMap"];

        $collection = $metadata->getCollection();

        if (empty($prefixedFields[$collection])) {
            throw new NormalisationException("The collection '$collection' was not found in the fields array for this record set: '" . implode("', '", array_keys($prefixedFields)) . "'");
        }

        // reset primary key fields
        $this->primaryKeyFields = [];
        $this->treedEntities = [];
        $this->childRowAliases = [];

        $this->createFieldTree($prefixedFields, $entityMap, $collection, $options["entityClass"]);

        reset($data);
        $result = $this->denormaliseData($data, $prefixedFields[$collection], $collection);

        return  $result;
    }
702589
public static function get($type, array $options)
    {
        if (self::TYPE_STASH == $type) {
            $cache = new StashCache();
        } elseif (self::TYPE_DOCTRINE == $type) {
            $cache = new DoctrineCache();
        } elseif (self::TYPE_NONE == $type) {
            $cache = new NoCache();
        } else {
            throw new InvalidArgumentException(sprintf('Unknown cache type "%s".', $type));
        }
        $cache->setOptions($options);

        return $cache;
    }
1076197
public function get($options = []) {
		// get available data types
		if (get_called_class() == 'Object\Data\Types') {
			$types = $this->data;
		} else {
			$types = \Object\Data\Types::getStatic();
		}
		// transform data
		$result = [];
		foreach ($this->data as $k => $v) {
			foreach ($this->columns as $k2 => $v2) {
				if ($this->column_key == $k2) {
					$result[$k][$k2] = $k;
				} else if (!array_key_exists($k2, $v)) {
					$result[$k][$k2] = $v2['default'] ?? $types[$v2['type']]['no_data_type_default'] ?? null;
				} else {
					$result[$k][$k2] = $v[$k2];
				}
			}
		}
		// filtering
		if (!empty($options['where'])) {
			foreach ($result as $k => $v) {
				$found = true;
				foreach ($options['where'] as $k2 => $v2) {
					// todo: add options ad in query
					if (array_key_exists($k2, $v) && $v[$k2] != $v2) {
						$found = false;
						break;
					}
				}
				if (!$found) {
					unset($result[$k]);
				}
			}
		}
		// sorting, if none specified we sort by name if its in columns
		$orderby = null;
		if (isset($options['orderby'])) {
			$orderby = $options['orderby'];
		} else if (isset($this->orderby)) {
			$orderby = $this->orderby;
		} else if (isset($this->columns[$this->column_prefix . 'name'])) {
			$orderby = [$this->column_prefix . 'name' => SORT_ASC];
		}
		if (!empty($orderby)) {
			$method = [];
			foreach ($orderby as $k => $v) {
				$type = $types[$this->columns[$k]['type']]['php_type'];
				if ($type == 'integer' || $type == 'float') {
					$method[$k] = SORT_NUMERIC;
				}
			}
			array_key_sort($result, $orderby, $method);
		}
		// if we have primary key
		$pk = $options['pk'] ?? $this->pk;
		if (!empty($pk)) {
			pk($pk, $result);
		}
		// single row
		if (!empty($options['single_row'])) {
			return current($result);
		}
		return $result;
	}
1201749
public function setOptions(array $options): FieldTypeInterface
    {
        $l10n = $this->handleLocalization($options);

        $options = array_merge(
            $this->getDefaultOptions(),
            $this->options,
            $options
        );

        if (isset($options['l10n']) && ! empty($l10n)) {
            $options['l10n'] = array_merge($options['l10n'], $l10n);
        }

        $this->options = $this->parseOptions($options);

        return $this;
    }
1128287
public function optionMetadata($type)
    {
        if (in_array($type, ['modules', 'languages'])) {
            switch ($type) {
                case 'modules':
                    $line = PHP_EOL . print_r(modules()->getRegistry(), true);
                    break;

                case 'languages':
                    $line = PHP_EOL . print_r(language()->getRegistry(), true);
                    break;
            }

            if (isset($line)) {
                output()->write($line);

                exit(EXIT_SUCCESS);
            }
        }
    }
1290499
public function createColumn($name, $type = null, array $options = [])
    {
        $this->preventIfLocked();

        if (null !== $type) {
            return $this->getFactory()->createColumnBuilder($name, $type, $options);
        }

        throw new \InvalidArgumentException('Column type guessing is not yet supported.');
        // TODO return $this->getFormFactory()->createBuilderForProperty($this->getDataClass(), $name, $options);
    }
79632
public function createNamed($type, array $options = [])
    {
        if ($type instanceof BlockInterface) {
            return $type;
        }

        $name = $this->getBlockName($options);

        return $this->factory->createNamed($name, $type, null, $options);
    }
1150880
public function create($type, $options = array()) {
        $options = new Values($options);

        $data = Values::of(array(
            'Type' => $type,
            'FriendlyName' => $options['friendlyName'],
            'Certificate' => $options['certificate'],
            'PrivateKey' => $options['privateKey'],
            'Sandbox' => Serialize::booleanToString($options['sandbox']),
            'ApiKey' => $options['apiKey'],
            'Secret' => $options['secret'],
        ));

        $payload = $this->version->create(
            'POST',
            $this->uri,
            array(),
            $data
        );

        return new CredentialInstance($this->version, $payload);
    }
1284384
protected function _handleFlash($type, $options) {
		if (isset($options[$type . 'Message']) && $options[$type . 'Message'] !== false) {
			if (is_string($options[$type . 'Message'])) {
				$flashOptions = [];
				if (isset($options[$type . 'FlashOptions'])) {
					$flashOptions = $options[$type . 'FlashOptions'];
				}

				if (!isset($flashOptions['element'])) {
					if (!$this->_registry->has('Flash')) {
						$this->_registry->load('Flash');
					}

					$flashOptions['element'] = $type;
					$this->_registry->get('Flash')->set($options[$type . 'Message'], $flashOptions);
				}

				return true;
			}
		}

		return false;
	}
120037
public function getEndpoint(string $type, ClientInterface $client, array $options = []): EndpointInterface
    {
        if (!array_key_exists($type, $this->endpointList)) {
            if (class_exists($type)) {
                $this->endpointList[$type] = new $type($client, $options);
            } else {
                $className = sprintf('%s\%sEndpoint', __NAMESPACE__, ucfirst($type));
                if (!class_exists($className)) {
                    throw new \InvalidArgumentException("{$className} is not valid endpoint");
                }

                $this->endpointList[$type] = new $className($client);
            }
        }

        return $this->endpointList[$type];
    }
280956
public function setType($type, $options = null)
    {
        $this->type = $type;
        $this->_setCertConfigure();

        return $this;
    }
85394
public function setType($type)
    {
        if (!is_string($type) || empty($type)) {
            throw MetadataException::invalidEntityType();
        }
        $this->type = $type;
        return $this;
    }