Пример #1
0
 /**
  * prioriCalc
  * Will use the content as a mathematical term and calculate the result
  * Can be set to 1 to just get a calculated value or 'intval' to get the integer of the result
  *
  * @param string $content Input value undergoing processing in this function.
  * @param array $conf stdWrap properties for prioriCalc.
  * @return string The processed input value
  */
 public function stdWrap_prioriCalc($content = '', $conf = array())
 {
     $content = MathUtility::calculateWithParentheses($content);
     if ($conf['prioriCalc'] === 'intval') {
         $content = (int) $content;
     }
     return $content;
 }
Пример #2
0
 /**
  * @test
  * @dataProvider calculateWithParenthesesDataProvider
  */
 public function calculateWithParenthesesCorrectlyCalculatesExpression($expected, $expression)
 {
     $this->assertEquals($expected, \TYPO3\CMS\Core\Utility\MathUtility::calculateWithParentheses($expression));
 }
 /**
  * prioriCalc
  * Will use the content as a mathematical term and calculate the result
  * Can be set to 1 to just get a calculated value or 'intval' to get the integer of the result
  *
  * @param string $content Input value undergoing processing in this function.
  * @param array $conf stdWrap properties for prioriCalc.
  * @return string The processed input value
  */
 public function stdWrap_prioriCalc($content = '', $conf = array())
 {
     $content = \TYPO3\CMS\Core\Utility\MathUtility::calculateWithParentheses($content);
     if ($conf['prioriCalc'] == 'intval') {
         $content = intval($content);
     }
     return $content;
 }