QuestionAttributeFetcher

Fetches question attribute definitions from the available providers

package

Default

Methods

__construct

__construct( $providers = null)

Arguments

$providers

Returns the question attribute definitions according to the specified filters, from all available sources.

fetch(): \LimeSurvey\Models\Services\array<string,array>
Throws
\InvalidArgumentException

if no question is specified

Response

\LimeSurvey\Models\Services\array

array of question attribute definitions

Populates the $attributeDefinitions with their corresponding values.

populateValues(\LimeSurvey\Models\Services\array<string,array> $attributeDefinitions,string|null $language = null): \LimeSurvey\Models\Services\array<string,array>

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.

Throws
\Exception

if the question ()

TODO: Move to QuestionAttributeHelper? Not sure if it belongs here.

Arguments

$attributeDefinitions

\LimeSurvey\Models\Services\array

the array of attribute definitions that will be filled with values

$language

string|null

the language to use for i18n enabled attributes. If null, all survey languages are considered.

Response

\LimeSurvey\Models\Services\array

the attributes from $attributeDefinitions, with their values.

Clears the filters

resetOptions()

Convenience method to add the 'advancedOnly' filter

setAdvancedOnly(boolean $advancedOnly)

Arguments

$advancedOnly

boolean

Adds a new filter or overrides an existing one

setOption(string $key,mixed $value)

Arguments

$key

string

the name of the filter

$value

mixed

Sets the question to use when fetching the attributes

setQuestion(\Question $question)

Arguments

$question

\Question

Convenience method to add a question type filter

setQuestionType(string $questionType)

Arguments

$questionType

string

the name of the question theme

Convenience method to add a question theme filter

setTheme(string $questionTheme)

Arguments

$questionTheme

string

the name of the question theme

Properties

the question where the attributes should apply

question :\Question
var

the question where the attributes should apply

Type(s)

\Question

array of options to pass to the providers

options :\LimeSurvey\Models\Services\array<string,mixed>
var

array of options to pass to the providers

Type(s)

\LimeSurvey\Models\Services\array

array of question attribute providers

providers :\LimeSurvey\Models\Services\array<QuestionAttributeProvider>
var

array of question attribute providers

Type(s)

\LimeSurvey\Models\Services\array