19 declare(strict_types=1);
28 public const REGEXP_SOURCE =
'%^(((\w|.)+(/(\w|.)+)*(\.\w{2,4})?)|(\.htaccess))$%';
38 protected string $source,
39 protected string $target,
41 if (!preg_match(self::REGEXP_SOURCE, $this->source)) {
42 throw new \InvalidArgumentException(
43 "'{$this->source}' is not a valid source path for a public asset." 46 if (!preg_match(self::REGEXP_TARGET, $this->target)) {
47 throw new \InvalidArgumentException(
48 "'{$this->target}' is not a valid target path for a public asset." 55 list($vendor, $component) = explode(
"\\", get_class($this->component));
57 return "components/$vendor/$component/resources/{$this->source}";
62 $source = explode(
"/", $this->source);
63 if ($this->target ===
".") {
64 return array_pop($source);
66 return $this->target .
"/" . array_pop($source);
getSource()
The path of asset relative to the ILIAS base directory.
__construct(protected \ILIAS\Component\Component $component, protected string $source, protected string $target,)
Interface Observer Contains several chained tasks and infos about them.
An public asset is a file or folder that should be served via the web.
getTarget()
The new path of relative to the ILIAS public directory.
An public asset that is a resource of some component.