ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
CodeFilter.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 {
25  public function __construct(
26  private string $code = '',
27  private int $role = 0,
28  private string $generated = '',
29  private string $access_limitation = '',
30  ) {
31  }
32 
36  public function withData(array $filter): CodeFilter
37  {
38  $clone = clone $this;
39 
40  $clone->code = (string) ($filter['code'] ?? '');
41  $clone->role = (int) ($filter['role'] ?? 0);
42  $clone->generated = (string) ($filter['generated'] ?? '');
43  $clone->access_limitation = (string) ($filter['access_limitation'] ?? '');
44 
45  return $clone;
46  }
47 
48  public function getCode(): string
49  {
50  return $this->code;
51  }
52 
53  public function getRole(): int
54  {
55  return $this->role;
56  }
57 
58  public function getGenerated(): string
59  {
60  return $this->generated;
61  }
62 
63  public function getAccessLimitation(): string
64  {
65  return $this->access_limitation;
66  }
67 
71  public function getData(): array
72  {
73  return [
74  'code' => $this->getCode(),
75  'role' => $this->getRole(),
76  'generated' => $this->getGenerated(),
77  'access_limitation' => $this->getAccessLimitation(),
78  ];
79  }
80 }
__construct(private string $code='', private int $role=0, private string $generated='', private string $access_limitation='',)
Definition: CodeFilter.php:25