ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
ILIAS\WebDAV\Entity\Factory Class Reference
+ Collaboration diagram for ILIAS\WebDAV\Entity\Factory:

Public Member Functions

 __construct (private RequestTranslation $request_translation, private TreeProxyRepository $proxy_generator,)
 
 getMountPoint ()
 
 get (string $path, ?Container $parent=null)
 
 getProblemInfoFile (Container $container)
 
 createFile (Container $container, string $name, mixed $data=null)
 
 createContainer (Container $container, string $name)
 
 has (Container $container, string $name)
 
 rename (Entity $entity)
 
 delete (Entity $entity)
 
 getChildren (Container $container)
 
 getByFullPath (string $full_path)
 

Private Member Functions

 buildEntity (Proxy $proxy, ?Container $container)
 

Detailed Description

Author
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

Definition at line 36 of file Factory.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\WebDAV\Entity\Factory::__construct ( private RequestTranslation  $request_translation,
private TreeProxyRepository  $proxy_generator 
)

Definition at line 40 of file Factory.php.

43 {
44 }

Member Function Documentation

◆ buildEntity()

ILIAS\WebDAV\Entity\Factory::buildEntity ( Proxy  $proxy,
?Container  $container 
)
private

Definition at line 80 of file Factory.php.

80 : Entity
81 {
82 if ($proxy->getType() === Type::FILE) {
83 return new File(
84 $this,
85 $container?->getFullPath() . '/' . $proxy->getName(),
86 $proxy,
88 );
89 }
90 return new Container(
91 $this,
92 $container?->getFullPath() . '/' . $proxy->getName(),
93 $proxy,
95 );
96 }
$container
@noRector
Definition: wac.php:37

References $container, ILIAS\WebDAV\Objects\Proxy\getName(), and ILIAS\WebDAV\Objects\Proxy\getType().

Referenced by ILIAS\WebDAV\Entity\Factory\get(), and ILIAS\WebDAV\Entity\Factory\getChildren().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createContainer()

ILIAS\WebDAV\Entity\Factory::createContainer ( Container  $container,
string  $name 
)

Definition at line 114 of file Factory.php.

114 : string
115 {
116 $proxy = $this->proxy_generator->createContainer($container, $name);
117 if ($proxy === null || $proxy instanceof NullProxy) {
118 throw new Forbidden("Cannot create container '{$name}' in '{$container->getName()}'");
119 }
120 return $proxy->getName();
121 }

References $container.

◆ createFile()

ILIAS\WebDAV\Entity\Factory::createFile ( Container  $container,
string  $name,
mixed  $data = null 
)

Definition at line 98 of file Factory.php.

98 : ?string
99 {
100 $proxy = $this->proxy_generator->createFile($container, $name);
101 if (!$proxy instanceof FileProxy) {
102 throw new Forbidden("Cannot create file '{$name}' in container '{$container->getName()}'");
103 }
104 $proxy->getStreamHandler()->put($name, $data, !$this->isEmpty($data));
105
106 $entity = $this->get($name, $container);
107 if (!$entity instanceof File) {
108 throw new Forbidden("Created file '{$name}' could not be retrieved");
109 }
110
111 return $entity->getEtag();
112 }

References $container, and $data.

◆ delete()

ILIAS\WebDAV\Entity\Factory::delete ( Entity  $entity)

Definition at line 135 of file Factory.php.

135 : void
136 {
137 if (!$this->proxy_generator->delete($entity)) {
138 throw new Forbidden("Cannot delete '{$entity->getName()}'");
139 }
140 }

◆ get()

ILIAS\WebDAV\Entity\Factory::get ( string  $path,
?Container  $parent = null 
)

Definition at line 59 of file Factory.php.

59 : ?Entity
60 {
61 $proxy = $this->proxy_generator->get($path, $parent);
62 if ($proxy === null || $proxy instanceof NullProxy) {
63 return null;
64 }
65 return $this->buildEntity($proxy, $parent);
66 }
buildEntity(Proxy $proxy, ?Container $container)
Definition: Factory.php:80
$path
Definition: ltiservices.php:30

References $path, and ILIAS\WebDAV\Entity\Factory\buildEntity().

+ Here is the call graph for this function:

◆ getByFullPath()

ILIAS\WebDAV\Entity\Factory::getByFullPath ( string  $full_path)

Definition at line 163 of file Factory.php.

163 : ?Entity
164 {
165 $parts = array_values(array_filter(explode('/', $full_path), static fn(string $p): bool => $p !== ''));
166 if ($parts === []) {
167 return null;
168 }
169
170 $entity = $this->get(array_shift($parts));
171 foreach ($parts as $part) {
172 if (!$entity instanceof Container) {
173 return null;
174 }
175 $entity = $this->get($part, $entity);
176 }
177
178 return $entity;
179 }
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:61

References $parts.

◆ getChildren()

ILIAS\WebDAV\Entity\Factory::getChildren ( Container  $container)

Definition at line 142 of file Factory.php.

142 : array
143 {
144 $entities = [];
145 foreach ($this->proxy_generator->in($container) as $proxy) {
146 if ($proxy === null) {
147 continue;
148 }
149 if ($proxy instanceof NullProxy) {
150 continue;
151 }
152 $entities[] = $this->buildEntity($proxy, $container);
153 }
154
155 $info_file = $this->getProblemInfoFile($container);
156 if ($info_file->hasProblems()) {
157 $entities[] = $info_file;
158 }
159
160 return $entities;
161 }
getProblemInfoFile(Container $container)
Definition: Factory.php:68

References $container, ILIAS\WebDAV\Entity\Factory\buildEntity(), and ILIAS\WebDAV\Entity\Factory\getProblemInfoFile().

+ Here is the call graph for this function:

◆ getMountPoint()

ILIAS\WebDAV\Entity\Factory::getMountPoint ( )

Definition at line 46 of file Factory.php.

46 : ?ICollection
47 {
48 $base_path = $this->request_translation->getRequestedPathAsArray()[0] ?? '';
49 if (empty($base_path)) {
50 return null;
51 }
52
53 return new MountPoint(
54 $this,
55 $base_path
56 );
57 }

◆ getProblemInfoFile()

ILIAS\WebDAV\Entity\Factory::getProblemInfoFile ( Container  $container)

Definition at line 68 of file Factory.php.

68 : ProblemInfoFile
69 {
70 global $DIC;
71 $problems = $this->proxy_generator->analyseProblems($container);
72 return new ProblemInfoFile(
73 $problems['duplicates'],
74 $problems['forbidden'],
75 $problems['info_name_collision'],
76 $DIC->language()
77 );
78 }
global $DIC
Definition: shib_login.php:26

References $container, and $DIC.

Referenced by ILIAS\WebDAV\Entity\Factory\getChildren().

+ Here is the caller graph for this function:

◆ has()

ILIAS\WebDAV\Entity\Factory::has ( Container  $container,
string  $name 
)

Definition at line 123 of file Factory.php.

123 : bool
124 {
125 return $this->proxy_generator->get($name, $container) !== null;
126 }

References $container.

◆ rename()

ILIAS\WebDAV\Entity\Factory::rename ( Entity  $entity)

Definition at line 128 of file Factory.php.

128 : void
129 {
130 if (!$this->proxy_generator->rename($entity)) {
131 throw new Forbidden("Cannot rename '{$entity->getName()}'");
132 }
133 }

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