Automated native_function_invocation fixes

This commit is contained in:
drowe authored and Adrien Loison committed 2019-11-18 12:17:27 +01:00
1 parent 94b654175c
commit eb88bb4c3a
62 files changed
+237 -237

No files matched your search

@@ -98,7 +98,7 @@ class WriterEntityFactory
*/
public static function createRowFromArray(array $cellValues = [], Style $rowStyle = null)
{
$cells = array_map(function ($cellValue) {
$cells = \array_map(function ($cellValue) {
return new Cell($cellValue);
}, $cellValues);
@@ -35,7 +35,7 @@ class WriterFactory
*/
public static function createFromFile(string $path)
{
$extension = strtolower(pathinfo($path, PATHINFO_EXTENSION));
$extension = \strtolower(\pathinfo($path, PATHINFO_EXTENSION));
return self::createFromType($extension);
}
+1 -1
View File
@@ -19,7 +19,7 @@ class Workbook
*/
public function __construct()
{
$this->internalId = uniqid();
$this->internalId = \uniqid();
}
/**
@@ -28,11 +28,11 @@ class CellHelper
// Using isset here because it is way faster than array_key_exists...
if (!isset(self::$columnIndexToColumnLettersCache[$originalColumnIndex])) {
$columnLetters = '';
$capitalAAsciiValue = ord('A');
$capitalAAsciiValue = \ord('A');
do {
$modulus = $columnIndexZeroBased % 26;
$columnLetters = chr($capitalAAsciiValue + $modulus) . $columnLetters;
$columnLetters = \chr($capitalAAsciiValue + $modulus) . $columnLetters;
// substracting 1 because it's zero-based
$columnIndexZeroBased = (int) ($columnIndexZeroBased / 26) - 1;
+7 -7
View File
@@ -135,7 +135,7 @@ class ZipHelper
public static function canChooseCompressionMethod()
{
// setCompressionName() is a PHP7+ method...
return (method_exists(new \ZipArchive(), 'setCompressionName'));
return (\method_exists(new \ZipArchive(), 'setCompressionName'));
}
/**
@@ -151,7 +151,7 @@ class ZipHelper
foreach ($itemIterator as $itemInfo) {
$itemRealPath = $this->getNormalizedRealPath($itemInfo->getPathname());
$itemLocalPath = str_replace($folderRealPath, '', $itemRealPath);
$itemLocalPath = \str_replace($folderRealPath, '', $itemRealPath);
if ($itemInfo->isFile() && !$this->shouldSkipFile($zip, $itemLocalPath, $existingFileMode)) {
$zip->addFile($itemRealPath, $itemLocalPath);
@@ -181,9 +181,9 @@ class ZipHelper
*/
protected function getNormalizedRealPath($path)
{
$realPath = realpath($path);
$realPath = \realpath($path);
return str_replace(DIRECTORY_SEPARATOR, '/', $realPath);
return \str_replace(DIRECTORY_SEPARATOR, '/', $realPath);
}
/**
@@ -210,8 +210,8 @@ class ZipHelper
*/
protected function copyZipToStream($zipFilePath, $pointer)
{
$zipFilePointer = fopen($zipFilePath, 'r');
stream_copy_to_stream($zipFilePointer, $pointer);
fclose($zipFilePointer);
$zipFilePointer = \fopen($zipFilePath, 'r');
\stream_copy_to_stream($zipFilePointer, $pointer);
\fclose($zipFilePointer);
}
}
@@ -45,8 +45,8 @@ class SheetManager
*/
public function throwIfNameIsInvalid($name, Sheet $sheet)
{
if (!is_string($name)) {
$actualType = gettype($name);
if (!\is_string($name)) {
$actualType = \gettype($name);
$errorMessage = "The sheet's name is invalid. It must be a string ($actualType given).";
throw new InvalidSheetNameException($errorMessage);
}
@@ -74,9 +74,9 @@ class SheetManager
}
}
if (count($failedRequirements) !== 0) {
if (\count($failedRequirements) !== 0) {
$errorMessage = "The sheet's name (\"$name\") is invalid. It did not respect these rules:\n - ";
$errorMessage .= implode("\n - ", $failedRequirements);
$errorMessage .= \implode("\n - ", $failedRequirements);
throw new InvalidSheetNameException($errorMessage);
}
}
@@ -90,7 +90,7 @@ class SheetManager
*/
private function doesContainInvalidCharacters($name)
{
return (str_replace(self::$INVALID_CHARACTERS_IN_SHEET_NAME, '', $name) !== $name);
return (\str_replace(self::$INVALID_CHARACTERS_IN_SHEET_NAME, '', $name) !== $name);
}
/**
@@ -80,7 +80,7 @@ class StyleManager implements StyleManagerInterface
return $cellStyle;
}
if ($cell->isString() && strpos($cell->getValue(), "\n") !== false) {
if ($cell->isString() && \strpos($cell->getValue(), "\n") !== false) {
$cellStyle->setShouldWrapText();
}
@@ -37,7 +37,7 @@ class StyleRegistry
$serializedStyle = $this->serialize($style);
if (!$this->hasStyleAlreadyBeenRegistered($style)) {
$nextStyleId = count($this->serializedStyleToStyleIdMappingTable);
$nextStyleId = \count($this->serializedStyleToStyleIdMappingTable);
$style->setId($nextStyleId);
$this->serializedStyleToStyleIdMappingTable[$serializedStyle] = $nextStyleId;
@@ -79,7 +79,7 @@ class StyleRegistry
*/
public function getRegisteredStyles()
{
return array_values($this->styleIdToStyleMappingTable);
return \array_values($this->styleIdToStyleMappingTable);
}
/**
@@ -105,7 +105,7 @@ class StyleRegistry
$currentId = $style->getId();
$style->setId(0);
$serializedStyle = serialize($style);
$serializedStyle = \serialize($style);
$style->setId($currentId);
@@ -124,7 +124,7 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
{
$worksheets = $this->getWorksheets();
$newSheetIndex = count($worksheets);
$newSheetIndex = \count($worksheets);
$sheetManager = $this->managerFactory->createSheetManager();
$sheet = $this->entityFactory->createSheet($newSheetIndex, $this->workbook->getInternalId(), $sheetManager);
@@ -260,7 +260,7 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
// update max num columns for the worksheet
$currentMaxNumColumns = $worksheet->getMaxNumColumns();
$cellsCount = $row->getNumCells();
$worksheet->setMaxNumColumns(max($currentMaxNumColumns, $cellsCount));
$worksheet->setMaxNumColumns(\max($currentMaxNumColumns, $cellsCount));
}
/**
@@ -11,6 +11,6 @@ class InvalidNameException extends WriterException
{
$msg = '%s is not a valid name identifier for a border. Valid identifiers are: %s.';
parent::__construct(sprintf($msg, $name, implode(',', BorderPart::getAllowedNames())));
parent::__construct(\sprintf($msg, $name, \implode(',', BorderPart::getAllowedNames())));
}
}
@@ -11,6 +11,6 @@ class InvalidStyleException extends WriterException
{
$msg = '%s is not a valid style identifier for a border. Valid identifiers are: %s.';
parent::__construct(sprintf($msg, $name, implode(',', BorderPart::getAllowedStyles())));
parent::__construct(\sprintf($msg, $name, \implode(',', BorderPart::getAllowedStyles())));
}
}
@@ -11,6 +11,6 @@ class InvalidWidthException extends WriterException
{
$msg = '%s is not a valid width identifier for a border. Valid identifiers are: %s.';
parent::__construct(sprintf($msg, $name, implode(',', BorderPart::getAllowedWidths())));
parent::__construct(\sprintf($msg, $name, \implode(',', BorderPart::getAllowedWidths())));
}
}
+2 -2
View File
@@ -53,14 +53,14 @@ class BorderHelper
$definition = 'fo:border-%s="%s"';
if ($borderPart->getStyle() === Border::STYLE_NONE) {
$borderPartDefinition = sprintf($definition, $borderPart->getName(), 'none');
$borderPartDefinition = \sprintf($definition, $borderPart->getName(), 'none');
} else {
$attributes = [
self::$widthMap[$borderPart->getWidth()],
self::$styleMap[$borderPart->getStyle()],
'#' . $borderPart->getColor(),
];
$borderPartDefinition = sprintf($definition, $borderPart->getName(), implode(' ', $attributes));
$borderPartDefinition = \sprintf($definition, $borderPart->getName(), \implode(' ', $attributes));
}
return $borderPartDefinition;
@@ -89,7 +89,7 @@ class FileSystemHelper extends \Box\Spout\Common\Helper\FileSystemHelper impleme
*/
protected function createRootFolder()
{
$this->rootFolder = $this->createFolder($this->baseFolderRealPath, uniqid('ods'));
$this->rootFolder = $this->createFolder($this->baseFolderRealPath, \uniqid('ods'));
return $this;
}
@@ -210,22 +210,22 @@ EOD;
// Append sheets content to "content.xml"
$contentXmlFilePath = $this->rootFolder . '/' . self::CONTENT_XML_FILE_NAME;
$contentXmlHandle = fopen($contentXmlFilePath, 'a');
$contentXmlHandle = \fopen($contentXmlFilePath, 'a');
foreach ($worksheets as $worksheet) {
// write the "<table:table>" node, with the final sheet's name
fwrite($contentXmlHandle, $worksheetManager->getTableElementStartAsString($worksheet));
\fwrite($contentXmlHandle, $worksheetManager->getTableElementStartAsString($worksheet));
$worksheetFilePath = $worksheet->getFilePath();
$this->copyFileContentsToTarget($worksheetFilePath, $contentXmlHandle);
fwrite($contentXmlHandle, '</table:table>');
\fwrite($contentXmlHandle, '</table:table>');
}
$contentXmlFileContents = '</office:spreadsheet></office:body></office:document-content>';
fwrite($contentXmlHandle, $contentXmlFileContents);
fclose($contentXmlHandle);
\fwrite($contentXmlHandle, $contentXmlFileContents);
\fclose($contentXmlHandle);
return $this;
}
@@ -241,9 +241,9 @@ EOD;
*/
protected function copyFileContentsToTarget($sourceFilePath, $targetResource)
{
$sourceHandle = fopen($sourceFilePath, 'r');
stream_copy_to_stream($sourceHandle, $targetResource);
fclose($sourceHandle);
$sourceHandle = \fopen($sourceFilePath, 'r');
\stream_copy_to_stream($sourceHandle, $targetResource);
\fclose($sourceHandle);
}
/**
@@ -42,7 +42,7 @@ class OptionsManager extends OptionsManagerAbstract
*/
protected function setDefaultOptions()
{
$this->setOption(Options::TEMP_FOLDER, sys_get_temp_dir());
$this->setOption(Options::TEMP_FOLDER, \sys_get_temp_dir());
$this->setOption(Options::DEFAULT_ROW_STYLE, $this->styleBuilder->build());
$this->setOption(Options::SHOULD_CREATE_NEW_SHEETS_AUTOMATICALLY, true);
}
@@ -295,7 +295,7 @@ EOD;
*/
private function getCellAlignmentSectionContent($style)
{
return sprintf(
return \sprintf(
' fo:text-align="%s" ',
$this->transformCellAlignment($style->getCellAlignment())
);
@@ -364,11 +364,11 @@ EOD;
*/
private function getBorderXMLContent($style)
{
$borders = array_map(function (BorderPart $borderPart) {
$borders = \array_map(function (BorderPart $borderPart) {
return BorderHelper::serializeBorderPart($borderPart);
}, $style->getBorder()->getParts());
return sprintf(' %s ', implode(' ', $borders));
return \sprintf(' %s ', \implode(' ', $borders));
}
/**
@@ -379,6 +379,6 @@ EOD;
*/
private function getBackgroundColorXMLContent($style)
{
return sprintf(' fo:background-color="#%s" ', $style->getBackgroundColor());
return \sprintf(' fo:background-color="#%s" ', $style->getBackgroundColor());
}
}
@@ -33,6 +33,6 @@ class StyleRegistry extends \Box\Spout\Writer\Common\Manager\Style\StyleRegistry
*/
public function getUsedFonts()
{
return array_keys($this->usedFontsSet);
return \array_keys($this->usedFontsSet);
}
}
@@ -56,7 +56,7 @@ class WorkbookManager extends WorkbookManagerAbstract
protected function writeAllFilesToDiskAndZipThem($finalFilePointer)
{
$worksheets = $this->getWorksheets();
$numWorksheets = count($worksheets);
$numWorksheets = \count($worksheets);
$this->fileSystemHelper
->createContentFile($this->worksheetManager, $this->styleManager, $worksheets)
@@ -61,7 +61,7 @@ class WorksheetManager implements WorksheetManagerInterface
*/
public function startSheet(Worksheet $worksheet)
{
$sheetFilePointer = fopen($worksheet->getFilePath(), 'w');
$sheetFilePointer = \fopen($worksheet->getFilePath(), 'w');
$this->throwIfSheetFilePointerIsNotAvailable($sheetFilePointer);
$worksheet->setFilePointer($sheetFilePointer);
@@ -134,7 +134,7 @@ class WorksheetManager implements WorksheetManagerInterface
$data .= '</table:table-row>';
$wasWriteSuccessful = fwrite($worksheet->getFilePointer(), $data);
$wasWriteSuccessful = \fwrite($worksheet->getFilePointer(), $data);
if ($wasWriteSuccessful === false) {
throw new IOException("Unable to write data in {$worksheet->getFilePath()}");
}
@@ -190,7 +190,7 @@ class WorksheetManager implements WorksheetManagerInterface
if ($cell->isString()) {
$data .= ' office:value-type="string" calcext:value-type="string">';
$cellValueLines = explode("\n", $cell->getValue());
$cellValueLines = \explode("\n", $cell->getValue());
foreach ($cellValueLines as $cellValueLine) {
$data .= '<text:p>' . $this->stringsEscaper->escape($cellValueLine) . '</text:p>';
}
@@ -207,7 +207,7 @@ class WorksheetManager implements WorksheetManagerInterface
} elseif ($cell->isEmpty()) {
$data .= '/>';
} else {
throw new InvalidArgumentException('Trying to add a value with an unsupported type: ' . gettype($cell->getValue()));
throw new InvalidArgumentException('Trying to add a value with an unsupported type: ' . \gettype($cell->getValue()));
}
return $data;
@@ -223,10 +223,10 @@ class WorksheetManager implements WorksheetManagerInterface
{
$worksheetFilePointer = $worksheet->getFilePointer();
if (!is_resource($worksheetFilePointer)) {
if (!\is_resource($worksheetFilePointer)) {
return;
}
fclose($worksheetFilePointer);
\fclose($worksheetFilePointer);
}
}
+2 -2
View File
@@ -223,7 +223,7 @@ abstract class WriterAbstract implements WriterInterface
$this->closeWriter();
if (is_resource($this->filePointer)) {
if (\is_resource($this->filePointer)) {
$this->globalFunctionsHelper->fclose($this->filePointer);
}
@@ -243,7 +243,7 @@ abstract class WriterAbstract implements WriterInterface
// remove output file if it was created
if ($this->globalFunctionsHelper->file_exists($this->outputFilePath)) {
$outputFolderPath = dirname($this->outputFilePath);
$outputFolderPath = \dirname($this->outputFilePath);
$fileSystemHelper = $this->helperFactory->createFileSystemHelper($outputFolderPath);
$fileSystemHelper->deleteFile($this->outputFilePath);
}
@@ -43,8 +43,8 @@ class BorderHelper
{
$borderStyle = self::getBorderStyle($borderPart);
$colorEl = $borderPart->getColor() ? sprintf('<color rgb="%s"/>', $borderPart->getColor()) : '';
$partEl = sprintf(
$colorEl = $borderPart->getColor() ? \sprintf('<color rgb="%s"/>', $borderPart->getColor()) : '';
$partEl = \sprintf(
'<%s style="%s">%s</%s>',
$borderPart->getName(),
$borderStyle,
@@ -112,7 +112,7 @@ class FileSystemHelper extends \Box\Spout\Common\Helper\FileSystemHelper impleme
*/
private function createRootFolder()
{
$this->rootFolder = $this->createFolder($this->baseFolderRealPath, uniqid('xlsx', true));
$this->rootFolder = $this->createFolder($this->baseFolderRealPath, \uniqid('xlsx', true));
return $this;
}
@@ -52,7 +52,7 @@ class OptionsManager extends OptionsManagerAbstract
->setFontName(self::DEFAULT_FONT_NAME)
->build();
$this->setOption(Options::TEMP_FOLDER, sys_get_temp_dir());
$this->setOption(Options::TEMP_FOLDER, \sys_get_temp_dir());
$this->setOption(Options::DEFAULT_ROW_STYLE, $defaultRowStyle);
$this->setOption(Options::SHOULD_CREATE_NEW_SHEETS_AUTOMATICALLY, true);
$this->setOption(Options::SHOULD_USE_INLINE_STRINGS, true);
@@ -40,13 +40,13 @@ EOD;
public function __construct($xlFolder, $stringsEscaper)
{
$sharedStringsFilePath = $xlFolder . '/' . self::SHARED_STRINGS_FILE_NAME;
$this->sharedStringsFilePointer = fopen($sharedStringsFilePath, 'w');
$this->sharedStringsFilePointer = \fopen($sharedStringsFilePath, 'w');
$this->throwIfSharedStringsFilePointerIsNotAvailable();
// the headers is split into different parts so that we can fseek and put in the correct count and uniqueCount later
$header = self::SHARED_STRINGS_XML_FILE_FIRST_PART_HEADER . ' ' . self::DEFAULT_STRINGS_COUNT_PART . '>';
fwrite($this->sharedStringsFilePointer, $header);
\fwrite($this->sharedStringsFilePointer, $header);
$this->stringsEscaper = $stringsEscaper;
}
@@ -73,7 +73,7 @@ EOD;
*/
public function writeString($string)
{
fwrite($this->sharedStringsFilePointer, '<si><t xml:space="preserve">' . $this->stringsEscaper->escape($string) . '</t></si>');
\fwrite($this->sharedStringsFilePointer, '<si><t xml:space="preserve">' . $this->stringsEscaper->escape($string) . '</t></si>');
$this->numSharedStrings++;
// Shared string ID is zero-based
@@ -87,20 +87,20 @@ EOD;
*/
public function close()
{
if (!is_resource($this->sharedStringsFilePointer)) {
if (!\is_resource($this->sharedStringsFilePointer)) {
return;
}
fwrite($this->sharedStringsFilePointer, '</sst>');
\fwrite($this->sharedStringsFilePointer, '</sst>');
// Replace the default strings count with the actual number of shared strings in the file header
$firstPartHeaderLength = strlen(self::SHARED_STRINGS_XML_FILE_FIRST_PART_HEADER);
$defaultStringsCountPartLength = strlen(self::DEFAULT_STRINGS_COUNT_PART);
$firstPartHeaderLength = \strlen(self::SHARED_STRINGS_XML_FILE_FIRST_PART_HEADER);
$defaultStringsCountPartLength = \strlen(self::DEFAULT_STRINGS_COUNT_PART);
// Adding 1 to take into account the space between the last xml attribute and "count"
fseek($this->sharedStringsFilePointer, $firstPartHeaderLength + 1);
fwrite($this->sharedStringsFilePointer, sprintf("%-{$defaultStringsCountPartLength}s", 'count="' . $this->numSharedStrings . '" uniqueCount="' . $this->numSharedStrings . '"'));
\fseek($this->sharedStringsFilePointer, $firstPartHeaderLength + 1);
\fwrite($this->sharedStringsFilePointer, \sprintf("%-{$defaultStringsCountPartLength}s", 'count="' . $this->numSharedStrings . '" uniqueCount="' . $this->numSharedStrings . '"'));
fclose($this->sharedStringsFilePointer);
\fclose($this->sharedStringsFilePointer);
}
}
@@ -88,8 +88,8 @@ EOD;
$format = $style->getFormat();
$tags[] = '<numFmt numFmtId="' . $numFmtId . '" formatCode="' . $format . '"/>';
}
$content = '<numFmts count="' . count($tags) . '">';
$content .= implode('', $tags);
$content = '<numFmts count="' . \count($tags) . '">';
$content .= \implode('', $tags);
$content .= '</numFmts>';
return $content;
@@ -104,7 +104,7 @@ EOD;
{
$registeredStyles = $this->styleRegistry->getRegisteredStyles();
$content = '<fonts count="' . count($registeredStyles) . '">';
$content = '<fonts count="' . \count($registeredStyles) . '">';
/** @var Style $style */
foreach ($registeredStyles as $style) {
@@ -145,8 +145,8 @@ EOD;
$registeredFills = $this->styleRegistry->getRegisteredFills();
// Excel reserves two default fills
$fillsCount = count($registeredFills) + 2;
$content = sprintf('<fills count="%d">', $fillsCount);
$fillsCount = \count($registeredFills) + 2;
$content = \sprintf('<fills count="%d">', $fillsCount);
$content .= '<fill><patternFill patternType="none"/></fill>';
$content .= '<fill><patternFill patternType="gray125"/></fill>';
@@ -157,7 +157,7 @@ EOD;
$style = $this->styleRegistry->getStyleFromStyleId($styleId);
$backgroundColor = $style->getBackgroundColor();
$content .= sprintf(
$content .= \sprintf(
'<fill><patternFill patternType="solid"><fgColor rgb="%s"/></patternFill></fill>',
$backgroundColor
);
@@ -178,7 +178,7 @@ EOD;
$registeredBorders = $this->styleRegistry->getRegisteredBorders();
// There is one default border with index 0
$borderCount = count($registeredBorders) + 1;
$borderCount = \count($registeredBorders) + 1;
$content = '<borders count="' . $borderCount . '">';
@@ -233,7 +233,7 @@ EOD;
{
$registeredStyles = $this->styleRegistry->getRegisteredStyles();
$content = '<cellXfs count="' . count($registeredStyles) . '">';
$content = '<cellXfs count="' . \count($registeredStyles) . '">';
foreach ($registeredStyles as $style) {
$styleId = $style->getId();
@@ -247,13 +247,13 @@ EOD;
$content .= ' applyFont="1"';
}
$content .= sprintf(' applyBorder="%d"', $style->shouldApplyBorder() ? 1 : 0);
$content .= \sprintf(' applyBorder="%d"', $style->shouldApplyBorder() ? 1 : 0);
if ($style->shouldApplyCellAlignment() || $style->shouldWrapText()) {
$content .= ' applyAlignment="1">';
$content .= '<alignment';
if ($style->shouldApplyCellAlignment()) {
$content .= sprintf(' horizontal="%s"', $style->getCellAlignment());
$content .= \sprintf(' horizontal="%s"', $style->getCellAlignment());
}
if ($style->shouldWrapText()) {
$content .= ' wrapText="1"';
@@ -221,7 +221,7 @@ class StyleRegistry extends \Box\Spout\Writer\Common\Manager\Style\StyleRegistry
if ($style->shouldApplyBorder()) {
$border = $style->getBorder();
$serializedBorder = serialize($border);
$serializedBorder = \serialize($border);
$isBorderAlreadyRegistered = isset($this->registeredBorders[$serializedBorder]);
@@ -231,7 +231,7 @@ class StyleRegistry extends \Box\Spout\Writer\Common\Manager\Style\StyleRegistry
$this->styleIdToBorderMappingTable[$styleId] = $registeredBorderId;
} else {
$this->registeredBorders[$serializedBorder] = $styleId;
$this->styleIdToBorderMappingTable[$styleId] = count($this->registeredBorders);
$this->styleIdToBorderMappingTable[$styleId] = \count($this->registeredBorders);
}
} else {
// If no border should be applied - the mapping is the default border: 0
@@ -44,7 +44,7 @@ class WorkbookManager extends WorkbookManagerAbstract
{
$worksheetFilesFolder = $this->fileSystemHelper->getXlWorksheetsFolder();
return $worksheetFilesFolder . '/' . strtolower($sheet->getName()) . '.xml';
return $worksheetFilesFolder . '/' . \strtolower($sheet->getName()) . '.xml';
}
/**
@@ -107,13 +107,13 @@ EOD;
*/
public function startSheet(Worksheet $worksheet)
{
$sheetFilePointer = fopen($worksheet->getFilePath(), 'w');
$sheetFilePointer = \fopen($worksheet->getFilePath(), 'w');
$this->throwIfSheetFilePointerIsNotAvailable($sheetFilePointer);
$worksheet->setFilePointer($sheetFilePointer);
fwrite($sheetFilePointer, self::SHEET_XML_FILE_HEADER);
fwrite($sheetFilePointer, '<sheetData>');
\fwrite($sheetFilePointer, self::SHEET_XML_FILE_HEADER);
\fwrite($sheetFilePointer, '<sheetData>');
}
/**
@@ -165,7 +165,7 @@ EOD;
$rowXML .= '</row>';
$wasWriteSuccessful = fwrite($worksheet->getFilePointer(), $rowXML);
$wasWriteSuccessful = \fwrite($worksheet->getFilePointer(), $rowXML);
if ($wasWriteSuccessful === false) {
throw new IOException("Unable to write data in {$worksheet->getFilePath()}");
}
@@ -227,7 +227,7 @@ EOD;
$cellXML = '';
}
} else {
throw new InvalidArgumentException('Trying to add a value with an unsupported type: ' . gettype($cell->getValue()));
throw new InvalidArgumentException('Trying to add a value with an unsupported type: ' . \gettype($cell->getValue()));
}
return $cellXML;
@@ -263,12 +263,12 @@ EOD;
{
$worksheetFilePointer = $worksheet->getFilePointer();
if (!is_resource($worksheetFilePointer)) {
if (!\is_resource($worksheetFilePointer)) {
return;
}
fwrite($worksheetFilePointer, '</sheetData>');
fwrite($worksheetFilePointer, '</worksheet>');
fclose($worksheetFilePointer);
\fwrite($worksheetFilePointer, '</sheetData>');
\fwrite($worksheetFilePointer, '</worksheet>');
\fclose($worksheetFilePointer);
}
}