19 declare(strict_types=1);
    49                 protected array $values
    53             public function type(): 
Type    63             public function values(): \Generator
    65                 yield 
from $this->values;
    73             public function txt(
string $key): 
string    75                 return 'translated suffix';
    82         string ...$values_from_vocab
    84         return new class ($slot_with_vocab, $values_from_vocab) extends NullCopyrightBridge {
    87                 protected array $values_from_vocab
    91             public function labelsForValues(
    95                 foreach ($values as $value) {
    96                     if ($slot !== $this->slot_with_vocab) {
    99                     if (!in_array($value, $this->values_from_vocab)) {
   103                         public function __construct(
protected string $value)
   107                         public function value(): 
string   112                         public function label(): 
string   114                             return 'copyright label for ' . $this->value;
   126         string ...$values_from_vocab
   127     ): ControlledRepository {
   128         return new class ($slot_with_vocab, $only_active, $empty_labels, $values_from_vocab) extends 
NullControlledRepository {
   131                 protected bool $only_active,
   132                 protected bool $empty_labels,
   133                 protected array $values_from_vocab
   137             public function getLabelsForValues(
   142                 if ($slot !== $this->slot_with_vocab || $only_active !== $this->only_active) {
   145                 foreach ($values as $value) {
   146                     if (!in_array($value, $this->values_from_vocab)) {
   151                             protected string $value,
   152                             protected bool $empty_label
   156                         public function value(): 
string   161                         public function label(): 
string   163                             if ($this->empty_label) {
   166                             return 'controlled label for ' . $this->value;
   177         string ...$values_from_vocab
   178     ): StandardRepository {
   179         return new class ($slot_with_vocab, $only_active, $values_from_vocab) extends NullStandardRepository {
   182                 protected bool $only_active,
   183                 protected array $values_from_vocab
   187             public function getLabelsForValues(
   193                 if ($slot !== $this->slot_with_vocab || $only_active !== $this->only_active) {
   196                 foreach ($values as $value) {
   197                     if (!in_array($value, $this->values_from_vocab)) {
   201                         public function __construct(
protected string $value)
   205                         public function value(): 
string   210                         public function label(): 
string   212                             return 'standard label for ' . $this->value;
   222         string $expected_value,
   223         string $expected_label
   227             $labelled_value->
value(),
   228             'Value of Labelled value ' . $labelled_value->
value() . 
' should be ' . $expected_value
   232             $labelled_value->
label(),
   233             'Label of Labelled value ' . $labelled_value->
label() . 
' should be ' . $expected_label
   245         $as_array = iterator_to_array($labelled_values);
   249             'There should be ' . count($expected) . 
' labelled values, not ' . count($as_array)
   252         foreach ($as_array as $labelled_value) {
   255                 $expected[$i][
'value'],
   256                 $expected[$i][
'label']
   265             [
'v1', 
true, 
true, 
true, 
'copyright label for v1'],
   266             [
'v2', 
true, 
false, 
true, 
'copyright label for v2'],
   267             [
'v3', 
true, 
true, 
false, 
'copyright label for v3'],
   268             [
'v4', 
true, 
false, 
false, 
'copyright label for v4'],
   269             [
'v5', 
false, 
true, 
true, 
'controlled label for v5'],
   270             [
'v6', 
false, 
false, 
true, 
'standard label for v6'],
   271             [
'v7', 
false, 
true, 
false, 
'controlled label for v7'],
   272             [
'v8', 
false, 
false, 
false, 
'v8']
   281         bool $is_in_copyright,
   282         bool $is_in_controlled,
   283         bool $is_in_standard,
   284         string $expected_label
   288                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   289                 ...($is_in_copyright ? [$value] : [])
   292                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   295                 ...($is_in_controlled ? [$value] : [])
   298                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   300                 ...($is_in_standard ? [$value] : [])
   304         $labels = $presentation->presentableLabels(
   306             SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   313             [[
'value' => $value, 
'label' => $expected_label]]
   322         bool $is_in_copyright,
   323         bool $is_in_controlled,
   324         bool $is_in_standard,
   325         string $expected_label_without_suffix
   329                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   330                 ...($is_in_copyright ? [$value] : [])
   333                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   336                 ...($is_in_controlled ? [$value] : [])
   339                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   341                 ...($is_in_standard ? [$value] : [])
   345         $labels = $presentation->presentableLabels(
   347             SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   352         $suffix = (!$is_in_standard && !$is_in_controlled && !$is_in_copyright) ? 
' translated suffix' : 
'';
   355             [[
'value' => $value, 
'label' => $expected_label_without_suffix . $suffix]]
   361         $value = 
'some value';
   365                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   370                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   375         $labels = $presentation->presentableLabels(
   377             SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   384             [[
'value' => $value, 
'label' => $value]]
   392                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   397                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   405                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   412         $labels = $presentation->presentableLabels(
   414             SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   426                 [
'value' => 
'contr 2', 
'label' => 
'controlled label for contr 2'],
   427                 [
'value' => 
'cp 1', 
'label' => 
'copyright label for cp 1'],
   428                 [
'value' => 
'something else', 
'label' => 
'something else'],
   429                 [
'value' => 
'stand 2', 
'label' => 
'standard label for stand 2'],
   430                 [
'value' => 
'contr 3', 
'label' => 
'controlled label for contr 3']
   439                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   445                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   453                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   461         $labels = $presentation->labelsForVocabulary(
   465                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   475                 [
'value' => 
'v1', 
'label' => 
'standard label for v1'],
   476                 [
'value' => 
'v2', 
'label' => 
'standard label for v2'],
   477                 [
'value' => 
'v3', 
'label' => 
'standard label for v3']
   486                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   492                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   500                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   508         $labels = $presentation->labelsForVocabulary(
   511                 Type::CONTROLLED_STRING,
   512                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   522                 [
'value' => 
'v1', 
'label' => 
'controlled label for v1'],
   523                 [
'value' => 
'v2', 
'label' => 
'controlled label for v2'],
   524                 [
'value' => 
'v3', 
'label' => 
'controlled label for v3']
   533                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   539                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   547                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   555         $labels = $presentation->labelsForVocabulary(
   558                 Type::CONTROLLED_VOCAB_VALUE,
   559                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   569                 [
'value' => 
'v1', 
'label' => 
'controlled label for v1'],
   570                 [
'value' => 
'v2', 
'label' => 
'controlled label for v2'],
   571                 [
'value' => 
'v3', 
'label' => 
'controlled label for v3']
   580                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   586                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   594                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   602         $labels = $presentation->labelsForVocabulary(
   606                 SlotIdentifier::EDUCATIONAL_DIFFICULTY,
   616                 [
'value' => 
'v1', 
'label' => 
'copyright label for v1'],
   617                 [
'value' => 
'v2', 
'label' => 
'copyright label for v2'],
   618                 [
'value' => 
'v3', 
'label' => 
'copyright label for v3']
 
__construct()
Constructor setup ILIAS global object  public.