AbstractUserRequestAction
extends AbstractIlsAndUserAction
in package
Uses
SummaryTrait
Abstract base class for fetching information about user requests.
Tags
Table of Contents
- $ils : Connection
- $ilsAuthenticator : ILSAuthenticator
- $lookupMethod : string
- ILS driver method for data retrieval.
- $sessionSettings : Settings
- Session settings
- $translator : TranslatorInterface
- Translator
- $user : UserEntityInterface|null
- __construct() : mixed
- Constructor
- getTranslator() : TranslatorInterface
- Get translator object.
- getTranslatorLocale() : string
- Get the locale from the translator.
- handleRequest() : array<string|int, mixed>
- Handle a request.
- setTranslator() : TranslatorAwareInterface
- Set a translator
- translate() : string
- Translate a string (or string-castable object)
- translateWithPrefix() : string
- Translate a string (or string-castable object) using a prefix, or without the prefix if a prefixed translation is not found.
- disableSessionWrites() : void
- Prevent session writes -- this is designed to be called prior to time- consuming AJAX operations to help reduce the odds of a timing-related bug that causes the wrong version of session data to be written to disk (see VUFIND-716 for more details).
- extractTextDomain() : array<string|int, mixed>
- Given a translation string with or without a text domain, return an array with the raw string and the text domain separated.
- formatResponse() : array<string|int, mixed>
- Format a response array.
- getDebugTranslation() : string
- Build a debug-mode translation
- getFineSummary() : array<string|int, mixed>
- Get a status summary for an array of fines
- getRequestSummary() : array<string|int, mixed>
- Get a status summary for an array of requests
- getTransactionSummary() : array<string|int, mixed>
- Get a status summary for an array of checkouts
- sanitizeTranslationKey() : string
- Make sure there are not any illegal characters in the translation key that might prevent successful lookup in language files.
- translateString() : string
- Get translation for a string
Properties
$ils
protected
Connection
$ils
$ilsAuthenticator
protected
ILSAuthenticator
$ilsAuthenticator
$lookupMethod
ILS driver method for data retrieval.
protected
string
$lookupMethod
$sessionSettings
Session settings
protected
Settings
$sessionSettings
= null
$translator
Translator
protected
TranslatorInterface
$translator
= null
$user
protected
UserEntityInterface|null
$user
Methods
__construct()
Constructor
public
__construct(Settings $ss, Connection $ils, ILSAuthenticator $ilsAuthenticator, UserEntityInterface|null $user) : mixed
Parameters
- $ss : Settings
-
Session settings
- $ils : Connection
-
ILS connection
- $ilsAuthenticator : ILSAuthenticator
-
ILS authenticator
- $user : UserEntityInterface|null
-
Logged in user (or null)
Return values
mixed —getTranslator()
Get translator object.
public
getTranslator() : TranslatorInterface
Return values
TranslatorInterface —getTranslatorLocale()
Get the locale from the translator.
public
getTranslatorLocale([string $default = 'en' ]) : string
Parameters
- $default : string = 'en'
-
Default to use if translator absent.
Return values
string —handleRequest()
Handle a request.
public
handleRequest(Params $params) : array<string|int, mixed>
Parameters
- $params : Params
-
Parameter helper from controller
Return values
array<string|int, mixed> —[response data, internal status code, HTTP status code]
setTranslator()
Set a translator
public
setTranslator(TranslatorInterface $translator) : TranslatorAwareInterface
Parameters
- $translator : TranslatorInterface
-
Translator
Return values
TranslatorAwareInterface —translate()
Translate a string (or string-castable object)
public
translate(string|object|array<string|int, mixed> $target[, array<string|int, mixed> $tokens = [] ][, string $default = null ][, bool $useIcuFormatter = false ][, array<string|int, string> $fallbackDomains = [] ]) : string
Parameters
- $target : string|object|array<string|int, mixed>
-
String to translate or an array of text domain and string to translate
- $tokens : array<string|int, mixed> = []
-
Tokens to inject into the translated string
- $default : string = null
-
Default value to use if no translation is found (null for no default).
- $useIcuFormatter : bool = false
-
Should we use an ICU message formatter instead of the default behavior?
- $fallbackDomains : array<string|int, string> = []
-
Text domains to check if no match is found in the domain specified in $target
Return values
string —translateWithPrefix()
Translate a string (or string-castable object) using a prefix, or without the prefix if a prefixed translation is not found.
public
translateWithPrefix(string $prefix, string|object|array<string|int, mixed> $target[, array<string|int, mixed> $tokens = [] ][, string $default = null ][, bool $useIcuFormatter = false ][, array<string|int, string> $fallbackDomains = [] ]) : string
Parameters
- $prefix : string
-
Translation key prefix
- $target : string|object|array<string|int, mixed>
-
String to translate or an array of text domain and string to translate
- $tokens : array<string|int, mixed> = []
-
Tokens to inject into the translated string
- $default : string = null
-
Default value to use if no translation is found (null for no default).
- $useIcuFormatter : bool = false
-
Should we use an ICU message formatter instead of the default behavior?
- $fallbackDomains : array<string|int, string> = []
-
Text domains to check if no match is found in the domain specified in $target
Return values
string —disableSessionWrites()
Prevent session writes -- this is designed to be called prior to time- consuming AJAX operations to help reduce the odds of a timing-related bug that causes the wrong version of session data to be written to disk (see VUFIND-716 for more details).
protected
disableSessionWrites() : void
Return values
void —extractTextDomain()
Given a translation string with or without a text domain, return an array with the raw string and the text domain separated.
protected
extractTextDomain(string|object|array<string|int, mixed> $target) : array<string|int, mixed>
Parameters
- $target : string|object|array<string|int, mixed>
-
String to translate or an array of text domain and string to translate
Return values
array<string|int, mixed> —formatResponse()
Format a response array.
protected
formatResponse(mixed $response[, int $httpCode = null ]) : array<string|int, mixed>
Parameters
- $response : mixed
-
Response data
- $httpCode : int = null
-
HTTP status code (omit for default)
Return values
array<string|int, mixed> —getDebugTranslation()
Build a debug-mode translation
protected
getDebugTranslation(string $domain, string $str, array<string|int, mixed> $tokens) : string
Parameters
- $domain : string
-
Text domain
- $str : string
-
String to translate
- $tokens : array<string|int, mixed>
-
Tokens to inject into the translated string
Return values
string —getFineSummary()
Get a status summary for an array of fines
protected
getFineSummary(iteratable<string|int, mixed> $fines, CurrencyFormatter $formatter) : array<string|int, mixed>
Parameters
- $fines : iteratable<string|int, mixed>
-
Fines
- $formatter : CurrencyFormatter
-
Currency formatter
Return values
array<string|int, mixed> —Associative array with keys total and display.
getRequestSummary()
Get a status summary for an array of requests
protected
getRequestSummary(iteratable<string|int, mixed> $requests) : array<string|int, mixed>
Parameters
- $requests : iteratable<string|int, mixed>
-
Requests
Return values
array<string|int, mixed> —Associative array with keys available, in_transit and other.
getTransactionSummary()
Get a status summary for an array of checkouts
protected
getTransactionSummary(iteratable<string|int, mixed> $transactions) : array<string|int, mixed>
Parameters
- $transactions : iteratable<string|int, mixed>
-
Checkouts
Return values
array<string|int, mixed> —Associative array with keys available, in_transit and other.
sanitizeTranslationKey()
Make sure there are not any illegal characters in the translation key that might prevent successful lookup in language files.
protected
sanitizeTranslationKey(string $key) : string
Parameters
- $key : string
-
Key to sanitize
Return values
string —Sanitized key
translateString()
Get translation for a string
protected
translateString(string $rawStr[, array<string|int, mixed> $tokens = [] ][, string $default = null ][, string $domain = 'default' ][, bool $useIcuFormatter = false ]) : string
Parameters
- $rawStr : string
-
String to translate
- $tokens : array<string|int, mixed> = []
-
Tokens to inject into the translated string
- $default : string = null
-
Default value to use if no translation is found (null for no default).
- $domain : string = 'default'
-
Text domain (omit for default)
- $useIcuFormatter : bool = false
-
Should we use an ICU message formatter instead of the default behavior?