Builds a list of type handlers for the available columns
@throws \UnexpectedValueException
173204
protected function buildTypeHandlerList() {
		foreach ($this->properties as $name => $propertyProfile) {
			$column = $propertyProfile->getColumn();
			
			if (!array_key_exists($column, $this->columnTypes))
				continue;
			
			$this->availableColumns[$name] = $column;
			$type = $propertyProfile->getType();
				
			if (isset($type)) {
				$typeHandler = $this->typeManager->getTypeHandler($type);
	
				if ($typeHandler == false)
					throw new \UnexpectedValueException("No typehandler assigned to type '$type' defined at property $name");
	
				$this->typeHandlers[$name] = $typeHandler;
			}
			else {
				$type = $this->columnTypes[$column];
				$this->typeHandlers[$name] = $this->typeManager->getTypeHandler($type);
			}
		}
	}
667605
public function mapObjects()
    {
        if ($this->mapObjects === null) {
            $objType = $this->objType();
            if (!$objType) {
                throw new UnexpectedValueException(sprintf(
                    '%1$s cannot create collection map. Object type is not defined.',
                    get_class($this)
                ));
            }

            $loader = $this->collectionLoader();
            $loader->setModel($this->proto());

            $collectionConfig = $this->collectionConfig();
            if (is_array($collectionConfig) && !empty($collectionConfig)) {
                unset($collectionConfig['properties']);
                $loader->setData($collectionConfig);
            }

            $callback = function(&$obj) {
                $obj->mapInfoboxTemplate = $this->infoboxTemplate();

                if ($this->latProperty() && $this->latProperty()) {
                    $obj->mapShowMarker = true;
                    $obj->mapLat = $this->getPropertyValue($obj, $this->latProperty());
                    $obj->mapLon = $this->getPropertyValue($obj, $this->lonProperty());

                    if (!$obj->mapLat || !$obj->mapLon) {
                        $obj = null;
                    }
                } else {
                    $obj->mapShowMarker = false;
                }

                if ($this->pathProperty()) {
                    $mapPath = $this->getPropertyValue($obj, $this->pathProperty());
                    if ($mapPath) {
                        $obj->mapShowPath = true;
                        // Same type of coords.
                        $obj->mapPath = $this->formatPolygon($mapPath);

                        if (!$obj->mapPath) {
                            $obj = null;
                        }
                    } else {
                        $obj->mapShowPath = false;
                    }
                }

                if ($this->polygonProperty()) {
                    $mapPolygon = $this->getPropertyValue($obj, $this->polygonProperty());
                    if ($mapPolygon) {
                        $obj->mapShowPolygon = true;
                        $obj->mapPolygon = $this->formatPolygon($mapPolygon);

                        if (!$obj->mapPolygon) {
                            $obj = null;
                        }
                    } else {
                        $obj->mapShowPolygon = false;
                    }
                }
            };

            $loader->setCallback($callback->bindTo($this));

            $this->mapObjects = $loader->load();
        }

        foreach ($this->mapObjects as $obj) {
            $GLOBALS['widget_template'] = $obj->mapInfoboxTemplate;
            yield $obj;
            $GLOBALS['widget_template'] = '';
        }
    }
598020
public function build()
    {
        $value = $this->getValue();

        $this->uppercaseComparator();

        // Check for IS/IS NOT and set the value to NULL if it is.
        if ($this->isComparatorIsNotNullIsNull()) {
            $value = null;
        }

        // Check for IN/NOT IN and build a nice comma-separated list.
        if (!$this->isComparatorIsNotNullIsNull() && $this->isComparatorInNotIn() && is_array($value)) {
            $this->uppercaseComparator();
            $valueArray = [];
            foreach ($value as $valueItem) {
                if ($this->shouldQuoteValues()) {
                    $valueArray[] = $this->query->quote($valueItem);
                } else {
                    $valueArray[] = $valueItem;
                }
            }
            $value = '(' . implode(',', $valueArray) . ')';
        }

        // Now check if we need to still quote the value.
        if (!$this->isComparatorIsNotNullIsNull() && !$this->isComparatorInNotIn() && $this->shouldQuoteValues()) {
            $value = $this->query->quote($value);
        }

        // If we don't have IN/NOT IN, IS/NOT IS, and we shouldn't quote, we assume we're checking fields.
        if ($this->shouldCompareFields()) {
            $valueBuild = [
                $this->query->quoteIdentifier($this->getTableName()),
                '.',
                $this->query->quoteIdentifier($value),
            ];
            $value = implode($valueBuild);
        }

        $tableName = $this->getTableName();
        if ($this->getJoinTableName()) {
            $tableName = $this->getJoinTableName();
        }
        $tableName = $this->query->quoteIdentifier($tableName);

        $returnArray = [
            $tableName . '.' . $this->query->quoteIdentifier($this->getKey()),
            $this->getComparator(),
            $value,
        ];
        $returnString = implode(' ', $returnArray);

        return trim($returnString);
    }
1128781
protected function buildValuesForUpdate()
    {
        $values = array();
        foreach ($this->col_values as $col => $value) {
            $values[] = "{$col} = {$value}";
        }
        return ' SET' . $this->indentCsv($values);
    }
459631
public function form_select($params) {
        if (!isset($params['field'])) {
            throw new \UnexpectedValueException("The field parameter is required.");
        }
        $values = isset($params['values']) ? $params['values'] : null;
        $attributes = isset($params['attrs']) ? $params['attrs'] : array();
        $options = isset($params['options']) ? $params['options'] : array();
        return Form::select($params['field'], $values, $options, $attributes);
    }
96565
private function initColumnTypeExtensions()
    {
        $this->columnTypeExtensions = [];

        foreach ($this->loadColumnTypeExtensions() as $extension) {
            if (!$extension instanceof ColumnTypeExtensionInterface) {
                throw new UnexpectedTypeException($extension, ColumnTypeExtensionInterface::class);
            }

            $type = $extension->getExtendedType();

            $this->columnTypeExtensions[$type][] = $extension;
        }
    }
161240
private function initFilterTypeExtensions()
    {
        $this->filterTypeExtensions = [];

        foreach ($this->loadFilterTypeExtensions() as $extension) {
            if (!$extension instanceof FilterTypeExtensionInterface) {
                throw new UnexpectedTypeException($extension, FilterTypeExtensionInterface::class);
            }

            $type = $extension->getExtendedType();

            $this->filterTypeExtensions[$type][] = $extension;
        }
    }
313822
private function buildFieldColumnDescription()
    {
        if (!$info = entity_get_info($this->entityType)) {
            throw new ConfigurationError(sprintf("entity type '%s' does not exist", $this->entityType));
        }

        $idColumn = $info['entity keys']['id'];
        $done = [];

        foreach (array_keys($info['bundles']) as $bundle) {
            if (!$instances = field_info_instances($this->entityType, $bundle)) {
                continue;
            }

            foreach ($instances as $fieldName => $instance) {

                // Avoid doing the same field twice
                if (isset($done[$fieldName])) {
                    continue;
                }
                $done[$fieldName] = true;

                // Ensure field exists
                if (!$field = field_info_field($fieldName)) {
                    continue;
                }
                // We cannot proceed with multiple values, for now, without
                // using group by on those
                // @todo handle this gracefully
                if (1 !== (int)$field['cardinality']) {
                    continue;
                }
                // Do not use deleted fields, or non SQL handled fields
                if ($field['deleted'] || 'field_sql_storage' !== $field['storage']['type']) {
                    continue;
                }

                $table = _field_sql_storage_tablename($field);
                // @todo handle conflicts
                if ('field_' === substr($fieldName, 0, 6)) {
                    $tableAlias = substr($fieldName, 6);
                } else {
                    $tableAlias = $fieldName;
                }

                $this->joins[$tableAlias] = [
                    'type'      => 'LEFT',
                    'table'     => $table,
                    'condition' => sprintf(
                        "%s.entity_type = '%s' AND %s.entity_id = base.%s",
                        $tableAlias, $this->entityType, $tableAlias, $idColumn
                    )
                ];

                foreach ($field['columns'] as $name => $description) {
                    $column = _field_sql_storage_columnname($fieldName, $name);
                    $columnAlias = $tableAlias.'_'.$name;

                    if (!empty($instance['label'])) {
                        $label = $instance['label'];
                    } else if (!empty($description['description'])) {
                        $label = $description['description'];
                    } else {
                        $label = $fieldName;
                    }

                    $this->fields[$columnAlias] = [
                        'label'   => $label,
                        'column'  => $tableAlias.'.'.$column,
                        'choices' => null,
                    ];
                }
            }
        }
    }
832056
public function getExceptionHandler()
    {
        if(!$this->__exception_handler instanceof KExceptionHandlerInterface)
        {
            $this->__exception_handler = $this->getObject($this->__exception_handler);

            if(!$this->__exception_handler instanceof KExceptionHandler)
            {
                throw new UnexpectedValueException(
                    'Exception Handler: '.get_class($this->__exception_handler).' does not implement KExceptionHandlerInterface'
                );
            }
        }

        return $this->__exception_handler;
    }
1203224
private function initTypeGuesser()
    {
        $this->typeGuesserLoaded = true;

        $this->typeGuesser = $this->loadTypeGuesser();
        if (null !== $this->typeGuesser && !$this->typeGuesser instanceof BlockTypeGuesserInterface) {
            throw new UnexpectedTypeException($this->typeGuesser, 'Fxp\Component\Block\BlockTypeGuesserInterface');
        }
    }
990947
protected function build()
    {
        $closure = $this['closure'];
        /** @var $closure \Closure */
        $this->request = $closure($this, $this->operation);

        if (!$this->request || !$this->request instanceof RequestInterface) {
            throw new UnexpectedValueException('Closure command did not return a RequestInterface object');
        }
    }
159378
private function initTypeExtensions()
    {
        $this->typeExtensions = [];

        foreach ($this->loadTypeExtensions() as $extension) {
            if (!$extension instanceof BlockTypeExtensionInterface) {
                throw new Exception\UnexpectedTypeException(
                    $extension,
                    'Oro\Component\Layout\BlockTypeExtensionInterface'
                );
            }

            $type = $extension->getExtendedType();

            $this->typeExtensions[$type][] = $extension;
        }
    }
1000614
private function bindTypedParameters()
    {
        $streams = $values = [];
        $types   = $this->types;

        foreach ($this->_bindedValues as $parameter => $value) {
            if (! isset($types[$parameter - 1])) {
                $types[$parameter - 1] = static::$_paramTypeMap[ParameterType::STRING];
            }

            if ($types[$parameter - 1] === static::$_paramTypeMap[ParameterType::LARGE_OBJECT]) {
                if (is_resource($value)) {
                    if (get_resource_type($value) !== 'stream') {
                        throw new InvalidArgumentException('Resources passed with the LARGE_OBJECT parameter type must be stream resources.');
                    }
                    $streams[$parameter] = $value;
                    $values[$parameter]  = null;
                    continue;
                }

                $types[$parameter - 1] = static::$_paramTypeMap[ParameterType::STRING];
            }

            $values[$parameter] = $value;
        }

        if (! $this->_stmt->bind_param($types, ...$values)) {
            throw new MysqliException($this->_stmt->error, $this->_stmt->sqlstate, $this->_stmt->errno);
        }

        $this->sendLongData($streams);
    }
19656
private function initTypeExtensions()
    {
        $this->typeExtensions = [];

        foreach ($this->loadTypeExtensions() as $extension) {
            if (!$extension instanceof FormTypeExtensionInterface) {
                throw new UnexpectedTypeException($extension, 'Symfony\Component\Form\FormTypeExtensionInterface');
            }

            if (method_exists($extension, 'getExtendedTypes')) {
                $extendedTypes = [];

                foreach ($extension::getExtendedTypes() as $extendedType) {
                    $extendedTypes[] = $extendedType;
                }
            } else {
                @trigger_error(sprintf('Not implementing the static getExtendedTypes() method in %s when implementing the %s is deprecated since Symfony 4.2. The method will be added to the interface in 5.0.', \get_class($extension), FormTypeExtensionInterface::class), E_USER_DEPRECATED);

                $extendedTypes = [$extension->getExtendedType()];
            }

            foreach ($extendedTypes as $extendedType) {
                $this->typeExtensions[$extendedType][] = $extension;
            }
        }
    }
1030659
public static function setDataTypes(array $types) : void
    {
        // Datatypes key validation
        foreach ($types as $key => $value) {
            if (!preg_match('/^[A-Za-z0-9-_]+$/', $key)) {
                throw new \UnexpectedValueException("<b>$key</b> is not a valid datatype key", 1);

            } elseif (!is_string($value)) {
                throw new \LogicException("<b>$key</b> must have a string value", 1);
            }
        }

        // Put keys between brackets
        self::$datatypes = array_combine(
            array_map(function ($t) {
                return '/\{' . $t . '\}/';
            }, array_keys($types)),
            $types
        );
    }
337043
public function asEnumerated(): Primitive\Enumerated
    {
        if (!$this->_element instanceof Primitive\Enumerated) {
            throw new \UnexpectedValueException(
                $this->_generateExceptionMessage(Element::TYPE_ENUMERATED));
        }
        return $this->_element;
    }
837541
private function initTypes()
    {
        $this->types = [];

        foreach ($this->loadTypes() as $type) {
            if (!$type instanceof BlockTypeInterface) {
                throw new Exception\UnexpectedTypeException(
                    $type,
                    'Oro\Component\Layout\BlockTypeInterface'
                );
            }

            $this->types[$type->getName()] = $type;
        }
    }