CsvService
extends PhpSpreadsheetService
in package
AbstractYes
Table of Contents
Properties
- $files : array<string|int, string>
- $sheet : Worksheet
- $spreadsheet : Spreadsheet
- $values : array<string|int, mixed>
- $zip : ZipArchive
- $zipFileName : string
Methods
- __construct() : mixed
- getFileName() : array<string|int, string>
- Gets the name of an specific file in the files property based on the key value of the array.
- handleFileCreation() : mixed
- removeFilesAddedToZip() : self
- Removes the files that have been added to the zip file from the server.
- saveFile() : void
- zipFiles() : $this
Properties
$files
protected
array<string|int, string>
$files
= []
$sheet
protected
Worksheet
$sheet
$spreadsheet
protected
Spreadsheet
$spreadsheet
$values
protected
array<string|int, mixed>
$values
$zip
protected
ZipArchive
$zip
$zipFileName
protected
string
$zipFileName
Methods
__construct()
public
__construct(array<string|int, mixed> $values) : mixed
Parameters
- $values : array<string|int, mixed>
getFileName()
Gets the name of an specific file in the files property based on the key value of the array.
public
getFileName(int $index) : array<string|int, string>
Parameters
- $index : int
Return values
array<string|int, string>handleFileCreation()
public
abstract handleFileCreation(string $fileName) : mixed
Parameters
- $fileName : string
removeFilesAddedToZip()
Removes the files that have been added to the zip file from the server.
public
removeFilesAddedToZip() : self
This method iterates over the files stored in the $this->files array, which are the files that have been added to the zip file. Each file is removed from the server using the unlink function. After all files have been removed, the method returns the current object ($this), allowing for method chaining.
Return values
self —Returns the current object, allowing for method chaining.
saveFile()
public
saveFile(string $fileName) : void
Parameters
- $fileName : string
Tags
zipFiles()
public
zipFiles(string $filePath) : $this
Parameters
- $filePath : string