ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\MetaData\Elements\MockScaffoldProvider Class Reference
+ Inheritance diagram for ILIAS\MetaData\Elements\MockScaffoldProvider:
+ Collaboration diagram for ILIAS\MetaData\Elements\MockScaffoldProvider:

Public Member Functions

 getScaffoldsForElement (ElementInterface $element)
 Returns all elements that could be added as sub-elements to the given element as scaffolds. More...
 

Protected Member Functions

 getScaffold (string $name, ElementInterface ... $elements)
 

Detailed Description

Definition at line 271 of file ElementTest.php.

Member Function Documentation

◆ getScaffold()

ILIAS\MetaData\Elements\MockScaffoldProvider::getScaffold ( string  $name,
ElementInterface ...  $elements 
)
protected

Definition at line 273 of file ElementTest.php.

References $data, and ILIAS\__construct().

273  : ElementInterface
274  {
275  $definition = new class ($name) implements DefinitionInterface {
276  protected string $name;
277 
278  public function __construct(string $name)
279  {
280  $this->name = $name;
281  }
282 
283  public function name(): string
284  {
285  return $this->name;
286  }
287 
288  public function unique(): bool
289  {
290  return false;
291  }
292 
293  public function dataType(): Type
294  {
295  return Type::NULL;
296  }
297  };
298 
299  $data = new class () implements DataInterface {
300  public function type(): Type
301  {
302  return Type::STRING;
303  }
304 
305  public function value(): string
306  {
307  return 'value';
308  }
309  };
310 
311  return new Element(
312  NoID::SCAFFOLD,
313  $definition,
314  $data,
315  ...$elements
316  );
317  }
__construct()
Constructor setup ILIAS global object public.
Definition: class.ilias.php:62
+ Here is the call graph for this function:

◆ getScaffoldsForElement()

ILIAS\MetaData\Elements\MockScaffoldProvider::getScaffoldsForElement ( ElementInterface  $element)

Returns all elements that could be added as sub-elements to the given element as scaffolds.

Scaffolds are used to mark where elements could potentially be created. Keys are the name of the following element.

Returns
ElementInterface[]

Implements ILIAS\MetaData\Repository\Utilities\ScaffoldProviderInterface.

Definition at line 319 of file ElementTest.php.

319  : \Generator
320  {
321  $first = $this->getScaffold('first');
322  $second = $this->getScaffold('second');
323  $third = $this->getScaffold('third');
324 
325  yield 'second' => $first;
326  yield 'third' => $second;
327  yield '' => $third;
328  }
getScaffold(string $name, ElementInterface ... $elements)

The documentation for this class was generated from the following file: