Get code

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

@see getDefaultCode()

@return string|null code or null if no code has been set
19635
public function getCode() : ?string 
    {
        if ( ! $this->hasCode()) {
            $this->setCode($this->getDefaultCode());
        }
        return $this->code;
    }
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;
    }
552300
public function get_default(): ?string
  {
    if (
      ($id_opt = $this->from_path('default')) &&
      ($all = $this->pref->get_all($id_opt))
    ){
      $id = false;
      foreach ( $all as $a ){
        if ( !empty($a['id_user']) ){
          $id = $a['id_alias'];
          break;
        }
        else if ( !empty($a['id_group']) ){
          $id = $a['id_alias'];
          break;
        }
        else if ( !empty($a['public']) ){
          $id = $a['id_alias'];
          break;
        }
      }
      return $id;
    }
	return null;
  }
923757
public static function getCurrencyCode()
	{
		if (!isset(self::$_currencyCode)) {
			$localeconv = localeconv();
			self::$_currencyCode = ($localeconv['currency_symbol'] != '')
				? $localeconv['currency_symbol'] : $localeconv['int_curr_symbol'];

			if (self::$_currencyCode == '') {
				// Default to $
				self::$_currencyCode = '$';
			}
		}
		return self::$_currencyCode;
	}
101095
public function getDefaultValue()
    {
        if ($this->isArray() || $this->isList()) {
            return [];
        }
        return Utils::getValueWithinItsType($this->getMetaValueFirstSet([
            'default',
            'Default',
            'DefaultValue',
            'defaultValue',
            'defaultvalue',
        ]), $this->getType(true));
    }
1325172
public function getValue()
    {

        $value = $this->defaultValue;
        if ($this->existsRequest()) {
            $value = trim($_GET[$this->requestName]);
        }

        return $value;

    }
1325358
public static function getDefault()
    {
        $fields = self::getDbConnection()->fetchAssoc( "SELECT * FROM dir_data where hidden<>1 and is_server<>0 and type&".Server::DEFAULT_SERVER."=1" );
        if ($fields) {
            return self::fetch($fields);
        } else {
            return false;
        }     
    }
1231303
public function getReasonCode()
    {
        $code = null;

        if (isset($this->data->transactionResponse->messages)) {
            // In case of a successful transaction, a "messages" element is present
            $code = intval((string)$this->data->transactionResponse->messages->message->code);
        } elseif (isset($this->data->transactionResponse->errors)) {
            // In case of an unsuccessful transaction, an "errors" element is present
            $code = intval((string)$this->data->transactionResponse->errors->error->errorCode);
        } elseif (isset($this->data->messages->message)) {
            // In case of invalid request, the top-level message provides details.
            $code = (string)$this->data->messages->message->code;
        }

        return $code;
    }
1074050
public function getScript() : ?string 
    {
        if ( ! $this->hasScript()) {
            $this->setScript($this->getDefaultScript());
        }
        return $this->script;
    }
770566
public function GetCode () {
		if ($this->code === NULL) {
			$phpCode = http_response_code();
			$this->code = $phpCode === FALSE ? static::OK : $phpCode;
		}
		return $this->code;
	}
532901
function getCode()
    {

        $out = $this->getHeaderCode();
        $out .= $this->getFormItemsCode();
        $out .= $this->getFooterCode();

        return $out;
    }
226449
protected function initDefault()
    {
        if ($this->isCli()) {
            return null;
        }

        $uri = (empty($_SERVER['HTTPS']) ? 'http' : 'https')
            . '://'
            . $_SERVER['HTTP_HOST']
            . $_SERVER['REQUEST_URI'];
        return  rtrim(preg_replace('/\?.*/', '', $uri), '/');
    }
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;
    }
653889
public function getConfirmCode()
    {
        $confirmCodeAttribute = $this->confirmCodeAttribute;
        return (is_string($confirmCodeAttribute) && !empty($confirmCodeAttribute)) ? $this->$confirmCodeAttribute : null;
    }
564484
public function getPhpDefaultValue()
    {
        if (null === $this->defaultValue) {
            return null;
        }

        if ($this->defaultValue->isExpression()) {
            throw new EngineException('Cannot get PHP version of default value for default value EXPRESSION.');
        }

        if (in_array($this->mappingType, [ PropelTypes::BOOLEAN, PropelTypes::BOOLEAN_EMU ])) {
            return $this->booleanValue($this->defaultValue->getValue());
        }

        if (PropelTypes::PHP_ARRAY === $this->mappingType) {
            return $this->getDefaultValueForArray($this->defaultValue->getValue());
        }
        if (PropelTypes::SET === $this->mappingType) {
            return $this->getDefaultValueForSet($this->defaultValue->getValue());
        }

        return $this->defaultValue->getValue();
    }
1007792
private function _getCode(){
        $code = null;
        //try{
            $text = $this->text;
            $textColor = new CINColor($this->foregroundColor);
            $backgroudColor = new CINColor($this->backgroundColor);
            $fontPath = isset($this->font) ? $this->font : $this->_getDefaultFont();

            $font = new CINFontFile($fontPath, (is_int($this->fontSize)) ? $this->fontSize : 18);

            $codeClass = "\\CodeItNow\\BarcodeBundle\\Generator\\".$this->barcodeType;
            $code = new $codeClass();
            if($this->scale){
                $code->setScale($this->scale); // Resolution
            }
            if($this->thickness){
                $code->setThickness($this->thickness); // Thickness
            }
            if($this->label !== FALSE){
                $code->setLabel($this->label);
            }
            if($this->noLengthLimit){
                $code->setNoLengthLimit($this->noLengthLimit);
            }
            if($this->allowsUnknownIdentifier){
                $code->setAllowsUnknownIdentifier($this->allowsUnknownIdentifier);
            }
            $code->setForegroundColor($textColor); // Color of bars
            $code->setBackgroundColor($backgroudColor); // Color of spaces
            $code->setFont($font); // Font (or 0)
            $code->parse($text); // Text
        //} catch (\Exception $ex) {
            
        //}
        return $code;
    }
695589
public function getDefault() {
    	if ($this->isPublic() && !$this->isStatic() && $this->refClass->isAbstract() == false) {	    		 
	  		$className = $this->refClass->getName();
	  		// TODO: find a way to get default value for abstract properties.
	  		// TODO: optimize this: we should not have to create one new instance for every property....
	  		/*$instance = new $className();
			$property = $this->getName();
	    	return $instance->$property;*/
	  		
	  		// In some cases, the call to getDefaultProperties can log NOTICES
	  		// in particular if an undefined constant is used as default value.
	  		ob_start();
	  		$defaultProperties = $this->refClass->getDefaultProperties();
	  		$possibleError = ob_get_clean();
			if ($possibleError) {
				throw new \Exception($possibleError);	
			}
	  		return $defaultProperties[$this->getName()];
    	} else {
    		return null;
    	}
    }