Converts human-readable value to plain
@param $value
@return int|null
421266
public static function humanToPlain($value)
    {
        if ($value === null) {
            return null;
        }
        $l = substr($value, -1);

        if (($l === 'k') || ($l === 'K')) {
            return ((int)substr($value, 0, -1) * 1000);
        }

        if (($l === 'm') || ($l === 'M')) {
            return ((int)substr($value, 0, -1) * 1000 * 1000);
        }

        if (($l === 'g') || ($l === 'G')) {
            return ((int)substr($value, 0, -1) * 1000 * 1000 * 1000);
        }
        return (int)$value;
    }
516215
public static function blank($value)
    {
        if (\is_null($value)) {
            return true;
        }

        if (\is_string($value)) {
            return trim($value) === '';
        }

        if (is_numeric($value) || \is_bool($value)) {
            return false;
        }

        if ($value instanceof \Countable) {
            return \count($value) === 0;
        }

        return empty($value);
    }
1217307
public function sanitize($value)
    {
        $value = trim($value);

        $parts  = explode('-', $value, 2);
        if(2 != count($parts)) {
            return null;
        }

        $parts[0]   = substr(preg_replace('/[^a-z]*/', '', $parts[0]), 0, 2);
        $parts[1]   = substr(preg_replace('/[^A-Z]*/', '', $parts[1]), 0, 2);
        $result = implode('-', $parts);

        // just making sure :-)
        if($this->validate($result)) {
            return $result;
        }

        return null;
    }
418265
private function normToView($value)
    {
        // Scalar values should  be converted to strings to
        // facilitate differentiation between empty ("") and zero (0).
        // Only do this for simple forms, as the resulting value in
        // compound forms is passed to the data mapper and thus should
        // not be converted to a string before.
        if (!($transformers = $this->config->getViewTransformers()) && !$this->config->getCompound()) {
            return null === $value || is_scalar($value) ? (string) $value : $value;
        }

        try {
            foreach ($transformers as $transformer) {
                $value = $transformer->transform($value);
            }
        } catch (TransformationFailedException $exception) {
            throw new TransformationFailedException('Unable to transform value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
        }

        return $value;
    }
517918
public static function plainNumber(string $value) : int {
		$temp = explode('ext', $value);
		$result = preg_replace('/[^0-9]/', '', $temp[0]);
		// remove first 1 in US numbers
		if (strlen($result) == 11 && $result[0] == 1) {
			$result = substr($result, 1);
		}
		return $result;
	}
608874
protected function normalizeValue($value)
    {
        if (is_array($value)) {
            $value = $this->normalizeArray($value);
        } elseif (is_bool($value)) {
            $value = $this->normalizeBoolean($value);
        } elseif (is_null($value)) {
            $value = 'null';
        } elseif (is_string($value) && $this->checkFlag(self::STRING_MODE_QUOTE)) {
            $value = sprintf('"%s"', $value);
        }

        return $value;
    }
1328429
public function prepareValue($value)
    {
        return $value === null ? null : Carbon::createFromFormat($this->format, $value)->toDateString();
    }
358681
protected function normalize($value)
    {
        if ($value === null) {
            return $value;
        }
        foreach ($this->normalizers as $normalizer) {
            $value = $normalizer($value);
        }

        return $value;
    }
1188551
public function transform($value)
    {
        if (null === $value) {
            return '';
        }

        if (!$this->mask) {
            return $value;
        }

        return str_repeat($this->maskSymbol, $this->maskLength);
    }
1061953
public function hydrate($value)
    {
        if ($value === null) {
            return $this->schema->getDefault();
        }

        if (!is_string($value)) {
            return $value;
        }

        return !ctype_digit($value) ? (float)$value : (int)$value;
    }
493324
protected function _sanitize($value)
    {
        $value = (string) $value;

        // Filter var for XSS and other 'bad' code etc.
        if (!empty($value)) {
            $value = $this->_remove($this->_decode($value));
        }

        return $value;
    }
346679
protected function value($value)
    {
        if (is_numeric($value)) {
            return $value;
        }

        if (is_bool($value)) {
            return $value ? 1 : 0;
        }

        if (is_string($value)) {
            return "'" . str_replace("'", "''", $value) . "'";
        }

        return 'NULL';
    }
37492
protected function convertType(string $value)
    {
        $val = \mb_strtolower($value);
        if ($val === 'true') {
            return true;
        } elseif ($val === 'false') {
            return false;
        } elseif ($val === 'null') {
            return null;
        } elseif (\mb_strpos($val, '.') !== false && \is_numeric($val)) {
            return (float) $val;
        } elseif (\is_numeric($val)) {
            return (int) $val;
        }

        return $this->replaceVariables($value);
    }
206628
protected function formatValue($value)
    {
        if (PHP_VERSION_ID < 50400) {
            return str_replace('\/', '/', json_encode($value));
        }

        return json_encode($value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
    }
225584
public function renderDefaultValue($value)
    {
        if ($value === null) {
            return 'null';
        }

        // special numbers which are usually used in octal or hex notation
        static $specials = [
            // file permissions
            '420' => '0644',
            '436' => '0664',
            '438' => '0666',
            '493' => '0755',
            '509' => '0775',
            '511' => '0777',
            // colors used in yii\captcha\CaptchaAction
            '2113696' => '0x2040A0',
            '16777215' => '0xFFFFFF',
        ];
        if (isset($specials[$value])) {
            return $specials[$value];
        }

        return $value;
    }
456465
private function sanitize($value)
    {
        if ($value === null) {
            $value = 'null';
        }

        if (is_array($value)) {
            $value = 'array';
        }

        if (is_bool($value)) {
            $value = $value
                ? 'true'
                : 'false';
        }

        return $value;
    }
759179
private function prepareValue($value)
    {
        if (is_numeric($value)) {
            return $value;
        }

        if (strpos($value, "\n") !== false) {
            $values = explode("\n", $value);
            foreach ($values as &$line) {
                $line = $this->getIndentation(8) . $line;
            }
            $value = implode("\n", $values);

            return "|\n" . $value;
        }

        return '\'' . str_replace('\'', '\'\'', $value) . '\'';
    }