Файловый менеджер - Редактировать - /home/easybachat/hisabat365.com/4a7891/phpoffice.zip
Ðазад
PK ��)[���P^ ^ phpspreadsheet/phpstan.neon.distnu �[��� includes: - phpstan-baseline.neon - phpstan-conditional.php - vendor/phpstan/phpstan-phpunit/extension.neon - vendor/phpstan/phpstan-phpunit/rules.neon parameters: level: 8 paths: - src/ - tests/ excludePaths: - src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - src/PhpSpreadsheet/Chart/Renderer/JpGraphRendererBase.php - src/PhpSpreadsheet/Collection/Memory/SimpleCache1.php - src/PhpSpreadsheet/Collection/Memory/SimpleCache3.php - src/PhpSpreadsheet/Writer/ZipStream2.php - src/PhpSpreadsheet/Writer/ZipStream3.php parallel: processTimeout: 300.0 checkMissingIterableValueType: false ignoreErrors: - '~^Parameter \#1 \$im(age)? of function (imagedestroy|imageistruecolor|imagealphablending|imagesavealpha|imagecolortransparent|imagecolorsforindex|imagesavealpha|imagesx|imagesy|imagepng) expects (GdImage|resource), GdImage\|resource given\.$~' - '~^Parameter \#2 \$src_im(age)? of function imagecopy expects (GdImage|resource), GdImage\|resource given\.$~' # Accept a bit anything for assert methods - '~^Parameter \#2 .* of static method PHPUnit\\Framework\\Assert\:\:assert\w+\(\) expects .*, .* given\.$~' - '~^Method PhpOffice\\PhpSpreadsheetTests\\.*\:\:test.*\(\) has parameter \$args with no type specified\.$~' PK ��)[�or<# <# / phpspreadsheet/src/PhpSpreadsheet/IOFactory.phpnu �[��� <?php namespace PhpOffice\PhpSpreadsheet; use PhpOffice\PhpSpreadsheet\Reader\IReader; use PhpOffice\PhpSpreadsheet\Shared\File; use PhpOffice\PhpSpreadsheet\Writer\IWriter; /** * Factory to create readers and writers easily. * * It is not required to use this class, but it should make it easier to read and write files. * Especially for reading files with an unknown format. */ abstract class IOFactory { public const READER_XLSX = 'Xlsx'; public const READER_XLS = 'Xls'; public const READER_XML = 'Xml'; public const READER_ODS = 'Ods'; public const READER_SYLK = 'Slk'; public const READER_SLK = 'Slk'; public const READER_GNUMERIC = 'Gnumeric'; public const READER_HTML = 'Html'; public const READER_CSV = 'Csv'; public const WRITER_XLSX = 'Xlsx'; public const WRITER_XLS = 'Xls'; public const WRITER_ODS = 'Ods'; public const WRITER_CSV = 'Csv'; public const WRITER_HTML = 'Html'; /** @var string[] */ private static $readers = [ self::READER_XLSX => Reader\Xlsx::class, self::READER_XLS => Reader\Xls::class, self::READER_XML => Reader\Xml::class, self::READER_ODS => Reader\Ods::class, self::READER_SLK => Reader\Slk::class, self::READER_GNUMERIC => Reader\Gnumeric::class, self::READER_HTML => Reader\Html::class, self::READER_CSV => Reader\Csv::class, ]; /** @var string[] */ private static $writers = [ self::WRITER_XLS => Writer\Xls::class, self::WRITER_XLSX => Writer\Xlsx::class, self::WRITER_ODS => Writer\Ods::class, self::WRITER_CSV => Writer\Csv::class, self::WRITER_HTML => Writer\Html::class, 'Tcpdf' => Writer\Pdf\Tcpdf::class, 'Dompdf' => Writer\Pdf\Dompdf::class, 'Mpdf' => Writer\Pdf\Mpdf::class, ]; /** * Create Writer\IWriter. */ public static function createWriter(Spreadsheet $spreadsheet, string $writerType): IWriter { if (!isset(self::$writers[$writerType])) { throw new Writer\Exception("No writer found for type $writerType"); } // Instantiate writer /** @var IWriter */ $className = self::$writers[$writerType]; return new $className($spreadsheet); } /** * Create IReader. */ public static function createReader(string $readerType): IReader { if (!isset(self::$readers[$readerType])) { throw new Reader\Exception("No reader found for type $readerType"); } // Instantiate reader /** @var IReader */ $className = self::$readers[$readerType]; return new $className(); } /** * Loads Spreadsheet from file using automatic Reader\IReader resolution. * * @param string $filename The name of the spreadsheet file * @param int $flags the optional second parameter flags may be used to identify specific elements * that should be loaded, but which won't be loaded by default, using these values: * IReader::LOAD_WITH_CHARTS - Include any charts that are defined in the loaded file. * IReader::READ_DATA_ONLY - Read cell values only, not formatting or merge structure. * IReader::IGNORE_EMPTY_CELLS - Don't load empty cells into the model. * @param string[] $readers An array of Readers to use to identify the file type. By default, load() will try * all possible Readers until it finds a match; but this allows you to pass in a * list of Readers so it will only try the subset that you specify here. * Values in this list can be any of the constant values defined in the set * IOFactory::READER_*. */ public static function load(string $filename, int $flags = 0, ?array $readers = null): Spreadsheet { $reader = self::createReaderForFile($filename, $readers); return $reader->load($filename, $flags); } /** * Identify file type using automatic IReader resolution. */ public static function identify(string $filename, ?array $readers = null): string { $reader = self::createReaderForFile($filename, $readers); $className = get_class($reader); $classType = explode('\\', $className); unset($reader); return array_pop($classType); } /** * Create Reader\IReader for file using automatic IReader resolution. * * @param string[] $readers An array of Readers to use to identify the file type. By default, load() will try * all possible Readers until it finds a match; but this allows you to pass in a * list of Readers so it will only try the subset that you specify here. * Values in this list can be any of the constant values defined in the set * IOFactory::READER_*. */ public static function createReaderForFile(string $filename, ?array $readers = null): IReader { File::assertFile($filename); $testReaders = self::$readers; if ($readers !== null) { $readers = array_map('strtoupper', $readers); $testReaders = array_filter( self::$readers, function (string $readerType) use ($readers) { return in_array(strtoupper($readerType), $readers, true); }, ARRAY_FILTER_USE_KEY ); } // First, lucky guess by inspecting file extension $guessedReader = self::getReaderTypeFromExtension($filename); if (($guessedReader !== null) && array_key_exists($guessedReader, $testReaders)) { $reader = self::createReader($guessedReader); // Let's see if we are lucky if ($reader->canRead($filename)) { return $reader; } } // If we reach here then "lucky guess" didn't give any result // Try walking through all the options in self::$readers (or the selected subset) foreach ($testReaders as $readerType => $class) { // Ignore our original guess, we know that won't work if ($readerType !== $guessedReader) { $reader = self::createReader($readerType); if ($reader->canRead($filename)) { return $reader; } } } throw new Reader\Exception('Unable to identify a reader for this file'); } /** * Guess a reader type from the file extension, if any. */ private static function getReaderTypeFromExtension(string $filename): ?string { $pathinfo = pathinfo($filename); if (!isset($pathinfo['extension'])) { return null; } switch (strtolower($pathinfo['extension'])) { case 'xlsx': // Excel (OfficeOpenXML) Spreadsheet case 'xlsm': // Excel (OfficeOpenXML) Macro Spreadsheet (macros will be discarded) case 'xltx': // Excel (OfficeOpenXML) Template case 'xltm': // Excel (OfficeOpenXML) Macro Template (macros will be discarded) return 'Xlsx'; case 'xls': // Excel (BIFF) Spreadsheet case 'xlt': // Excel (BIFF) Template return 'Xls'; case 'ods': // Open/Libre Offic Calc case 'ots': // Open/Libre Offic Calc Template return 'Ods'; case 'slk': return 'Slk'; case 'xml': // Excel 2003 SpreadSheetML return 'Xml'; case 'gnumeric': return 'Gnumeric'; case 'htm': case 'html': return 'Html'; case 'csv': // Do nothing // We must not try to use CSV reader since it loads // all files including Excel files etc. return null; default: return null; } } /** * Register a writer with its type and class name. */ public static function registerWriter(string $writerType, string $writerClass): void { if (!is_a($writerClass, IWriter::class, true)) { throw new Writer\Exception('Registered writers must implement ' . IWriter::class); } self::$writers[$writerType] = $writerClass; } /** * Register a reader with its type and class name. */ public static function registerReader(string $readerType, string $readerClass): void { if (!is_a($readerClass, IReader::class, true)) { throw new Reader\Exception('Registered readers must implement ' . IReader::class); } self::$readers[$readerType] = $readerClass; } } PK ��)[Z�� 8 phpspreadsheet/src/PhpSpreadsheet/Cell/DataValidator.phpnu �[��� <?php namespace PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Exception; /** * Validate a cell value according to its validation rules. */ class DataValidator { /** * Does this cell contain valid value? * * @param Cell $cell Cell to check the value * * @return bool */ public function isValid(Cell $cell) { if (!$cell->hasDataValidation() || $cell->getDataValidation()->getType() === DataValidation::TYPE_NONE) { return true; } $cellValue = $cell->getValue(); $dataValidation = $cell->getDataValidation(); if (!$dataValidation->getAllowBlank() && ($cellValue === null || $cellValue === '')) { return false; } $returnValue = false; $type = $dataValidation->getType(); if ($type === DataValidation::TYPE_LIST) { $returnValue = $this->isValueInList($cell); } elseif ($type === DataValidation::TYPE_WHOLE) { if (!is_numeric($cellValue) || fmod((float) $cellValue, 1) != 0) { $returnValue = false; } else { $returnValue = $this->numericOperator($dataValidation, (int) $cellValue); } } elseif ($type === DataValidation::TYPE_DECIMAL || $type === DataValidation::TYPE_DATE || $type === DataValidation::TYPE_TIME) { if (!is_numeric($cellValue)) { $returnValue = false; } else { $returnValue = $this->numericOperator($dataValidation, (float) $cellValue); } } elseif ($type === DataValidation::TYPE_TEXTLENGTH) { $returnValue = $this->numericOperator($dataValidation, mb_strlen((string) $cellValue)); } return $returnValue; } /** @param float|int $cellValue */ private function numericOperator(DataValidation $dataValidation, $cellValue): bool { $operator = $dataValidation->getOperator(); $formula1 = $dataValidation->getFormula1(); $formula2 = $dataValidation->getFormula2(); $returnValue = false; if ($operator === DataValidation::OPERATOR_BETWEEN) { $returnValue = $cellValue >= $formula1 && $cellValue <= $formula2; } elseif ($operator === DataValidation::OPERATOR_NOTBETWEEN) { $returnValue = $cellValue < $formula1 || $cellValue > $formula2; } elseif ($operator === DataValidation::OPERATOR_EQUAL) { $returnValue = $cellValue == $formula1; } elseif ($operator === DataValidation::OPERATOR_NOTEQUAL) { $returnValue = $cellValue != $formula1; } elseif ($operator === DataValidation::OPERATOR_LESSTHAN) { $returnValue = $cellValue < $formula1; } elseif ($operator === DataValidation::OPERATOR_LESSTHANOREQUAL) { $returnValue = $cellValue <= $formula1; } elseif ($operator === DataValidation::OPERATOR_GREATERTHAN) { $returnValue = $cellValue > $formula1; } elseif ($operator === DataValidation::OPERATOR_GREATERTHANOREQUAL) { $returnValue = $cellValue >= $formula1; } return $returnValue; } /** * Does this cell contain valid value, based on list? * * @param Cell $cell Cell to check the value * * @return bool */ private function isValueInList(Cell $cell) { $cellValue = $cell->getValue(); $dataValidation = $cell->getDataValidation(); $formula1 = $dataValidation->getFormula1(); if (!empty($formula1)) { // inline values list if ($formula1[0] === '"') { return in_array(strtolower($cellValue), explode(',', strtolower(trim($formula1, '"'))), true); } elseif (strpos($formula1, ':') > 0) { // values list cells $matchFormula = '=MATCH(' . $cell->getCoordinate() . ', ' . $formula1 . ', 0)'; $calculation = Calculation::getInstance($cell->getWorksheet()->getParent()); try { $result = $calculation->calculateFormula($matchFormula, $cell->getCoordinate(), $cell); while (is_array($result)) { $result = array_pop($result); } return $result !== ExcelError::NA(); } catch (Exception $ex) { return false; } } } return true; } } PK ��)[��� � 4 phpspreadsheet/src/PhpSpreadsheet/Cell/CellRange.phpnu �[��� <?php namespace PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Exception; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; class CellRange implements AddressRange { /** * @var CellAddress */ protected $from; /** * @var CellAddress */ protected $to; public function __construct(CellAddress $from, CellAddress $to) { $this->validateFromTo($from, $to); } private function validateFromTo(CellAddress $from, CellAddress $to): void { // Identify actual top-left and bottom-right values (in case we've been given top-right and bottom-left) $firstColumn = min($from->columnId(), $to->columnId()); $firstRow = min($from->rowId(), $to->rowId()); $lastColumn = max($from->columnId(), $to->columnId()); $lastRow = max($from->rowId(), $to->rowId()); $fromWorksheet = $from->worksheet(); $toWorksheet = $to->worksheet(); $this->validateWorksheets($fromWorksheet, $toWorksheet); $this->from = $this->cellAddressWrapper($firstColumn, $firstRow, $fromWorksheet); $this->to = $this->cellAddressWrapper($lastColumn, $lastRow, $toWorksheet); } private function validateWorksheets(?Worksheet $fromWorksheet, ?Worksheet $toWorksheet): void { if ($fromWorksheet !== null && $toWorksheet !== null) { // We could simply compare worksheets rather than worksheet titles; but at some point we may introduce // support for 3d ranges; and at that point we drop this check and let the validation fall through // to the check for same workbook; but unless we check on titles, this test will also detect if the // worksheets are in different spreadsheets, and the next check will never execute or throw its // own exception. if ($fromWorksheet->getTitle() !== $toWorksheet->getTitle()) { throw new Exception('3d Cell Ranges are not supported'); } elseif ($fromWorksheet->getParent() !== $toWorksheet->getParent()) { throw new Exception('Worksheets must be in the same spreadsheet'); } } } private function cellAddressWrapper(int $column, int $row, ?Worksheet $worksheet = null): CellAddress { $cellAddress = Coordinate::stringFromColumnIndex($column) . (string) $row; return new class ($cellAddress, $worksheet) extends CellAddress { public function nextRow(int $offset = 1): CellAddress { /** @var CellAddress $result */ $result = parent::nextRow($offset); $this->rowId = $result->rowId; $this->cellAddress = $result->cellAddress; return $this; } public function previousRow(int $offset = 1): CellAddress { /** @var CellAddress $result */ $result = parent::previousRow($offset); $this->rowId = $result->rowId; $this->cellAddress = $result->cellAddress; return $this; } public function nextColumn(int $offset = 1): CellAddress { /** @var CellAddress $result */ $result = parent::nextColumn($offset); $this->columnId = $result->columnId; $this->columnName = $result->columnName; $this->cellAddress = $result->cellAddress; return $this; } public function previousColumn(int $offset = 1): CellAddress { /** @var CellAddress $result */ $result = parent::previousColumn($offset); $this->columnId = $result->columnId; $this->columnName = $result->columnName; $this->cellAddress = $result->cellAddress; return $this; } }; } public function from(): CellAddress { // Re-order from/to in case the cell addresses have been modified $this->validateFromTo($this->from, $this->to); return $this->from; } public function to(): CellAddress { // Re-order from/to in case the cell addresses have been modified $this->validateFromTo($this->from, $this->to); return $this->to; } public function __toString(): string { // Re-order from/to in case the cell addresses have been modified $this->validateFromTo($this->from, $this->to); if ($this->from->cellAddress() === $this->to->cellAddress()) { return "{$this->from->fullCellAddress()}"; } $fromAddress = $this->from->fullCellAddress(); $toAddress = $this->to->cellAddress(); return "{$fromAddress}:{$toAddress}"; } } PK ��)[:�� � 3 phpspreadsheet/src/PhpSpreadsheet/Cell/DataType.phpnu �[��� <?php namespace PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\RichText\RichText; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; class DataType { // Data types const TYPE_STRING2 = 'str'; const TYPE_STRING = 's'; const TYPE_FORMULA = 'f'; const TYPE_NUMERIC = 'n'; const TYPE_BOOL = 'b'; const TYPE_NULL = 'null'; const TYPE_INLINE = 'inlineStr'; const TYPE_ERROR = 'e'; const TYPE_ISO_DATE = 'd'; /** * List of error codes. * * @var array<string, int> */ private static $errorCodes = [ '#NULL!' => 0, '#DIV/0!' => 1, '#VALUE!' => 2, '#REF!' => 3, '#NAME?' => 4, '#NUM!' => 5, '#N/A' => 6, '#CALC!' => 7, ]; public const MAX_STRING_LENGTH = 32767; /** * Get list of error codes. * * @return array<string, int> */ public static function getErrorCodes() { return self::$errorCodes; } /** * Check a string that it satisfies Excel requirements. * * @param null|RichText|string $textValue Value to sanitize to an Excel string * * @return RichText|string Sanitized value */ public static function checkString($textValue) { if ($textValue instanceof RichText) { // TODO: Sanitize Rich-Text string (max. character count is 32,767) return $textValue; } // string must never be longer than 32,767 characters, truncate if necessary $textValue = StringHelper::substring((string) $textValue, 0, self::MAX_STRING_LENGTH); // we require that newline is represented as "\n" in core, not as "\r\n" or "\r" $textValue = str_replace(["\r\n", "\r"], "\n", $textValue); return $textValue; } /** * Check a value that it is a valid error code. * * @param mixed $value Value to sanitize to an Excel error code * * @return string Sanitized value */ public static function checkErrorCode($value) { $value = (string) $value; if (!isset(self::$errorCodes[$value])) { $value = '#NULL!'; } return $value; } } PK ��)[��K�R R 8 phpspreadsheet/src/PhpSpreadsheet/Cell/AddressHelper.phpnu �[��� <?php namespace PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Functions; use PhpOffice\PhpSpreadsheet\Exception; class AddressHelper { public const R1C1_COORDINATE_REGEX = '/(R((?:\[-?\d*\])|(?:\d*))?)(C((?:\[-?\d*\])|(?:\d*))?)/i'; /** @return string[] */ public static function getRowAndColumnChars() { $rowChar = 'R'; $colChar = 'C'; if (Functions::getCompatibilityMode() === Functions::COMPATIBILITY_EXCEL) { $rowColChars = Calculation::localeFunc('*RC'); if (mb_strlen($rowColChars) === 2) { $rowChar = mb_substr($rowColChars, 0, 1); $colChar = mb_substr($rowColChars, 1, 1); } } return [$rowChar, $colChar]; } /** * Converts an R1C1 format cell address to an A1 format cell address. */ public static function convertToA1( string $address, int $currentRowNumber = 1, int $currentColumnNumber = 1, bool $useLocale = true ): string { [$rowChar, $colChar] = $useLocale ? self::getRowAndColumnChars() : ['R', 'C']; $regex = '/^(' . $rowChar . '(\[?[-+]?\d*\]?))(' . $colChar . '(\[?[-+]?\d*\]?))$/i'; $validityCheck = preg_match($regex, $address, $cellReference); if (empty($validityCheck)) { throw new Exception('Invalid R1C1-format Cell Reference'); } $rowReference = $cellReference[2]; // Empty R reference is the current row if ($rowReference === '') { $rowReference = (string) $currentRowNumber; } // Bracketed R references are relative to the current row if ($rowReference[0] === '[') { $rowReference = $currentRowNumber + (int) trim($rowReference, '[]'); } $columnReference = $cellReference[4]; // Empty C reference is the current column if ($columnReference === '') { $columnReference = (string) $currentColumnNumber; } // Bracketed C references are relative to the current column if (is_string($columnReference) && $columnReference[0] === '[') { $columnReference = $currentColumnNumber + (int) trim($columnReference, '[]'); } $columnReference = (int) $columnReference; if ($columnReference <= 0 || $rowReference <= 0) { throw new Exception('Invalid R1C1-format Cell Reference, Value out of range'); } $A1CellReference = Coordinate::stringFromColumnIndex($columnReference) . $rowReference; return $A1CellReference; } protected static function convertSpreadsheetMLFormula(string $formula): string { $formula = substr($formula, 3); $temp = explode('"', $formula); $key = false; foreach ($temp as &$value) { // Only replace in alternate array entries (i.e. non-quoted blocks) $key = $key === false; if ($key) { $value = str_replace(['[.', ':.', ']'], ['', ':', ''], $value); } } unset($value); return implode('"', $temp); } /** * Converts a formula that uses R1C1/SpreadsheetXML format cell address to an A1 format cell address. */ public static function convertFormulaToA1( string $formula, int $currentRowNumber = 1, int $currentColumnNumber = 1 ): string { if (substr($formula, 0, 3) == 'of:') { // We have an old-style SpreadsheetML Formula return self::convertSpreadsheetMLFormula($formula); } // Convert R1C1 style references to A1 style references (but only when not quoted) $temp = explode('"', $formula); $key = false; foreach ($temp as &$value) { // Only replace in alternate array entries (i.e. non-quoted blocks) $key = $key === false; if ($key) { preg_match_all(self::R1C1_COORDINATE_REGEX, $value, $cellReferences, PREG_SET_ORDER + PREG_OFFSET_CAPTURE); // Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way // through the formula from left to right. Reversing means that we work right to left.through // the formula $cellReferences = array_reverse($cellReferences); // Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent, // then modify the formula to use that new reference foreach ($cellReferences as $cellReference) { $A1CellReference = self::convertToA1($cellReference[0][0], $currentRowNumber, $currentColumnNumber, false); $value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0])); } } } unset($value); // Then rebuild the formula string return implode('"', $temp); } /** * Converts an A1 format cell address to an R1C1 format cell address. * If $currentRowNumber or $currentColumnNumber are provided, then the R1C1 address will be formatted as a relative address. */ public static function convertToR1C1( string $address, ?int $currentRowNumber = null, ?int $currentColumnNumber = null ): string { $validityCheck = preg_match(Coordinate::A1_COORDINATE_REGEX, $address, $cellReference); if ($validityCheck === 0) { throw new Exception('Invalid A1-format Cell Reference'); } if ($cellReference['col'][0] === '$') { // Column must be absolute address $currentColumnNumber = null; } $columnId = Coordinate::columnIndexFromString(ltrim($cellReference['col'], '$')); if ($cellReference['row'][0] === '$') { // Row must be absolute address $currentRowNumber = null; } $rowId = (int) ltrim($cellReference['row'], '$'); if ($currentRowNumber !== null) { if ($rowId === $currentRowNumber) { $rowId = ''; } else { $rowId = '[' . ($rowId - $currentRowNumber) . ']'; } } if ($currentColumnNumber !== null) { if ($columnId === $currentColumnNumber) { $columnId = ''; } else { $columnId = '[' . ($columnId - $currentColumnNumber) . ']'; } } $R1C1Address = "R{$rowId}C{$columnId}"; return $R1C1Address; } } PK ��)[p ��J J 4 phpspreadsheet/src/PhpSpreadsheet/Cell/Hyperlink.phpnu �[��� <?php namespace PhpOffice\PhpSpreadsheet\Cell; class Hyperlink { /** * URL to link the cell to. * * @var string */ private $url; /** * Tooltip to display on the hyperlink. * * @var string */ private $tooltip; /** * Create a new Hyperlink. * * @param string $url Url to link the cell to * @param string $tooltip Tooltip to display on the hyperlink */ public function __construct($url = '', $tooltip = '') { // Initialise member variables $this->url = $url; $this->tooltip = $tooltip; } /** * Get URL. * * @return string */ public function getUrl() { return $this->url; } /** * Set URL. * * @param string $url * * @return $this */ public function setUrl($url) { $this->url = $url; return $this; } /** * Get tooltip. * * @return string */ public function getTooltip() { return $this->tooltip; } /** * Set tooltip. * * @param string $tooltip * * @return $this */ public function setTooltip($tooltip) { $this->tooltip = $tooltip; return $this; } /** * Is this hyperlink internal? (to another worksheet). * * @return bool */ public function isInternal() { return strpos($this->url, 'sheet://') !== false; } /** * @return string */ public function getTypeHyperlink() { return $this->isInternal() ? '' : 'External'; } /** * Get hash code. * * @return string Hash code */ public function getHashCode() { return md5( $this->url . $this->tooltip . __CLASS__ ); } } PK ��)[f�F� 6 phpspreadsheet/src/PhpSpreadsheet/Cell/CellAddress.phpnu �[��� <?php namespace PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Exception; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; class CellAddress { /** * @var ?Worksheet */ protected $worksheet; /** * @var string */ protected $cellAddress; /** * @var string */ protected $columnName; /** * @var int */ protected $columnId; /** * @var int */ protected $rowId; public function __construct(string $cellAddress, ?Worksheet $worksheet = null) { $this->cellAddress = str_replace('$', '', $cellAddress); [$this->columnId, $this->rowId, $this->columnName] = Coordinate::indexesFromString($this->cellAddress); $this->worksheet = $worksheet; } /** * @param mixed $columnId * @param mixed $rowId */ private static function validateColumnAndRow($columnId, $rowId): void { if (!is_numeric($columnId) || $columnId <= 0 || !is_numeric($rowId) || $rowId <= 0) { throw new Exception('Row and Column Ids must be positive integer values'); } } /** * @param mixed $columnId * @param mixed $rowId */ public static function fromColumnAndRow($columnId, $rowId, ?Worksheet $worksheet = null): self { self::validateColumnAndRow($columnId, $rowId); /** @phpstan-ignore-next-line */ return new static(Coordinate::stringFromColumnIndex($columnId) . ((string) $rowId), $worksheet); } public static function fromColumnRowArray(array $array, ?Worksheet $worksheet = null): self { [$columnId, $rowId] = $array; return static::fromColumnAndRow($columnId, $rowId, $worksheet); } /** * @param mixed $cellAddress */ public static function fromCellAddress($cellAddress, ?Worksheet $worksheet = null): self { /** @phpstan-ignore-next-line */ return new static($cellAddress, $worksheet); } /** * The returned address string will contain the worksheet name as well, if available, * (ie. if a Worksheet was provided to the constructor). * e.g. "'Mark''s Worksheet'!C5". */ public function fullCellAddress(): string { if ($this->worksheet !== null) { $title = str_replace("'", "''", $this->worksheet->getTitle()); return "'{$title}'!{$this->cellAddress}"; } return $this->cellAddress; } public function worksheet(): ?Worksheet { return $this->worksheet; } /** * The returned address string will contain just the column/row address, * (even if a Worksheet was provided to the constructor). * e.g. "C5". */ public function cellAddress(): string { return $this->cellAddress; } public function rowId(): int { return $this->rowId; } public function columnId(): int { return $this->columnId; } public function columnName(): string { return $this->columnName; } public function nextRow(int $offset = 1): self { $newRowId = $this->rowId + $offset; if ($newRowId < 1) { $newRowId = 1; } return static::fromColumnAndRow($this->columnId, $newRowId); } public function previousRow(int $offset = 1): self { return $this->nextRow(0 - $offset); } public function nextColumn(int $offset = 1): self { $newColumnId = $this->columnId + $offset; if ($newColumnId < 1) { $newColumnId = 1; } return static::fromColumnAndRow($newColumnId, $this->rowId); } public function previousColumn(int $offset = 1): self { return $this->nextColumn(0 - $offset); } /** * The returned address string will contain the worksheet name as well, if available, * (ie. if a Worksheet was provided to the constructor). * e.g. "'Mark''s Worksheet'!C5". */ public function __toString() { return $this->fullCellAddress(); } } PK ��)[G�� � 8 phpspreadsheet/src/PhpSpreadsheet/Cell/IgnoredErrors.phpnu �[��� <?php namespace PhpOffice\PhpSpreadsheet\Cell; class IgnoredErrors { /** @var bool */ private $numberStoredAsText = false; /** @var bool */ private $formula = false; /** @var bool */ private $twoDigitTextYear = false; /** @var bool */ private $evalError = false; public function setNumberStoredAsText(bool $value): self { $this->numberStoredAsText = $value; return $this; } public function getNumberStoredAsText(): bool { return $this->numberStoredAsText; } public function setFormula(bool $value): self { $this->formula = $value; return $this; } public function getFormula(): bool { return $this->formula; } public function setTwoDigitTextYear(bool $value): self { $this->twoDigitTextYear = $value; return $this; } public function getTwoDigitTextYear(): bool { return $this->twoDigitTextYear; } public function setEvalError(bool $value): self { $this->evalError = $value; return $this; } public function getEvalError(): bool { return $this->evalError; } } PK ��)[Q��~JR JR 5 phpspreadsheet/src/PhpSpreadsheet/Cell/Coordinate.phpnu �[��� <?php namespace PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Calculation\Functions; use PhpOffice\PhpSpreadsheet\Exception; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; /** * Helper class to manipulate cell coordinates. * * Columns indexes and rows are always based on 1, **not** on 0. This match the behavior * that Excel users are used to, and also match the Excel functions `COLUMN()` and `ROW()`. */ abstract class Coordinate { public const A1_COORDINATE_REGEX = '/^(?<col>\$?[A-Z]{1,3})(?<row>\$?\d{1,7})$/i'; /** * Default range variable constant. * * @var string */ const DEFAULT_RANGE = 'A1:A1'; /** * Convert string coordinate to [0 => int column index, 1 => int row index]. * * @param string $cellAddress eg: 'A1' * * @return array{0: string, 1: string} Array containing column and row (indexes 0 and 1) */ public static function coordinateFromString($cellAddress): array { if (preg_match(self::A1_COORDINATE_REGEX, $cellAddress, $matches)) { return [$matches['col'], $matches['row']]; } elseif (self::coordinateIsRange($cellAddress)) { throw new Exception('Cell coordinate string can not be a range of cells'); } elseif ($cellAddress == '') { throw new Exception('Cell coordinate can not be zero-length string'); } throw new Exception('Invalid cell coordinate ' . $cellAddress); } /** * Convert string coordinate to [0 => int column index, 1 => int row index, 2 => string column string]. * * @param string $coordinates eg: 'A1', '$B$12' * * @return array{0: int, 1: int, 2: string} Array containing column and row index, and column string */ public static function indexesFromString(string $coordinates): array { [$column, $row] = self::coordinateFromString($coordinates); $column = ltrim($column, '$'); return [ self::columnIndexFromString($column), (int) ltrim($row, '$'), $column, ]; } /** * Checks if a Cell Address represents a range of cells. * * @param string $cellAddress eg: 'A1' or 'A1:A2' or 'A1:A2,C1:C2' * * @return bool Whether the coordinate represents a range of cells */ public static function coordinateIsRange($cellAddress) { return (strpos($cellAddress, ':') !== false) || (strpos($cellAddress, ',') !== false); } /** * Make string row, column or cell coordinate absolute. * * @param string $cellAddress e.g. 'A' or '1' or 'A1' * Note that this value can be a row or column reference as well as a cell reference * * @return string Absolute coordinate e.g. '$A' or '$1' or '$A$1' */ public static function absoluteReference($cellAddress) { if (self::coordinateIsRange($cellAddress)) { throw new Exception('Cell coordinate string can not be a range of cells'); } // Split out any worksheet name from the reference [$worksheet, $cellAddress] = Worksheet::extractSheetTitle($cellAddress, true); if ($worksheet > '') { $worksheet .= '!'; } // Create absolute coordinate $cellAddress = "$cellAddress"; if (ctype_digit($cellAddress)) { return $worksheet . '$' . $cellAddress; } elseif (ctype_alpha($cellAddress)) { return $worksheet . '$' . strtoupper($cellAddress); } return $worksheet . self::absoluteCoordinate($cellAddress); } /** * Make string coordinate absolute. * * @param string $cellAddress e.g. 'A1' * * @return string Absolute coordinate e.g. '$A$1' */ public static function absoluteCoordinate($cellAddress) { if (self::coordinateIsRange($cellAddress)) { throw new Exception('Cell coordinate string can not be a range of cells'); } // Split out any worksheet name from the coordinate [$worksheet, $cellAddress] = Worksheet::extractSheetTitle($cellAddress, true); if ($worksheet > '') { $worksheet .= '!'; } // Create absolute coordinate [$column, $row] = self::coordinateFromString($cellAddress); $column = ltrim($column, '$'); $row = ltrim($row, '$'); return $worksheet . '$' . $column . '$' . $row; } /** * Split range into coordinate strings. * * @param string $range e.g. 'B4:D9' or 'B4:D9,H2:O11' or 'B4' * * @return array Array containing one or more arrays containing one or two coordinate strings * e.g. ['B4','D9'] or [['B4','D9'], ['H2','O11']] * or ['B4'] */ public static function splitRange($range) { // Ensure $pRange is a valid range if (empty($range)) { $range = self::DEFAULT_RANGE; } $exploded = explode(',', $range); $counter = count($exploded); for ($i = 0; $i < $counter; ++$i) { // @phpstan-ignore-next-line $exploded[$i] = explode(':', $exploded[$i]); } return $exploded; } /** * Build range from coordinate strings. * * @param array $range Array containing one or more arrays containing one or two coordinate strings * * @return string String representation of $pRange */ public static function buildRange(array $range) { // Verify range if (empty($range) || !is_array($range[0])) { throw new Exception('Range does not contain any information'); } // Build range $counter = count($range); for ($i = 0; $i < $counter; ++$i) { $range[$i] = implode(':', $range[$i]); } return implode(',', $range); } /** * Calculate range boundaries. * * @param string $range Cell range, Single Cell, Row/Column Range (e.g. A1:A1, B2, B:C, 2:3) * * @return array Range coordinates [Start Cell, End Cell] * where Start Cell and End Cell are arrays (Column Number, Row Number) */ public static function rangeBoundaries(string $range): array { // Ensure $pRange is a valid range if (empty($range)) { $range = self::DEFAULT_RANGE; } // Uppercase coordinate $range = strtoupper($range); // Extract range if (strpos($range, ':') === false) { $rangeA = $rangeB = $range; } else { [$rangeA, $rangeB] = explode(':', $range); } if (is_numeric($rangeA) && is_numeric($rangeB)) { $rangeA = 'A' . $rangeA; $rangeB = AddressRange::MAX_COLUMN . $rangeB; } if (ctype_alpha($rangeA) && ctype_alpha($rangeB)) { $rangeA = $rangeA . '1'; $rangeB = $rangeB . AddressRange::MAX_ROW; } // Calculate range outer borders $rangeStart = self::coordinateFromString($rangeA); $rangeEnd = self::coordinateFromString($rangeB); // Translate column into index $rangeStart[0] = self::columnIndexFromString($rangeStart[0]); $rangeEnd[0] = self::columnIndexFromString($rangeEnd[0]); return [$rangeStart, $rangeEnd]; } /** * Calculate range dimension. * * @param string $range Cell range, Single Cell, Row/Column Range (e.g. A1:A1, B2, B:C, 2:3) * * @return array Range dimension (width, height) */ public static function rangeDimension($range) { // Calculate range outer borders [$rangeStart, $rangeEnd] = self::rangeBoundaries($range); return [($rangeEnd[0] - $rangeStart[0] + 1), ($rangeEnd[1] - $rangeStart[1] + 1)]; } /** * Calculate range boundaries. * * @param string $range Cell range, Single Cell, Row/Column Range (e.g. A1:A1, B2, B:C, 2:3) * * @return array Range coordinates [Start Cell, End Cell] * where Start Cell and End Cell are arrays [Column ID, Row Number] */ public static function getRangeBoundaries($range) { [$rangeA, $rangeB] = self::rangeBoundaries($range); return [ [self::stringFromColumnIndex($rangeA[0]), $rangeA[1]], [self::stringFromColumnIndex($rangeB[0]), $rangeB[1]], ]; } /** * Column index from string. * * @param ?string $columnAddress eg 'A' * * @return int Column index (A = 1) */ public static function columnIndexFromString($columnAddress) { // Using a lookup cache adds a slight memory overhead, but boosts speed // caching using a static within the method is faster than a class static, // though it's additional memory overhead static $indexCache = []; $columnAddress = $columnAddress ?? ''; if (isset($indexCache[$columnAddress])) { return $indexCache[$columnAddress]; } // It's surprising how costly the strtoupper() and ord() calls actually are, so we use a lookup array // rather than use ord() and make it case insensitive to get rid of the strtoupper() as well. // Because it's a static, there's no significant memory overhead either. static $columnLookup = [ 'A' => 1, 'B' => 2, 'C' => 3, 'D' => 4, 'E' => 5, 'F' => 6, 'G' => 7, 'H' => 8, 'I' => 9, 'J' => 10, 'K' => 11, 'L' => 12, 'M' => 13, 'N' => 14, 'O' => 15, 'P' => 16, 'Q' => 17, 'R' => 18, 'S' => 19, 'T' => 20, 'U' => 21, 'V' => 22, 'W' => 23, 'X' => 24, 'Y' => 25, 'Z' => 26, 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5, 'f' => 6, 'g' => 7, 'h' => 8, 'i' => 9, 'j' => 10, 'k' => 11, 'l' => 12, 'm' => 13, 'n' => 14, 'o' => 15, 'p' => 16, 'q' => 17, 'r' => 18, 's' => 19, 't' => 20, 'u' => 21, 'v' => 22, 'w' => 23, 'x' => 24, 'y' => 25, 'z' => 26, ]; // We also use the language construct isset() rather than the more costly strlen() function to match the // length of $columnAddress for improved performance if (isset($columnAddress[0])) { if (!isset($columnAddress[1])) { $indexCache[$columnAddress] = $columnLookup[$columnAddress]; return $indexCache[$columnAddress]; } elseif (!isset($columnAddress[2])) { $indexCache[$columnAddress] = $columnLookup[$columnAddress[0]] * 26 + $columnLookup[$columnAddress[1]]; return $indexCache[$columnAddress]; } elseif (!isset($columnAddress[3])) { $indexCache[$columnAddress] = $columnLookup[$columnAddress[0]] * 676 + $columnLookup[$columnAddress[1]] * 26 + $columnLookup[$columnAddress[2]]; return $indexCache[$columnAddress]; } } throw new Exception( 'Column string index can not be ' . ((isset($columnAddress[0])) ? 'longer than 3 characters' : 'empty') ); } /** * String from column index. * * @param int $columnIndex Column index (A = 1) * * @return string */ public static function stringFromColumnIndex($columnIndex) { static $indexCache = []; static $lookupCache = ' ABCDEFGHIJKLMNOPQRSTUVWXYZ'; if (!isset($indexCache[$columnIndex])) { $indexValue = $columnIndex; $base26 = ''; do { $characterValue = ($indexValue % 26) ?: 26; $indexValue = ($indexValue - $characterValue) / 26; $base26 = $lookupCache[$characterValue] . $base26; } while ($indexValue > 0); $indexCache[$columnIndex] = $base26; } return $indexCache[$columnIndex]; } /** * Extract all cell references in range, which may be comprised of multiple cell ranges. * * @param string $cellRange Range: e.g. 'A1' or 'A1:C10' or 'A1:E10,A20:E25' or 'A1:E5 C3:G7' or 'A1:C1,A3:C3 B1:C3' * * @return array Array containing single cell references */ public static function extractAllCellReferencesInRange($cellRange): array { if (substr_count($cellRange, '!') > 1) { throw new Exception('3-D Range References are not supported'); } [$worksheet, $cellRange] = Worksheet::extractSheetTitle($cellRange, true); $quoted = ''; if ($worksheet > '') { $quoted = Worksheet::nameRequiresQuotes($worksheet) ? "'" : ''; if (substr($worksheet, 0, 1) === "'" && substr($worksheet, -1, 1) === "'") { $worksheet = substr($worksheet, 1, -1); } $worksheet = str_replace("'", "''", $worksheet); } [$ranges, $operators] = self::getCellBlocksFromRangeString($cellRange); $cells = []; foreach ($ranges as $range) { $cells[] = self::getReferencesForCellBlock($range); } $cells = self::processRangeSetOperators($operators, $cells); if (empty($cells)) { return []; } $cellList = array_merge(...$cells); return array_map( function ($cellAddress) use ($worksheet, $quoted) { return ($worksheet !== '') ? "{$quoted}{$worksheet}{$quoted}!{$cellAddress}" : $cellAddress; }, self::sortCellReferenceArray($cellList) ); } private static function processRangeSetOperators(array $operators, array $cells): array { $operatorCount = count($operators); for ($offset = 0; $offset < $operatorCount; ++$offset) { $operator = $operators[$offset]; if ($operator !== ' ') { continue; } $cells[$offset] = array_intersect($cells[$offset], $cells[$offset + 1]); unset($operators[$offset], $cells[$offset + 1]); $operators = array_values($operators); $cells = array_values($cells); --$offset; --$operatorCount; } return $cells; } private static function sortCellReferenceArray(array $cellList): array { // Sort the result by column and row $sortKeys = []; foreach ($cellList as $coordinate) { $column = ''; $row = 0; sscanf($coordinate, '%[A-Z]%d', $column, $row); $key = (--$row * 16384) + self::columnIndexFromString((string) $column); $sortKeys[$key] = $coordinate; } ksort($sortKeys); return array_values($sortKeys); } /** * Get all cell references for an individual cell block. * * @param string $cellBlock A cell range e.g. A4:B5 * * @return array All individual cells in that range */ private static function getReferencesForCellBlock($cellBlock) { $returnValue = []; // Single cell? if (!self::coordinateIsRange($cellBlock)) { return (array) $cellBlock; } // Range... $ranges = self::splitRange($cellBlock); foreach ($ranges as $range) { // Single cell? if (!isset($range[1])) { $returnValue[] = $range[0]; continue; } // Range... [$rangeStart, $rangeEnd] = $range; [$startColumn, $startRow] = self::coordinateFromString($rangeStart); [$endColumn, $endRow] = self::coordinateFromString($rangeEnd); $startColumnIndex = self::columnIndexFromString($startColumn); $endColumnIndex = self::columnIndexFromString($endColumn); ++$endColumnIndex; // Current data $currentColumnIndex = $startColumnIndex; $currentRow = $startRow; self::validateRange($cellBlock, $startColumnIndex, $endColumnIndex, (int) $currentRow, (int) $endRow); // Loop cells while ($currentColumnIndex < $endColumnIndex) { while ($currentRow <= $endRow) { $returnValue[] = self::stringFromColumnIndex($currentColumnIndex) . $currentRow; ++$currentRow; } ++$currentColumnIndex; $currentRow = $startRow; } } return $returnValue; } /** * Convert an associative array of single cell coordinates to values to an associative array * of cell ranges to values. Only adjacent cell coordinates with the same * value will be merged. If the value is an object, it must implement the method getHashCode(). * * For example, this function converts: * * [ 'A1' => 'x', 'A2' => 'x', 'A3' => 'x', 'A4' => 'y' ] * * to: * * [ 'A1:A3' => 'x', 'A4' => 'y' ] * * @param array $coordinateCollection associative array mapping coordinates to values * * @return array associative array mapping coordinate ranges to valuea */ public static function mergeRangesInCollection(array $coordinateCollection) { $hashedValues = []; $mergedCoordCollection = []; foreach ($coordinateCollection as $coord => $value) { if (self::coordinateIsRange($coord)) { $mergedCoordCollection[$coord] = $value; continue; } [$column, $row] = self::coordinateFromString($coord); $row = (int) (ltrim($row, '$')); $hashCode = $column . '-' . ((is_object($value) && method_exists($value, 'getHashCode')) ? $value->getHashCode() : $value); if (!isset($hashedValues[$hashCode])) { $hashedValues[$hashCode] = (object) [ 'value' => $value, 'col' => $column, 'rows' => [$row], ]; } else { $hashedValues[$hashCode]->rows[] = $row; } } ksort($hashedValues); foreach ($hashedValues as $hashedValue) { sort($hashedValue->rows); $rowStart = null; $rowEnd = null; $ranges = []; foreach ($hashedValue->rows as $row) { if ($rowStart === null) { $rowStart = $row; $rowEnd = $row; } elseif ($rowEnd === $row - 1) { $rowEnd = $row; } else { if ($rowStart == $rowEnd) { $ranges[] = $hashedValue->col . $rowStart; } else { $ranges[] = $hashedValue->col . $rowStart . ':' . $hashedValue->col . $rowEnd; } $rowStart = $row; $rowEnd = $row; } } if ($rowStart !== null) { if ($rowStart == $rowEnd) { $ranges[] = $hashedValue->col . $rowStart; } else { $ranges[] = $hashedValue->col . $rowStart . ':' . $hashedValue->col . $rowEnd; } } foreach ($ranges as $range) { $mergedCoordCollection[$range] = $hashedValue->value; } } return $mergedCoordCollection; } /** * Get the individual cell blocks from a range string, removing any $ characters. * then splitting by operators and returning an array with ranges and operators. * * @param string $rangeString * * @return array[] */ private static function getCellBlocksFromRangeString($rangeString) { $rangeString = str_replace('$', '', strtoupper($rangeString)); // split range sets on intersection (space) or union (,) operators $tokens = preg_split('/([ ,])/', $rangeString, -1, PREG_SPLIT_DELIM_CAPTURE); /** @phpstan-ignore-next-line */ $split = array_chunk($tokens, 2); $ranges = array_column($split, 0); $operators = array_column($split, 1); return [$ranges, $operators]; } /** * Check that the given range is valid, i.e. that the start column and row are not greater than the end column and * row. * * @param string $cellBlock The original range, for displaying a meaningful error message * @param int $startColumnIndex * @param int $endColumnIndex * @param int $currentRow * @param int $endRow */ private static function validateRange($cellBlock, $startColumnIndex, $endColumnIndex, $currentRow, $endRow): void { if ($startColumnIndex >= $endColumnIndex || $currentRow > $endRow) { throw new Exception('Invalid range: "' . $cellBlock . '"'); } } } PK ��)[��)�. . 7 phpspreadsheet/src/PhpSpreadsheet/Cell/IValueBinder.phpnu �[��� <?php namespace PhpOffice\PhpSpreadsheet\Cell; interface IValueBinder { /** * Bind value to a cell. * * @param Cell $cell Cell to bind value to * @param mixed $value Value to bind in cell * * @return bool */ public function bindValue(Cell $cell, $value); } PK ��)[��(! (! 9 phpspreadsheet/src/PhpSpreadsheet/Cell/DataValidation.phpnu �[��� <?php namespace PhpOffice\PhpSpreadsheet\Cell; class DataValidation { // Data validation types const TYPE_NONE = 'none'; const TYPE_CUSTOM = 'custom'; const TYPE_DATE = 'date'; const TYPE_DECIMAL = 'decimal'; const TYPE_LIST = 'list'; const TYPE_TEXTLENGTH = 'textLength'; const TYPE_TIME = 'time'; const TYPE_WHOLE = 'whole'; // Data validation error styles const STYLE_STOP = 'stop'; const STYLE_WARNING = 'warning'; const STYLE_INFORMATION = 'information'; // Data validation operators const OPERATOR_BETWEEN = 'between'; const OPERATOR_EQUAL = 'equal'; const OPERATOR_GREATERTHAN = 'greaterThan'; const OPERATOR_GREATERTHANOREQUAL = 'greaterThanOrEqual'; const OPERATOR_LESSTHAN = 'lessThan'; const OPERATOR_LESSTHANOREQUAL = 'lessThanOrEqual'; const OPERATOR_NOTBETWEEN = 'notBetween'; const OPERATOR_NOTEQUAL = 'notEqual'; /** * Formula 1. * * @var string */ private $formula1 = ''; /** * Formula 2. * * @var string */ private $formula2 = ''; /** * Type. * * @var string */ private $type = self::TYPE_NONE; /** * Error style. * * @var string */ private $errorStyle = self::STYLE_STOP; /** * Operator. * * @var string */ private $operator = self::OPERATOR_BETWEEN; /** * Allow Blank. * * @var bool */ private $allowBlank = false; /** * Show DropDown. * * @var bool */ private $showDropDown = false; /** * Show InputMessage. * * @var bool */ private $showInputMessage = false; /** * Show ErrorMessage. * * @var bool */ private $showErrorMessage = false; /** * Error title. * * @var string */ private $errorTitle = ''; /** * Error. * * @var string */ private $error = ''; /** * Prompt title. * * @var string */ private $promptTitle = ''; /** * Prompt. * * @var string */ private $prompt = ''; /** * Create a new DataValidation. */ public function __construct() { } /** * Get Formula 1. * * @return string */ public function getFormula1() { return $this->formula1; } /** * Set Formula 1. * * @param string $formula * * @return $this */ public function setFormula1($formula) { $this->formula1 = $formula; return $this; } /** * Get Formula 2. * * @return string */ public function getFormula2() { return $this->formula2; } /** * Set Formula 2. * * @param string $formula * * @return $this */ public function setFormula2($formula) { $this->formula2 = $formula; return $this; } /** * Get Type. * * @return string */ public function getType() { return $this->type; } /** * Set Type. * * @param string $type * * @return $this */ public function setType($type) { $this->type = $type; return $this; } /** * Get Error style. * * @return string */ public function getErrorStyle() { return $this->errorStyle; } /** * Set Error style. * * @param string $errorStyle see self::STYLE_* * * @return $this */ public function setErrorStyle($errorStyle) { $this->errorStyle = $errorStyle; return $this; } /** * Get Operator. * * @return string */ public function getOperator() { return $this->operator; } /** * Set Operator. * * @param string $operator * * @return $this */ public function setOperator($operator) { $this->operator = $operator; return $this; } /** * Get Allow Blank. * * @return bool */ public function getAllowBlank() { return $this->allowBlank; } /** * Set Allow Blank. * * @param bool $allowBlank * * @return $this */ public function setAllowBlank($allowBlank) { $this->allowBlank = $allowBlank; return $this; } /** * Get Show DropDown. * * @return bool */ public function getShowDropDown() { return $this->showDropDown; } /** * Set Show DropDown. * * @param bool $showDropDown * * @return $this */ public function setShowDropDown($showDropDown) { $this->showDropDown = $showDropDown; return $this; } /** * Get Show InputMessage. * * @return bool */ public function getShowInputMessage() { return $this->showInputMessage; } /** * Set Show InputMessage. * * @param bool $showInputMessage * * @return $this */ public function setShowInputMessage($showInputMessage) { $this->showInputMessage = $showInputMessage; return $this; } /** * Get Show ErrorMessage. * * @return bool */ public function getShowErrorMessage() { return $this->showErrorMessage; } /** * Set Show ErrorMessage. * * @param bool $showErrorMessage * * @return $this */ public function setShowErrorMessage($showErrorMessage) { $this->showErrorMessage = $showErrorMessage; return $this; } /** * Get Error title. * * @return string */ public function getErrorTitle() { return $this->errorTitle; } /** * Set Error title. * * @param string $errorTitle * * @return $this */ public function setErrorTitle($errorTitle) { $this->errorTitle = $errorTitle; return $this; } /** * Get Error. * * @return string */ public function getError() { return $this->error; } /** * Set Error. * * @param string $error * * @return $this */ public function setError($error) { $this->error = $error; return $this; } /** * Get Prompt title. * * @return string */ public function getPromptTitle() { return $this->promptTitle; } /** * Set Prompt title. * * @param string $promptTitle * * @return $this */ public function setPromptTitle($promptTitle) { $this->promptTitle = $promptTitle; return $this; } /** * Get Prompt. * * @return string */ public function getPrompt() { return $this->prompt; } /** * Set Prompt. * * @param string $prompt * * @return $this */ public function setPrompt($prompt) { $this->prompt = $prompt; return $this; } /** * Get hash code. * * @return string Hash code */ public function getHashCode() { return md5( $this->formula1 . $this->formula2 . $this->type . $this->errorStyle . $this->operator . ($this->allowBlank ? 't' : 'f') . ($this->showDropDown ? 't' : 'f') . ($this->showInputMessage ? 't' : 'f') . ($this->showErrorMessage ? 't' : 'f') . $this->errorTitle . $this->error . $this->promptTitle . $this->prompt . $this->sqref . __CLASS__ ); } /** * Implement PHP __clone to create a deep clone, not just a shallow copy. */ public function __clone() { $vars = get_object_vars($this); foreach ($vars as $key => $value) { if (is_object($value)) { $this->$key = clone $value; } else { $this->$key = $value; } } } /** @var ?string */ private $sqref; public function getSqref(): ?string { return $this->sqref; } public function setSqref(?string $str): self { $this->sqref = $str; return $this; } } PK ��)[Mx�@ 6 phpspreadsheet/src/PhpSpreadsheet/Cell/ColumnRange.phpnu �[��� <?php namespace PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; class ColumnRange implements AddressRange { /** * @var ?Worksheet */ protected $worksheet; /** * @var int */ protected $from; /** * @var int */ protected $to; public function __construct(string $from, ?string $to = null, ?Worksheet $worksheet = null) { $this->validateFromTo( Coordinate::columnIndexFromString($from), Coordinate::columnIndexFromString($to ?? $from) ); $this->worksheet = $worksheet; } public static function fromColumnIndexes(int $from, int $to, ?Worksheet $worksheet = null): self { return new self(Coordinate::stringFromColumnIndex($from), Coordinate::stringFromColumnIndex($to), $worksheet); } /** * @param array<int|string> $array */ public static function fromArray(array $array, ?Worksheet $worksheet = null): self { array_walk( $array, function (&$column): void { $column = is_numeric($column) ? Coordinate::stringFromColumnIndex((int) $column) : $column; } ); /** @var string $from */ /** @var string $to */ [$from, $to] = $array; return new self($from, $to, $worksheet); } private function validateFromTo(int $from, int $to): void { // Identify actual top and bottom values (in case we've been given bottom and top) $this->from = min($from, $to); $this->to = max($from, $to); } public function columnCount(): int { return $this->to - $this->from + 1; } public function shiftDown(int $offset = 1): self { $newFrom = $this->from + $offset; $newFrom = ($newFrom < 1) ? 1 : $newFrom; $newTo = $this->to + $offset; $newTo = ($newTo < 1) ? 1 : $newTo; return self::fromColumnIndexes($newFrom, $newTo, $this->worksheet); } public function shiftUp(int $offset = 1): self { return $this->shiftDown(0 - $offset); } public function from(): string { return Coordinate::stringFromColumnIndex($this->from); } public function to(): string { return Coordinate::stringFromColumnIndex($this->to); } public function fromIndex(): int { return $this->from; } public function toIndex(): int { return $this->to; } public function toCellRange(): CellRange { return new CellRange( CellAddress::fromColumnAndRow($this->from, 1, $this->worksheet), CellAddress::fromColumnAndRow($this->to, AddressRange::MAX_ROW) ); } public function __toString(): string { $from = $this->from(); $to = $this->to(); if ($this->worksheet !== null) { $title = str_replace("'", "''", $this->worksheet->getTitle()); return "'{$title}'!{$from}:{$to}"; } return "{$from}:{$to}"; } } PK ��)[�4��m m 7 phpspreadsheet/src/PhpSpreadsheet/Cell/AddressRange.phpnu �[��� <?php namespace PhpOffice\PhpSpreadsheet\Cell; interface AddressRange { public const MAX_ROW = 1048576; public const MAX_COLUMN = 'XFD'; public const MAX_COLUMN_INT = 16384; /** * @return mixed */ public function from(); /** * @return mixed */ public function to(); public function __toString(): string; } PK ��)[,�_� � <