PHP Class Box\Spout\Writer\ODS\Helper\FileSystemHelper

Inheritance: extends Box\Spout\Common\Helper\FileSystemHelper
Show file Open project: box/spout

Protected Properties

Property Type Description
$metaInfFolder Path to the "META-INF" folder inside the root folder
$rootFolder Path to the root folder inside the temp folder where the files to create the ODS will be stored
$sheetsContentTempFolder Path to the temp folder, inside the root folder, where specific sheets content will be written to

Public Methods

Method Description
createBaseFilesAndFolders ( ) : void Creates all the folders needed to create a ODS file, as well as the files that won't change.
createContentFile ( Worksheet[] $worksheets, StyleHelper $styleHelper ) : FileSystemHelper Creates the "content.xml" file under the root folder
createStylesFile ( StyleHelper $styleHelper, integer $numWorksheets ) : FileSystemHelper Creates the "styles.xml" file under the root folder
deleteWorksheetTempFolder ( ) : FileSystemHelper Deletes the temporary folder where sheets content was stored.
getRootFolder ( ) : string
getSheetsContentTempFolder ( ) : string
zipRootFolderAndCopyToStream ( resource $streamPointer ) : void Zips the root folder and streams the contents of the zip into the given stream

Protected Methods

Method Description
copyFileContentsToTarget ( string $sourceFilePath, resource $targetResource ) : void Streams the content of the file at the given path into the target resource.
createManifestFile ( ) : FileSystemHelper Creates the "manifest.xml" file under the "META-INF" folder (under root)
createMetaFile ( ) : FileSystemHelper Creates the "meta.xml" file under the root folder
createMetaInfoFolderAndFile ( ) : FileSystemHelper Creates the "META-INF" folder under the root folder as well as the "manifest.xml" file in it
createMimetypeFile ( ) : FileSystemHelper Creates the "mimetype" file under the root folder
createRootFolder ( ) : FileSystemHelper Creates the folder that will be used as root
createSheetsContentTempFolder ( ) : FileSystemHelper Creates the temp folder where specific sheets content will be written to.

Method Details

copyFileContentsToTarget() protected method

Depending on which mode the target resource was created with, it will truncate then copy or append the content to the target file.
protected copyFileContentsToTarget ( string $sourceFilePath, resource $targetResource ) : void
$sourceFilePath string Path of the file whose content will be copied
$targetResource resource Target resource that will receive the content
return void

createBaseFilesAndFolders() public method

Creates all the folders needed to create a ODS file, as well as the files that won't change.
public createBaseFilesAndFolders ( ) : void
return void

createContentFile() public method

Creates the "content.xml" file under the root folder
public createContentFile ( Worksheet[] $worksheets, StyleHelper $styleHelper ) : FileSystemHelper
$worksheets Box\Spout\Writer\ODS\Internal\Worksheet[]
$styleHelper StyleHelper
return FileSystemHelper

createManifestFile() protected method

Creates the "manifest.xml" file under the "META-INF" folder (under root)
protected createManifestFile ( ) : FileSystemHelper
return FileSystemHelper

createMetaFile() protected method

Creates the "meta.xml" file under the root folder
protected createMetaFile ( ) : FileSystemHelper
return FileSystemHelper

createMetaInfoFolderAndFile() protected method

Creates the "META-INF" folder under the root folder as well as the "manifest.xml" file in it
protected createMetaInfoFolderAndFile ( ) : FileSystemHelper
return FileSystemHelper

createMimetypeFile() protected method

Creates the "mimetype" file under the root folder
protected createMimetypeFile ( ) : FileSystemHelper
return FileSystemHelper

createRootFolder() protected method

Creates the folder that will be used as root
protected createRootFolder ( ) : FileSystemHelper
return FileSystemHelper

createSheetsContentTempFolder() protected method

This folder is not part of the final ODS file and is only used to be able to jump between sheets.
protected createSheetsContentTempFolder ( ) : FileSystemHelper
return FileSystemHelper

createStylesFile() public method

Creates the "styles.xml" file under the root folder
public createStylesFile ( StyleHelper $styleHelper, integer $numWorksheets ) : FileSystemHelper
$styleHelper StyleHelper
$numWorksheets integer Number of created worksheets
return FileSystemHelper

deleteWorksheetTempFolder() public method

Deletes the temporary folder where sheets content was stored.
public deleteWorksheetTempFolder ( ) : FileSystemHelper
return FileSystemHelper

getRootFolder() public method

public getRootFolder ( ) : string
return string

getSheetsContentTempFolder() public method

zipRootFolderAndCopyToStream() public method

Zips the root folder and streams the contents of the zip into the given stream
public zipRootFolderAndCopyToStream ( resource $streamPointer ) : void
$streamPointer resource Pointer to the stream to copy the zip
return void

Property Details

$metaInfFolder protected property

Path to the "META-INF" folder inside the root folder
protected $metaInfFolder

$rootFolder protected property

Path to the root folder inside the temp folder where the files to create the ODS will be stored
protected $rootFolder

$sheetsContentTempFolder protected property

Path to the temp folder, inside the root folder, where specific sheets content will be written to
protected $sheetsContentTempFolder