Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
eZ\Publish\Core\IO\IOService Class Reference

The io service for managing binary files. More...

Inheritance diagram for eZ\Publish\Core\IO\IOService:

## Public Member Functions
| __construct (IOMetadataHandler $metadataHandler, IOBinarydataHandler $binarydataHandler, MimeTypeDetector $mimeTypeDetector, array $settings=[])
| setPrefix ($prefix)
| The the internal prefix added by the IO Service. More...
| newBinaryCreateStructFromUploadedFile (array $uploadedFile)
| Creates a BinaryFileCreateStruct object from the uploaded file $uploadedFile. More...
| newBinaryCreateStructFromLocalFile ($localFile)
| Creates a BinaryFileCreateStruct object from $localFile. More...
| createBinaryFile (BinaryFileCreateStruct $binaryFileCreateStruct)
| Creates a binary file in the repository. More...
| deleteBinaryFile (BinaryFile $binaryFile)
| Deletes the BinaryFile with $id. More...
| loadBinaryFile ($binaryFileId)
| Loads the binary file with $id. More...
| loadBinaryFileByUri ($binaryFileUri)
| Loads the binary file with uri $uri. More...
| getFileInputStream (BinaryFile $binaryFile)
| Returns a read (mode: rb) file resource to the binary file identified by $path. More...
| getFileContents (BinaryFile $binaryFile)
| Returns the content of the binary file. More...
| getInternalPath ($binaryFileId)
| Returns the internal, handler level path to $externalPath. More...
| getExternalPath ($internalId)
| Returns the external path to $internalPath. More...
| getUri ($binaryFileId)
| Returns the public HTTP uri for $binaryFileId. More...
| getMimeType ($binaryFileId)
| Gets the mime-type of the BinaryFile. More...
| exists ($binaryFileId)
| Checks if a Binary File with $binaryFileId exists. More...
| deleteDirectory ($path)
| Deletes a directory. More...

## Protected Member Functions
| buildSPIBinaryFileCreateStructObject (BinaryFileCreateStruct $binaryFileCreateStruct)
| Generates SPI BinaryFileCreateStruct object from provided API BinaryFileCreateStruct object. More...
| buildDomainBinaryFileObject (SPIBinaryFile $spiBinaryFile)
| Generates API BinaryFile object from provided SPI BinaryFile object. More...
| getPrefixedUri ($binaryFileId)
| Returns $uri prefixed with what is configured in the service. More...
| removeUriPrefix ($spiBinaryFileId)
| checkBinaryFileId ($binaryFileId)
| isAbsolutePath ($path)
| Check if path is absolute, in terms of http or disk (incl if it contains driver letter on Win). More...

## Protected Attributes
| $binarydataHandler
| $metadataHandler
| $mimeTypeDetector
| $settings

## Detailed Description

The io service for managing binary files.

Definition at line 25 of file IO/IOService.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZ\Publish\Core\IO\IOService::__construct | ( | IOMetadataHandler | $metadataHandler,
|  | IOBinarydataHandler | $binarydataHandler,
|  | MimeTypeDetector | $mimeTypeDetector,
|  | array | $settings = `[]`
| ) |  |

Definition at line 39 of file IO/IOService.php.

References eZ\Publish\Core\IO\IOService\$binarydataHandler, eZ\Publish\Core\IO\IOService\$metadataHandler, eZ\Publish\Core\IO\IOService\$mimeTypeDetector, and eZ\Publish\Core\IO\IOService\$settings.

## Member Function Documentation

## ◆ buildDomainBinaryFileObject()

eZ\Publish\Core\IO\IOService::buildDomainBinaryFileObject | ( | SPIBinaryFile | $spiBinaryFile | ) |
| protected

Generates API BinaryFile object from provided SPI BinaryFile object.

Parameters

  \eZ\Publish\SPI\IO\BinaryFile | $spiBinaryFile |

Returns
  \eZ\Publish\Core\IO\Values\BinaryFile

Definition at line 252 of file IO/IOService.php.

Referenced by eZ\Publish\Core\IO\IOService\createBinaryFile(), eZ\Publish\Core\IO\IOService\loadBinaryFile(), and eZ\Publish\Core\IO\TolerantIOService\loadBinaryFile().

## ◆ buildSPIBinaryFileCreateStructObject()

eZ\Publish\Core\IO\IOService::buildSPIBinaryFileCreateStructObject | ( | BinaryFileCreateStruct | $binaryFileCreateStruct | ) |
| protected

Generates SPI BinaryFileCreateStruct object from provided API BinaryFileCreateStruct object.

Parameters

  \eZ\Publish\Core\IO\Values\BinaryFileCreateStruct | $binaryFileCreateStruct |

Returns
  \eZ\Publish\SPI\IO\BinaryFileCreateStruct

Definition at line 232 of file IO/IOService.php.

References eZ\Publish\Core\IO\IOService\getPrefixedUri().

Referenced by eZ\Publish\Core\IO\IOService\createBinaryFile().

## ◆ checkBinaryFileId()

eZ\Publish\Core\IO\IOService::checkBinaryFileId | ( |  | $binaryFileId | ) |
| protected

Parameters

  string | $binaryFileId |

Exceptions

  InvalidBinaryFileIdException | If the id is invalid

Definition at line 307 of file IO/IOService.php.

Referenced by eZ\Publish\Core\IO\IOService\deleteBinaryFile(), eZ\Publish\Core\IO\TolerantIOService\deleteBinaryFile(), eZ\Publish\Core\IO\IOService\getFileContents(), eZ\Publish\Core\IO\IOService\getFileInputStream(), eZ\Publish\Core\IO\IOService\loadBinaryFile(), and eZ\Publish\Core\IO\TolerantIOService\loadBinaryFile().

## ◆ createBinaryFile()

eZ\Publish\Core\IO\IOService::createBinaryFile | ( | BinaryFileCreateStruct | $binaryFileCreateStruct | ) |

Creates a binary file in the repository.

Parameters

  BinaryFileCreateStruct | $binaryFileCreateStruct |

Exceptions

Implements eZ\Publish\Core\IO\IOServiceInterface.

Definition at line 105 of file IO/IOService.php.

References eZ\Publish\Core\IO\IOService\buildDomainBinaryFileObject(), and eZ\Publish\Core\IO\IOService\buildSPIBinaryFileCreateStructObject().

## ◆ deleteBinaryFile()

eZ\Publish\Core\IO\IOService::deleteBinaryFile | ( | BinaryFile | $binaryFile | ) |

Deletes the BinaryFile with $id.

Parameters

  BinaryFile | $binaryFile |

Exceptions

Implements eZ\Publish\Core\IO\IOServiceInterface.

Reimplemented in eZ\Publish\Core\IO\TolerantIOService.

Definition at line 141 of file IO/IOService.php.

References eZ\Publish\Core\IO\IOService\checkBinaryFileId(), and eZ\Publish\Core\IO\IOService\getPrefixedUri().

## ◆ deleteDirectory()

eZ\Publish\Core\IO\IOService::deleteDirectory | ( |  | $path | ) |

Deletes a directory.

Parameters

  string | $path |

Implements eZ\Publish\Core\IO\IOServiceInterface.

Definition at line 319 of file IO/IOService.php.

References eZ\Publish\Core\IO\IOService\getPrefixedUri().

## ◆ exists()

eZ\Publish\Core\IO\IOService::exists | ( |  | $binaryFileId | ) |

Checks if a Binary File with $binaryFileId exists.

Parameters

  string | $binaryFileId |

Returns
  bool

Implements eZ\Publish\Core\IO\IOServiceInterface.

Definition at line 220 of file IO/IOService.php.

References eZ\Publish\Core\IO\IOService\getPrefixedUri().

## ◆ getExternalPath()

eZ\Publish\Core\IO\IOService::getExternalPath | ( |  | $internalId | ) |

Returns the external path to $internalPath.

Parameters

  string | $internalId |

Deprecated:
  Since 5.4. Use loadBinaryFileByUri.

Returns
  string

Implements eZ\Publish\Core\IO\IOServiceInterface.

Definition at line 205 of file IO/IOService.php.

References eZ\Publish\Core\IO\IOService\loadBinaryFileByUri().

## ◆ getFileContents()

eZ\Publish\Core\IO\IOService::getFileContents | ( | BinaryFile | $binaryFile | ) |

Returns the content of the binary file.

Parameters

  BinaryFile | $binaryFile |

Exceptions

Implements eZ\Publish\Core\IO\IOServiceInterface.

Definition at line 191 of file IO/IOService.php.

References eZ\Publish\Core\IO\IOService\checkBinaryFileId(), and eZ\Publish\Core\IO\IOService\getPrefixedUri().

## ◆ getFileInputStream()

eZ\Publish\Core\IO\IOService::getFileInputStream | ( | BinaryFile | $binaryFile | ) |

Returns a read (mode: rb) file resource to the binary file identified by $path.

Parameters

  BinaryFile | $binaryFile |

Exceptions

Implements eZ\Publish\Core\IO\IOServiceInterface.

Definition at line 182 of file IO/IOService.php.

References eZ\Publish\Core\IO\IOService\checkBinaryFileId(), and eZ\Publish\Core\IO\IOService\getPrefixedUri().

## ◆ getInternalPath()

eZ\Publish\Core\IO\IOService::getInternalPath | ( |  | $externalId | ) |

Returns the internal, handler level path to $externalPath.

Parameters

  string | $externalId |

Deprecated:
  Since 5.4. Use the uri property.

Returns
  string

Implements eZ\Publish\Core\IO\IOServiceInterface.

Definition at line 200 of file IO/IOService.php.

References eZ\Publish\Core\IO\IOService\getPrefixedUri().

## ◆ getMimeType()

eZ\Publish\Core\IO\IOService::getMimeType | ( |  | $binaryFileId | ) |

Gets the mime-type of the BinaryFile.

Example: text/xml

Parameters

  string | $binaryFileId |

Returns
  string|null

Implements eZ\Publish\Core\IO\IOServiceInterface.

Definition at line 215 of file IO/IOService.php.

References eZ\Publish\Core\IO\IOService\getPrefixedUri().

## ◆ getPrefixedUri()

eZ\Publish\Core\IO\IOService::getPrefixedUri | ( |  | $binaryFileId | ) |
| protected

Returns $uri prefixed with what is configured in the service.

Parameters

  string | $binaryFileId |

Returns
  string

Definition at line 272 of file IO/IOService.php.

Referenced by eZ\Publish\Core\IO\IOService\buildSPIBinaryFileCreateStructObject(), eZ\Publish\Core\IO\IOService\deleteBinaryFile(), eZ\Publish\Core\IO\TolerantIOService\deleteBinaryFile(), eZ\Publish\Core\IO\IOService\deleteDirectory(), eZ\Publish\Core\IO\IOService\exists(), eZ\Publish\Core\IO\IOService\getFileContents(), eZ\Publish\Core\IO\IOService\getFileInputStream(), eZ\Publish\Core\IO\IOService\getInternalPath(), eZ\Publish\Core\IO\IOService\getMimeType(), eZ\Publish\Core\IO\IOService\loadBinaryFile(), and eZ\Publish\Core\IO\TolerantIOService\loadBinaryFile().

## ◆ getUri()

eZ\Publish\Core\IO\IOService::getUri | ( |  | $binaryFileId | ) |

Returns the public HTTP uri for $binaryFileId.

Parameters

  string | $binaryFileId |

Returns
  string

Implements eZ\Publish\Core\IO\IOServiceInterface.

Definition at line 210 of file IO/IOService.php.

## ◆ isAbsolutePath()

eZ\Publish\Core\IO\IOService::isAbsolutePath | ( |  | $path | ) |
| protected

Check if path is absolute, in terms of http or disk (incl if it contains driver letter on Win).

Parameters

  string | $path |

Returns
  bool

Definition at line 333 of file IO/IOService.php.

Referenced by eZ\Publish\Core\IO\IOService\loadBinaryFile(), and eZ\Publish\Core\IO\TolerantIOService\loadBinaryFile().

## ◆ loadBinaryFile()

eZ\Publish\Core\IO\IOService::loadBinaryFile | ( |  | $binaryFileId | ) |

Loads the binary file with $id.

Exceptions

Implements eZ\Publish\Core\IO\IOServiceInterface.

Reimplemented in eZ\Publish\Core\IO\TolerantIOService.

Definition at line 156 of file IO/IOService.php.

References eZ\Publish\Core\IO\IOService\buildDomainBinaryFileObject(), eZ\Publish\Core\IO\IOService\checkBinaryFileId(), eZ\Publish\Core\IO\IOService\getPrefixedUri(), and eZ\Publish\Core\IO\IOService\isAbsolutePath().

Referenced by eZ\Publish\Core\IO\IOService\loadBinaryFileByUri().

## ◆ loadBinaryFileByUri()

eZ\Publish\Core\IO\IOService::loadBinaryFileByUri | ( |  | $binaryFileUri | ) |

Loads the binary file with uri $uri.

Exceptions

Implements eZ\Publish\Core\IO\IOServiceInterface.

Reimplemented in eZ\Publish\Core\IO\TolerantIOService.

Definition at line 173 of file IO/IOService.php.

References eZ\Publish\Core\IO\IOService\loadBinaryFile(), and eZ\Publish\Core\IO\IOService\removeUriPrefix().

Referenced by eZ\Publish\Core\IO\IOService\getExternalPath().

## ◆ newBinaryCreateStructFromLocalFile()

eZ\Publish\Core\IO\IOService::newBinaryCreateStructFromLocalFile | ( |  | $localFile | ) |

Creates a BinaryFileCreateStruct object from $localFile.

Exceptions

Implements eZ\Publish\Core\IO\IOServiceInterface.

Definition at line 79 of file IO/IOService.php.

## ◆ newBinaryCreateStructFromUploadedFile()

eZ\Publish\Core\IO\IOService::newBinaryCreateStructFromUploadedFile | ( | array | $uploadedFile | ) |

Creates a BinaryFileCreateStruct object from the uploaded file $uploadedFile.

Exceptions

Implements eZ\Publish\Core\IO\IOServiceInterface.

Definition at line 56 of file IO/IOService.php.

## ◆ removeUriPrefix()

eZ\Publish\Core\IO\IOService::removeUriPrefix | ( |  | $spiBinaryFileId | ) |
| protected

Parameters

  mixed | $spiBinaryFileId |

Returns
  string

Exceptions

Definition at line 289 of file IO/IOService.php.

Referenced by eZ\Publish\Core\IO\IOService\loadBinaryFileByUri(), and eZ\Publish\Core\IO\TolerantIOService\loadBinaryFileByUri().

## ◆ setPrefix()

eZ\Publish\Core\IO\IOService::setPrefix | ( |  | $prefix | ) |

The the internal prefix added by the IO Service.

Parameters

  string | $prefix |

Implements eZ\Publish\Core\IO\IOServiceInterface.

Definition at line 51 of file IO/IOService.php.

## Member Data Documentation

## ◆ $binarydataHandler

eZ\Publish\Core\IO\IOService::$binarydataHandler
| protected

Definition at line 28 of file IO/IOService.php.

Referenced by eZ\Publish\Core\IO\IOService\__construct().

## ◆ $metadataHandler

eZ\Publish\Core\IO\IOService::$metadataHandler
| protected

Definition at line 31 of file IO/IOService.php.

Referenced by eZ\Publish\Core\IO\IOService\__construct().

## ◆ $mimeTypeDetector

eZ\Publish\Core\IO\IOService::$mimeTypeDetector
| protected

Definition at line 34 of file IO/IOService.php.

Referenced by eZ\Publish\Core\IO\IOService\__construct().

## ◆ $settings

eZ\Publish\Core\IO\IOService::$settings
| protected

Definition at line 37 of file IO/IOService.php.

Referenced by eZ\Publish\Core\IO\IOService\__construct().

The documentation for this class was generated from the following file:

- IO/IOService.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.