ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
FileNamePolicyStack.php
Go to the documentation of this file.
1<?php
2
20
27{
31 protected array $stack = [];
32
33 public function addPolicy(FileNamePolicy $policy): void
34 {
35 $this->stack[] = $policy;
36 }
37
38 public function isValidExtension(string $extension): bool
39 {
40 foreach ($this->stack as $policy) {
41 if (!$policy->isValidExtension($extension)) {
42 return false;
43 }
44 }
45 return true;
46 }
47
48 public function isBlockedExtension(string $extension): bool
49 {
50 foreach ($this->stack as $policy) {
51 if (!$policy->isBlockedExtension($extension)) {
52 return false;
53 }
54 }
55 return true;
56 }
57
58 public function prepareFileNameForConsumer(string $filename_with_extension): string
59 {
60 foreach ($this->stack as $policy) {
61 $filename_with_extension = $policy->prepareFileNameForConsumer($filename_with_extension);
62 }
63 return $filename_with_extension;
64 }
65
66 public function check(string $extension): bool
67 {
68 foreach ($this->stack as $policy) {
69 $policy->check($extension);
70 }
71 return true;
72 }
73}
prepareFileNameForConsumer(string $filename_with_extension)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...