file-fetcher
Public Member Functions | List of all members
FileFetcher\Processor\ProcessorInterface Interface Reference
Inheritance diagram for FileFetcher\Processor\ProcessorInterface:
FileFetcher\Processor\LastResort FileFetcher\Processor\Local FileFetcher\Processor\Remote

Detailed Description

A processor represents a specific way of getting data from a server to produce a file.

The FileFetcher::FileFetcher class relies on processors to do the work. In multiple places through out the process of fetching a file, the FileFetcher::FileFetcher asks the processor classes for information or to do some work.

The majority of information passed to the Processors from the FileFetcher::FileFetcher comes in an array: $state. The array looks like this:

35 
36  $state = [
37  'source' => $config['filePath'],
38  'total_bytes' => 0,
39  'total_bytes_copied' => 0,
40  'temporary' => false,
41  'keep_original_filename' => $config['keep_original_filename'] ?? false,
42  'destination' => $config['filePath'],
43  'temporary_directory' => $config['temporaryDirectory'],
44  ];
45 

Public Member Functions

 isServerCompatible (array $state)
 
 setupState (array $state)
 
 copy (array $state, Result $result, int $timeLimit=PHP_INT_MAX)
 
 isTimeLimitIncompatible ()
 

Member Function Documentation

◆ copy()

FileFetcher\Processor\ProcessorInterface::copy ( array  $state,
Result  $result,
int  $timeLimit = PHP_INT_MAX 
)

Copying data from the "source location" into a file.

Returns
array The return should contain the $state and the $result.

Implemented in FileFetcher\Processor\Remote, FileFetcher\Processor\LastResort, and FileFetcher\Processor\Local.

◆ isServerCompatible()

FileFetcher\Processor\ProcessorInterface::isServerCompatible ( array  $state)

Whether the server holding the "file" will work with this processor.

Returns
bool

Implemented in FileFetcher\Processor\LastResort, FileFetcher\Processor\Remote, and FileFetcher\Processor\Local.

◆ isTimeLimitIncompatible()

FileFetcher\Processor\ProcessorInterface::isTimeLimitIncompatible ( )

Whether the processor can deal with time limits.

Returns
bool

Implemented in FileFetcher\Processor\Remote, FileFetcher\Processor\LastResort, and FileFetcher\Processor\Local.

◆ setupState()

FileFetcher\Processor\ProcessorInterface::setupState ( array  $state)

An opportunity to modify the state before attempting to fetch the file.

Returns
array The appropriately modified state.

Implemented in FileFetcher\Processor\Remote, FileFetcher\Processor\Local, and FileFetcher\Processor\LastResort.


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