AbstractService implements LoggerAwareInterface uses BlockSerializationTrait, LoggerAwareTrait

AbstractYes

Parent class for "Services" classes

Deprecated

since v11, will be removed in v12.

Table of Contents

Interfaces

LoggerAwareInterface

Constants

ERROR_FILE_NOT_FOUND  = -20
ERROR_FILE_NOT_READABLE  = -21
ERROR_FILE_NOT_WRITEABLE  = -22
ERROR_GENERAL  = -1
ERROR_NO_INPUT  = -4
ERROR_PROGRAM_FAILED  = -41
ERROR_PROGRAM_NOT_FOUND  = -40
ERROR_SERVICE_NOT_AVAILABLE  = -2
ERROR_WRONG_SUBTYPE  = -3

Properties

$error  : array<string|int, mixed>
$info  : array<string|int, mixed>
$inputContent  : string
$inputFile  : string
$inputType  : string
$out  : string
$outputFile  : string
$tempFiles  : array<string|int, mixed>
Temporary files which have to be deleted
$prefixId  : string
$shutdownRegistry  : array<string|int, mixed>

Methods

__destruct()  : mixed
Clean up the service.
__wakeup()  : mixed
Deny object deserialization.
checkExec()  : bool
check the availability of external programs
checkInputFile()  : string|bool
Check if a file exists and is readable.
deactivateService()  : mixed
Deactivate the service. Use this if the service fails at runtime and will not be available.
errorPull()  : mixed
Removes the last error from the error stack.
errorPush()  : mixed
Puts an error on the error stack. Calling without parameter adds a general error.
getErrorMsgArray()  : array<string|int, mixed>
Returns all error messages as array.
getInput()  : string
Get the input content.
getInputFile()  : string
Get the input file name.
getLastError()  : int|bool
Returns the last error number from the error stack.
getLastErrorArray()  : array<string|int, mixed>
Returns the last array from the error stack.
getLastErrorMsg()  : string
Returns the last message from the error stack.
getOutput()  : string
Get the output content.
getOutputFile()  : mixed
Get the output file name. If no output file is set, the ->out buffer is written to the file given by input parameter filename
getServiceInfo()  : array<string|int, mixed>
Returns internal information array for service
getServiceKey()  : string
Returns the service key of the service
getServiceOption()  : mixed
Returns service configuration values from the $TYPO3_CONF_VARS['SVCONF'] array
getServiceTitle()  : string
Returns the title of the service
init()  : bool
Initialization of the service.
readFile()  : string|bool
Read content from a file a file.
registerTempFile()  : mixed
Register file which should be deleted afterwards.
reset()  : mixed
Resets the service.
resetErrors()  : mixed
Reset the error stack.
setInput()  : mixed
Set the input content for service processing.
setInputFile()  : mixed
Set the input file name for service processing.
setOutputFile()  : mixed
Set the output file name.
tempFile()  : string|bool
Create a temporary file.
unlinkTempFiles()  : mixed
Delete registered temporary files.
writeFile()  : string|bool
Write content to a file.

Constants

ERROR_FILE_NOT_FOUND

public mixed ERROR_FILE_NOT_FOUND = -20

ERROR_FILE_NOT_READABLE

public mixed ERROR_FILE_NOT_READABLE = -21

ERROR_FILE_NOT_WRITEABLE

public mixed ERROR_FILE_NOT_WRITEABLE = -22

ERROR_GENERAL

public mixed ERROR_GENERAL = -1

ERROR_NO_INPUT

public mixed ERROR_NO_INPUT = -4

ERROR_PROGRAM_FAILED

public mixed ERROR_PROGRAM_FAILED = -41

ERROR_PROGRAM_NOT_FOUND

public mixed ERROR_PROGRAM_NOT_FOUND = -40

ERROR_SERVICE_NOT_AVAILABLE

public mixed ERROR_SERVICE_NOT_AVAILABLE = -2

ERROR_WRONG_SUBTYPE

public mixed ERROR_WRONG_SUBTYPE = -3

Properties

$error

public array<string|int, mixed> $error = []

error stack

$info

public array<string|int, mixed> $info = []

service description array

$inputContent

public string $inputContent = ''

The content that should be processed.

$inputFile

public string $inputFile = ''

The file that should be processed.

$inputType

public string $inputType = ''

The type of the input content (or file). Might be the same as the service subtypes.

$out

public string $out = ''

The output content. That's what the services produced as result.

$outputFile

public string $outputFile = ''

The file where the output should be written to.

$tempFiles

Temporary files which have to be deleted

public array<string|int, mixed> $tempFiles = []
Tags
private

$prefixId

protected string $prefixId = ''

Prefix for temporary files

$shutdownRegistry

protected array<string|int, mixed> $shutdownRegistry = []

list of registered shutdown functions; should be used to prevent registering the same function multiple times

Methods

__destruct()

Clean up the service.

public __destruct() : mixed

Child classes should explicitly call parent::__destruct() in their destructors for this to work

__wakeup()

Deny object deserialization.

public __wakeup() : mixed

checkExec()

check the availability of external programs

public checkExec(string $progList) : bool
Parameters
$progList : string

Comma list of programs 'perl,python,pdftotext'

Return values
bool

Return FALSE if one program was not found

checkInputFile()

Check if a file exists and is readable.

public checkInputFile(string $absFile) : string|bool
Parameters
$absFile : string

File name with absolute path.

Return values
string|bool

File name or FALSE.

deactivateService()

Deactivate the service. Use this if the service fails at runtime and will not be available.

public deactivateService() : mixed

errorPull()

Removes the last error from the error stack.

public errorPull() : mixed

errorPush()

Puts an error on the error stack. Calling without parameter adds a general error.

public errorPush([int $errNum = self::ERROR_GENERAL ][, string $errMsg = 'Unspecified error occurred' ]) : mixed
Parameters
$errNum : int = self::ERROR_GENERAL

Error number (see class constants)

$errMsg : string = 'Unspecified error occurred'

Error message

getErrorMsgArray()

Returns all error messages as array.

public getErrorMsgArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

Error messages

getInput()

Get the input content.

public getInput() : string

Will be read from input file if needed. (That is if ->inputContent is empty and ->inputFile is not)

Return values
string

getInputFile()

Get the input file name.

public getInputFile([string $createFile = '' ]) : string

If the content was set by setContent a file will be created.

Parameters
$createFile : string = ''

File name. If empty a temp file will be created.

Return values
string

File name or FALSE if no input or file error.

getLastError()

Returns the last error number from the error stack.

public getLastError() : int|bool
Return values
int|bool

Error number (or TRUE if no error)

getLastErrorArray()

Returns the last array from the error stack.

public getLastErrorArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

Error number and message

getLastErrorMsg()

Returns the last message from the error stack.

public getLastErrorMsg() : string
Return values
string

Error message

getOutput()

Get the output content.

public getOutput() : string
Return values
string

getOutputFile()

Get the output file name. If no output file is set, the ->out buffer is written to the file given by input parameter filename

public getOutputFile([string $absFile = '' ]) : mixed
Parameters
$absFile : string = ''

Absolute filename to write to

getServiceInfo()

Returns internal information array for service

public getServiceInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>

Service description array

getServiceKey()

Returns the service key of the service

public getServiceKey() : string
Return values
string

Service key

getServiceOption()

Returns service configuration values from the $TYPO3_CONF_VARS['SVCONF'] array

public getServiceOption(string $optionName[, mixed $defaultValue = '' ][, bool $includeDefaultConfig = true ]) : mixed
Parameters
$optionName : string

Name of the config option

$defaultValue : mixed = ''

Default configuration if no special config is available

$includeDefaultConfig : bool = true

If set the 'default' config will be returned if no special config for this service is available (default: TRUE)

Return values
mixed

Configuration value for the service

getServiceTitle()

Returns the title of the service

public getServiceTitle() : string
Return values
string

Service title

init()

Initialization of the service.

public init() : bool

The class have to do a strict check if the service is available. example: check if the perl interpreter is available which is needed to run an external perl script.

Return values
bool

TRUE if the service is available

readFile()

Read content from a file a file.

public readFile(string $absFile[, int $length = 0 ]) : string|bool
Parameters
$absFile : string

File name to read from.

$length : int = 0

Maximum length to read. If empty the whole file will be read.

Return values
string|bool

file content or false

registerTempFile()

Register file which should be deleted afterwards.

public registerTempFile(string $absFile) : mixed
Parameters
$absFile : string

File name with absolute path.

reset()

Resets the service.

public reset() : mixed

Will be called by init(). Should be used before every use if a service instance is used multiple times.

resetErrors()

Reset the error stack.

public resetErrors() : mixed

setInput()

Set the input content for service processing.

public setInput(mixed $content[, string $type = '' ]) : mixed
Parameters
$content : mixed

Input content (going into ->inputContent)

$type : string = ''

The type of the input content (or file). Might be the same as the service subtypes.

setInputFile()

Set the input file name for service processing.

public setInputFile(string $absFile[, string $type = '' ]) : mixed
Parameters
$absFile : string

File name

$type : string = ''

The type of the input content (or file). Might be the same as the service subtypes.

setOutputFile()

Set the output file name.

public setOutputFile(string $absFile) : mixed
Parameters
$absFile : string

File name

tempFile()

Create a temporary file.

public tempFile(string $filePrefix) : string|bool
Parameters
$filePrefix : string

File prefix.

Return values
string|bool

File name or FALSE

unlinkTempFiles()

Delete registered temporary files.

public unlinkTempFiles() : mixed

writeFile()

Write content to a file.

public writeFile(string $content[, string $absFile = '' ]) : string|bool
Parameters
$content : string

Content to write to the file

$absFile : string = ''

File name to write into. If empty a temp file will be created.

Return values
string|bool

File name or FALSE


        
On this page

Search results