QuestionAttributeFetcher
in package
Fetches question attribute definitions from the available providers
Table of Contents
Properties
- $options : array<string, mixed>
- $providers : array<string|int, QuestionAttributeProvider>
- $question : Question
Methods
- __construct() : mixed
- fetch() : array<string, array<string|int, mixed>>
- Returns the question attribute definitions according to the specified filters, from all available sources.
- populateValues() : array<string, array<string|int, mixed>>
- Populates the $attributeDefinitions with their corresponding values.
- resetOptions() : mixed
- Clears the filters
- setAdvancedOnly() : mixed
- Convenience method to add the 'advancedOnly' filter
- setOption() : mixed
- Adds a new filter or overrides an existing one
- setQuestion() : mixed
- Sets the question to use when fetching the attributes
- setQuestionType() : mixed
- Convenience method to add a question type filter
- setTheme() : mixed
- Convenience method to add a question theme filter
Properties
$options
private
array<string, mixed>
$options
= []
array of options to pass to the providers
$providers
private
array<string|int, QuestionAttributeProvider>
$providers
= []
array of question attribute providers
$question
private
Question
$question
the question where the attributes should apply
Methods
__construct()
public
__construct([mixed $providers = null ]) : mixed
Parameters
- $providers : mixed = null
fetch()
Returns the question attribute definitions according to the specified filters, from all available sources.
public
fetch() : array<string, array<string|int, mixed>>
Tags
Return values
array<string, array<string|int, mixed>> —array of question attribute definitions
populateValues()
Populates the $attributeDefinitions with their corresponding values.
public
populateValues(array<string, array<string|int, mixed>> $attributeDefinitions[, string|null $language = null ]) : array<string, array<string|int, mixed>>
If no $language is specified, the values for all survey languages are retrieved. A question must be set with QuestionAttributeFetcher::setQuestion() before calling this method.
Parameters
- $attributeDefinitions : array<string, array<string|int, mixed>>
-
the array of attribute definitions that will be filled with values
- $language : string|null = null
-
the language to use for i18n enabled attributes. If null, all survey languages are considered.
Tags
Return values
array<string, array<string|int, mixed>> —the attributes from $attributeDefinitions, with their values.
resetOptions()
Clears the filters
public
resetOptions() : mixed
setAdvancedOnly()
Convenience method to add the 'advancedOnly' filter
public
setAdvancedOnly(bool $advancedOnly) : mixed
Parameters
- $advancedOnly : bool
setOption()
Adds a new filter or overrides an existing one
public
setOption(string $key, mixed $value) : mixed
Parameters
- $key : string
-
the name of the filter
- $value : mixed
setQuestion()
Sets the question to use when fetching the attributes
public
setQuestion(Question $question) : mixed
Parameters
- $question : Question
setQuestionType()
Convenience method to add a question type filter
public
setQuestionType(string $questionType) : mixed
Parameters
- $questionType : string
-
the name of the question theme
setTheme()
Convenience method to add a question theme filter
public
setTheme(string $questionTheme) : mixed
Parameters
- $questionTheme : string
-
the name of the question theme