Get type

If no "type" value has been set, this method will
set and return a default "type" value,
if any such value is available

@see getDefaultType()

@return string|null type or null if no type has been set
511399
public function getType() : ?string 
    {
        if ( ! $this->hasType()) {
            $this->setType($this->getDefaultType());
        }
        return $this->type;
    }
192308
public function getDefaultValueString()
    {
        $defaultValue = $this->getDefaultValue();

        if (null === $defaultValue) {
            return 'null';
        }

        if ($this->isNumericType()) {
            return (float) $defaultValue->getValue();
        }

        if ($this->isTextType() || $this->getDefaultValue()->isExpression()) {
            return sprintf("'%s'", str_replace("'", "\'", $defaultValue->getValue()));
        }

        if ($this->getType() === PropelTypes::BOOLEAN) {
            return $this->booleanValue($defaultValue->getValue()) ? 'true' : 'false';
        }

        return sprintf("'%s'", $defaultValue->getValue());
    }
629300
public static function get_default() {
        if ($visiblechildren = self::top()->get_children()) {
            $defcategory = reset($visiblechildren);
        } else {
            $toplevelcategories = self::get_tree(0);
            $defcategoryid = $toplevelcategories[0];
            $defcategory = self::get($defcategoryid, MUST_EXIST, true);
        }
        return $defcategory;
    }
221285
public function getValueType()
	{
		$xmlType =SchemaTypes::getInstance()->getTypeForDOMNode( $this->domNode );
		// $xmlType = $this->types->getType( $this->domNode->localName, $this->domNode->prefix );
		if ( $xmlType )
		{
			$type = Type::XmlTypeToPHPType( $xmlType );
			if ( $type ) return $type;
		}
		return Type::string;
	}
1126628
public function getDefault(string $type)
    {
        switch ($type) {
            case self::TYPE_NULL:
                return null;
            case self::TYPE_BOOLEAN:
                return false;
            case self::TYPE_INTEGER:
            case self::TYPE_FLOAT:
                return 0;
            case self::TYPE_STRING:
            case self::TYPE_BINARY:
                return '';
            case self::TYPE_ARRAY:
            case self::TYPE_OBJECT:
                return [];
        }

        throw new InvalidValueException("Invalid value type: $type");
    }
256519
public function getDefaultValue()
    {
        if (1 != $this->parameters->get('defaultValueIsNull')) {
            $defaultValue = $this->parameters->get('defaultValue');
            if (strlen($defaultValue) && 'NULL' != $defaultValue) {
                return trim($defaultValue, '\'"');
            }
        }
    }
1116943
public function default_returntype() {
        $setting = get_config('googledocs', 'defaultreturntype');
        $supported = get_config('googledocs', 'supportedreturntypes');
        if (($setting == FILE_INTERNAL && $supported != 'external') || $supported == 'internal') {
            return FILE_INTERNAL;
        } else {
            return FILE_CONTROLLED_LINK;
        }
    }
902643
public function getDefaultValue()
    {
        if (!$this->hasDefaultValue()) {
            return null;
        }

        if ($this->defaultValue instanceof FragmentInterface) {
            //Defined as SQL piece
            return $this->defaultValue;
        }

        if (in_array($this->getAbstractType(), ['time', 'date', 'datetime', 'timestamp'])) {
            return $this->formatDatetime($this->getAbstractType(), $this->defaultValue);
        }

        switch ($this->getType()) {
            case 'int':
                return (int)$this->defaultValue;
            case 'float':
                return (float)$this->defaultValue;
            case 'bool':
                if (is_string($this->defaultValue) && strtolower($this->defaultValue) == 'false') {
                    return false;
                }

                return (bool)$this->defaultValue;
        }

        return (string)$this->defaultValue;
    }
142748
public function getPhpType()
    {
        if (isset(self::$_phpTypesByProtobufType[$this->getType()])) {
            return self::$_phpTypesByProtobufType[$this->getType()];
        } else {
            return null;
        }
    }
145770
@Override
	public Object getDefaultValue() {

		Indexed indexedAnnotation = getIndexAnnotation();
		if (indexedAnnotation != null && StringUtils.hasText(indexedAnnotation.defaultValue())) {
			return indexedAnnotation.defaultValue();
		}
		return null;
	}
19009
public function getCardType() : ?string 
    {
        if ( ! $this->hasCardType()) {
            $this->setCardType($this->getDefaultCardType());
        }
        return $this->cardType;
    }
747364
public function getType()
    {
        if (!empty($this->type)) {
            return $this->type;
        }

        if ($this->getDbColumnJoin()) {
            // best guess
            return self::TYPE_TEXT;
        }

        if ($this->getEnumColumnValues()) {
            // best guess
            return self::TYPE_ENUM;
        }

        if (!empty($this->columnType)) {
            // best guess
            $type = strtolower($this->columnType);
            if (strpos($type, 'datetime') !== false) {
                return self::TYPE_DATETIME;
            } elseif (strpos($type, 'timestamp') !== false) {
                return self::TYPE_TIMESTAMP;
            } elseif (strpos($type, 'date') !== false) {
                return self::TYPE_DATE;
            } elseif (strpos($type, 'time') !== false) {
                return self::TYPE_TIME;
            } elseif (strpos($type, 'float') !== false) {
                return self::TYPE_FLOAT;
            } elseif (strpos($type, 'decimal') !== false) {
                return self::TYPE_FLOAT;
            } elseif (strpos($type, 'int') !== false) {
                return self::TYPE_NUMBER;
            } elseif (strpos($type, 'binary') !== false) {
                return self::TYPE_BINARY;
            }
        }

        return self::TYPE_TEXT;
    }
318038
public function getDefault()
    {
        if ($this->default) {
            return $this->default;
        }
        if (!empty($this->values)) {
            return reset($this->values);
        }
        return null;
    }
832486
public function getValue()
    {
        if ( ! $this->isSet() and isset($this->default))
        {
            $this->setValue($this->default, true);
        }

        return $this->value;
    }
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));
        }
    }
270530
protected function _getType() {
        $className = strtolower(get_class($this));
        $classNameParts = explode('_', $className);
        $type = array_pop($classNameParts);
        if (array_key_exists($type, self::$_mapping)) {
            return self::$_mapping[$type];
        }
        return self::DEFAULT_TYPE;
    }
360379
protected function getDefaultSerial()
    {
        if ($this->getServiceConfig()->getShopEdition() != 'CE') {
            $core = new Core();
            /** @var \OxidEsales\EshopProfessional\Setup\Setup|\OxidEsales\EshopEnterprise\Setup\Setup $setup */
            $setup = $core->getInstance('Setup');
            return $setup->getDefaultSerial();
        }

        return null;
    }