Reversing background shorthands
@param string $value
@return string
346769
public function reverse_left_and_right_background($value) {
		$values = $this->dissolve_short_bg($value);
		if (isset($values['background-position']) and $values['background-position']) {
			$v = $this->reverse_left_and_right_background_position($values['background-position']);
			if ($v !== $values['background-position']) {
				if ($value == $values['background-position']) {
					return $v;
				}
				else {
					$values['background-position'] = $v;
					$x = $this->merge_bg($values);
					if (isset($x['background'])) {
						return $x['background'];
					}
				}
			}
		}
		return $value;
	}
831417
public function reverse_left_and_right_4value_radius_shorthands($property, $value) {
		$shorthands = & $this->parser->data['csstidy']['radius_shorthands'];
		if (isset($shorthands[$property])) {
			$v = $this->dissolve_4value_radius_shorthands($property, $value);
			if ($v[$shorthands[$property][0]] !== $v[$shorthands[$property][1]]
			  or $v[$shorthands[$property][2]] !== $v[$shorthands[$property][3]]) {
				$r = array(
					$shorthands[$property][0] => $v[$shorthands[$property][1]],
					$shorthands[$property][1] => $v[$shorthands[$property][0]],
					$shorthands[$property][2] => $v[$shorthands[$property][3]],
					$shorthands[$property][3] => $v[$shorthands[$property][2]],
				);
				$v = $this->merge_4value_radius_shorthands($r);
				if (isset($v[$property])) {
					return $v[$property];
				}
			}
		}
		return $value;
	}
1183025
protected function _toBoolean($value)
    {
        $value = strtolower((string)$value);
        $result = ($value != 'false')
                && ($value != 'off')
                && !empty($value);

        return $result;
    }
850110
public function reverseTransform($value)
    {
        /** @var Value $valueObject */
        $valueObject = $this->getReverseTransformedValue($value);

        if ($this->fieldType->isEmptyValue($valueObject)) {
            return $valueObject;
        }

        $valueObject->hasController = $value['hasController'];
        $valueObject->loop = $value['loop'];
        $valueObject->autoplay = $value['autoplay'];
        $valueObject->width = $value['width'];
        $valueObject->height = $value['height'];

        return $valueObject;
    }
417588
protected function coerceColor($value)
    {
        switch ($value[0]) {
            case 'color': return $value;
            case 'raw_color':
                $c = array('color', 0, 0, 0);
                $colorStr = substr($value[1], 1);
                $num = hexdec($colorStr);
                $width = strlen($colorStr) == 3 ? 16 : 256;

                for ($i = 3; $i > 0; --$i) { // 3 2 1
                    $t = $num % $width;
                    $num /= $width;

                    $c[$i] = $t * (256 / $width) + $t * floor(16 / $width);
                }

                return $c;
            case 'keyword':
                $name = $value[1];
                if (isset(self::$cssColors[$name])) {
                    list($r, $g, $b) = explode(',', self::$cssColors[$name]);

                    return array('color', $r, $g, $b);
                }

                return;
        }
    }
1090192
public function reverseTransform($value)
    {
        return is_array($value) && array_key_exists($this->name, $value) ? $value[$this->name] : array();
    }
1193049
private function stripSlashesDeep($value) {
        $value = is_array($value) ? array_map(array($this, 'stripSlashesDeep'), $value) : stripslashes($value);
        return $value;
    }
1279328
public function clean($value)
  {
    if ($value==='' || $value===null || $value===false)
    {
      return null;
    }

    $tmp = AmbiguityCleaner::get()->clean($value);

    $tmp = str_replace([' ', "\t", "\n"], '', $tmp);
    if ($tmp==='') $tmp = null;

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

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

        return str_repeat($this->maskSymbol, $this->maskLength);
    }
532909
public function reverseTransform($value)
    {
        if (null === $value) {
            return null;
        }

        if (is_array($value) && array_key_exists(FileType::UPLOAD_FIELDNAME, $value)) {
            return $value[FileType::UPLOAD_FIELDNAME];
        }

        return null;
    }
327106
private function cleanup($value)
    {
        $value = str_replace(array("\r\n", "\r"), "\n", $value);

        // strip YAML header
        $count = 0;
        $value = preg_replace('#^\%YAML[: ][\d\.]+.*\n#u', '', $value, -1, $count);
        $this->offset += $count;

        // remove leading comments
        $trimmedValue = preg_replace('#^(\#.*?\n)+#s', '', $value, -1, $count);
        if (1 == $count) {
            // items have been removed, update the offset
            $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
            $value = $trimmedValue;
        }

        // remove start of the document marker (---)
        $trimmedValue = preg_replace('#^\-\-\-.*?\n#s', '', $value, -1, $count);
        if (1 == $count) {
            // items have been removed, update the offset
            $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
            $value = $trimmedValue;

            // remove end of the document marker (...)
            $value = preg_replace('#\.\.\.\s*$#', '', $value);
        }

        return $value;
    }
113676
protected function nicetime($value) {
        if (!$value) {
            return '';
        } else if ($value > mktime(0, 0, 0, date('m'), date('d'), date('Y'))) {
            return 'Today ' . date('g:i a', $value);
        } else if ($value > mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'))) {
            return 'Yesterday ' . date('g:i a', $value);
        } else {
            return date('jS F Y, g:i a', $value);
        }
    }
1314729
public function formatDefault($value) {
        if ($value === '') {
            return '';
        }

        if ($value instanceof Closure) {
            $value = call_user_func($value, $this);

        } else if (is_string($value) || $value === null) {
            $value = $this->getDriver()->escape($value);
        }

        return sprintf($this->getClause(self::DEFAULT_TO), $value);
    }
157323
public static function toUnderlineString($value)
    {
        $str = preg_replace_callback("/([A-Z]{1})/",function($matches){
            return "_".strtolower($matches[0]);
        },$value);
        if(strpos($str, "_")===0){
            $str=substr($str, 1);
        }
        return $str;
    }
16929
public function trim($value)
    {
        $result = '';
        $value = (string) $value;
        if ($value !== '') {
            // Temporarily remove leadin sign
            $sign = $value[0];
            if ($sign === '-' || $sign === '+') {
                $value = substr($value, 1);
            } else {
                $sign = '';
            }
            if ($value !== '') {
                // Remove initial zeroes
                $value = ltrim($value, '0');
                if ($value === '' || $value[0] === '.') {
                    $value = '0' . $value;
                }
                if (strpos($value, '.') !== false) {
                    // Remove trailing zeroes after the dot
                    $value = rtrim(rtrim($value, '0'), '.');
                }
                $result = $sign . $value;
            }
        }

        return $result;
    }
52032
public function shorthand($value) {
		$important = '';
		if ($this->parser->is_important($value)) {
			$values = $this->parser->gvw_important($value);
			$important = '!important';
		}
		else
			$values = $value;

		$values = explode(' ', $values);
		switch (count($values)) {
			case 4:
				if ($values[0] == $values[1] && $values[0] == $values[2] && $values[0] == $values[3]) {
					return $values[0] . $important;
				} elseif ($values[1] == $values[3] && $values[0] == $values[2]) {
					return $values[0] . ' ' . $values[1] . $important;
				} elseif ($values[1] == $values[3]) {
					return $values[0] . ' ' . $values[1] . ' ' . $values[2] . $important;
				}
				break;

			case 3:
				if ($values[0] == $values[1] && $values[0] == $values[2]) {
					return $values[0] . $important;
				} elseif ($values[0] == $values[2]) {
					return $values[0] . ' ' . $values[1] . $important;
				}
				break;

			case 2:
				if ($values[0] == $values[1]) {
					return $values[0] . $important;
				}
				break;
		}

		return $value;
	}
1012187
public static function convertExponentialToString($value)
    {
        if (!is_float($value)) {
            return $value;
        }

        $result = explode('E', strtoupper($value));

        if (count($result) === 1) {
            return $result[0];
        }

        $dotSplitted = explode('.', $result[0]);

        return '0.' . str_repeat('0', abs($result[1]) - 1) . $dotSplitted[0];
    }