ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.assAnswerMatchingTerm.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
28{
29 protected string $text;
30 protected string $picture;
31 protected int $identifier;
32
33 public function __construct(string $text = "", string $picture = "", int $identifier = 0)
34 {
35 $this->text = $text;
36 $this->picture = $picture;
37
38 $this->identifier = ($identifier !== 0) ? $identifier : $this->createIdentifier();
39 }
40
41 protected function createIdentifier(): int
42 {
43 $id = random_int(1, 100000);
44 return $id;
45 }
46
47 public function getText(): string
48 {
49 return $this->text;
50 }
51 public function withText(string $text): self
52 {
53 $clone = clone $this;
54 $clone->text = $text;
55 return $clone;
56 }
57
58 public function getPicture(): string
59 {
60 return $this->picture;
61 }
62 public function withPicture(string $picture): self
63 {
64 $clone = clone $this;
65 $clone->picture = $picture;
66 return $clone;
67 }
68
69 public function getIdentifier(): int
70 {
71 return $this->identifier;
72 }
73 public function withIdentifier(int $identifier): self
74 {
75 $clone = clone $this;
76 $clone->identifier = $identifier;
77 return $clone;
78 }
79}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Class for matching question terms.
__construct(string $text="", string $picture="", int $identifier=0)