Resolve description of value's type

@param  $value
@return string
541023
protected function resolveTypeDescription($value): string
    {
        $type = gettype($value);

        if ($type === 'object') {
            return 'an instance of ' . get_class($value);
        }

        if ($type === 'integer') {
            return 'an integer';
        }

        return 'a ' . $type;
    }
125949
public static function getTypeCodeFromObject( $value )
	{
		if ( is_null( $value ) )
		{
			return TypeCode::Null_;
		}

		if ( is_array( $value ) )
		{
			return TypeCode::assocArray;
		}

		if ( is_string( $value ) )
		{
			return strlen( $value ) === 1 ? TypeCode::Char : TypeCode::String;
		}

		if ( $value instanceof DateTime )
		{
			return TypeCode::DateTime;
		}

		if ( $value instanceof DateTimeInterval )
		{
			return TypeCode::DateTimeInterval;
		}

		if ( is_double( $value ) )
		{
			return TypeCode::Double;
		}

		if ( is_int( $value ) )
		{
			return TypeCode::Int32;
		}

		if ( is_bool( $value ) )
		{
			return TypeCode::Boolean;
		}

		if ( is_object( $value ) )
		{
			return TypeCode::Object;
		}
	}
968745
public static function getType($value)
    {
        if ($value === null) {
            return null;
        }

        $type = gettype($value);
        if (is_array($value) && !empty($value)) {
            $arrayType = null;
            foreach ($value as $entry) {
                if ($arrayType == null) {
                    $arrayType = self::getType($entry);
                } else {
                    return "mixed[]";
                }
            }
            return $arrayType . "[]";
        } elseif ($type == 'object') {
            return get_class($value);
        }

        return self::mapToBuiltInType($type);
    }
742568
private function getType($value): string
    {
        if (is_array($value)) {
            if ($value !== array_values($value)) {
                return self::DATATYPE_OBJECT;
            }

            return self::DATATYPE_ARRAY;
        }

        if (is_bool($value)) {
            return self::DATATYPE_BOOLEAN;
        }

        if (is_string($value)) {
            return self::DATATYPE_STRING;
        }

        if (is_int($value) || is_float($value)) {
            return self::DATATYPE_NUMBER;
        }

        if (null === $value) {
            return self::DATATYPE_NULL;
        }

        throw new \InvalidArgumentException(
            sprintf(
                'Value needs to be of type array|bool|string|int|float|null, %s given',
                is_object($value) ? get_class($value) : gettype($value)
            )
        );
    }
343337
protected function getDataTypeByValue($value)
    {
        if(null === $value)
        {
            return \PDO::PARAM_NULL;
        }
        if(is_bool($value))
        {
            return \PDO::PARAM_BOOL;
        }
        if(is_int($value))
        {
            return \PDO::PARAM_INT;
        }
        return \PDO::PARAM_STR;
    }
1076148
protected function getValueAsIni($value)
	{
		$string = '';

		switch (\gettype($value))
		{
			case 'integer':
			case 'double':
				$string = $value;

				break;

			case 'boolean':
				$string = $value ? 'true' : 'false';

				break;

			case 'string':
				// Sanitize any CRLF characters..
				$string = '"' . str_replace(array("\r\n", "\n"), '\\n', $value) . '"';

				break;
		}

		return $string;
	}
786816
public function isValueValidType($value)
    {
        switch ($this->getType()) {
            case self::TYPE_BOOLEAN:
                $isValid = is_bool($value);
                break;
            case self::TYPE_DATE:
            case self::TYPE_DATETIME:
                $isValid = is_object($value) and get_class($value) == 'DateTime';
                break;
            case self::TYPE_NUMBER:
                $isValid = is_numeric($value);
                break;
            case self::TYPE_STRING:
                $isValid = is_string($value);
                break;
            default:
                $isValid = false;
        }

        return $isValid;
    }
427193
private function bindDataType($value)
    {
        switch (true) {
            case is_string($value):
                return PDO::PARAM_STR;
            case is_int($value):
                return PDO::PARAM_INT;
            case is_bool($value):
                return PDO::PARAM_BOOL;
            case is_null($value):
                return PDO::PARAM_NULL;
            default:
                return false;
        }
    }
428391
private function getTypedValue(string $value)
    {
        if (\in_array($value, self::$boolValues, true)) {
            return \in_array($value, self::$truthlyValues, true);
        }

        if (\is_numeric($value)) {
            return $this->getNumericValue($value);
        }

        return $value;
    }
1232714
private function showTypeDetails($value)
    {
        if ($this->_debugLog->getWriteDebugLog()) {
            $testArray = PHPExcel_Calculation_Functions::flattenArray($value);
            if (count($testArray) == 1) {
                $value = array_pop($testArray);
            }

            if ($value === null) {
                return 'a NULL value';
            } elseif (is_float($value)) {
                $typeString = 'a floating point number';
            } elseif (is_int($value)) {
                $typeString = 'an integer number';
            } elseif (is_bool($value)) {
                $typeString = 'a boolean';
            } elseif (is_array($value)) {
                $typeString = 'a matrix';
            } else {
                if ($value == '') {
                    return 'an empty string';
                } elseif ($value{0} == '#') {
                    return 'a '.$value.' error';
                } else {
                    $typeString = 'a string';
                }
            }
            return $typeString.' with a value of '.$this->showValue($value);
        }
    }
536619
private function _toType($value) {

	 if (strpos($value, '#') !== FALSE)
		 $value = trim(preg_replace('/#(.+)$/','',$value));


		if (preg_match('/^("(.*)"|\'(.*)\')/',$value,$matches)) {
			$value = (string)preg_replace('/(\'\'|\\\\\')/',"'",end($matches));
			$value = preg_replace('/\\\\"/','"',$value);
		} elseif (preg_match('/^\\[(.+)\\]$/',$value,$matches)) {
			// Inline Sequence

			// Take out strings sequences and mappings
			$explode = $this->_inlineEscape($matches[1]);

			// Propogate value array
			$value  = array();
			foreach ($explode as $v) {
				$value[] = $this->_toType($v);
			}
		} elseif (strpos($value,': ')!==FALSE && !preg_match('/^{(.+)/',$value)) {

			// It's a map
			$array = explode(': ',$value);
			$key   = trim($array[0]);
			array_shift($array);
			$value = trim(implode(': ',$array));
			$value = $this->_toType($value);
			$value = array($key => $value);
		} elseif (preg_match("/{(.+)}$/",$value,$matches)) {
			// Inline Mapping

			// Take out strings sequences and mappings
			$explode = $this->_inlineEscape($matches[1]);

			// Propogate value array
			$array = array();
			foreach ($explode as $v) {
				$array = $array + $this->_toType($v);
			}
			$value = $array;
		} elseif (strtolower($value) == 'null' or $value == '' or $value == '~') {
			$value = NULL;
		} elseif (preg_match ('/^[0-9]+$/', $value)) {
			$value = (int)$value;
		} elseif (in_array(strtolower($value),
		array('true', 'on', '+', 'yes', 'y'))) {
			$value = true;
		} elseif (in_array(strtolower($value),
		array('false', 'off', '-', 'no', 'n'))) {
			$value = FALSE;
		} elseif (is_numeric($value)) {
			$value = (float)$value;
		} else {
			// Just a normal string, right?
		 // $value = trim(preg_replace('/#(.+)$/','',$value));
		}


		//  print_r ($value);
		return $value;
	}
1185170
protected function resolveArgumentValue($value)
    {
        if ($value instanceof ClassMeta) {
            $value = $value->setContainer($this)->newInstance();
        } elseif ($value instanceof ValueReference) {
            $v = $value->get($this->getParameters());

            if ($v === null && $this->parent instanceof Container) {
                $v = $value->get($this->parent->getParameters());
            }

            $value = $v;
        } elseif ($value instanceof RawWrapper) {
            $value = $value->get();
        }

        return $value;
    }
608080
public static function getType( $value )
    {
        $type = gettype($value);
        switch( $type ){
        case 'string':
            return $type . '(' . strlen($value) . ')';
            break;
        case 'integer':
        case 'float':
        case 'boolean':
            return $type . '(' . $value . ')';
            break;
        case 'NULL':
        case 'unknown type':
            return $type;
            break;
        case 'array':
            return $type . '(' . count($value) . ')';
            break;
        case 'object':
            if ( $value instanceof \Countable ){
                return get_class( $value ) . '(' . count($value) . ')';
            }
            elseif ( $value instanceof HashableInterface ){
                return get_class( $value ) . '(hash=' . $value->hash() . ')';
            }
            return get_class( $value );
            break;
        }
        return '';
    }
829429
public static function inferType($value)
    {
        if (is_int($value)) {
            return Type::INTEGER;
        }

        if (is_bool($value)) {
            return Type::BOOLEAN;
        }

        if ($value instanceof DateTimeInterface) {
            return Type::DATETIME;
        }

        if ($value instanceof DateInterval) {
            return Type::DATEINTERVAL;
        }

        if (is_array($value)) {
            return is_int(current($value))
                ? Connection::PARAM_INT_ARRAY
                : Connection::PARAM_STR_ARRAY;
        }

        return ParameterType::STRING;
    }
703614
protected static function GetTypeStr( $value ) : string
   {

      if ( \is_null( $value ) )
      {
         return 'NULL';
      }

      if ( \is_resource( $value ) )
      {
         return \get_resource_type( $value ) . '-Resource';
      }

      if ( \is_string( $value ) )
      {
         if ( \strlen( $value ) > 128 )
         {
            return 'string with value (' . \substr( $value, 0, 126 ) . '…)';
         }
         return 'string with value (' . $value . ')';
      }

      if ( \is_bool( $value ) )
      {
         return 'boolean with value (' . ( $value ? 'true' : 'false' ) . ')';
      }

      if ( \is_int( $value ) )
      {
         return 'integer with value (' . $value . ')';
      }

      if ( \is_float( $value ) )
      {
         return 'float with value (' . $value . ')';
      }

      if ( \is_double( $value ) )
      {
         return 'double with value (' . $value . ')';
      }

      if ( \is_array( $value ) )
      {
         return 'Array: ' . \json_encode( $value );
      }

      if ( \is_object( $value ) )
      {
         return \get_class( $value ) . ' object: ' . \json_encode( $value );
      }

      return \gettype( $value );

   }
945116
protected function resolveValue($value)
    {
        if (is_array($value)) {
            foreach ($value as $index => $val) {
                $value[$index] = $this->resolveValue($val);
            }

            return $value;
        }

        if (is_string($value) && '@' == $value[0]) {
            return $this->offsetGet(substr($value, 1));
        }

        return $value;
    }
1280474
public function getPDOType($value) {
        $type= null;
        if (is_null($value)) $type= \PDO::PARAM_NULL;
        elseif (is_scalar($value)) {
            if (is_int($value)) $type= \PDO::PARAM_INT;
            else $type= \PDO::PARAM_STR;
        }
        return $type;
    }