ILIAS  trunk Revision v11.0_alpha-1753-gb21ca8c4367
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilWebDAVMountInstructionsFactory.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
28 {
29  public function __construct(
31  private RequestInterface $request,
32  private ilObjUser $user
33  ) {
34  }
35 
37  {
38  $uri_builder = new ilWebDAVUriBuilder($this->request);
39  $uri = $this->request->getUri()->getPath();
40 
41  $splitted_uri = explode('/', $uri);
42 
43  // Remove path elements before and until webdav script
44  while (array_shift($splitted_uri) !== 'webdav.php' && $splitted_uri !== []) {
45  ;
46  }
47 
48  $path_value = $splitted_uri[1] ?? '';
49 
50  if (strlen($path_value) === 2) {
52  $this->repo,
53  $uri_builder,
54  new ilSetting(),
55  $path_value
56  );
57  }
58 
59  if (str_starts_with($path_value, 'ref_')) {
61  $this->repo,
62  $uri_builder,
63  new ilSetting(),
64  $this->user->getLanguage(),
65  (int) substr($path_value, 4)
66  );
67  }
68 
69  throw new InvalidArgumentException("Invalid path given");
70  }
71 }
__construct(private ilWebDAVMountInstructionsRepositoryImpl $repo, private RequestInterface $request, private ilObjUser $user)