| 1 |
<?php |
| 2 |
|
| 3 |
namespace TablePress\PhpOffice\PhpSpreadsheet\Calculation\Information; |
| 4 |
|
| 5 |
use TablePress\PhpOffice\PhpSpreadsheet\Calculation\Functions; |
| 6 |
use TablePress\PhpOffice\PhpSpreadsheet\Cell\Cell; |
| 7 |
|
| 8 |
class Info |
| 9 |
{ |
| 10 |
/** |
| 11 |
* @internal |
| 12 |
*/ |
| 13 |
public static bool $infoSupported = true; |
| 14 |
|
| 15 |
/** |
| 16 |
* INFO. |
| 17 |
* |
| 18 |
* Excel Function: |
| 19 |
* =INFO(type_text) |
| 20 |
* |
| 21 |
* @param mixed $typeText String specifying the type of information to be returned |
| 22 |
* @param ?Cell $cell Cell from which spreadsheet information is retrieved |
| 23 |
* |
| 24 |
* @return int|string The requested information about the current operating environment |
| 25 |
*/ |
| 26 |
public static function getInfo($typeText = '', ?Cell $cell = null) |
| 27 |
{ |
| 28 |
if (!self::$infoSupported) { |
| 29 |
return Functions::DUMMY(); |
| 30 |
} |
| 31 |
|
| 32 |
switch (is_string($typeText) ? strtolower($typeText) : $typeText) { |
| 33 |
case 'directory': |
| 34 |
return '/'; |
| 35 |
case 'numfile': |
| 36 |
return (($nullsafeVariable1 = ($nullsafeVariable2 = ($nullsafeVariable3 = $cell) ? $nullsafeVariable3->getWorksheetOrNull() : null) ? $nullsafeVariable2->getParent() : null) ? $nullsafeVariable1->getSheetCount() : null) ?? 1; |
| 37 |
case 'origin': |
| 38 |
return '$A:$A$1'; |
| 39 |
case 'osversion': |
| 40 |
return 'PHP ' . PHP_VERSION; |
| 41 |
case 'recalc': |
| 42 |
return 'Automatic'; |
| 43 |
case 'release': |
| 44 |
return PHP_VERSION; |
| 45 |
case 'system': |
| 46 |
return 'PHP'; |
| 47 |
case 'memavail': |
| 48 |
case 'memused': |
| 49 |
case 'totmem': |
| 50 |
return ExcelError::NA(); |
| 51 |
default: |
| 52 |
return ExcelError::VALUE(); |
| 53 |
} |
| 54 |
} |
| 55 |
} |
| 56 |
|