19 declare(strict_types=1);
    42             $webRelativeWithLeadingDot,
    43             $webRelativeWithoutLeadingDot,
    46             $customizingRelativeWithLeadingDot,
    48             $libsRelativeWithLeadingDot,
    51             $nodeModulesWithLeadingDot
    52         ] = self::listPaths();
    55             self::checkPossiblePath($temp, $absolute_path) => Location::TEMPORARY,
    56             self::checkPossiblePath($web, $absolute_path), self::checkPossiblePath(
    57                 $webRelativeWithLeadingDot,
    59             ), self::checkPossiblePath($webRelativeWithoutLeadingDot, $absolute_path) => Location::WEB,
    60             self::checkPossiblePath($storage, $absolute_path) => Location::STORAGE,
    61             self::checkPossiblePath($customizing, $absolute_path), self::checkPossiblePath(
    62                 $customizingRelativeWithLeadingDot,
    64             ) => Location::CUSTOMIZING,
    65             default => 
throw new \InvalidArgumentException(
    66                 "Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$absolute_path}'"    88             $webRelativeWithLeadingDot,
    89             $webRelativeWithoutLeadingDot,
    92             $customizingRelativeWithLeadingDot,
    94             $libsRelativeWithLeadingDot,
    97             $nodeModulesWithLeadingDot
    98         ] = self::listPaths();
   100         return match (
true) {
   103             self::checkPossiblePath($webRelativeWithLeadingDot, $absolute_path) => 
self::filesystems()->web(),
   104             self::checkPossiblePath($webRelativeWithoutLeadingDot, $absolute_path) => 
self::filesystems()->web(),
   105             self::checkPossiblePath($storage, $absolute_path) => 
self::filesystems()->storage(),
   106             self::checkPossiblePath($customizing, $absolute_path) => 
self::filesystems()->customizing(),
   107             self::checkPossiblePath($customizingRelativeWithLeadingDot, $absolute_path) => 
self::filesystems(
   110             self::checkPossiblePath($libsRelativeWithLeadingDot, $absolute_path) => 
self::filesystems()->libs(),
   111             self::checkPossiblePath($nodeModules, $absolute_path) => 
self::filesystems()->nodeModules(),
   112             self::checkPossiblePath($nodeModulesWithLeadingDot, $absolute_path) => 
self::filesystems()->nodeModules(),
   113             default => 
throw new \InvalidArgumentException(
   114                 "Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$absolute_path}'"   135             $webRelativeWithLeadingDot,
   136             $webRelativeWithoutLeadingDot,
   139             $customizingRelativeWithLeadingDot,
   141             $libsRelativeWithLeadingDot,
   144             $nodeModulesWithLeadingDot
   145         ] = self::listPaths();
   147         return match (
true) {
   148             self::checkPossiblePath($webRelativeWithoutLeadingDot, $absolute_path) => self::resolveRelativePath(
   149                 $webRelativeWithoutLeadingDot,
   152             self::checkPossiblePath($webRelativeWithLeadingDot, $absolute_path) => self::resolveRelativePath(
   153                 $webRelativeWithLeadingDot,
   156             self::checkPossiblePath($web, $absolute_path) => self::resolveRelativePath($web, $absolute_path),
   157             self::checkPossiblePath($temp, $absolute_path) => self::resolveRelativePath($temp, $absolute_path),
   158             self::checkPossiblePath($storage, $absolute_path) => self::resolveRelativePath($storage, $absolute_path),
   159             self::checkPossiblePath($customizing, $absolute_path) => self::resolveRelativePath(
   163             self::checkPossiblePath($customizingRelativeWithLeadingDot, $absolute_path) => self::resolveRelativePath(
   164                 $customizingRelativeWithLeadingDot,
   167             self::checkPossiblePath($libs, $absolute_path), self::checkPossiblePath(
   168                 $libsRelativeWithLeadingDot,
   170             ) => self::resolveRelativePath($libsRelativeWithLeadingDot, $absolute_path),
   171             self::checkPossiblePath($nodeModules, $absolute_path), self::checkPossiblePath(
   172                 $nodeModulesWithLeadingDot,
   174             ) => self::resolveRelativePath($nodeModulesWithLeadingDot, $absolute_path),
   175             default => 
throw new \InvalidArgumentException(
   176                 "Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$absolute_path}'"   183         $real_possible_path = realpath($possible_path);
   185         return match (
true) {
   186             $possible_path === $absolute_path, $real_possible_path === $absolute_path => 
"",
   187             str_starts_with($absolute_path, $possible_path) => substr(
   189                 strlen($possible_path) + 1
   191             str_starts_with($absolute_path, $real_possible_path) => substr(
   193                 strlen($real_possible_path) + 1
   195             default => 
throw new \InvalidArgumentException(
   196                 "Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$absolute_path}'"   203         $real_possible_path = realpath($possible_path);
   205         return match (
true) {
   206             $possible_path === $absolute_path => 
true,
   207             $real_possible_path === $absolute_path => 
true,
   208             is_string($possible_path) && str_starts_with($absolute_path, $possible_path) => 
true,
   209             is_string($real_possible_path) && str_starts_with($absolute_path, $real_possible_path) => 
true,
   223         $customizing = ILIAS_ABSOLUTE_PATH . 
'/public/Customizing';
   224         $customizingRelativeWithLeadingDot = 
'./Customizing';
   225         $libs = ILIAS_ABSOLUTE_PATH . 
'/vendor';
   226         $libsRelativeWithLeadingDot = 
"./vendor";
   228         $nodeModules = ILIAS_ABSOLUTE_PATH . 
'/node_modules';
   229         $nodeModulesWithLeadingDot = 
'./node_modules';
   233             $webRelativeWithLeadingDot,
   234             $webRelativeWithoutLeadingDot,
   237             $customizingRelativeWithLeadingDot,
   239             $libsRelativeWithLeadingDot,
   242             $nodeModulesWithLeadingDot
 static createRelativePath(string $absolute_path)
Creates a relative path from an absolute path which starts with a valid storage location. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static resolveRelativePath(string $possible_path, string $absolute_path)
 
static checkPossiblePath(string $possible_path, string $absolute_path)
 
static filesystems()
Returns the loaded filesystems. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static deriveLocationFrom(string $absolute_path)
 
trait FilesystemsAware
Trait which ease the filesystem integration within legacy ILIAS components. 
 
static deriveFilesystemFrom(string $absolute_path)
Tries to fetch the filesystem responsible for the absolute path. 
 
The legacy path helper provides convenient functions for the integration of the filesystem service wi...