@@ -65,196 +65,196 @@ |
||
| 65 | 65 | final class SearchTemplate implements ISearchTemplate, JsonSerializable { |
| 66 | 66 | |
| 67 | 67 | |
| 68 | - /** @var string */ |
|
| 69 | - private $icon = ''; |
|
| 70 | - |
|
| 71 | - /** @var string */ |
|
| 72 | - private $css = ''; |
|
| 73 | - |
|
| 74 | - /** @var string */ |
|
| 75 | - private $template = ''; |
|
| 76 | - |
|
| 77 | - /** @var SearchOption[] */ |
|
| 78 | - private $panelOptions = []; |
|
| 79 | - |
|
| 80 | - /** @var SearchOption[] */ |
|
| 81 | - private $navigationOptions = []; |
|
| 82 | - |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * ISearchTemplate constructor. |
|
| 86 | - * |
|
| 87 | - * the class of the icon and the css file to be loaded can be set during the |
|
| 88 | - * creation of the object. |
|
| 89 | - * |
|
| 90 | - * @since 15.0.0 |
|
| 91 | - * |
|
| 92 | - * @param string $icon |
|
| 93 | - * @param string $css |
|
| 94 | - */ |
|
| 95 | - public function __construct(string $icon = '', string $css = '') { |
|
| 96 | - $this->icon = $icon; |
|
| 97 | - $this->css = $css; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - |
|
| 101 | - /** |
|
| 102 | - * Set the class of the icon to be displayed in the left panel of the |
|
| 103 | - * FullTextSearch navigation page, in front of the related Content Provider. |
|
| 104 | - * |
|
| 105 | - * @since 15.0.0 |
|
| 106 | - * |
|
| 107 | - * @param string $class |
|
| 108 | - * |
|
| 109 | - * @return ISearchTemplate |
|
| 110 | - */ |
|
| 111 | - public function setIcon(string $class): ISearchTemplate { |
|
| 112 | - $this->icon = $class; |
|
| 113 | - |
|
| 114 | - return $this; |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - /** |
|
| 118 | - * Get the class of the icon. |
|
| 119 | - * |
|
| 120 | - * @since 15.0.0 |
|
| 121 | - * |
|
| 122 | - * @return string |
|
| 123 | - */ |
|
| 124 | - public function getIcon(): string { |
|
| 125 | - return $this->icon; |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - |
|
| 129 | - /** |
|
| 130 | - * Set the path of a CSS file that will be loaded when needed. |
|
| 131 | - * |
|
| 132 | - * @since 15.0.0 |
|
| 133 | - * |
|
| 134 | - * @param string $css |
|
| 135 | - * |
|
| 136 | - * @return ISearchTemplate |
|
| 137 | - */ |
|
| 138 | - public function setCss(string $css): ISearchTemplate { |
|
| 139 | - $this->css = $css; |
|
| 140 | - |
|
| 141 | - return $this; |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - /** |
|
| 145 | - * Get the path of the CSS file. |
|
| 146 | - * |
|
| 147 | - * @since 15.0.0 |
|
| 148 | - * |
|
| 149 | - * @return string |
|
| 150 | - */ |
|
| 151 | - public function getCss(): string { |
|
| 152 | - return $this->css; |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - |
|
| 156 | - /** |
|
| 157 | - * Set the path of the file of a template that the HTML will be displayed |
|
| 158 | - * below the Options. |
|
| 159 | - * This should only be used if your Content Provider needs to set options in |
|
| 160 | - * a way not generated by FullTextSearch |
|
| 161 | - * |
|
| 162 | - * @since 15.0.0 |
|
| 163 | - * |
|
| 164 | - * @param string $template |
|
| 165 | - * |
|
| 166 | - * @return ISearchTemplate |
|
| 167 | - */ |
|
| 168 | - public function setTemplate(string $template): ISearchTemplate { |
|
| 169 | - $this->template = $template; |
|
| 170 | - |
|
| 171 | - return $this; |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - /** |
|
| 175 | - * Get the path of the template file. |
|
| 176 | - * |
|
| 177 | - * @since 15.0.0 |
|
| 178 | - * |
|
| 179 | - * @return string |
|
| 180 | - */ |
|
| 181 | - public function getTemplate(): string { |
|
| 182 | - return $this->template; |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * Add an option in the Panel that is displayed when the user start a search |
|
| 188 | - * within the app that generate the content. |
|
| 189 | - * |
|
| 190 | - * @see ISearchOption |
|
| 191 | - * |
|
| 192 | - * @since 15.0.0 |
|
| 193 | - * |
|
| 194 | - * @param ISearchOption $option |
|
| 195 | - * |
|
| 196 | - * @return ISearchTemplate |
|
| 197 | - */ |
|
| 198 | - public function addPanelOption(ISearchOption $option): ISearchTemplate { |
|
| 199 | - $this->panelOptions[] = $option; |
|
| 200 | - |
|
| 201 | - return $this; |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - /** |
|
| 205 | - * Get all options to be displayed in the Panel. |
|
| 206 | - * |
|
| 207 | - * @since 15.0.0 |
|
| 208 | - * |
|
| 209 | - * @return SearchOption[] |
|
| 210 | - */ |
|
| 211 | - public function getPanelOptions(): array { |
|
| 212 | - return $this->panelOptions; |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - |
|
| 216 | - /** |
|
| 217 | - * Add an option in the left panel of the FullTextSearch navigation page. |
|
| 218 | - * |
|
| 219 | - * @see ISearchOption |
|
| 220 | - * |
|
| 221 | - * @since 15.0.0 |
|
| 222 | - * |
|
| 223 | - * @param ISearchOption $option |
|
| 224 | - * |
|
| 225 | - * @return ISearchTemplate |
|
| 226 | - */ |
|
| 227 | - public function addNavigationOption(ISearchOption $option): ISearchTemplate { |
|
| 228 | - $this->navigationOptions[] = $option; |
|
| 229 | - |
|
| 230 | - return $this; |
|
| 231 | - } |
|
| 232 | - |
|
| 233 | - /** |
|
| 234 | - * Get all options to be displayed in the FullTextSearch navigation page. |
|
| 235 | - * |
|
| 236 | - * @since 15.0.0 |
|
| 237 | - * |
|
| 238 | - * @return array |
|
| 239 | - */ |
|
| 240 | - public function getNavigationOptions(): array { |
|
| 241 | - return $this->navigationOptions; |
|
| 242 | - } |
|
| 243 | - |
|
| 244 | - |
|
| 245 | - /** |
|
| 246 | - * @since 15.0.0 |
|
| 247 | - * |
|
| 248 | - * @return array |
|
| 249 | - */ |
|
| 250 | - public function jsonSerialize(): array { |
|
| 251 | - return [ |
|
| 252 | - 'icon' => $this->getIcon(), |
|
| 253 | - 'css' => $this->getCss(), |
|
| 254 | - 'template' => $this->getTemplate(), |
|
| 255 | - 'panel' => $this->getPanelOptions(), |
|
| 256 | - 'navigation' => $this->getNavigationOptions() |
|
| 257 | - ]; |
|
| 258 | - } |
|
| 68 | + /** @var string */ |
|
| 69 | + private $icon = ''; |
|
| 70 | + |
|
| 71 | + /** @var string */ |
|
| 72 | + private $css = ''; |
|
| 73 | + |
|
| 74 | + /** @var string */ |
|
| 75 | + private $template = ''; |
|
| 76 | + |
|
| 77 | + /** @var SearchOption[] */ |
|
| 78 | + private $panelOptions = []; |
|
| 79 | + |
|
| 80 | + /** @var SearchOption[] */ |
|
| 81 | + private $navigationOptions = []; |
|
| 82 | + |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * ISearchTemplate constructor. |
|
| 86 | + * |
|
| 87 | + * the class of the icon and the css file to be loaded can be set during the |
|
| 88 | + * creation of the object. |
|
| 89 | + * |
|
| 90 | + * @since 15.0.0 |
|
| 91 | + * |
|
| 92 | + * @param string $icon |
|
| 93 | + * @param string $css |
|
| 94 | + */ |
|
| 95 | + public function __construct(string $icon = '', string $css = '') { |
|
| 96 | + $this->icon = $icon; |
|
| 97 | + $this->css = $css; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + |
|
| 101 | + /** |
|
| 102 | + * Set the class of the icon to be displayed in the left panel of the |
|
| 103 | + * FullTextSearch navigation page, in front of the related Content Provider. |
|
| 104 | + * |
|
| 105 | + * @since 15.0.0 |
|
| 106 | + * |
|
| 107 | + * @param string $class |
|
| 108 | + * |
|
| 109 | + * @return ISearchTemplate |
|
| 110 | + */ |
|
| 111 | + public function setIcon(string $class): ISearchTemplate { |
|
| 112 | + $this->icon = $class; |
|
| 113 | + |
|
| 114 | + return $this; |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + /** |
|
| 118 | + * Get the class of the icon. |
|
| 119 | + * |
|
| 120 | + * @since 15.0.0 |
|
| 121 | + * |
|
| 122 | + * @return string |
|
| 123 | + */ |
|
| 124 | + public function getIcon(): string { |
|
| 125 | + return $this->icon; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + |
|
| 129 | + /** |
|
| 130 | + * Set the path of a CSS file that will be loaded when needed. |
|
| 131 | + * |
|
| 132 | + * @since 15.0.0 |
|
| 133 | + * |
|
| 134 | + * @param string $css |
|
| 135 | + * |
|
| 136 | + * @return ISearchTemplate |
|
| 137 | + */ |
|
| 138 | + public function setCss(string $css): ISearchTemplate { |
|
| 139 | + $this->css = $css; |
|
| 140 | + |
|
| 141 | + return $this; |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + /** |
|
| 145 | + * Get the path of the CSS file. |
|
| 146 | + * |
|
| 147 | + * @since 15.0.0 |
|
| 148 | + * |
|
| 149 | + * @return string |
|
| 150 | + */ |
|
| 151 | + public function getCss(): string { |
|
| 152 | + return $this->css; |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + |
|
| 156 | + /** |
|
| 157 | + * Set the path of the file of a template that the HTML will be displayed |
|
| 158 | + * below the Options. |
|
| 159 | + * This should only be used if your Content Provider needs to set options in |
|
| 160 | + * a way not generated by FullTextSearch |
|
| 161 | + * |
|
| 162 | + * @since 15.0.0 |
|
| 163 | + * |
|
| 164 | + * @param string $template |
|
| 165 | + * |
|
| 166 | + * @return ISearchTemplate |
|
| 167 | + */ |
|
| 168 | + public function setTemplate(string $template): ISearchTemplate { |
|
| 169 | + $this->template = $template; |
|
| 170 | + |
|
| 171 | + return $this; |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + /** |
|
| 175 | + * Get the path of the template file. |
|
| 176 | + * |
|
| 177 | + * @since 15.0.0 |
|
| 178 | + * |
|
| 179 | + * @return string |
|
| 180 | + */ |
|
| 181 | + public function getTemplate(): string { |
|
| 182 | + return $this->template; |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * Add an option in the Panel that is displayed when the user start a search |
|
| 188 | + * within the app that generate the content. |
|
| 189 | + * |
|
| 190 | + * @see ISearchOption |
|
| 191 | + * |
|
| 192 | + * @since 15.0.0 |
|
| 193 | + * |
|
| 194 | + * @param ISearchOption $option |
|
| 195 | + * |
|
| 196 | + * @return ISearchTemplate |
|
| 197 | + */ |
|
| 198 | + public function addPanelOption(ISearchOption $option): ISearchTemplate { |
|
| 199 | + $this->panelOptions[] = $option; |
|
| 200 | + |
|
| 201 | + return $this; |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + /** |
|
| 205 | + * Get all options to be displayed in the Panel. |
|
| 206 | + * |
|
| 207 | + * @since 15.0.0 |
|
| 208 | + * |
|
| 209 | + * @return SearchOption[] |
|
| 210 | + */ |
|
| 211 | + public function getPanelOptions(): array { |
|
| 212 | + return $this->panelOptions; |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + |
|
| 216 | + /** |
|
| 217 | + * Add an option in the left panel of the FullTextSearch navigation page. |
|
| 218 | + * |
|
| 219 | + * @see ISearchOption |
|
| 220 | + * |
|
| 221 | + * @since 15.0.0 |
|
| 222 | + * |
|
| 223 | + * @param ISearchOption $option |
|
| 224 | + * |
|
| 225 | + * @return ISearchTemplate |
|
| 226 | + */ |
|
| 227 | + public function addNavigationOption(ISearchOption $option): ISearchTemplate { |
|
| 228 | + $this->navigationOptions[] = $option; |
|
| 229 | + |
|
| 230 | + return $this; |
|
| 231 | + } |
|
| 232 | + |
|
| 233 | + /** |
|
| 234 | + * Get all options to be displayed in the FullTextSearch navigation page. |
|
| 235 | + * |
|
| 236 | + * @since 15.0.0 |
|
| 237 | + * |
|
| 238 | + * @return array |
|
| 239 | + */ |
|
| 240 | + public function getNavigationOptions(): array { |
|
| 241 | + return $this->navigationOptions; |
|
| 242 | + } |
|
| 243 | + |
|
| 244 | + |
|
| 245 | + /** |
|
| 246 | + * @since 15.0.0 |
|
| 247 | + * |
|
| 248 | + * @return array |
|
| 249 | + */ |
|
| 250 | + public function jsonSerialize(): array { |
|
| 251 | + return [ |
|
| 252 | + 'icon' => $this->getIcon(), |
|
| 253 | + 'css' => $this->getCss(), |
|
| 254 | + 'template' => $this->getTemplate(), |
|
| 255 | + 'panel' => $this->getPanelOptions(), |
|
| 256 | + 'navigation' => $this->getNavigationOptions() |
|
| 257 | + ]; |
|
| 258 | + } |
|
| 259 | 259 | } |
| 260 | 260 | |
@@ -58,308 +58,308 @@ |
||
| 58 | 58 | final class DocumentAccess implements IDocumentAccess, JsonSerializable { |
| 59 | 59 | |
| 60 | 60 | |
| 61 | - /** @var string */ |
|
| 62 | - private $ownerId; |
|
| 63 | - |
|
| 64 | - /** @var string */ |
|
| 65 | - private $viewerId = ''; |
|
| 66 | - |
|
| 67 | - /** @var array */ |
|
| 68 | - private $users = []; |
|
| 69 | - |
|
| 70 | - /** @var array */ |
|
| 71 | - private $groups = []; |
|
| 72 | - |
|
| 73 | - /** @var array */ |
|
| 74 | - private $circles = []; |
|
| 75 | - |
|
| 76 | - /** @var array */ |
|
| 77 | - private $links = []; |
|
| 78 | - |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * Owner of the document can be set at the init of the object. |
|
| 82 | - * |
|
| 83 | - * @since 16.0.0 |
|
| 84 | - * |
|
| 85 | - * IDocumentAccess constructor. |
|
| 86 | - * |
|
| 87 | - * @param string $ownerId |
|
| 88 | - */ |
|
| 89 | - public function __construct(string $ownerId = '') { |
|
| 90 | - $this->setOwnerId($ownerId); |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * Set the Owner of the document. |
|
| 96 | - * |
|
| 97 | - * @since 16.0.0 |
|
| 98 | - * |
|
| 99 | - * @param string $ownerId |
|
| 100 | - * |
|
| 101 | - * @return IDocumentAccess |
|
| 102 | - */ |
|
| 103 | - public function setOwnerId(string $ownerId): IDocumentAccess { |
|
| 104 | - $this->ownerId = $ownerId; |
|
| 105 | - |
|
| 106 | - return $this; |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * Get the Owner of the document. |
|
| 111 | - * |
|
| 112 | - * @since 16.0.0 |
|
| 113 | - * |
|
| 114 | - * @return string |
|
| 115 | - */ |
|
| 116 | - public function getOwnerId(): string { |
|
| 117 | - return $this->ownerId; |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * Set the viewer of the document. |
|
| 123 | - * |
|
| 124 | - * @since 16.0.0 |
|
| 125 | - * |
|
| 126 | - * @param string $viewerId |
|
| 127 | - * |
|
| 128 | - * @return IDocumentAccess |
|
| 129 | - */ |
|
| 130 | - public function setViewerId(string $viewerId): IDocumentAccess { |
|
| 131 | - $this->viewerId = $viewerId; |
|
| 132 | - |
|
| 133 | - return $this; |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - /** |
|
| 137 | - * Get the viewer of the document. |
|
| 138 | - * |
|
| 139 | - * @since 16.0.0 |
|
| 140 | - * |
|
| 141 | - * @return string |
|
| 142 | - */ |
|
| 143 | - public function getViewerId(): string { |
|
| 144 | - return $this->viewerId; |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - |
|
| 148 | - /** |
|
| 149 | - * Set the list of users that have read access to the document. |
|
| 150 | - * |
|
| 151 | - * @since 16.0.0 |
|
| 152 | - * |
|
| 153 | - * @param array $users |
|
| 154 | - * |
|
| 155 | - * @return IDocumentAccess |
|
| 156 | - */ |
|
| 157 | - public function setUsers(array $users): IDocumentAccess { |
|
| 158 | - $this->users = $users; |
|
| 159 | - |
|
| 160 | - return $this; |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - /** |
|
| 164 | - * Add an entry to the list of users that have read access to the document. |
|
| 165 | - * |
|
| 166 | - * @since 16.0.0 |
|
| 167 | - * |
|
| 168 | - * @param string $user |
|
| 169 | - * |
|
| 170 | - * @return IDocumentAccess |
|
| 171 | - */ |
|
| 172 | - public function addUser(string $user): IDocumentAccess { |
|
| 173 | - $this->users[] = $user; |
|
| 174 | - |
|
| 175 | - return $this; |
|
| 176 | - } |
|
| 177 | - |
|
| 178 | - /** |
|
| 179 | - * Add multiple entries to the list of users that have read access to the |
|
| 180 | - * document. |
|
| 181 | - * |
|
| 182 | - * @since 16.0.0 |
|
| 183 | - * |
|
| 184 | - * @param array $users |
|
| 185 | - * |
|
| 186 | - * @return IDocumentAccess |
|
| 187 | - */ |
|
| 188 | - public function addUsers($users): IDocumentAccess { |
|
| 189 | - $this->users = array_merge($this->users, $users); |
|
| 190 | - |
|
| 191 | - return $this; |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - /** |
|
| 195 | - * Get the complete list of users that have read access to the document. |
|
| 196 | - * |
|
| 197 | - * @since 16.0.0 |
|
| 198 | - * |
|
| 199 | - * @return array |
|
| 200 | - */ |
|
| 201 | - public function getUsers(): array { |
|
| 202 | - return $this->users; |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - |
|
| 206 | - /** |
|
| 207 | - * Set the list of groups that have read access to the document. |
|
| 208 | - * |
|
| 209 | - * @since 16.0.0 |
|
| 210 | - * |
|
| 211 | - * @param array $groups |
|
| 212 | - * |
|
| 213 | - * @return IDocumentAccess |
|
| 214 | - */ |
|
| 215 | - public function setGroups(array $groups): IDocumentAccess { |
|
| 216 | - $this->groups = $groups; |
|
| 217 | - |
|
| 218 | - return $this; |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - /** |
|
| 222 | - * Add an entry to the list of groups that have read access to the document. |
|
| 223 | - * |
|
| 224 | - * @since 16.0.0 |
|
| 225 | - * |
|
| 226 | - * @param string $group |
|
| 227 | - * |
|
| 228 | - * @return IDocumentAccess |
|
| 229 | - */ |
|
| 230 | - public function addGroup(string $group): IDocumentAccess { |
|
| 231 | - $this->groups[] = $group; |
|
| 232 | - |
|
| 233 | - return $this; |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - /** |
|
| 237 | - * Add multiple entries to the list of groups that have read access to the |
|
| 238 | - * document. |
|
| 239 | - * |
|
| 240 | - * @since 16.0.0 |
|
| 241 | - * |
|
| 242 | - * @param array $groups |
|
| 243 | - * |
|
| 244 | - * @return IDocumentAccess |
|
| 245 | - */ |
|
| 246 | - public function addGroups(array $groups) { |
|
| 247 | - $this->groups = array_merge($this->groups, $groups); |
|
| 248 | - |
|
| 249 | - return $this; |
|
| 250 | - } |
|
| 251 | - |
|
| 252 | - /** |
|
| 253 | - * Get the complete list of groups that have read access to the document. |
|
| 254 | - * |
|
| 255 | - * @since 16.0.0 |
|
| 256 | - * |
|
| 257 | - * @return array |
|
| 258 | - */ |
|
| 259 | - public function getGroups(): array { |
|
| 260 | - return $this->groups; |
|
| 261 | - } |
|
| 262 | - |
|
| 263 | - |
|
| 264 | - /** |
|
| 265 | - * Set the list of circles that have read access to the document. |
|
| 266 | - * |
|
| 267 | - * @since 16.0.0 |
|
| 268 | - * |
|
| 269 | - * @param array $circles |
|
| 270 | - * |
|
| 271 | - * @return IDocumentAccess |
|
| 272 | - */ |
|
| 273 | - public function setCircles(array $circles): IDocumentAccess { |
|
| 274 | - $this->circles = $circles; |
|
| 275 | - |
|
| 276 | - return $this; |
|
| 277 | - } |
|
| 278 | - |
|
| 279 | - /** |
|
| 280 | - * Add an entry to the list of circles that have read access to the document. |
|
| 281 | - * |
|
| 282 | - * @since 16.0.0 |
|
| 283 | - * |
|
| 284 | - * @param string $circle |
|
| 285 | - * |
|
| 286 | - * @return IDocumentAccess |
|
| 287 | - */ |
|
| 288 | - public function addCircle(string $circle): IDocumentAccess { |
|
| 289 | - $this->circles[] = $circle; |
|
| 290 | - |
|
| 291 | - return $this; |
|
| 292 | - } |
|
| 293 | - |
|
| 294 | - /** |
|
| 295 | - * Add multiple entries to the list of groups that have read access to the |
|
| 296 | - * document. |
|
| 297 | - * |
|
| 298 | - * @since 16.0.0 |
|
| 299 | - * |
|
| 300 | - * @param array $circles |
|
| 301 | - * |
|
| 302 | - * @return IDocumentAccess |
|
| 303 | - */ |
|
| 304 | - public function addCircles(array $circles): IDocumentAccess { |
|
| 305 | - $this->circles = array_merge($this->circles, $circles); |
|
| 306 | - |
|
| 307 | - return $this; |
|
| 308 | - } |
|
| 309 | - |
|
| 310 | - /** |
|
| 311 | - * Get the complete list of circles that have read access to the document. |
|
| 312 | - * |
|
| 313 | - * @since 16.0.0 |
|
| 314 | - * |
|
| 315 | - * @return array |
|
| 316 | - */ |
|
| 317 | - public function getCircles(): array { |
|
| 318 | - return $this->circles; |
|
| 319 | - } |
|
| 320 | - |
|
| 321 | - |
|
| 322 | - /** |
|
| 323 | - * Set the list of links that have read access to the document. |
|
| 324 | - * |
|
| 325 | - * @since 16.0.0 |
|
| 326 | - * |
|
| 327 | - * @param array $links |
|
| 328 | - * |
|
| 329 | - * @return IDocumentAccess |
|
| 330 | - */ |
|
| 331 | - public function setLinks(array $links): IDocumentAccess { |
|
| 332 | - $this->links = $links; |
|
| 333 | - |
|
| 334 | - return $this; |
|
| 335 | - } |
|
| 336 | - |
|
| 337 | - /** |
|
| 338 | - * Get the list of links that have read access to the document. |
|
| 339 | - * |
|
| 340 | - * @since 16.0.0 |
|
| 341 | - * |
|
| 342 | - * @return array |
|
| 343 | - */ |
|
| 344 | - public function getLinks(): array { |
|
| 345 | - return $this->links; |
|
| 346 | - } |
|
| 347 | - |
|
| 348 | - |
|
| 349 | - /** |
|
| 350 | - * @since 16.0.0 |
|
| 351 | - * |
|
| 352 | - * @return array |
|
| 353 | - */ |
|
| 354 | - public function jsonSerialize(): array { |
|
| 355 | - return [ |
|
| 356 | - 'ownerId' => $this->getOwnerId(), |
|
| 357 | - 'viewerId' => $this->getViewerId(), |
|
| 358 | - 'users' => $this->getUsers(), |
|
| 359 | - 'groups' => $this->getGroups(), |
|
| 360 | - 'circles' => $this->getCircles(), |
|
| 361 | - 'links' => $this->getLinks() |
|
| 362 | - ]; |
|
| 363 | - } |
|
| 61 | + /** @var string */ |
|
| 62 | + private $ownerId; |
|
| 63 | + |
|
| 64 | + /** @var string */ |
|
| 65 | + private $viewerId = ''; |
|
| 66 | + |
|
| 67 | + /** @var array */ |
|
| 68 | + private $users = []; |
|
| 69 | + |
|
| 70 | + /** @var array */ |
|
| 71 | + private $groups = []; |
|
| 72 | + |
|
| 73 | + /** @var array */ |
|
| 74 | + private $circles = []; |
|
| 75 | + |
|
| 76 | + /** @var array */ |
|
| 77 | + private $links = []; |
|
| 78 | + |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * Owner of the document can be set at the init of the object. |
|
| 82 | + * |
|
| 83 | + * @since 16.0.0 |
|
| 84 | + * |
|
| 85 | + * IDocumentAccess constructor. |
|
| 86 | + * |
|
| 87 | + * @param string $ownerId |
|
| 88 | + */ |
|
| 89 | + public function __construct(string $ownerId = '') { |
|
| 90 | + $this->setOwnerId($ownerId); |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * Set the Owner of the document. |
|
| 96 | + * |
|
| 97 | + * @since 16.0.0 |
|
| 98 | + * |
|
| 99 | + * @param string $ownerId |
|
| 100 | + * |
|
| 101 | + * @return IDocumentAccess |
|
| 102 | + */ |
|
| 103 | + public function setOwnerId(string $ownerId): IDocumentAccess { |
|
| 104 | + $this->ownerId = $ownerId; |
|
| 105 | + |
|
| 106 | + return $this; |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * Get the Owner of the document. |
|
| 111 | + * |
|
| 112 | + * @since 16.0.0 |
|
| 113 | + * |
|
| 114 | + * @return string |
|
| 115 | + */ |
|
| 116 | + public function getOwnerId(): string { |
|
| 117 | + return $this->ownerId; |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * Set the viewer of the document. |
|
| 123 | + * |
|
| 124 | + * @since 16.0.0 |
|
| 125 | + * |
|
| 126 | + * @param string $viewerId |
|
| 127 | + * |
|
| 128 | + * @return IDocumentAccess |
|
| 129 | + */ |
|
| 130 | + public function setViewerId(string $viewerId): IDocumentAccess { |
|
| 131 | + $this->viewerId = $viewerId; |
|
| 132 | + |
|
| 133 | + return $this; |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + /** |
|
| 137 | + * Get the viewer of the document. |
|
| 138 | + * |
|
| 139 | + * @since 16.0.0 |
|
| 140 | + * |
|
| 141 | + * @return string |
|
| 142 | + */ |
|
| 143 | + public function getViewerId(): string { |
|
| 144 | + return $this->viewerId; |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + |
|
| 148 | + /** |
|
| 149 | + * Set the list of users that have read access to the document. |
|
| 150 | + * |
|
| 151 | + * @since 16.0.0 |
|
| 152 | + * |
|
| 153 | + * @param array $users |
|
| 154 | + * |
|
| 155 | + * @return IDocumentAccess |
|
| 156 | + */ |
|
| 157 | + public function setUsers(array $users): IDocumentAccess { |
|
| 158 | + $this->users = $users; |
|
| 159 | + |
|
| 160 | + return $this; |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + /** |
|
| 164 | + * Add an entry to the list of users that have read access to the document. |
|
| 165 | + * |
|
| 166 | + * @since 16.0.0 |
|
| 167 | + * |
|
| 168 | + * @param string $user |
|
| 169 | + * |
|
| 170 | + * @return IDocumentAccess |
|
| 171 | + */ |
|
| 172 | + public function addUser(string $user): IDocumentAccess { |
|
| 173 | + $this->users[] = $user; |
|
| 174 | + |
|
| 175 | + return $this; |
|
| 176 | + } |
|
| 177 | + |
|
| 178 | + /** |
|
| 179 | + * Add multiple entries to the list of users that have read access to the |
|
| 180 | + * document. |
|
| 181 | + * |
|
| 182 | + * @since 16.0.0 |
|
| 183 | + * |
|
| 184 | + * @param array $users |
|
| 185 | + * |
|
| 186 | + * @return IDocumentAccess |
|
| 187 | + */ |
|
| 188 | + public function addUsers($users): IDocumentAccess { |
|
| 189 | + $this->users = array_merge($this->users, $users); |
|
| 190 | + |
|
| 191 | + return $this; |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + /** |
|
| 195 | + * Get the complete list of users that have read access to the document. |
|
| 196 | + * |
|
| 197 | + * @since 16.0.0 |
|
| 198 | + * |
|
| 199 | + * @return array |
|
| 200 | + */ |
|
| 201 | + public function getUsers(): array { |
|
| 202 | + return $this->users; |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + |
|
| 206 | + /** |
|
| 207 | + * Set the list of groups that have read access to the document. |
|
| 208 | + * |
|
| 209 | + * @since 16.0.0 |
|
| 210 | + * |
|
| 211 | + * @param array $groups |
|
| 212 | + * |
|
| 213 | + * @return IDocumentAccess |
|
| 214 | + */ |
|
| 215 | + public function setGroups(array $groups): IDocumentAccess { |
|
| 216 | + $this->groups = $groups; |
|
| 217 | + |
|
| 218 | + return $this; |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + /** |
|
| 222 | + * Add an entry to the list of groups that have read access to the document. |
|
| 223 | + * |
|
| 224 | + * @since 16.0.0 |
|
| 225 | + * |
|
| 226 | + * @param string $group |
|
| 227 | + * |
|
| 228 | + * @return IDocumentAccess |
|
| 229 | + */ |
|
| 230 | + public function addGroup(string $group): IDocumentAccess { |
|
| 231 | + $this->groups[] = $group; |
|
| 232 | + |
|
| 233 | + return $this; |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + /** |
|
| 237 | + * Add multiple entries to the list of groups that have read access to the |
|
| 238 | + * document. |
|
| 239 | + * |
|
| 240 | + * @since 16.0.0 |
|
| 241 | + * |
|
| 242 | + * @param array $groups |
|
| 243 | + * |
|
| 244 | + * @return IDocumentAccess |
|
| 245 | + */ |
|
| 246 | + public function addGroups(array $groups) { |
|
| 247 | + $this->groups = array_merge($this->groups, $groups); |
|
| 248 | + |
|
| 249 | + return $this; |
|
| 250 | + } |
|
| 251 | + |
|
| 252 | + /** |
|
| 253 | + * Get the complete list of groups that have read access to the document. |
|
| 254 | + * |
|
| 255 | + * @since 16.0.0 |
|
| 256 | + * |
|
| 257 | + * @return array |
|
| 258 | + */ |
|
| 259 | + public function getGroups(): array { |
|
| 260 | + return $this->groups; |
|
| 261 | + } |
|
| 262 | + |
|
| 263 | + |
|
| 264 | + /** |
|
| 265 | + * Set the list of circles that have read access to the document. |
|
| 266 | + * |
|
| 267 | + * @since 16.0.0 |
|
| 268 | + * |
|
| 269 | + * @param array $circles |
|
| 270 | + * |
|
| 271 | + * @return IDocumentAccess |
|
| 272 | + */ |
|
| 273 | + public function setCircles(array $circles): IDocumentAccess { |
|
| 274 | + $this->circles = $circles; |
|
| 275 | + |
|
| 276 | + return $this; |
|
| 277 | + } |
|
| 278 | + |
|
| 279 | + /** |
|
| 280 | + * Add an entry to the list of circles that have read access to the document. |
|
| 281 | + * |
|
| 282 | + * @since 16.0.0 |
|
| 283 | + * |
|
| 284 | + * @param string $circle |
|
| 285 | + * |
|
| 286 | + * @return IDocumentAccess |
|
| 287 | + */ |
|
| 288 | + public function addCircle(string $circle): IDocumentAccess { |
|
| 289 | + $this->circles[] = $circle; |
|
| 290 | + |
|
| 291 | + return $this; |
|
| 292 | + } |
|
| 293 | + |
|
| 294 | + /** |
|
| 295 | + * Add multiple entries to the list of groups that have read access to the |
|
| 296 | + * document. |
|
| 297 | + * |
|
| 298 | + * @since 16.0.0 |
|
| 299 | + * |
|
| 300 | + * @param array $circles |
|
| 301 | + * |
|
| 302 | + * @return IDocumentAccess |
|
| 303 | + */ |
|
| 304 | + public function addCircles(array $circles): IDocumentAccess { |
|
| 305 | + $this->circles = array_merge($this->circles, $circles); |
|
| 306 | + |
|
| 307 | + return $this; |
|
| 308 | + } |
|
| 309 | + |
|
| 310 | + /** |
|
| 311 | + * Get the complete list of circles that have read access to the document. |
|
| 312 | + * |
|
| 313 | + * @since 16.0.0 |
|
| 314 | + * |
|
| 315 | + * @return array |
|
| 316 | + */ |
|
| 317 | + public function getCircles(): array { |
|
| 318 | + return $this->circles; |
|
| 319 | + } |
|
| 320 | + |
|
| 321 | + |
|
| 322 | + /** |
|
| 323 | + * Set the list of links that have read access to the document. |
|
| 324 | + * |
|
| 325 | + * @since 16.0.0 |
|
| 326 | + * |
|
| 327 | + * @param array $links |
|
| 328 | + * |
|
| 329 | + * @return IDocumentAccess |
|
| 330 | + */ |
|
| 331 | + public function setLinks(array $links): IDocumentAccess { |
|
| 332 | + $this->links = $links; |
|
| 333 | + |
|
| 334 | + return $this; |
|
| 335 | + } |
|
| 336 | + |
|
| 337 | + /** |
|
| 338 | + * Get the list of links that have read access to the document. |
|
| 339 | + * |
|
| 340 | + * @since 16.0.0 |
|
| 341 | + * |
|
| 342 | + * @return array |
|
| 343 | + */ |
|
| 344 | + public function getLinks(): array { |
|
| 345 | + return $this->links; |
|
| 346 | + } |
|
| 347 | + |
|
| 348 | + |
|
| 349 | + /** |
|
| 350 | + * @since 16.0.0 |
|
| 351 | + * |
|
| 352 | + * @return array |
|
| 353 | + */ |
|
| 354 | + public function jsonSerialize(): array { |
|
| 355 | + return [ |
|
| 356 | + 'ownerId' => $this->getOwnerId(), |
|
| 357 | + 'viewerId' => $this->getViewerId(), |
|
| 358 | + 'users' => $this->getUsers(), |
|
| 359 | + 'groups' => $this->getGroups(), |
|
| 360 | + 'circles' => $this->getCircles(), |
|
| 361 | + 'links' => $this->getLinks() |
|
| 362 | + ]; |
|
| 363 | + } |
|
| 364 | 364 | } |
| 365 | 365 | |