Automated native_function_invocation fixes
This commit is contained in:
1 parent
94b654175c
commit
eb88bb4c3a
62 files changed
+237
-237
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user