Modify value for function call or setting property

@param mixed $value

@return string

@throws CompileErrorException
180954
private function decorateValue($value) : string
    {
        $ret = 'null';
        switch(gettype($value)){
            case 'string':
                $ret = $this->decorateStringValue($value);
                break;
            case 'integer':
            case 'double':
                $ret = $value;
                break;
            case 'boolean':
                $ret = $value ? 'true' : 'false';
                break;
            case 'array':
                $ret = $this->decorateArrayValue($value);
                break;
        }
        return $ret;
    }
1370830
protected function wrapValue($value)
    {
        $value = Str::upper($value);

        return $this->isReserved($value) ? '"' . $value . '"' : $value;
    }
335746
protected function parseValue($value)
  {
    if ('*' === substr($value, 0, 1)) {
      if (false !== $pos = strpos($value, '#')) {
        $value = substr($value, 1, $pos - 2);
      } else {
        $value = substr($value, 1);
      }

      if (!array_key_exists($value, $this->refs)) {
        throw new InvalidArgumentException(sprintf('Reference "%s" does not exist (%s).', $value, $this->currentLine));
      }

      return $this->refs[$value];
    }

    if (preg_match('/^(?P<separator>\||>)(?P<modifiers>\+|\-|\d+|\+\d+|\-\d+|\d+\+|\d+\-)?(?P<comments> +#.*)?$/', $value, $matches)) {
      $modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : '';

      return $this->parseFoldedScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), intval(abs($modifiers)));
    } else {
      return sfYamlInline::load($value);
    }
  }
414032
protected function coerceString($value)
    {
        if ($value[0] === Type::T_STRING) {
            return $value;
        }

        return [Type::T_STRING, '', [$this->compileValue($value)]];
    }
221781
protected function prepareValue($value)
    {
        if ($this->hasMutator()) {
            return call_user_func($this->getMutator(), $value);
        } elseif ($value && $this->isElementOfDate() && $this->isDateCastable()) {
            $value = $this->castValueAsDateTime($value);
            if ($this instanceof Timestamp) {
                $value = $value->getTimestamp();
            }

            return $value;
        }

        if (! is_null($value)) {
            if ($this->isJsonCastable()) {
                return $this->castValueAsJson($value);
            } elseif ($this->isCommaCastable()) {
                return $this->castValueAsCommaSeparated($value);
            }
        }

        return $value;
    }
173084
protected function compileRegularEchos($value)
	{
		$me = $this;

		$pattern = sprintf('/(@)?%s\s*(.+?)\s*%s/s', $this->contentTags[0], $this->contentTags[1]);

		$callback = function($matches) use ($me)
		{
			return $matches[1] ? substr($matches[0], 1) : '<?php echo '.$me->compileEchoDefaults($matches[2]).'; ?>';
		};

		return preg_replace_callback($pattern, $callback, $value);
	}
611779
protected function compileRawEchos($value)
    {
        $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->rawTags[0], $this->rawTags[1]);

        $callback = function ($matches) {
            $whitespace = empty($matches[3]) ? '' : $matches[3] . $matches[3];

            return $matches[1] ? substr(
                $matches[0],
                1
            ) : '<?php echo ' . $this->compileEchoDefaults($matches[2]) . '; ?>' . $whitespace;
        };

        return preg_replace_callback($pattern, $callback, $value);
    }
721088
public function compile($value = "")
	{
		$html = $this->compiledLabel;

		if (!empty($this->help)) {
			$html .= "<div class='help'>{$this->help}</div>";
		}

		$html .= "<div class=\"elements\">";

		$hasOptionValue = $this->hasOptionValue($this->options);

		foreach ($this->options as $k => $v) {

			$html .= "<div class=\"element\"><input type=\"{$this->type}\" {$this->compiledAttr} ";
			$html .= "name=\"" . $this->name;

			if ($this->type == "checkbox") {
				$html .= "[]";
			}

			$html .= "\" ";

			// handle options in an associative array differently than ones in a numeric array
			if ($hasOptionValue || $this->useNumericValue) {
				$html .= "value=\"{$k}\" ";
				if ($k === $value || (is_array($value) && in_array($k, $value))) {
					$html .= "checked=\"checked\"";
				}

			} else {
				$html .= "value=\"{$v}\" ";
				if ($v === $value || (is_array($value) && in_array($v, $value))) {
					$html .= "checked=\"checked\"";
				}
			}

			$html .= " /> <span>{$v}</span></div>";
		}

		$html .= "</div>";

		return $html;
	}
644232
public function add($value)
    {
        if (! $value instanceof SpecificationInterface) {
            throw new InvalidArgumentException(sprintf(
                '"%s" does not implement "%s"!',
                (is_object($value)) ? get_class($value) : $value,
                SpecificationInterface::class
            ));
        }

        return parent::add($value);
    }
383671
protected function _compileRawEchos($value)
    {
        $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->_rawTags[0], $this->_rawTags[1]);

        $callback = function ($matches) {
            $whitespace = empty($matches[3]) ? '' : $matches[3];

            return $matches[1] ? substr($matches[0], 1) : '<?= ' . $this->_compileEchoDefaults($matches[2]) . '; ?>' . $whitespace;
        };

        return preg_replace_callback($pattern, $callback, $value);
    }
1118972
protected function _compileComments($value)
    {
        $pattern = sprintf('/%s--(.*?)--%s/s', $this->_escapedTags[0], $this->_escapedTags[1]);

        return preg_replace($pattern, '<?php /*$1*/ ?> ', $value);
    }
341950
public function mutate($value, $callables)
    {
        if (!is_array($callables)) {
            $callables = explode('|', $callables);
        }

        foreach ($callables as $callable) {
            list($callable, $args) = $this->parse(trim($callable));

            $value = call_user_func_array($callable, array_merge([$value], $args));
        }

        return $value;
    }
1112549
protected function compileEchos($value)
    {
        foreach ($this->getEchoMethods() as $method => $length) {
            $value = $this->$method($value);
        }

        return $value;
    }
326573
protected function processCallbackArray($value)
    {
        if ($this->isCallbackArray($value)) {
            
            $class  = $value['class'];
            $method = $value['method'];
            
            if ($result = call_user_func("{$class}::{$method}")) {
                
                if (isset($value['property'])) {
                    return $result->{$value['property']};
                }
                
                return $result;
                
            }
            
        }
    }
1222663
public function compile($value = "")
	{
		$html = $this->compiledLabel;

		if (!empty($this->help)) {
			$html .= "<div class='help'>{$this->help}</div>";
		}

		$html .= "<input type=\"{$this->type}\" name=\"{$this->name}\" {$this->compiledAttr} value=\"{$value}\" />";

		return $html;
	}
26102
public function cast($value)
    {
        $fn = 'cast' . ucfirst(gettype($value));
        
        return method_exists($this, $fn) ? $this->$fn($value) : (string)$value;
    }
1018916
protected function optimizeValueForJavaScript($value)
    {
        // For every transformable type, let's see if
        // it needs to be transformed for JS-use.
        foreach ($this->types as $transformer) {
            $js = $this->{"transform{$transformer}"}($value);
            if (! is_null($js)) {
                return $js;
            }
        }
    }