You are here

public static function PHPExcel_Calculation_Functions::TYPE 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::TYPE()

* TYPE * * Returns a number that identifies the type of a value * *

Parameters

value The value you want tested: * @return number N converts values listed in the following table * If value is or refers to N returns * A number 1 * Text 2 * Logical Value 4 * An error value 16 * Array or Matrix 64

File

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

Class

PHPExcel_Calculation_Functions
PHPExcel_Calculation_Functions

Code

public static function TYPE($value = NULL) {
  $value = self::flattenArrayIndexed($value);
  if (is_array($value) && count($value) > 1) {
    $a = array_keys($value);
    $a = array_pop($a);

    //	Range of cells is an error
    if (self::isCellValue($a)) {
      return 16;

      //	Test for Matrix
    }
    elseif (self::isMatrixValue($a)) {
      return 64;
    }
  }
  elseif (empty($value)) {

    //	Empty Cell
    return 1;
  }
  $value = self::flattenSingleValue($value);
  if ($value === NULL || is_float($value) || is_int($value)) {
    return 1;
  }
  elseif (is_bool($value)) {
    return 4;
  }
  elseif (is_array($value)) {
    return 64;
  }
  elseif (is_string($value)) {

    //	Errors
    if (strlen($value) > 0 && $value[0] == '#') {
      return 16;
    }
    return 2;
  }
  return 0;
}