Parse query parameter and get field name and order.

@param string $value
@param string $defaultOrder default sort order if order is not given explicitly in query

@return string[]

@throws InvalidArgumentException when unable to parse field name or order
173917
protected static function parseFieldAndOrder($value, $defaultOrder)
    {
        if (preg_match('/^([^,]+)(,(asc|desc))?$/', $value, $match)) {
            return [$match[1], isset($match[3]) ? $match[3] : $defaultOrder];

        }

        throw new InvalidArgumentException(sprintf('Unable to parse field name or order from "%s"', $value));
    }
339679
public function getSearchSortingDefaultOrderBySortOptionName($sortOptionName = '', $defaultIfEmpty = 'asc')
    {
        $sortOrderSpecificPath = 'plugin.tx_solr.search.sorting.options.' . $sortOptionName . '.defaultOrder';
        $specificSortOrder = $this->getValueByPathOrDefaultValue($sortOrderSpecificPath, null);

        // if we have a concrete setting, use it
        if ($specificSortOrder !== null) {
            return mb_strtolower($specificSortOrder);
        }

        // no specific setting, check common setting
        $commonPath = 'plugin.tx_solr.search.sorting.defaultOrder';
        $commonATagParamOrDefaultValue = $this->getValueByPathOrDefaultValue($commonPath, $defaultIfEmpty);
        return mb_strtolower($commonATagParamOrDefaultValue);
    }
744208
public String getOrDefault(String key, String defaultValue) {
        return map.getOrDefault(key, defaultValue);
    }
281736
public function orderByPagination($field, $order, $value)
    {
        return $this->getModel()->orderBy($field, $order)->paginate($value);
    }
466479
public function parse_value( $value ) {
		if ( is_array( $this->defaults ) ) {
			$value = is_array( $value )
				? wp_parse_args( $value, $this->defaults )
				: $this->defaults;
		}

		return $value;
	}
814177
protected function extractDefault($defaultValue)
	{
		if($defaultValue==='true')
			$this->defaultValue=true;
		elseif($defaultValue==='false')
			$this->defaultValue=false;
		elseif(strpos($defaultValue,'nextval')===0)
			$this->defaultValue=null;
		elseif(preg_match('/^\'(.*)\'::/',$defaultValue,$matches))
			$this->defaultValue=$this->typecast(str_replace("''","'",$matches[1]));
		elseif(preg_match('/^(-?\d+(\.\d*)?)(::.*)?$/',$defaultValue,$matches))
			$this->defaultValue=$this->typecast($matches[1]);
		// else is null
	}
1204472
public function setDefaultValue($defaultValue): FieldInterface
    {
        if (!is_array($defaultValue)) {
            throw new \InvalidArgumentException(
                "The default value for instances of ".
                __CLASS__." must be an array"
            );
        }

        $this->defaultValue = $defaultValue;
        return $this;
    }
935098
public function get($param, $defaultValue = null)
    {
        return array_key_exists($param, $this->config) ? $this->config[$param] : $defaultValue;
    }
789407
public function get($key, $defaultValue = null)
    {
        if (!isset($this->keyToIndexMap[$key]) && 2 === func_num_args()) {
            return $defaultValue;
        }

        return $this->value($key);
    }
1163869
private String getValueOrDefault(HttpServletRequest req, String paramName, String defaultValue) {
		final String value = req.getParameter(paramName);
		return StringUtils.isEmpty(value) ? defaultValue : value;
	}
674986
public function setAccessorOrder($order, array $customOrder = []): void
    {
        if (! \in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) {
            throw new InvalidArgumentException(\sprintf('The accessor order "%s" is invalid.', $order));
        }

        foreach ($customOrder as $name) {
            if (! \is_string($name)) {
                throw new InvalidArgumentException(\sprintf('$customOrder is expected to be a list of strings, but got element of value %s.', \var_export($name, true)));
            }
        }

        $this->accessorOrder = $order;
        $this->customOrder = \array_flip($customOrder);
        $this->sortProperties();
    }
1268991
public function orderBy($field, $order)
    {
        if (!in_array($field, $this->getAvailableFields())) {
            throw new \InvalidArgumentException(sprintf('Field "%s" not supported, prefer: %s', $field, implode(', ', $this->getAvailableFields())));
        }

        if (!in_array($order, array('ASC', 'DESC'))) {
            throw new \InvalidArgumentException(sprintf('Order "%s" not supported, prefer: ASC or DESC', $order));
        }

        $this->sort = array($field, $order);

        return $this;
    }
816748
private function get($key, $value, $default)
    {
        if ($this->has($key)) {
            return $this->data[$key][$value];
        } else {
            return $default;
        }
    }
1135345
public function setDefaultValue($value)
    {
        if (($value instanceof ValueGenerator) === false) {
            $value = new ValueGenerator($value);
        }

        if ($this->isValidParameterDefaultValue($value) !== true) {
            throw new InvalidArgumentException('Parameter default value is not valid.');
        }

        $this->defaultValue = $value;

        return $this;
    }
1002376
protected function getMultipleRawOptionValue($name, $value, $defaultValue)
    {
        $modelVariable = $this->getSingularVariable($this->modelName);
        $valueString = 'null';

        if (!is_null($value)) {
            $valueString = starts_with($value, '$') ? sprintf("%s", $value) : sprintf("'%s'", $value);
        }

        $defaultValueString = '[]';

        if (!empty($defaultValue)) {
            $joinedValues = implode(',', Helpers::wrapItems((array) $defaultValue));
            $defaultValueString = sprintf('[%s]', $joinedValues);
        }

        $accessor = $this->getDefaultValueAccessor($modelVariable, $name, $defaultValueString);

        return sprintf("in_array(%s, old('%s', %s) ?: [])", $valueString, $name, $accessor);
    }
1369785
protected function extractDefault($defaultValue)
	{
		if(strncmp($this->dbType,'bit',3)===0)
			$this->defaultValue=bindec(trim($defaultValue,'b\''));
		elseif(($this->dbType==='timestamp' || $this->dbType==='datetime')  && ($defaultValue==='CURRENT_TIMESTAMP' || $defaultValue==='current_timestamp()'))
			$this->defaultValue=null;
		else
			parent::extractDefault($defaultValue);
	}
823041
private function parseString(FieldBuilder $field, $value = '')
    {
        return (empty($value) && isset($field['default'])) ? $field['default'] : $value;
    }