You are here

public static function PHPExcel_Calculation_Functions::_ifCondition in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Functions.php \PHPExcel_Calculation_Functions::_ifCondition()
6 calls to PHPExcel_Calculation_Functions::_ifCondition()
PHPExcel_Calculation_Database::__filter in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Database.php
* __filter * * Parses the selection criteria, extracts the database rows that match those criteria, and * returns that subset of rows. * * @access private *
PHPExcel_Calculation_MathTrig::SUMIF in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/MathTrig.php
* SUMIF * * Counts the number of cells that contain numbers within the list of arguments * * Excel Function: * SUMIF(value1[,value2[, ...]],condition) * * @access public * @category Mathematical and Trigonometric Functions *
PHPExcel_Calculation_Statistical::AVERAGEIF in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php
* AVERAGEIF * * Returns the average value from a range of cells that contain numbers within the list of arguments * * Excel Function: * AVERAGEIF(value1[,value2[, ...]],condition) * * @access public * @category Mathematical and…
PHPExcel_Calculation_Statistical::COUNTIF in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php
* COUNTIF * * Counts the number of cells that contain numbers within the list of arguments * * Excel Function: * COUNTIF(value1[,value2[, ...]],condition) * * @access public * @category Statistical Functions *
PHPExcel_Calculation_Statistical::MAXIF in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php
* MAXIF * * Counts the maximum value within a range of cells that contain numbers within the list of arguments * * Excel Function: * MAXIF(value1[,value2[, ...]],condition) * * @access public * @category Mathematical and Trigonometric…

... See full list

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Functions.php, line 309

Class

PHPExcel_Calculation_Functions
PHPExcel_Calculation_Functions

Code

public static function _ifCondition($condition) {
  $condition = PHPExcel_Calculation_Functions::flattenSingleValue($condition);
  if (!isset($condition[0])) {
    $condition = '=""';
  }
  if (!in_array($condition[0], array(
    '>',
    '<',
    '=',
  ))) {
    if (!is_numeric($condition)) {
      $condition = PHPExcel_Calculation::_wrapResult(strtoupper($condition));
    }
    return '=' . $condition;
  }
  else {
    preg_match('/([<>=]+)(.*)/', $condition, $matches);
    list(, $operator, $operand) = $matches;
    if (!is_numeric($operand)) {
      $operand = str_replace('"', '""', $operand);
      $operand = PHPExcel_Calculation::_wrapResult(strtoupper($operand));
    }
    return $operator . $operand;
  }
}