@@ -33,22 +33,22 @@ |
||
33 | 33 | * @since 18.0.0 |
34 | 34 | */ |
35 | 35 | class RegisterOperationsEvent extends Event { |
36 | - /** @var IManager */ |
|
37 | - private $manager; |
|
36 | + /** @var IManager */ |
|
37 | + private $manager; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @since 18.0.0 |
|
41 | - */ |
|
42 | - public function __construct(IManager $manager) { |
|
43 | - parent::__construct(); |
|
39 | + /** |
|
40 | + * @since 18.0.0 |
|
41 | + */ |
|
42 | + public function __construct(IManager $manager) { |
|
43 | + parent::__construct(); |
|
44 | 44 | |
45 | - $this->manager = $manager; |
|
46 | - } |
|
45 | + $this->manager = $manager; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @since 18.0.0 |
|
50 | - */ |
|
51 | - public function registerOperation(IOperation $operation): void { |
|
52 | - $this->manager->registerOperation($operation); |
|
53 | - } |
|
48 | + /** |
|
49 | + * @since 18.0.0 |
|
50 | + */ |
|
51 | + public function registerOperation(IOperation $operation): void { |
|
52 | + $this->manager->registerOperation($operation); |
|
53 | + } |
|
54 | 54 | } |
@@ -39,45 +39,45 @@ |
||
39 | 39 | * @since 18.0.0 |
40 | 40 | */ |
41 | 41 | interface IEntity { |
42 | - /** |
|
43 | - * returns a translated name to be presented in the web interface. |
|
44 | - * |
|
45 | - * Example: "File" (en), "Dosiero" (eo) |
|
46 | - * |
|
47 | - * @since 18.0.0 |
|
48 | - */ |
|
49 | - public function getName(): string; |
|
42 | + /** |
|
43 | + * returns a translated name to be presented in the web interface. |
|
44 | + * |
|
45 | + * Example: "File" (en), "Dosiero" (eo) |
|
46 | + * |
|
47 | + * @since 18.0.0 |
|
48 | + */ |
|
49 | + public function getName(): string; |
|
50 | 50 | |
51 | - /** |
|
52 | - * returns the URL to the icon of the entity for display in the web interface. |
|
53 | - * |
|
54 | - * Usually, the implementation would utilize the `imagePath()` method of the |
|
55 | - * `\OCP\IURLGenerator` instance and simply return its result. |
|
56 | - * |
|
57 | - * Example implementation: return $this->urlGenerator->imagePath('myApp', 'cat.svg'); |
|
58 | - * |
|
59 | - * @since 18.0.0 |
|
60 | - */ |
|
61 | - public function getIcon(): string; |
|
51 | + /** |
|
52 | + * returns the URL to the icon of the entity for display in the web interface. |
|
53 | + * |
|
54 | + * Usually, the implementation would utilize the `imagePath()` method of the |
|
55 | + * `\OCP\IURLGenerator` instance and simply return its result. |
|
56 | + * |
|
57 | + * Example implementation: return $this->urlGenerator->imagePath('myApp', 'cat.svg'); |
|
58 | + * |
|
59 | + * @since 18.0.0 |
|
60 | + */ |
|
61 | + public function getIcon(): string; |
|
62 | 62 | |
63 | - /** |
|
64 | - * returns a list of supported events |
|
65 | - * |
|
66 | - * @return IEntityEvent[] |
|
67 | - * @since 18.0.0 |
|
68 | - */ |
|
69 | - public function getEvents(): array; |
|
63 | + /** |
|
64 | + * returns a list of supported events |
|
65 | + * |
|
66 | + * @return IEntityEvent[] |
|
67 | + * @since 18.0.0 |
|
68 | + */ |
|
69 | + public function getEvents(): array; |
|
70 | 70 | |
71 | - /** |
|
72 | - * @since 18.0.0 |
|
73 | - */ |
|
74 | - public function prepareRuleMatcher(IRuleMatcher $ruleMatcher, string $eventName, Event $event): void; |
|
71 | + /** |
|
72 | + * @since 18.0.0 |
|
73 | + */ |
|
74 | + public function prepareRuleMatcher(IRuleMatcher $ruleMatcher, string $eventName, Event $event): void; |
|
75 | 75 | |
76 | - /** |
|
77 | - * returns whether the provided user id is allowed to run a flow against |
|
78 | - * the known context |
|
79 | - * |
|
80 | - * @since 18.0.0 |
|
81 | - */ |
|
82 | - public function isLegitimatedForUserId(string $userId): bool; |
|
76 | + /** |
|
77 | + * returns whether the provided user id is allowed to run a flow against |
|
78 | + * the known context |
|
79 | + * |
|
80 | + * @since 18.0.0 |
|
81 | + */ |
|
82 | + public function isLegitimatedForUserId(string $userId): bool; |
|
83 | 83 | } |
@@ -34,47 +34,47 @@ |
||
34 | 34 | * @since 18.0.0 |
35 | 35 | */ |
36 | 36 | class GenericEntityEvent implements IEntityEvent { |
37 | - /** @var string */ |
|
38 | - private $displayName; |
|
39 | - /** @var string */ |
|
40 | - private $eventName; |
|
37 | + /** @var string */ |
|
38 | + private $displayName; |
|
39 | + /** @var string */ |
|
40 | + private $eventName; |
|
41 | 41 | |
42 | - /** |
|
43 | - * GenericEntityEvent constructor. |
|
44 | - * |
|
45 | - * @since 18.0.0 |
|
46 | - */ |
|
47 | - public function __construct(string $displayName, string $eventName) { |
|
48 | - if (trim($displayName) === '') { |
|
49 | - throw new \InvalidArgumentException('DisplayName must not be empty'); |
|
50 | - } |
|
51 | - if (trim($eventName) === '') { |
|
52 | - throw new \InvalidArgumentException('EventName must not be empty'); |
|
53 | - } |
|
42 | + /** |
|
43 | + * GenericEntityEvent constructor. |
|
44 | + * |
|
45 | + * @since 18.0.0 |
|
46 | + */ |
|
47 | + public function __construct(string $displayName, string $eventName) { |
|
48 | + if (trim($displayName) === '') { |
|
49 | + throw new \InvalidArgumentException('DisplayName must not be empty'); |
|
50 | + } |
|
51 | + if (trim($eventName) === '') { |
|
52 | + throw new \InvalidArgumentException('EventName must not be empty'); |
|
53 | + } |
|
54 | 54 | |
55 | - $this->displayName = trim($displayName); |
|
56 | - $this->eventName = trim($eventName); |
|
57 | - } |
|
55 | + $this->displayName = trim($displayName); |
|
56 | + $this->eventName = trim($eventName); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * returns a translated name to be presented in the web interface. |
|
61 | - * |
|
62 | - * Example: "created" (en), "kreita" (eo) |
|
63 | - * |
|
64 | - * @since 18.0.0 |
|
65 | - */ |
|
66 | - public function getDisplayName(): string { |
|
67 | - return $this->displayName; |
|
68 | - } |
|
59 | + /** |
|
60 | + * returns a translated name to be presented in the web interface. |
|
61 | + * |
|
62 | + * Example: "created" (en), "kreita" (eo) |
|
63 | + * |
|
64 | + * @since 18.0.0 |
|
65 | + */ |
|
66 | + public function getDisplayName(): string { |
|
67 | + return $this->displayName; |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * returns the event name that is emitted by the EventDispatcher, e.g.: |
|
72 | - * |
|
73 | - * Example: "OCA\MyApp\Factory\Cats::postCreated" |
|
74 | - * |
|
75 | - * @since 18.0.0 |
|
76 | - */ |
|
77 | - public function getEventName(): string { |
|
78 | - return $this->eventName; |
|
79 | - } |
|
70 | + /** |
|
71 | + * returns the event name that is emitted by the EventDispatcher, e.g.: |
|
72 | + * |
|
73 | + * Example: "OCA\MyApp\Factory\Cats::postCreated" |
|
74 | + * |
|
75 | + * @since 18.0.0 |
|
76 | + */ |
|
77 | + public function getEventName(): string { |
|
78 | + return $this->eventName; |
|
79 | + } |
|
80 | 80 | } |
@@ -32,30 +32,30 @@ |
||
32 | 32 | * @since 16.0.0 |
33 | 33 | */ |
34 | 34 | interface IProvider { |
35 | - /** |
|
36 | - * Get the resource type of the provider |
|
37 | - * |
|
38 | - * @return string |
|
39 | - * @since 16.0.0 |
|
40 | - */ |
|
41 | - public function getType(): string; |
|
35 | + /** |
|
36 | + * Get the resource type of the provider |
|
37 | + * |
|
38 | + * @return string |
|
39 | + * @since 16.0.0 |
|
40 | + */ |
|
41 | + public function getType(): string; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Get the rich object data of a resource |
|
45 | - * |
|
46 | - * @param IResource $resource |
|
47 | - * @return array |
|
48 | - * @since 16.0.0 |
|
49 | - */ |
|
50 | - public function getResourceRichObject(IResource $resource): array; |
|
43 | + /** |
|
44 | + * Get the rich object data of a resource |
|
45 | + * |
|
46 | + * @param IResource $resource |
|
47 | + * @return array |
|
48 | + * @since 16.0.0 |
|
49 | + */ |
|
50 | + public function getResourceRichObject(IResource $resource): array; |
|
51 | 51 | |
52 | - /** |
|
53 | - * Can a user/guest access the collection |
|
54 | - * |
|
55 | - * @param IResource $resource |
|
56 | - * @param IUser|null $user |
|
57 | - * @return bool |
|
58 | - * @since 16.0.0 |
|
59 | - */ |
|
60 | - public function canAccessResource(IResource $resource, ?IUser $user): bool; |
|
52 | + /** |
|
53 | + * Can a user/guest access the collection |
|
54 | + * |
|
55 | + * @param IResource $resource |
|
56 | + * @param IUser|null $user |
|
57 | + * @return bool |
|
58 | + * @since 16.0.0 |
|
59 | + */ |
|
60 | + public function canAccessResource(IResource $resource, ?IUser $user): bool; |
|
61 | 61 | } |
@@ -33,94 +33,94 @@ |
||
33 | 33 | * @since 16.0.0 |
34 | 34 | */ |
35 | 35 | interface IManager extends IProvider { |
36 | - /** |
|
37 | - * @param int $id |
|
38 | - * @return ICollection |
|
39 | - * @throws CollectionException when the collection could not be found |
|
40 | - * @since 16.0.0 |
|
41 | - */ |
|
42 | - public function getCollection(int $id): ICollection; |
|
36 | + /** |
|
37 | + * @param int $id |
|
38 | + * @return ICollection |
|
39 | + * @throws CollectionException when the collection could not be found |
|
40 | + * @since 16.0.0 |
|
41 | + */ |
|
42 | + public function getCollection(int $id): ICollection; |
|
43 | 43 | |
44 | - /** |
|
45 | - * @param int $id |
|
46 | - * @param IUser|null $user |
|
47 | - * @return ICollection |
|
48 | - * @throws CollectionException when the collection could not be found |
|
49 | - * @since 16.0.0 |
|
50 | - */ |
|
51 | - public function getCollectionForUser(int $id, ?IUser $user): ICollection; |
|
44 | + /** |
|
45 | + * @param int $id |
|
46 | + * @param IUser|null $user |
|
47 | + * @return ICollection |
|
48 | + * @throws CollectionException when the collection could not be found |
|
49 | + * @since 16.0.0 |
|
50 | + */ |
|
51 | + public function getCollectionForUser(int $id, ?IUser $user): ICollection; |
|
52 | 52 | |
53 | - /** |
|
54 | - * @param string $name |
|
55 | - * @return ICollection |
|
56 | - * @since 16.0.0 |
|
57 | - */ |
|
58 | - public function newCollection(string $name): ICollection; |
|
53 | + /** |
|
54 | + * @param string $name |
|
55 | + * @return ICollection |
|
56 | + * @since 16.0.0 |
|
57 | + */ |
|
58 | + public function newCollection(string $name): ICollection; |
|
59 | 59 | |
60 | - /** |
|
61 | - * Can a user/guest access the collection |
|
62 | - * |
|
63 | - * @param ICollection $collection |
|
64 | - * @param IUser|null $user |
|
65 | - * @return bool |
|
66 | - * @since 16.0.0 |
|
67 | - */ |
|
68 | - public function canAccessCollection(ICollection $collection, ?IUser $user): bool; |
|
60 | + /** |
|
61 | + * Can a user/guest access the collection |
|
62 | + * |
|
63 | + * @param ICollection $collection |
|
64 | + * @param IUser|null $user |
|
65 | + * @return bool |
|
66 | + * @since 16.0.0 |
|
67 | + */ |
|
68 | + public function canAccessCollection(ICollection $collection, ?IUser $user): bool; |
|
69 | 69 | |
70 | - /** |
|
71 | - * @param IUser|null $user |
|
72 | - * @since 16.0.0 |
|
73 | - */ |
|
74 | - public function invalidateAccessCacheForUser(?IUser $user): void; |
|
70 | + /** |
|
71 | + * @param IUser|null $user |
|
72 | + * @since 16.0.0 |
|
73 | + */ |
|
74 | + public function invalidateAccessCacheForUser(?IUser $user): void; |
|
75 | 75 | |
76 | - /** |
|
77 | - * @param IResource $resource |
|
78 | - * @since 16.0.0 |
|
79 | - */ |
|
80 | - public function invalidateAccessCacheForResource(IResource $resource): void; |
|
76 | + /** |
|
77 | + * @param IResource $resource |
|
78 | + * @since 16.0.0 |
|
79 | + */ |
|
80 | + public function invalidateAccessCacheForResource(IResource $resource): void; |
|
81 | 81 | |
82 | - /** |
|
83 | - * @param IResource $resource |
|
84 | - * @param IUser|null $user |
|
85 | - * @since 16.0.0 |
|
86 | - */ |
|
87 | - public function invalidateAccessCacheForResourceByUser(IResource $resource, ?IUser $user): void; |
|
82 | + /** |
|
83 | + * @param IResource $resource |
|
84 | + * @param IUser|null $user |
|
85 | + * @since 16.0.0 |
|
86 | + */ |
|
87 | + public function invalidateAccessCacheForResourceByUser(IResource $resource, ?IUser $user): void; |
|
88 | 88 | |
89 | - /** |
|
90 | - * @param IProvider $provider |
|
91 | - * @since 16.0.0 |
|
92 | - */ |
|
93 | - public function invalidateAccessCacheForProvider(IProvider $provider): void; |
|
89 | + /** |
|
90 | + * @param IProvider $provider |
|
91 | + * @since 16.0.0 |
|
92 | + */ |
|
93 | + public function invalidateAccessCacheForProvider(IProvider $provider): void; |
|
94 | 94 | |
95 | - /** |
|
96 | - * @param IProvider $provider |
|
97 | - * @param IUser|null $user |
|
98 | - * @since 16.0.0 |
|
99 | - */ |
|
100 | - public function invalidateAccessCacheForProviderByUser(IProvider $provider, ?IUser $user): void; |
|
95 | + /** |
|
96 | + * @param IProvider $provider |
|
97 | + * @param IUser|null $user |
|
98 | + * @since 16.0.0 |
|
99 | + */ |
|
100 | + public function invalidateAccessCacheForProviderByUser(IProvider $provider, ?IUser $user): void; |
|
101 | 101 | |
102 | - /** |
|
103 | - * @param string $type |
|
104 | - * @param string $id |
|
105 | - * @return IResource |
|
106 | - * @since 16.0.0 |
|
107 | - */ |
|
108 | - public function createResource(string $type, string $id): IResource; |
|
102 | + /** |
|
103 | + * @param string $type |
|
104 | + * @param string $id |
|
105 | + * @return IResource |
|
106 | + * @since 16.0.0 |
|
107 | + */ |
|
108 | + public function createResource(string $type, string $id): IResource; |
|
109 | 109 | |
110 | - /** |
|
111 | - * @param string $type |
|
112 | - * @param string $id |
|
113 | - * @param IUser|null $user |
|
114 | - * @return IResource |
|
115 | - * @throws ResourceException |
|
116 | - * @since 16.0.0 |
|
117 | - */ |
|
118 | - public function getResourceForUser(string $type, string $id, ?IUser $user): IResource; |
|
110 | + /** |
|
111 | + * @param string $type |
|
112 | + * @param string $id |
|
113 | + * @param IUser|null $user |
|
114 | + * @return IResource |
|
115 | + * @throws ResourceException |
|
116 | + * @since 16.0.0 |
|
117 | + */ |
|
118 | + public function getResourceForUser(string $type, string $id, ?IUser $user): IResource; |
|
119 | 119 | |
120 | - /** |
|
121 | - * @param string $provider |
|
122 | - * @since 16.0.0 |
|
123 | - * @deprecated 18.0.0 Use IProviderManager::registerResourceProvider instead |
|
124 | - */ |
|
125 | - public function registerResourceProvider(string $provider): void; |
|
120 | + /** |
|
121 | + * @param string $provider |
|
122 | + * @since 16.0.0 |
|
123 | + * @deprecated 18.0.0 Use IProviderManager::registerResourceProvider instead |
|
124 | + */ |
|
125 | + public function registerResourceProvider(string $provider): void; |
|
126 | 126 | } |
@@ -31,53 +31,53 @@ |
||
31 | 31 | * @since 16.0.0 |
32 | 32 | */ |
33 | 33 | interface ICollection { |
34 | - /** |
|
35 | - * @return int |
|
36 | - * @since 16.0.0 |
|
37 | - */ |
|
38 | - public function getId(): int; |
|
34 | + /** |
|
35 | + * @return int |
|
36 | + * @since 16.0.0 |
|
37 | + */ |
|
38 | + public function getId(): int; |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string |
|
42 | - * @since 16.0.0 |
|
43 | - */ |
|
44 | - public function getName(): string; |
|
40 | + /** |
|
41 | + * @return string |
|
42 | + * @since 16.0.0 |
|
43 | + */ |
|
44 | + public function getName(): string; |
|
45 | 45 | |
46 | - /** |
|
47 | - * @param string $name |
|
48 | - * @since 16.0.0 |
|
49 | - */ |
|
50 | - public function setName(string $name): void; |
|
46 | + /** |
|
47 | + * @param string $name |
|
48 | + * @since 16.0.0 |
|
49 | + */ |
|
50 | + public function setName(string $name): void; |
|
51 | 51 | |
52 | - /** |
|
53 | - * @return IResource[] |
|
54 | - * @since 16.0.0 |
|
55 | - */ |
|
56 | - public function getResources(): array; |
|
52 | + /** |
|
53 | + * @return IResource[] |
|
54 | + * @since 16.0.0 |
|
55 | + */ |
|
56 | + public function getResources(): array; |
|
57 | 57 | |
58 | - /** |
|
59 | - * Adds a resource to a collection |
|
60 | - * |
|
61 | - * @param IResource $resource |
|
62 | - * @throws ResourceException when the resource is already part of the collection |
|
63 | - * @since 16.0.0 |
|
64 | - */ |
|
65 | - public function addResource(IResource $resource): void; |
|
58 | + /** |
|
59 | + * Adds a resource to a collection |
|
60 | + * |
|
61 | + * @param IResource $resource |
|
62 | + * @throws ResourceException when the resource is already part of the collection |
|
63 | + * @since 16.0.0 |
|
64 | + */ |
|
65 | + public function addResource(IResource $resource): void; |
|
66 | 66 | |
67 | - /** |
|
68 | - * Removes a resource from a collection |
|
69 | - * |
|
70 | - * @param IResource $resource |
|
71 | - * @since 16.0.0 |
|
72 | - */ |
|
73 | - public function removeResource(IResource $resource): void; |
|
67 | + /** |
|
68 | + * Removes a resource from a collection |
|
69 | + * |
|
70 | + * @param IResource $resource |
|
71 | + * @since 16.0.0 |
|
72 | + */ |
|
73 | + public function removeResource(IResource $resource): void; |
|
74 | 74 | |
75 | - /** |
|
76 | - * Can a user/guest access the collection |
|
77 | - * |
|
78 | - * @param IUser|null $user |
|
79 | - * @return bool |
|
80 | - * @since 16.0.0 |
|
81 | - */ |
|
82 | - public function canAccess(?IUser $user): bool; |
|
75 | + /** |
|
76 | + * Can a user/guest access the collection |
|
77 | + * |
|
78 | + * @param IUser|null $user |
|
79 | + * @return bool |
|
80 | + * @since 16.0.0 |
|
81 | + */ |
|
82 | + public function canAccess(?IUser $user): bool; |
|
83 | 83 | } |
@@ -29,15 +29,15 @@ |
||
29 | 29 | * @since 18.0.0 |
30 | 30 | */ |
31 | 31 | interface IProviderManager { |
32 | - /** |
|
33 | - * @return IProvider[] list of resource providers |
|
34 | - * @since 18.0.0 |
|
35 | - */ |
|
36 | - public function getResourceProviders(): array; |
|
32 | + /** |
|
33 | + * @return IProvider[] list of resource providers |
|
34 | + * @since 18.0.0 |
|
35 | + */ |
|
36 | + public function getResourceProviders(): array; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @param string $provider provider's class name |
|
40 | - * @since 18.0.0 |
|
41 | - */ |
|
42 | - public function registerResourceProvider(string $provider): void; |
|
38 | + /** |
|
39 | + * @param string $provider provider's class name |
|
40 | + * @since 18.0.0 |
|
41 | + */ |
|
42 | + public function registerResourceProvider(string $provider): void; |
|
43 | 43 | } |
@@ -29,22 +29,22 @@ |
||
29 | 29 | * @since 21.0.0 |
30 | 30 | */ |
31 | 31 | abstract class InitialStateProvider implements \JsonSerializable { |
32 | - /** |
|
33 | - * @since 21.0.0 |
|
34 | - */ |
|
35 | - abstract public function getKey(): string; |
|
32 | + /** |
|
33 | + * @since 21.0.0 |
|
34 | + */ |
|
35 | + abstract public function getKey(): string; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @since 21.0.0 |
|
39 | - */ |
|
40 | - abstract public function getData(); |
|
37 | + /** |
|
38 | + * @since 21.0.0 |
|
39 | + */ |
|
40 | + abstract public function getData(); |
|
41 | 41 | |
42 | - /** |
|
43 | - * @since 21.0.0 |
|
44 | - * @return mixed |
|
45 | - */ |
|
46 | - #[\ReturnTypeWillChange] |
|
47 | - final public function jsonSerialize() { |
|
48 | - return $this->getData(); |
|
49 | - } |
|
42 | + /** |
|
43 | + * @since 21.0.0 |
|
44 | + * @return mixed |
|
45 | + */ |
|
46 | + #[\ReturnTypeWillChange] |
|
47 | + final public function jsonSerialize() { |
|
48 | + return $this->getData(); |
|
49 | + } |
|
50 | 50 | } |
@@ -36,147 +36,147 @@ |
||
36 | 36 | * @since 17.0.0 |
37 | 37 | */ |
38 | 38 | class EmptyFeaturePolicy { |
39 | - /** @var string[] of allowed domains to autoplay media */ |
|
40 | - protected $autoplayDomains = null; |
|
41 | - |
|
42 | - /** @var string[] of allowed domains that can access the camera */ |
|
43 | - protected $cameraDomains = null; |
|
44 | - |
|
45 | - /** @var string[] of allowed domains that can use fullscreen */ |
|
46 | - protected $fullscreenDomains = null; |
|
47 | - |
|
48 | - /** @var string[] of allowed domains that can use the geolocation of the device */ |
|
49 | - protected $geolocationDomains = null; |
|
50 | - |
|
51 | - /** @var string[] of allowed domains that can use the microphone */ |
|
52 | - protected $microphoneDomains = null; |
|
53 | - |
|
54 | - /** @var string[] of allowed domains that can use the payment API */ |
|
55 | - protected $paymentDomains = null; |
|
56 | - |
|
57 | - /** |
|
58 | - * Allows to use autoplay from a specific domain. Use * to allow from all domains. |
|
59 | - * |
|
60 | - * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. |
|
61 | - * @return $this |
|
62 | - * @since 17.0.0 |
|
63 | - */ |
|
64 | - public function addAllowedAutoplayDomain(string $domain): self { |
|
65 | - $this->autoplayDomains[] = $domain; |
|
66 | - return $this; |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * Allows to use the camera on a specific domain. Use * to allow from all domains |
|
71 | - * |
|
72 | - * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. |
|
73 | - * @return $this |
|
74 | - * @since 17.0.0 |
|
75 | - */ |
|
76 | - public function addAllowedCameraDomain(string $domain): self { |
|
77 | - $this->cameraDomains[] = $domain; |
|
78 | - return $this; |
|
79 | - } |
|
80 | - |
|
81 | - /** |
|
82 | - * Allows the full screen functionality to be used on a specific domain. Use * to allow from all domains |
|
83 | - * |
|
84 | - * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. |
|
85 | - * @return $this |
|
86 | - * @since 17.0.0 |
|
87 | - */ |
|
88 | - public function addAllowedFullScreenDomain(string $domain): self { |
|
89 | - $this->fullscreenDomains[] = $domain; |
|
90 | - return $this; |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * Allows to use the geolocation on a specific domain. Use * to allow from all domains |
|
95 | - * |
|
96 | - * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. |
|
97 | - * @return $this |
|
98 | - * @since 17.0.0 |
|
99 | - */ |
|
100 | - public function addAllowedGeoLocationDomain(string $domain): self { |
|
101 | - $this->geolocationDomains[] = $domain; |
|
102 | - return $this; |
|
103 | - } |
|
104 | - |
|
105 | - /** |
|
106 | - * Allows to use the microphone on a specific domain. Use * to allow from all domains |
|
107 | - * |
|
108 | - * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. |
|
109 | - * @return $this |
|
110 | - * @since 17.0.0 |
|
111 | - */ |
|
112 | - public function addAllowedMicrophoneDomain(string $domain): self { |
|
113 | - $this->microphoneDomains[] = $domain; |
|
114 | - return $this; |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
118 | - * Allows to use the payment API on a specific domain. Use * to allow from all domains |
|
119 | - * |
|
120 | - * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. |
|
121 | - * @return $this |
|
122 | - * @since 17.0.0 |
|
123 | - */ |
|
124 | - public function addAllowedPaymentDomain(string $domain): self { |
|
125 | - $this->paymentDomains[] = $domain; |
|
126 | - return $this; |
|
127 | - } |
|
128 | - |
|
129 | - /** |
|
130 | - * Get the generated Feature-Policy as a string |
|
131 | - * |
|
132 | - * @return string |
|
133 | - * @since 17.0.0 |
|
134 | - */ |
|
135 | - public function buildPolicy(): string { |
|
136 | - $policy = ''; |
|
137 | - |
|
138 | - if (empty($this->autoplayDomains)) { |
|
139 | - $policy .= "autoplay 'none';"; |
|
140 | - } else { |
|
141 | - $policy .= 'autoplay ' . implode(' ', $this->autoplayDomains); |
|
142 | - $policy .= ';'; |
|
143 | - } |
|
144 | - |
|
145 | - if (empty($this->cameraDomains)) { |
|
146 | - $policy .= "camera 'none';"; |
|
147 | - } else { |
|
148 | - $policy .= 'camera ' . implode(' ', $this->cameraDomains); |
|
149 | - $policy .= ';'; |
|
150 | - } |
|
151 | - |
|
152 | - if (empty($this->fullscreenDomains)) { |
|
153 | - $policy .= "fullscreen 'none';"; |
|
154 | - } else { |
|
155 | - $policy .= 'fullscreen ' . implode(' ', $this->fullscreenDomains); |
|
156 | - $policy .= ';'; |
|
157 | - } |
|
158 | - |
|
159 | - if (empty($this->geolocationDomains)) { |
|
160 | - $policy .= "geolocation 'none';"; |
|
161 | - } else { |
|
162 | - $policy .= 'geolocation ' . implode(' ', $this->geolocationDomains); |
|
163 | - $policy .= ';'; |
|
164 | - } |
|
165 | - |
|
166 | - if (empty($this->microphoneDomains)) { |
|
167 | - $policy .= "microphone 'none';"; |
|
168 | - } else { |
|
169 | - $policy .= 'microphone ' . implode(' ', $this->microphoneDomains); |
|
170 | - $policy .= ';'; |
|
171 | - } |
|
172 | - |
|
173 | - if (empty($this->paymentDomains)) { |
|
174 | - $policy .= "payment 'none';"; |
|
175 | - } else { |
|
176 | - $policy .= 'payment ' . implode(' ', $this->paymentDomains); |
|
177 | - $policy .= ';'; |
|
178 | - } |
|
179 | - |
|
180 | - return rtrim($policy, ';'); |
|
181 | - } |
|
39 | + /** @var string[] of allowed domains to autoplay media */ |
|
40 | + protected $autoplayDomains = null; |
|
41 | + |
|
42 | + /** @var string[] of allowed domains that can access the camera */ |
|
43 | + protected $cameraDomains = null; |
|
44 | + |
|
45 | + /** @var string[] of allowed domains that can use fullscreen */ |
|
46 | + protected $fullscreenDomains = null; |
|
47 | + |
|
48 | + /** @var string[] of allowed domains that can use the geolocation of the device */ |
|
49 | + protected $geolocationDomains = null; |
|
50 | + |
|
51 | + /** @var string[] of allowed domains that can use the microphone */ |
|
52 | + protected $microphoneDomains = null; |
|
53 | + |
|
54 | + /** @var string[] of allowed domains that can use the payment API */ |
|
55 | + protected $paymentDomains = null; |
|
56 | + |
|
57 | + /** |
|
58 | + * Allows to use autoplay from a specific domain. Use * to allow from all domains. |
|
59 | + * |
|
60 | + * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. |
|
61 | + * @return $this |
|
62 | + * @since 17.0.0 |
|
63 | + */ |
|
64 | + public function addAllowedAutoplayDomain(string $domain): self { |
|
65 | + $this->autoplayDomains[] = $domain; |
|
66 | + return $this; |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * Allows to use the camera on a specific domain. Use * to allow from all domains |
|
71 | + * |
|
72 | + * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. |
|
73 | + * @return $this |
|
74 | + * @since 17.0.0 |
|
75 | + */ |
|
76 | + public function addAllowedCameraDomain(string $domain): self { |
|
77 | + $this->cameraDomains[] = $domain; |
|
78 | + return $this; |
|
79 | + } |
|
80 | + |
|
81 | + /** |
|
82 | + * Allows the full screen functionality to be used on a specific domain. Use * to allow from all domains |
|
83 | + * |
|
84 | + * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. |
|
85 | + * @return $this |
|
86 | + * @since 17.0.0 |
|
87 | + */ |
|
88 | + public function addAllowedFullScreenDomain(string $domain): self { |
|
89 | + $this->fullscreenDomains[] = $domain; |
|
90 | + return $this; |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * Allows to use the geolocation on a specific domain. Use * to allow from all domains |
|
95 | + * |
|
96 | + * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. |
|
97 | + * @return $this |
|
98 | + * @since 17.0.0 |
|
99 | + */ |
|
100 | + public function addAllowedGeoLocationDomain(string $domain): self { |
|
101 | + $this->geolocationDomains[] = $domain; |
|
102 | + return $this; |
|
103 | + } |
|
104 | + |
|
105 | + /** |
|
106 | + * Allows to use the microphone on a specific domain. Use * to allow from all domains |
|
107 | + * |
|
108 | + * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. |
|
109 | + * @return $this |
|
110 | + * @since 17.0.0 |
|
111 | + */ |
|
112 | + public function addAllowedMicrophoneDomain(string $domain): self { |
|
113 | + $this->microphoneDomains[] = $domain; |
|
114 | + return $this; |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * Allows to use the payment API on a specific domain. Use * to allow from all domains |
|
119 | + * |
|
120 | + * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. |
|
121 | + * @return $this |
|
122 | + * @since 17.0.0 |
|
123 | + */ |
|
124 | + public function addAllowedPaymentDomain(string $domain): self { |
|
125 | + $this->paymentDomains[] = $domain; |
|
126 | + return $this; |
|
127 | + } |
|
128 | + |
|
129 | + /** |
|
130 | + * Get the generated Feature-Policy as a string |
|
131 | + * |
|
132 | + * @return string |
|
133 | + * @since 17.0.0 |
|
134 | + */ |
|
135 | + public function buildPolicy(): string { |
|
136 | + $policy = ''; |
|
137 | + |
|
138 | + if (empty($this->autoplayDomains)) { |
|
139 | + $policy .= "autoplay 'none';"; |
|
140 | + } else { |
|
141 | + $policy .= 'autoplay ' . implode(' ', $this->autoplayDomains); |
|
142 | + $policy .= ';'; |
|
143 | + } |
|
144 | + |
|
145 | + if (empty($this->cameraDomains)) { |
|
146 | + $policy .= "camera 'none';"; |
|
147 | + } else { |
|
148 | + $policy .= 'camera ' . implode(' ', $this->cameraDomains); |
|
149 | + $policy .= ';'; |
|
150 | + } |
|
151 | + |
|
152 | + if (empty($this->fullscreenDomains)) { |
|
153 | + $policy .= "fullscreen 'none';"; |
|
154 | + } else { |
|
155 | + $policy .= 'fullscreen ' . implode(' ', $this->fullscreenDomains); |
|
156 | + $policy .= ';'; |
|
157 | + } |
|
158 | + |
|
159 | + if (empty($this->geolocationDomains)) { |
|
160 | + $policy .= "geolocation 'none';"; |
|
161 | + } else { |
|
162 | + $policy .= 'geolocation ' . implode(' ', $this->geolocationDomains); |
|
163 | + $policy .= ';'; |
|
164 | + } |
|
165 | + |
|
166 | + if (empty($this->microphoneDomains)) { |
|
167 | + $policy .= "microphone 'none';"; |
|
168 | + } else { |
|
169 | + $policy .= 'microphone ' . implode(' ', $this->microphoneDomains); |
|
170 | + $policy .= ';'; |
|
171 | + } |
|
172 | + |
|
173 | + if (empty($this->paymentDomains)) { |
|
174 | + $policy .= "payment 'none';"; |
|
175 | + } else { |
|
176 | + $policy .= 'payment ' . implode(' ', $this->paymentDomains); |
|
177 | + $policy .= ';'; |
|
178 | + } |
|
179 | + |
|
180 | + return rtrim($policy, ';'); |
|
181 | + } |
|
182 | 182 | } |