Returns the value to display when the prediction is $value.

@param float $value
@param string $subtype
@return string
346307
public function get_display_value($value, $subtype = false) {

        $displayvalue = array_search($subtype, static::get_classes(), false);

        debugging('Please overwrite \core_analytics\local\indicator\discrete::get_display_value to show something ' .
            'different than the default "' . $displayvalue . '"', DEBUG_DEVELOPER);

        return $displayvalue;
    }
1051943
public function sub($unit, $value = 1)
    {
        if (is_numeric($unit)) {
            $_unit = $value;
            $value = $unit;
            $unit = $_unit;
            unset($_unit);
        }

        return $this->add($unit, -floatval($value));
    }
485837
private static function identify($value)
    {
        if (!is_numeric($value) || !is_float($value)) {
            return gettype($value);
        }

        if (is_infinite($value)) {
            return $value < 0 ? '-INF' : 'INF';
        }

        if (is_nan($value)) {
            return 'NAN';
        }

        return 'float';
    }
510605
public function getTypeFromValue($value = null)
    {
        $value = ($value == null ? $this->value : $value);
        return array_search($this->value, self::$sourceList);
    }
262712
public function parse($value, $sub)
    {
        $label = $sub ?: $value;

        // if obfuscation is enabled generate tag string due to yii tag method will encode attributes.
        if ($this->obfuscate) {
            if (!$sub) {
                $label = $this->obfuscate($label);
            }
            return '<a href="'.$this->obfuscate("mailto:{$value}").'" rel="nofollow">'.$label.'</a>';
        }

        return Html::mailto($label, $value, [
            'rel' => 'nofollow',
        ]);
    }
921309
private static function getTypeStyle($value)
    {
        if (\is_int($value) || \is_float($value)) {
            return 'number';
        } elseif (\is_string($value)) {
            return 'string';
        } elseif (\is_bool($value) || \is_null($value)) {
            return 'bool';
        } else {
            return 'strong'; // @codeCoverageIgnore
        }
    }
484764
protected function typecastValue($value, $type)
    {
        if (is_scalar($type)) {
            if (is_object($value) && method_exists($value, '__toString')) {
                $value = $value->__toString();
            }

            switch ($type) {
                case self::TYPE_INTEGER:
                    return (int)$value;
                case self::TYPE_FLOAT:
                    return (float)$value;
                case self::TYPE_BOOLEAN:
                    return (bool)$value;
                case self::TYPE_STRING:
                    return (string)$value;
                case self::TYPE_JSON:
                    return is_string($value) ? $value : json_encode($value);
                case self::TYPE_IMPLODE:
                    return is_string($value) ? $value : (string)implode($this->delimiter, $value);
                case self::TYPE_SERIALIZE:
                    return is_string($value) ? $value : serialize($value);
                default:
                    throw new InvalidParamException("Unsupported type '{$type}'");
            }
        }

        return call_user_func($type, $value);
    }
787295
protected function convert ($type, $value)
		{
			switch ($type)
			{
				case 'string':
					return (string) $value;

				case 'number':
					return is_float($value)
						? (float) $value
						: (int) $value;

				case 'boolean':
					return $value === true || $value === 'true' || $value === '1' || $value === 'on';

				default:
					if (is_float($value))
					{
						return $this->convert('number', $value);
					}
					if (is_numeric($value))
					{
						return strpos($value, '.') !== FALSE
							? (float) $value
							: (int) $value;
					}
					if ($value === 'true' || $value === 'false')
					{
						return $value === 'true';
					}
					if ($value === '')
					{
						return null;
					}
			}
			return $value;
		}
719075
public static function typeOfValue($value)
    {
        if (is_null($value)) {
            return self::TYPE_NULL;
        }
        if (is_int($value)) {
            return self::TYPE_INT;
        }
        if (is_bool($value)) {
            return self::TYPE_BOOL;
        }
        return self::TYPE_STR;
    }
163524
public static function getValueWithinItsType($value, $knownType = null)
    {
        if (is_int($value) || (!is_null($value) && in_array($knownType, array(
            'time',
            'positiveInteger',
            'unsignedLong',
            'unsignedInt',
            'short',
            'long',
            'int',
            'integer',
        ), true))) {
            return intval($value);
        } elseif (is_float($value) || (!is_null($value) && in_array($knownType, array(
            'float',
            'double',
            'decimal',
        ), true))) {
            return floatval($value);
        } elseif (is_bool($value) || (!is_null($value) && in_array($knownType, array(
            'bool',
            'boolean',
        ), true))) {
            return ($value === 'true' || $value === true || $value === 1 || $value === '1');
        }
        return $value;
    }
536743
public static function VALUE($value = '')
    {
        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);

        if (!is_numeric($value)) {
            $numberValue = str_replace(
                PHPExcel_Shared_String::getThousandsSeparator(),
                '',
                trim($value, " \t\n\r\0\x0B" . PHPExcel_Shared_String::getCurrencyCode())
            );
            if (is_numeric($numberValue)) {
                return (float) $numberValue;
            }

            $dateSetting = PHPExcel_Calculation_Functions::getReturnDateType();
            PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);

            if (strpos($value, ':') !== false) {
                $timeValue = PHPExcel_Calculation_DateTime::TIMEVALUE($value);
                if ($timeValue !== PHPExcel_Calculation_Functions::VALUE()) {
                    PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
                    return $timeValue;
                }
            }
            $dateValue = PHPExcel_Calculation_DateTime::DATEVALUE($value);
            if ($dateValue !== PHPExcel_Calculation_Functions::VALUE()) {
                PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
                return $dateValue;
            }
            PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);

            return PHPExcel_Calculation_Functions::VALUE();
        }
        return (float) $value;
    }
180446
private function cast($value, $type)
    {
        switch ($type) {
            case 'bool':
                return (bool)$value;
            case 'float':
                return (float)$value;
            case 'int':
                return (int)$value;
            default:
                return $value;
        }
    }
538549
protected function detectType($value)
    {
        if (is_bool($value)) {
            return $value ? self::BINN_TRUE : self::BINN_FALSE;
        }

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

        if (is_integer($value)) {
            return $this->detectInt($value);
        }

        if (is_float($value)) {
            if (strlen($value) > 4) {
                return self::BINN_FLOAT64;
            } else {
                return self::BINN_FLOAT32;
            }
        }

        if (is_array($value)) {
            foreach ($this->containersClasses as $contanerType => $containersClass) {
                if ($containersClass::validArray($value)) {
                    return $contanerType;
                }
            }
        }

        return self::BINN_NULL;
    }
345274
protected function process($value, string $type)
    {
        if ($type === 'integer') {
            return (int) $value;
        }

        if ($type === 'float') {
            return (float) $value;
        }

        if ($type === 'boolean') {
            return (bool) $value;
        }

        return (string) $value;
    }
253968
protected function calculateSimpleType($type) {
    $pos = strrpos($type, '.');
    if ($pos !== false) {
      return substr($type, $pos+1);
    }
    return $type;
  }
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;
    }
958254
public function maybe($value, $subPattern = null)
    {
        return $this->add($this->sanitise($value), $subPattern, '?');
    }