Get a single value by type and index.

@return bool
169297
public function has(string $type): bool
    {
        return isset($this->values[$type]) && \count($this->values[$type]) > 0;
    }
591090
public function get_value() {
		$value  = parent::get_value();

		if ( is_array( $value ) ) {
			$value = json_encode( $value );
		}

		return $value;
	}
1283637
public function getValue()
    {
        $values = [];
        foreach($this->values as $key => $value) {
            $values[$key] = $value->getValue();
        }
        return $values;
    }
244064
private function get_type_index($field)
    {
        $result = 0;
        if ($this->raw[$field]) {
            foreach ($this->raw[$field] as $i => $data) {
                if (is_array($data['type']) && in_array_nocase('pref', $data['type'])) {
                    $result = $i;
                }
            }
        }

        return $result;
    }
566493
public function val($index = 0) {

		if(false === ('-' . intval($index) == '-' . $index)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($index)), E_USER_ERROR);
		}

		$val = $this -> strip();

		if(true === isset($val[$index])) {
			return $val[$index];
		}

		return null;
	}
396349
public function getValue() {
        if($this->input->old($this->getMeta()->name)) {
            return $this->getMeta()->getType()->transformInput($this->getMeta(), $this->input->old($this->getMeta()->name));
        } else {
            if($this->value !== null) {
                return parent::getValue();
            } else {
                return null;
            }
        }
    }
473363
public function setType($type)
    {
        if ($type instanceof Type) {
            $this->setIndex($type->getIndex());
            $type = $type->getName();
        }

        return $this->setParam('_type', $type);
    }
519117
public function get($index)
    {
        $index = intval($index);
        $i = 0;
        foreach ($this->getInnerIterator() as $v) {
            if ($i == $index) {
                return $v;
            }
            $i++;
        }

        return null;
    }
152578
public function searchValue($index): self
    {
        $this->generatorToArray();

        // init
        $return = [];

        if ($this->array === []) {
            return static::create(
                [],
                $this->iteratorClass,
                false
            );
        }

        // php cast "bool"-index into "int"-index
        if ((bool) $index === $index) {
            $index = (int) $index;
        }

        if (\array_key_exists($index, $this->array) === true) {
            $return = [$this->array[$index]];
        }

        return static::create(
            $return,
            $this->iteratorClass,
            false
        );
    }
901986
public function item($index)
    {
        if (null !== $this->getDraft()) {
            return $this->getDraft()->item($index);
        }

        if (0 <= $index && $index < $this->count()) {
            return $this->getData($index);
        }

        return;
    }
819973
public function getValue($only_valid = false)
  {
    if ($only_valid && !$this->isValid()) {
      return $this->isMultipleChoiceAllowed() ? array() : false;
    }

    $v = is_null($this->value) ? $this->getDefaultValue() : $this->value;

    if ($this->isMultipleChoiceAllowed()) {
      $v = !empty($v) ? (array) $v : array();
    }

    return $v;
  }
1148264
public static function getCodeByType($type)
    {
        if (isset(self::$typeList[$type])) {
            return self::$typeList[$type];
        } else {
            return false;
        }
    }
1315139
protected function value()
    {
        if (   !(list($value) = $this->str())
            && !(list($value) = $this->number())
            && !(list($value) = $this->match(CssParser::IDENTIFIER))
        ) {
            return false;
        }
        return array($value);
    }
1173812
protected function _getValueByType($value, $type)
	{
		if( !is_null($value) )
		{
			switch( $type )
			{
				case "id":
					if( array_contains( array('',null), $value, true ) )
					{
						$value = null;
					}
					else
					{
						$value = intval( $value );
					}
				break;
				case "bool":
				case "boolean":
					$value = (bool) $value;
				break;
				case "int":
					$value = (int) $value;
					break;
				case "float":
					$value = (float) $value;
				break;
				case "object":
				case "array":
					if(is_object($value) || !is_array($value))
					{
						$value = unserialize($value);
					}
				break;
				case "date":
					if($value == '0000-00-00' || $value == '')
					{
						$value = null;
					}
				break;
				case "time":
					if($value == '00:00:00' || $value == '')
					{
						$value = null;
					}
				break;
				case "datetime":
					if($value == '0000-00-00 00:00:00' || $value == '')
					{
						$value = null;
					}
				break;
				case "text":
				default:
					$value = (string) $value;
				break;
			}
		}

		return $value;
	}
269503
public function getHasta()
    {
        if (!$this->xml) {
            return false;
        }
        $H = $this->xml->getElementsByTagName('H')->item(0);
        return $H ? (int)$H->nodeValue : false;
    }
715725
public static function getBoolBaseValue($index, $default)
    {
        if (self::hasCustom($index)) {
            return (bool) self::getCustom($index);
        }

        return (bool) self::get($index, true);
    }
1230478
protected function getIndex($property, $index = null, $type = null) {
		//verify valid property
		if (!$this->wrappedArg->offsetExists($property))
			throw new \InvalidArgumentException("Unknown property '$property'");
	
		if (is_null($index))
			return $this->castParameter($this->wrappedArg->offsetGet($property), $type);
	
		//check if the value is null
		$value = $this->wrappedArg->offsetGet($property);
		if (is_null($value))
			throw new \InvalidArgumentException("Trying to obtain value from NULL property '$property'");
	
		//check value type
		if (is_array($value)) {
			//search for string index
			if (array_key_exists($index, $value))
				return $this->castParameter($value[$index], $type);
			//try numeric index instead
			elseif (is_numeric($index) && array_key_exists(intval($index), $value))
				return $this->castParameter($value[intval($index)], $type);
	
			throw new \InvalidArgumentException("Index '$index' does not exists in property '$property'");
		}
		//try to convert value to string
		elseif (($value = $this->toString($value)) !== false) {
			//check string length against index
			if ($index < strlen($value))
				return $this->castParameter($value[$index], $type);
	
			throw new \OutOfBoundsException("Index '$index' out of bounds for property '$property'");
		}
			
		throw new \InvalidArgumentException("Cannot obtain index '$index' from a non array/string property '$property'");
	}