Get default value from table schema for given entity field.

@param array $parts Each one of the parts in a path for a field name
@return mixed
187342
protected function _schemaDefault($parts)
    {
        $table = $this->_getTable($parts);
        if ($table === false) {
            return null;
        }
        $field = end($parts);
        $defaults = $table->getSchema()->defaultValues();
        if (!array_key_exists($field, $defaults)) {
            return null;
        }

        return $defaults[$field];
    }
982386
public function withArray(array $parts = null)
	{	//	WARNING: Cannot use ?? because we might want to set some parts explicity to null, eg. ['fragment' => null]
		//	UPDATE: we could do this: ['fragment' => '']
		$new = new static();
		$new->scheme	=	isset($parts['scheme'])		?	$parts['scheme']	:	$this->_scheme;
		$new->user		=	isset($parts['user'])		?	$parts['user']		:	$this->_user;
		$new->pass		=	isset($parts['pass'])		?	$parts['pass']		:	$this->_pass;
		$new->host		=	isset($parts['host'])		?	$parts['host']		:	$this->_host;
		$new->port		=	isset($parts['port'])		?	$parts['port']		:	$this->_port;
		$new->path		=	isset($parts['path'])		?	$parts['path']		:	$this->_path;
		$new->query		=	isset($parts['query'])		?	$parts['query']		:	$this->_query;
		$new->fragment	=	isset($parts['fragment'])	?	$parts['fragment']	:	$this->_fragment;
		return $new;
	}
851359
protected function getFields(array $queryParts)
    {
        if (isset($queryParts['fields'])) {
            if (is_array($queryParts['fields']) && !empty($queryParts['fields'])) {
                $quoted = array();

                foreach ($queryParts['fields'] as $field) {
                    $quoted[] = $this->quoteIdentifier($field);
                }

                return implode(', ', $quoted);
            } else {
                return (string)$queryParts['fields'];
            }
        }

        return null;
    }
1298825
public function getDefault() {
        // timestamp default
        if ($this->default === Schema::DF_CURRENT_TIMESTAMP) {
            // check for right datatpye
            $stamp_type = $this->findQuery($this->schema->dataTypes['TIMESTAMP']);
            if ($this->type != 'TIMESTAMP' &&
                ($this->passThrough && strtoupper($this->type) != strtoupper($stamp_type))
            )
                trigger_error(self::TEXT_CurrentStampDataType,E_USER_ERROR);
            return $this->findQuery($this->schema->defaultTypes[strtoupper($this->default)]);
        } else {
            // static defaults
            $type_val = $this->getTypeVal();
            $pdo_type = preg_match('/int|bool/i', $type_val, $parts) ?
                constant('\PDO::PARAM_'.strtoupper($parts[0])) : \PDO::PARAM_STR;
            return ($this->default === NULL ? 'NULL' :
                $this->db->quote(htmlspecialchars($this->default, ENT_QUOTES,
                    \Base::instance()->get('ENCODING')), $pdo_type));
        }
    }
822472
protected function get_default_values(array $values = [], $table = '', array $place_holders = [] ){
        if( empty($table) ){
            $table = $this->table;
        }
        if( $table == $this->table ){
            // Overwrite place holder
            if( $this->default_placeholder ){
                $default_place_holder = [];
                foreach( $values as $column => $value ){
                    $default_place_holder[] = $this->default_placeholder[$column];
                }
                if( empty($place_holders) ){
                    $place_holders = $default_place_holder;
                }
            }
            // Add updated column
            if( $this->updated_column ){
                if( !isset($values[$this->updated_column]) ){
                    $values[$this->updated_column] = current_time('mysql');
                    $place_holders[] = '%s';
                }
            }
        }
        return compact('table', 'place_holders', 'values');
    }
733252
public function map(array $parts): array
    {
        if (count($parts) < 2) {
            return [$this->handleSinglePart($parts[0])];
        }

        $pos = $this->findFirstnamePosition($parts);

        if (null !== $pos) {
            $parts[$pos] = new Firstname($parts[$pos]);
        }

        return $parts;
    }
1321340
function getDefaultValue (res) {
  if (res.body) {
    return res.body;
  }
  else if (res.swagger.schema) {
    return res.swagger.schema.default || res.swagger.schema.example;
  }
}
558525
public function getDefaultValue(): Node\Expr {
        $factory = new BuilderFactory();

        if ($this->nullable || $this->mixed || $this->class) {
            return $factory->val(null);
        }

        switch ($this->name) {
        case 'array':
            return $factory->val([]);

        case 'bool':
            return $factory->val(false);

        case 'float':
            return $factory->val(0.0);

        case 'int':
            return $factory->val(0);

        case 'string':
            return $factory->val('');

        default:
            return $factory->val(null);
        }
    }
770799
protected function _get( $config,  $parts )
	{
		if( ( $current = array_shift( $parts ) ) !== null && isset( $config[$current] ) )
		{
			if( count( $parts ) > 0 ) {
				return $this->_get( $config[$current], $parts );
			}

			return $config[$current];
		}

		return null;
	}
451740
protected function getTable(array $queryParts)
    {
        if (isset($queryParts['table'])) {
            $from =
                (isset($queryParts['fields']) && !empty($queryParts['fields'])) ||
                strtoupper($queryParts['type']) === 'DELETE' ?
                'FROM ' :
                '';

            if (is_a($queryParts['table'], 'Database\Table')) {
                $select = !empty($from) ? $from . '%s' : '%s';

                if (!empty($from) && strtoupper($queryParts['type']) !== 'DELETE') {
                    $select .= ' AS %s';
                }

                return sprintf(
                    $select,
                    $this->quoteTable($queryParts['table']->getTable()),
                    $this->quoteTable($queryParts['table']->getName())
                );
            } else {
                return $from . $this->quoteTable($queryParts['table']);
            }
        }

        return null;
    }
965108
public function __getDefaultValues ( $tableName ) {
		$values = $this->__defaultValues;

		if ( $values && $tableName && array_key_exists( $tableName, $values )) {
			return $values[$tableName];
		} else {
			return false;
		}
	}
194821
public function getSchemaState()
    {
        $defaults = $this->getSchemaStateDefaults();
        return array_merge($defaults, array_intersect_key($this->schemaState, $defaults));
    }
87339
public function getValueSegmented($object, $key, $default)
    {
        if (is_null($key) || trim($key) == '') {
            return $default;
        }

        foreach (explode('.', $key) as $segment) {
            $object = is_array($object) ? (object) $object : $object;
            if (!isset($object->{$segment})) {
                return $default;
            }

            $object = $object->{$segment};
        }

        return $object;
    }
195801
public function read_default_value(Schema $field_schema, $default_value)
    {
        switch ($field_schema->type()) {
            case Schema::NULL_TYPE:
                return null;
            case Schema::BOOLEAN_TYPE:
                return $default_value;
            case Schema::INT_TYPE:
            case Schema::LONG_TYPE:
                return (int)$default_value;
            case Schema::FLOAT_TYPE:
            case Schema::DOUBLE_TYPE:
                return (float)$default_value;
            case Schema::STRING_TYPE:
            case Schema::BYTES_TYPE:
                return $default_value;
            case Schema::ARRAY_SCHEMA:
                $array = array();
                foreach ($default_value as $json_val) {
                    $val = $this->read_default_value($field_schema->items(), $json_val);
                    $array [] = $val;
                }
                return $array;
            case Schema::MAP_SCHEMA:
                $map = array();
                foreach ($default_value as $key => $json_val)
                    $map[$key] = $this->read_default_value($field_schema->values(),
                        $json_val);
                return $map;
            case Schema::UNION_SCHEMA:
                return $this->read_default_value($field_schema->schema_by_index(0),
                    $default_value);
            case Schema::ENUM_SCHEMA:
            case Schema::FIXED_SCHEMA:
                return $default_value;
            case Schema::RECORD_SCHEMA:
                $record = array();
                foreach ($field_schema->fields() as $field) {
                    $field_name = $field->name();
                    if (!$json_val = $default_value[$field_name])
                        $json_val = $field->default_value();

                    $record[$field_name] = $this->read_default_value($field->type(),
                        $json_val);
                }
                return $record;
            default:
                throw new Exception(sprintf('Unknown type: %s', $field_schema->type()));
        }
    }
965783
public static function get($array, $key = null, $default = null, $useDotSyntax = false)
    {
        // Check arguments
        if (empty($array)) {
            return $default;
        }

        // Check if key is empty
        if (is_null($key)) {
            return $array;
        }

        // Check if value exists as is
        if (isset($array[$key])) {
            return $array[$key];
        }

        // Return default value, without dot syntax
        if (!$useDotSyntax) {
            return $default;
        }

        // Split name using dots
        $keyParts = explode('.', $key);
        if (count($keyParts) == 1) {
            return isset($array[$key]) ? $array[$key] : $default;
        }

        // Recursive call
        $base = $keyParts[0];
        unset($keyParts[0]);

        // Check if the base array exists
        if (!isset($array[$base])) {
            return $default;
        }

        // Get key, base array and continue
        $key = implode('.', $keyParts);
        $array = $array[$base];

        return static::get($array, $key, $default, $useDotSyntax);
    }
1114239
protected String determineDefaultSegmentValue(Properties params) {
		boolean preferSegmentPerEntity = ConfigurationHelper.getBoolean( CONFIG_PREFER_SEGMENT_PER_ENTITY, params, false );
		String defaultToUse = preferSegmentPerEntity ? params.getProperty( PersistentIdentifierGenerator.TABLE ) : DEF_SEGMENT_VALUE;
		log.infof( "explicit segment value for id generator [%1$s.%2$s] suggested; using default [%3$s]", tableName, segmentColumnName, defaultToUse );
		return defaultToUse;
	}
526574
public function getDefaultClause($xmldb_field) {

        $defaultvalue = $this->getDefaultValue ($xmldb_field);

        if ($defaultvalue !== null) {
            return ' DEFAULT ' . $defaultvalue;
        } else {
            return null;
        }
    }