ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
LinkProvider.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
30
32{
33 protected LinkFactory $link_factory;
34 protected PathFactory $path_factory;
35
36 public function __construct(
37 LinkFactory $link_factory,
38 PathFactory $path_factory
39 ) {
40 $this->link_factory = $link_factory;
41 $this->path_factory = $path_factory;
42 }
43
44 public function create(
45 PathInterface $base_path,
46 ElementInterface $to_be_created
47 ): URI {
48 return $this->getLink(
49 $base_path,
50 $this->path_factory->toElement($to_be_created, true),
51 Command::CREATE_FULL
52 );
53 }
54
55 public function update(
56 PathInterface $base_path,
57 ElementInterface $to_be_updated
58 ): URI {
59 return $this->getLink(
60 $base_path,
61 $this->path_factory->toElement($to_be_updated, true),
62 Command::UPDATE_FULL
63 );
64 }
65
66 public function delete(
67 PathInterface $base_path,
68 ElementInterface $to_be_deleted
69 ): URI {
70 return $this->getLink(
71 $base_path,
72 $this->path_factory->toElement($to_be_deleted, true),
73 Command::DELETE_FULL
74 );
75 }
76
77 protected function getLink(
78 PathInterface $base_path,
79 PathInterface $action_path,
80 Command $action_cmd
81 ): URI {
82 return $this->link_factory
83 ->custom($action_cmd)
84 ->withParameter(Parameter::BASE_PATH, $base_path->toString())
85 ->withParameter(Parameter::ACTION_PATH, $action_path->toString())
86 ->get();
87 }
88}
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
create(PathInterface $base_path, ElementInterface $to_be_created)
update(PathInterface $base_path, ElementInterface $to_be_updated)
getLink(PathInterface $base_path, PathInterface $action_path, Command $action_cmd)
__construct(LinkFactory $link_factory, PathFactory $path_factory)
return true
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
get(string $class_name)