ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilAttribute.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
25 use ILIAS\Export\ImportHandler\I\File\Path\Node\ilAttributeInterface as ilAttributeFilePathNodeInterface;
26 
27 class ilAttribute implements ilAttributeFilePathNodeInterface
28 {
30  protected string $attribute;
31  protected bool $any_attribute_enabled;
32 
33  public function __construct()
34  {
35  $this->attribute = '';
36  $this->comparison = new ilHandlerDummy();
37  $this->any_attribute_enabled = false;
38  }
39 
40  public function withAttribute(string $attribute): ilAttributeFilePathNodeInterface
41  {
42  $clone = clone $this;
43  $clone->attribute = $attribute;
44  return $clone;
45  }
46 
47  public function withComparison(ilHandlerInterface $comparison): ilAttributeFilePathNodeInterface
48  {
49  $clone = clone $this;
50  $clone->comparison = $comparison;
51  return $clone;
52  }
53 
54  public function withAnyAttributeEnabled(bool $enabled): ilAttributeFilePathNodeInterface
55  {
56  $clone = clone $this;
57  $clone->any_attribute_enabled = $enabled;
58  return $clone;
59  }
60 
61  public function toString(): string
62  {
63  $attribute = $this->any_attribute_enabled
64  ? '@*'
65  : '@' . $this->attribute . $this->comparison->toString();
66  return '[' . $attribute . ']';
67  }
68 
69  public function requiresPathSeparator(): bool
70  {
71  return true;
72  }
73 }
bool $enabled
Whether the system instance is enabled to accept connection requests.
Definition: System.php:123