/**
  * Convert the passed value into another value which does not contain sensible data any longer.
  *
  * @param string $value
  * @param array  $context
  *
  * @return string
  */
 public function convert($value, array $context = array())
 {
     extract($context);
     $result = eval(sprintf('return (%s);', $this->condition));
     if ($result && $this->ifTrue !== self::UNDEFINED) {
         return VariableParserHelper::parse($this->ifTrue, $context);
     }
     if (!$result && $this->ifFalse !== self::UNDEFINED) {
         return VariableParserHelper::parse($this->ifFalse, $context);
     }
     if ($result && $this->ifTrueConverter !== null) {
         return $this->ifTrueConverter->convert($value, $context);
     }
     if (!$result && $this->ifFalseConverter !== null) {
         return $this->ifFalseConverter->convert($value, $context);
     }
     return $value;
 }
Example #2
0
 /**
  * Convert the passed value into another value which does not contain sensible data any longer.
  *
  * @param string $value
  * @param array  $context
  *
  * @return string
  */
 public function convert($value, array $context = array())
 {
     return VariableParserHelper::parse($this->string, $context);
 }
 /**
  * Convert the passed value into another value which does not contain sensible data any longer.
  *
  * @param string $value
  * @param array  $context
  *
  * @return string
  */
 public function convert($value, array $context = array())
 {
     return str_replace($this->search, VariableParserHelper::parse($this->replace, $context), $value);
 }
 /**
  * Convert the passed value into another value which does not contain sensible data any longer.
  *
  * @param string $value
  * @param array  $context
  *
  * @return string
  */
 public function convert($value, array $context = array())
 {
     return VariableParserHelper::parse($this->prepend, $context) . $value;
 }
Example #5
0
 /**
  * Convert the passed value into another value which does not contain sensible data any longer.
  *
  * @param string $value
  * @param array  $context
  *
  * @return string
  */
 public function convert($value, array $context = array())
 {
     return $value . VariableParserHelper::parse($this->append, $context);
 }