Checking that typed field have correct type of value
@param string $name
@param mixed $value
@return boolean
@throws dbException If type is wrong
971340
public function type($name, $value)
    {
        $schema = Config::table($this->name)->schema();
        if (array_key_exists($name, $schema) && $schema[$name] == gettype($value))
        {
            return true;
        }
        throw new dbException('Wrong data type');
    }
667200
public static function isInternalType($value)
    {
        if (!is_object($value)) {
            return false;
        }

        if (class_exists('\MongoDB\BSON\Type')) {
            // mongodb extension for PHP 7
            return $value instanceof \MongoDB\BSON\Type;
        } else {
            // legacy mongo extension for PHP 5
            $mongoTypes = array(
                'MongoId',
                'MongoCode',
                'MongoDate',
                'MongoRegex',
                'MongoBinData',
                'MongoInt32',
                'MongoInt64',
                'MongoDBRef',
                'MongoMinKey',
                'MongoMaxKey',
                'MongoTimestamp'
            );

            return in_array(
                get_class($value),
                $mongoTypes
            );
        }
    }
1236813
protected static function formatFieldValue($name, $value) {
		$field	= static::$validator->getField($name);
		if( $field ) {
			$field->getType()->formatValue($field, $value);
		}
		return parent::formatFieldValue($name, $value);
	}
1319847
protected function handleJsonType($name, $value)
    {
        if ($cast = array_get($this->repository->getCasts(), $name)) {
            if (in_array($cast, ['array', 'json'], true)) {
                $value = json_decode($value);
            }
        }

        return $value;
    }
820613
protected static function parseFieldValue($name, $value) {
		$field	= static::$validator->getField($name);
		if( $field ) {
			$field->getType()->parseValue($field, $value);
		}
		return parent::parseFieldValue($name, $value);
	}
525158
public function setType($value)
    {
        if (!in_array($value, self::allowedRejectionTypes(), true)) {
            throw new DomainException(self::MSG_UNSUPPORTED_TYPE);
        }

        return $this->setAttribute('type', $value);
    }
537823
protected function isMatchAnyWithScalar($value, $contextValue, $name)
    {
        if (!\is_array($value)) {
            return $this->isMatchScalars($value, $contextValue, $name);
        }

        switch (\key($value)) {
            case self::OPERATOR_NOT:
                return !$this->isMatchScalars(\current($value), $contextValue, $name);
            case self::OPERATOR_AND:
                $result = true;
                foreach (\current($value) as $val) {
                    if (!$this->isMatchScalarWithScalar($val, $contextValue, $name)) {
                        $result = false;
                        break;
                    }
                }

                return $result;
            case self::OPERATOR_OR:
                $result = false;
                foreach (\current($value) as $val) {
                    if ($this->isMatchScalarWithScalar($val, $contextValue, $name)) {
                        $result = true;
                        break;
                    }
                }

                return $result;
        }

        return false;
    }
249378
public function setVal($name, $value = null)
    {
        $type = gettype($name);
        if('string' === $type)
        {
            $name = explode('.', $name);
        }
        else if('array' !== $type)
        {
            return false;
        }
        $last = array_pop($name);
        $data = &$this->data;
        foreach ($name as $val)
        {
            if (! isset($data[$val]))
            {
                $data[$val] = array ();
            }
            $data = &$data[$val];
        }
        $data[$last] = $value;
        return true;
    }
1135153
public function type($name)
    {
        if (!$this->has($name)) {
            return;
        }
        $column = $this->column($name);
        return isset($column['type']) ? $column['type'] : null;
    }
663814
protected function checkType($value, $type, $nullable = false)
    {
        if (gettype($value) === $type) {
            return true;
        }
        return $nullable && null === $value;
    }
985303
private function isValidColumn($name, $contenttype, $allowVariants = false)
    {
        $isValidColumn = false;

        if ($this->isMultiOrderQuery($name)) {
            $separatedOrders = $this->getOrderBys($name);
        } else {
            $separatedOrders = [$name];
        }

        //Loop through each term if multiple
        foreach ($separatedOrders as $index => $name) {
            $name = trim($name);

            // Strip the minus in '-title' if allowed.
            if ($allowVariants) {
                if ((strlen($name) > 0) && ($name[0] == "-")) {
                    $name = substr($name, 1);
                }
                $name = $this->getFieldName($name);
            }

            // Check if the $name is in the contenttype's fields.
            if (isset($contenttype['fields'][$name])) {
                $isValidColumn = true;
            }

            if (in_array($name, Content::getBaseColumns())) {
                $isValidColumn = true;
            }

            // Repeating fields are handled differently so skip here
            if (isset($contenttype['fields'][$name]) && $contenttype['fields'][$name]['type'] == 'repeater') {
                $isValidColumn = false;
            }

            if (! $isValidColumn) {
                return false;
            }
        }

        return true;
    }
249866
public function setAttribute($name,$value){
        try{
            common_Logger::d('setattri ' . $name . ' => ' . $value);
            $this->dbConnector->setAttribute($name, $value);
            
        } catch (PDOException $e){
            common_Logger::e('Fail to set attribute ' . $name . ' with value ' . $value);
            throw $e;
        }
    
    }
1225699
protected function _setField($name, $value)
    {
        // e.g. consumerBillingFirstname
        $this->_addressData[self::$PREFIX . $this->_addressType . $name] = (string) $value;
    }
972593
public function is_field($name,$collection = false){
		if (!$collection)
			$collection=$this->text;
			
		for ($i=0; $i<sizeof($collection); $i++)
			if ($collection[$i]["name"] == $name || $collection[$i]["db_name"] == $name)	return $i;
		return -1;
	}
488009
protected function checkType($value)
    {
        if (RuntimeUtils::isQtiScalarDatatypeCompliant($value)) {
            return;
        } else {
            $value = (gettype($value) === 'object') ? get_class($value) : $value;
            $msg = "The OperandsCollection only accepts QTI Runtime compliant values, '" . $value . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
1319326
public function get(string $name) : Type
    {
        if (! isset($this->instances[$name])) {
            throw DBALException::unknownColumnType($name);
        }

        return $this->instances[$name];
    }
1213691
public function field($name)
    {
        if (in_array($name, Config::table($this->name)->fields()))
        {
            return true;
        }
        throw new dbException('Field ' . $name . ' does not exists in table "' . $this->name . '"');
    }