@@ -34,21 +34,21 @@ |
||
34 | 34 | class TimeFactory implements ITimeFactory { |
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * @return int the result of a call to time() |
|
39 | - */ |
|
40 | - public function getTime(): int { |
|
41 | - return time(); |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * @param string $time |
|
46 | - * @param \DateTimeZone $timezone |
|
47 | - * @return \DateTime |
|
48 | - * @since 15.0.0 |
|
49 | - */ |
|
50 | - public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime { |
|
51 | - return new \DateTime($time, $timezone); |
|
52 | - } |
|
37 | + /** |
|
38 | + * @return int the result of a call to time() |
|
39 | + */ |
|
40 | + public function getTime(): int { |
|
41 | + return time(); |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * @param string $time |
|
46 | + * @param \DateTimeZone $timezone |
|
47 | + * @return \DateTime |
|
48 | + * @since 15.0.0 |
|
49 | + */ |
|
50 | + public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime { |
|
51 | + return new \DateTime($time, $timezone); |
|
52 | + } |
|
53 | 53 | |
54 | 54 | } |
@@ -46,103 +46,103 @@ |
||
46 | 46 | class DashboardManager implements IDashboardManager { |
47 | 47 | |
48 | 48 | |
49 | - /** @var IWidgetsService */ |
|
50 | - private $widgetsService; |
|
51 | - |
|
52 | - /** @var IEventsService */ |
|
53 | - private $eventsService; |
|
54 | - |
|
55 | - |
|
56 | - /** |
|
57 | - * @param IEventsService $eventsService |
|
58 | - */ |
|
59 | - public function registerEventsService(IEventsService $eventsService) { |
|
60 | - $this->eventsService = $eventsService; |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - /** |
|
65 | - * @param IWidgetsService $widgetsService |
|
66 | - */ |
|
67 | - public function registerWidgetsService(IWidgetsService $widgetsService) { |
|
68 | - $this->widgetsService = $widgetsService; |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - /** |
|
73 | - * @param string $widgetId |
|
74 | - * @param string $userId |
|
75 | - * |
|
76 | - * @return IWidgetConfig |
|
77 | - * @throws DashboardAppNotAvailableException |
|
78 | - */ |
|
79 | - public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig { |
|
80 | - return $this->getWidgetsService()->getWidgetConfig($widgetId, $userId); |
|
81 | - } |
|
82 | - |
|
83 | - |
|
84 | - /** |
|
85 | - * @param string $widgetId |
|
86 | - * @param array $users |
|
87 | - * @param array $payload |
|
88 | - * @param string $uniqueId |
|
89 | - * |
|
90 | - * @throws DashboardAppNotAvailableException |
|
91 | - */ |
|
92 | - public function createUsersEvent(string $widgetId, array $users, array $payload, string $uniqueId = '') { |
|
93 | - $this->getEventsService()->createUsersEvent($widgetId, $users, $payload, $uniqueId); |
|
94 | - } |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * @param string $widgetId |
|
99 | - * @param array $groups |
|
100 | - * @param array $payload |
|
101 | - * @param string $uniqueId |
|
102 | - * |
|
103 | - * @throws DashboardAppNotAvailableException |
|
104 | - */ |
|
105 | - public function createGroupsEvent(string $widgetId, array $groups, array $payload, string $uniqueId = '') { |
|
106 | - $this->getEventsService()->createGroupsEvent($widgetId, $groups, $payload, $uniqueId); |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * @param string $widgetId |
|
112 | - * @param array $payload |
|
113 | - * @param string $uniqueId |
|
114 | - * |
|
115 | - * @throws DashboardAppNotAvailableException |
|
116 | - */ |
|
117 | - public function createGlobalEvent(string $widgetId, array $payload, string $uniqueId = '') { |
|
118 | - $this->getEventsService()->createGlobalEvent($widgetId, $payload, $uniqueId); |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * @return IWidgetsService |
|
124 | - * @throws DashboardAppNotAvailableException |
|
125 | - */ |
|
126 | - private function getWidgetsService() { |
|
127 | - if ($this->widgetsService === null) { |
|
128 | - throw new DashboardAppNotAvailableException('No IWidgetsService registered'); |
|
129 | - } |
|
130 | - |
|
131 | - return $this->widgetsService; |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - /** |
|
136 | - * @return IEventsService |
|
137 | - * @throws DashboardAppNotAvailableException |
|
138 | - */ |
|
139 | - private function getEventsService() { |
|
140 | - if ($this->eventsService === null) { |
|
141 | - throw new DashboardAppNotAvailableException('No IEventsService registered'); |
|
142 | - } |
|
143 | - |
|
144 | - return $this->eventsService; |
|
145 | - } |
|
49 | + /** @var IWidgetsService */ |
|
50 | + private $widgetsService; |
|
51 | + |
|
52 | + /** @var IEventsService */ |
|
53 | + private $eventsService; |
|
54 | + |
|
55 | + |
|
56 | + /** |
|
57 | + * @param IEventsService $eventsService |
|
58 | + */ |
|
59 | + public function registerEventsService(IEventsService $eventsService) { |
|
60 | + $this->eventsService = $eventsService; |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + /** |
|
65 | + * @param IWidgetsService $widgetsService |
|
66 | + */ |
|
67 | + public function registerWidgetsService(IWidgetsService $widgetsService) { |
|
68 | + $this->widgetsService = $widgetsService; |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + /** |
|
73 | + * @param string $widgetId |
|
74 | + * @param string $userId |
|
75 | + * |
|
76 | + * @return IWidgetConfig |
|
77 | + * @throws DashboardAppNotAvailableException |
|
78 | + */ |
|
79 | + public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig { |
|
80 | + return $this->getWidgetsService()->getWidgetConfig($widgetId, $userId); |
|
81 | + } |
|
82 | + |
|
83 | + |
|
84 | + /** |
|
85 | + * @param string $widgetId |
|
86 | + * @param array $users |
|
87 | + * @param array $payload |
|
88 | + * @param string $uniqueId |
|
89 | + * |
|
90 | + * @throws DashboardAppNotAvailableException |
|
91 | + */ |
|
92 | + public function createUsersEvent(string $widgetId, array $users, array $payload, string $uniqueId = '') { |
|
93 | + $this->getEventsService()->createUsersEvent($widgetId, $users, $payload, $uniqueId); |
|
94 | + } |
|
95 | + |
|
96 | + |
|
97 | + /** |
|
98 | + * @param string $widgetId |
|
99 | + * @param array $groups |
|
100 | + * @param array $payload |
|
101 | + * @param string $uniqueId |
|
102 | + * |
|
103 | + * @throws DashboardAppNotAvailableException |
|
104 | + */ |
|
105 | + public function createGroupsEvent(string $widgetId, array $groups, array $payload, string $uniqueId = '') { |
|
106 | + $this->getEventsService()->createGroupsEvent($widgetId, $groups, $payload, $uniqueId); |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * @param string $widgetId |
|
112 | + * @param array $payload |
|
113 | + * @param string $uniqueId |
|
114 | + * |
|
115 | + * @throws DashboardAppNotAvailableException |
|
116 | + */ |
|
117 | + public function createGlobalEvent(string $widgetId, array $payload, string $uniqueId = '') { |
|
118 | + $this->getEventsService()->createGlobalEvent($widgetId, $payload, $uniqueId); |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * @return IWidgetsService |
|
124 | + * @throws DashboardAppNotAvailableException |
|
125 | + */ |
|
126 | + private function getWidgetsService() { |
|
127 | + if ($this->widgetsService === null) { |
|
128 | + throw new DashboardAppNotAvailableException('No IWidgetsService registered'); |
|
129 | + } |
|
130 | + |
|
131 | + return $this->widgetsService; |
|
132 | + } |
|
133 | + |
|
134 | + |
|
135 | + /** |
|
136 | + * @return IEventsService |
|
137 | + * @throws DashboardAppNotAvailableException |
|
138 | + */ |
|
139 | + private function getEventsService() { |
|
140 | + if ($this->eventsService === null) { |
|
141 | + throw new DashboardAppNotAvailableException('No IEventsService registered'); |
|
142 | + } |
|
143 | + |
|
144 | + return $this->eventsService; |
|
145 | + } |
|
146 | 146 | |
147 | 147 | } |
148 | 148 |
@@ -34,71 +34,71 @@ |
||
34 | 34 | */ |
35 | 35 | interface IAccountProperty extends \JsonSerializable { |
36 | 36 | |
37 | - /** |
|
38 | - * Set the value of a property |
|
39 | - * |
|
40 | - * @since 15.0.0 |
|
41 | - * |
|
42 | - * @param string $value |
|
43 | - * @return IAccountProperty |
|
44 | - */ |
|
45 | - public function setValue(string $value): IAccountProperty; |
|
37 | + /** |
|
38 | + * Set the value of a property |
|
39 | + * |
|
40 | + * @since 15.0.0 |
|
41 | + * |
|
42 | + * @param string $value |
|
43 | + * @return IAccountProperty |
|
44 | + */ |
|
45 | + public function setValue(string $value): IAccountProperty; |
|
46 | 46 | |
47 | - /** |
|
48 | - * Set the scope of a property |
|
49 | - * |
|
50 | - * @since 15.0.0 |
|
51 | - * |
|
52 | - * @param string $scope |
|
53 | - * @return IAccountProperty |
|
54 | - */ |
|
55 | - public function setScope(string $scope): IAccountProperty; |
|
47 | + /** |
|
48 | + * Set the scope of a property |
|
49 | + * |
|
50 | + * @since 15.0.0 |
|
51 | + * |
|
52 | + * @param string $scope |
|
53 | + * @return IAccountProperty |
|
54 | + */ |
|
55 | + public function setScope(string $scope): IAccountProperty; |
|
56 | 56 | |
57 | - /** |
|
58 | - * Set the verification status of a property |
|
59 | - * |
|
60 | - * @since 15.0.0 |
|
61 | - * |
|
62 | - * @param string $verified |
|
63 | - * @return IAccountProperty |
|
64 | - */ |
|
65 | - public function setVerified(string $verified): IAccountProperty; |
|
57 | + /** |
|
58 | + * Set the verification status of a property |
|
59 | + * |
|
60 | + * @since 15.0.0 |
|
61 | + * |
|
62 | + * @param string $verified |
|
63 | + * @return IAccountProperty |
|
64 | + */ |
|
65 | + public function setVerified(string $verified): IAccountProperty; |
|
66 | 66 | |
67 | - /** |
|
68 | - * Get the name of a property |
|
69 | - * |
|
70 | - * @since 15.0.0 |
|
71 | - * |
|
72 | - * @return string |
|
73 | - */ |
|
74 | - public function getName(): string; |
|
67 | + /** |
|
68 | + * Get the name of a property |
|
69 | + * |
|
70 | + * @since 15.0.0 |
|
71 | + * |
|
72 | + * @return string |
|
73 | + */ |
|
74 | + public function getName(): string; |
|
75 | 75 | |
76 | - /** |
|
77 | - * Get the value of a property |
|
78 | - * |
|
79 | - * @since 15.0.0 |
|
80 | - * |
|
81 | - * @return string |
|
82 | - */ |
|
83 | - public function getValue(): string; |
|
76 | + /** |
|
77 | + * Get the value of a property |
|
78 | + * |
|
79 | + * @since 15.0.0 |
|
80 | + * |
|
81 | + * @return string |
|
82 | + */ |
|
83 | + public function getValue(): string; |
|
84 | 84 | |
85 | - /** |
|
86 | - * Get the scope of a property |
|
87 | - * |
|
88 | - * @since 15.0.0 |
|
89 | - * |
|
90 | - * @return string |
|
91 | - */ |
|
92 | - public function getScope(): string; |
|
85 | + /** |
|
86 | + * Get the scope of a property |
|
87 | + * |
|
88 | + * @since 15.0.0 |
|
89 | + * |
|
90 | + * @return string |
|
91 | + */ |
|
92 | + public function getScope(): string; |
|
93 | 93 | |
94 | - /** |
|
95 | - * Get the verification status of a property |
|
96 | - * |
|
97 | - * @since 15.0.0 |
|
98 | - * |
|
99 | - * @return string |
|
100 | - */ |
|
101 | - public function getVerified(): string; |
|
94 | + /** |
|
95 | + * Get the verification status of a property |
|
96 | + * |
|
97 | + * @since 15.0.0 |
|
98 | + * |
|
99 | + * @return string |
|
100 | + */ |
|
101 | + public function getVerified(): string; |
|
102 | 102 | |
103 | 103 | } |
104 | 104 |
@@ -30,111 +30,111 @@ |
||
30 | 30 | |
31 | 31 | class AccountProperty implements IAccountProperty { |
32 | 32 | |
33 | - /** @var string */ |
|
34 | - private $name; |
|
35 | - /** @var string */ |
|
36 | - private $value; |
|
37 | - /** @var string */ |
|
38 | - private $scope; |
|
39 | - /** @var string */ |
|
40 | - private $verified; |
|
33 | + /** @var string */ |
|
34 | + private $name; |
|
35 | + /** @var string */ |
|
36 | + private $value; |
|
37 | + /** @var string */ |
|
38 | + private $scope; |
|
39 | + /** @var string */ |
|
40 | + private $verified; |
|
41 | 41 | |
42 | - public function __construct(string $name, string $value, string $scope, string $verified) { |
|
43 | - $this->name = $name; |
|
44 | - $this->value = $value; |
|
45 | - $this->scope = $scope; |
|
46 | - $this->verified = $verified; |
|
47 | - } |
|
42 | + public function __construct(string $name, string $value, string $scope, string $verified) { |
|
43 | + $this->name = $name; |
|
44 | + $this->value = $value; |
|
45 | + $this->scope = $scope; |
|
46 | + $this->verified = $verified; |
|
47 | + } |
|
48 | 48 | |
49 | - public function jsonSerialize() { |
|
50 | - return [ |
|
51 | - 'name' => $this->getName(), |
|
52 | - 'value' => $this->getValue(), |
|
53 | - 'scope' => $this->getScope(), |
|
54 | - 'verified' => $this->getVerified() |
|
55 | - ]; |
|
56 | - } |
|
49 | + public function jsonSerialize() { |
|
50 | + return [ |
|
51 | + 'name' => $this->getName(), |
|
52 | + 'value' => $this->getValue(), |
|
53 | + 'scope' => $this->getScope(), |
|
54 | + 'verified' => $this->getVerified() |
|
55 | + ]; |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * Set the value of a property |
|
60 | - * |
|
61 | - * @since 15.0.0 |
|
62 | - * |
|
63 | - * @param string $value |
|
64 | - * @return IAccountProperty |
|
65 | - */ |
|
66 | - public function setValue(string $value): IAccountProperty { |
|
67 | - $this->value = $value; |
|
68 | - return $this; |
|
69 | - } |
|
58 | + /** |
|
59 | + * Set the value of a property |
|
60 | + * |
|
61 | + * @since 15.0.0 |
|
62 | + * |
|
63 | + * @param string $value |
|
64 | + * @return IAccountProperty |
|
65 | + */ |
|
66 | + public function setValue(string $value): IAccountProperty { |
|
67 | + $this->value = $value; |
|
68 | + return $this; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * Set the scope of a property |
|
73 | - * |
|
74 | - * @since 15.0.0 |
|
75 | - * |
|
76 | - * @param string $scope |
|
77 | - * @return IAccountProperty |
|
78 | - */ |
|
79 | - public function setScope(string $scope): IAccountProperty { |
|
80 | - $this->scope = $scope; |
|
81 | - return $this; |
|
82 | - } |
|
71 | + /** |
|
72 | + * Set the scope of a property |
|
73 | + * |
|
74 | + * @since 15.0.0 |
|
75 | + * |
|
76 | + * @param string $scope |
|
77 | + * @return IAccountProperty |
|
78 | + */ |
|
79 | + public function setScope(string $scope): IAccountProperty { |
|
80 | + $this->scope = $scope; |
|
81 | + return $this; |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * Set the verification status of a property |
|
86 | - * |
|
87 | - * @since 15.0.0 |
|
88 | - * |
|
89 | - * @param string $verified |
|
90 | - * @return IAccountProperty |
|
91 | - */ |
|
92 | - public function setVerified(string $verified): IAccountProperty { |
|
93 | - $this->verified = $verified; |
|
94 | - return $this; |
|
95 | - } |
|
84 | + /** |
|
85 | + * Set the verification status of a property |
|
86 | + * |
|
87 | + * @since 15.0.0 |
|
88 | + * |
|
89 | + * @param string $verified |
|
90 | + * @return IAccountProperty |
|
91 | + */ |
|
92 | + public function setVerified(string $verified): IAccountProperty { |
|
93 | + $this->verified = $verified; |
|
94 | + return $this; |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * Get the name of a property |
|
99 | - * |
|
100 | - * @since 15.0.0 |
|
101 | - * |
|
102 | - * @return string |
|
103 | - */ |
|
104 | - public function getName(): string { |
|
105 | - return $this->name; |
|
106 | - } |
|
97 | + /** |
|
98 | + * Get the name of a property |
|
99 | + * |
|
100 | + * @since 15.0.0 |
|
101 | + * |
|
102 | + * @return string |
|
103 | + */ |
|
104 | + public function getName(): string { |
|
105 | + return $this->name; |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * Get the value of a property |
|
110 | - * |
|
111 | - * @since 15.0.0 |
|
112 | - * |
|
113 | - * @return string |
|
114 | - */ |
|
115 | - public function getValue(): string { |
|
116 | - return $this->value; |
|
117 | - } |
|
108 | + /** |
|
109 | + * Get the value of a property |
|
110 | + * |
|
111 | + * @since 15.0.0 |
|
112 | + * |
|
113 | + * @return string |
|
114 | + */ |
|
115 | + public function getValue(): string { |
|
116 | + return $this->value; |
|
117 | + } |
|
118 | 118 | |
119 | - /** |
|
120 | - * Get the scope of a property |
|
121 | - * |
|
122 | - * @since 15.0.0 |
|
123 | - * |
|
124 | - * @return string |
|
125 | - */ |
|
126 | - public function getScope(): string { |
|
127 | - return $this->scope; |
|
128 | - } |
|
119 | + /** |
|
120 | + * Get the scope of a property |
|
121 | + * |
|
122 | + * @since 15.0.0 |
|
123 | + * |
|
124 | + * @return string |
|
125 | + */ |
|
126 | + public function getScope(): string { |
|
127 | + return $this->scope; |
|
128 | + } |
|
129 | 129 | |
130 | - /** |
|
131 | - * Get the verification status of a property |
|
132 | - * |
|
133 | - * @since 15.0.0 |
|
134 | - * |
|
135 | - * @return string |
|
136 | - */ |
|
137 | - public function getVerified(): string { |
|
138 | - return $this->verified; |
|
139 | - } |
|
130 | + /** |
|
131 | + * Get the verification status of a property |
|
132 | + * |
|
133 | + * @since 15.0.0 |
|
134 | + * |
|
135 | + * @return string |
|
136 | + */ |
|
137 | + public function getVerified(): string { |
|
138 | + return $this->verified; |
|
139 | + } |
|
140 | 140 | } |
@@ -33,16 +33,16 @@ |
||
33 | 33 | */ |
34 | 34 | abstract class QueuedJob extends Job { |
35 | 35 | |
36 | - /** |
|
37 | - * run the job, then remove it from the joblist |
|
38 | - * |
|
39 | - * @param IJobList $jobList |
|
40 | - * @param ILogger|null $logger |
|
41 | - * |
|
42 | - * @since 15.0.0 |
|
43 | - */ |
|
44 | - final public function execute($jobList, ILogger $logger = null) { |
|
45 | - $jobList->remove($this, $this->argument); |
|
46 | - parent::execute($jobList, $logger); |
|
47 | - } |
|
36 | + /** |
|
37 | + * run the job, then remove it from the joblist |
|
38 | + * |
|
39 | + * @param IJobList $jobList |
|
40 | + * @param ILogger|null $logger |
|
41 | + * |
|
42 | + * @since 15.0.0 |
|
43 | + */ |
|
44 | + final public function execute($jobList, ILogger $logger = null) { |
|
45 | + $jobList->remove($this, $this->argument); |
|
46 | + parent::execute($jobList, $logger); |
|
47 | + } |
|
48 | 48 | } |
@@ -34,29 +34,29 @@ |
||
34 | 34 | * @since 15.0.0 |
35 | 35 | */ |
36 | 36 | abstract class TimedJob extends Job { |
37 | - /** @var int */ |
|
38 | - protected $interval = 0; |
|
37 | + /** @var int */ |
|
38 | + protected $interval = 0; |
|
39 | 39 | |
40 | - /** |
|
41 | - * set the interval for the job |
|
42 | - * |
|
43 | - * @since 15.0.0 |
|
44 | - */ |
|
45 | - public function setInterval(int $interval) { |
|
46 | - $this->interval = $interval; |
|
47 | - } |
|
40 | + /** |
|
41 | + * set the interval for the job |
|
42 | + * |
|
43 | + * @since 15.0.0 |
|
44 | + */ |
|
45 | + public function setInterval(int $interval) { |
|
46 | + $this->interval = $interval; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * run the job if the last run is is more than the interval ago |
|
51 | - * |
|
52 | - * @param JobList $jobList |
|
53 | - * @param ILogger|null $logger |
|
54 | - * |
|
55 | - * @since 15.0.0 |
|
56 | - */ |
|
57 | - final public function execute($jobList, ILogger $logger = null) { |
|
58 | - if (($this->time->getTime() - $this->lastRun) > $this->interval) { |
|
59 | - parent::execute($jobList, $logger); |
|
60 | - } |
|
61 | - } |
|
49 | + /** |
|
50 | + * run the job if the last run is is more than the interval ago |
|
51 | + * |
|
52 | + * @param JobList $jobList |
|
53 | + * @param ILogger|null $logger |
|
54 | + * |
|
55 | + * @since 15.0.0 |
|
56 | + */ |
|
57 | + final public function execute($jobList, ILogger $logger = null) { |
|
58 | + if (($this->time->getTime() - $this->lastRun) > $this->interval) { |
|
59 | + parent::execute($jobList, $logger); |
|
60 | + } |
|
61 | + } |
|
62 | 62 | } |
@@ -24,33 +24,33 @@ |
||
24 | 24 | use OCP\IUser; |
25 | 25 | |
26 | 26 | interface ITrashManager extends ITrashBackend { |
27 | - /** |
|
28 | - * Add a backend for the trashbin |
|
29 | - * |
|
30 | - * @param string $storageType |
|
31 | - * @param ITrashBackend $backend |
|
32 | - * @since 15.0.0 |
|
33 | - */ |
|
34 | - public function registerBackend(string $storageType, ITrashBackend $backend); |
|
27 | + /** |
|
28 | + * Add a backend for the trashbin |
|
29 | + * |
|
30 | + * @param string $storageType |
|
31 | + * @param ITrashBackend $backend |
|
32 | + * @since 15.0.0 |
|
33 | + */ |
|
34 | + public function registerBackend(string $storageType, ITrashBackend $backend); |
|
35 | 35 | |
36 | - /** |
|
37 | - * List all trash items in the root of the trashbin |
|
38 | - * |
|
39 | - * @param IUser $user |
|
40 | - * @return ITrashItem[] |
|
41 | - * @since 15.0.0 |
|
42 | - */ |
|
43 | - public function listTrashRoot(IUser $user): array; |
|
36 | + /** |
|
37 | + * List all trash items in the root of the trashbin |
|
38 | + * |
|
39 | + * @param IUser $user |
|
40 | + * @return ITrashItem[] |
|
41 | + * @since 15.0.0 |
|
42 | + */ |
|
43 | + public function listTrashRoot(IUser $user): array; |
|
44 | 44 | |
45 | - /** |
|
46 | - * Temporally prevent files from being moved to the trash |
|
47 | - * |
|
48 | - * @since 15.0.0 |
|
49 | - */ |
|
50 | - public function pauseTrash(); |
|
45 | + /** |
|
46 | + * Temporally prevent files from being moved to the trash |
|
47 | + * |
|
48 | + * @since 15.0.0 |
|
49 | + */ |
|
50 | + public function pauseTrash(); |
|
51 | 51 | |
52 | - /** |
|
53 | - * @since 15.0.0 |
|
54 | - */ |
|
55 | - public function resumeTrash(); |
|
52 | + /** |
|
53 | + * @since 15.0.0 |
|
54 | + */ |
|
55 | + public function resumeTrash(); |
|
56 | 56 | } |
@@ -31,54 +31,54 @@ |
||
31 | 31 | * @since 15.0.0 |
32 | 32 | */ |
33 | 33 | interface ITrashBackend { |
34 | - /** |
|
35 | - * List all trash items in the root of the trashbin |
|
36 | - * |
|
37 | - * @param IUser $user |
|
38 | - * @return ITrashItem[] |
|
39 | - * @since 15.0.0 |
|
40 | - */ |
|
41 | - public function listTrashRoot(IUser $user): array; |
|
34 | + /** |
|
35 | + * List all trash items in the root of the trashbin |
|
36 | + * |
|
37 | + * @param IUser $user |
|
38 | + * @return ITrashItem[] |
|
39 | + * @since 15.0.0 |
|
40 | + */ |
|
41 | + public function listTrashRoot(IUser $user): array; |
|
42 | 42 | |
43 | - /** |
|
44 | - * List all trash items in a subfolder in the trashbin |
|
45 | - * |
|
46 | - * @param ITrashItem $folder |
|
47 | - * @return ITrashItem[] |
|
48 | - * @since 15.0.0 |
|
49 | - */ |
|
50 | - public function listTrashFolder(ITrashItem $folder): array; |
|
43 | + /** |
|
44 | + * List all trash items in a subfolder in the trashbin |
|
45 | + * |
|
46 | + * @param ITrashItem $folder |
|
47 | + * @return ITrashItem[] |
|
48 | + * @since 15.0.0 |
|
49 | + */ |
|
50 | + public function listTrashFolder(ITrashItem $folder): array; |
|
51 | 51 | |
52 | - /** |
|
53 | - * Restore a trashbin item |
|
54 | - * |
|
55 | - * @param ITrashItem $item |
|
56 | - * @since 15.0.0 |
|
57 | - */ |
|
58 | - public function restoreItem(ITrashItem $item); |
|
52 | + /** |
|
53 | + * Restore a trashbin item |
|
54 | + * |
|
55 | + * @param ITrashItem $item |
|
56 | + * @since 15.0.0 |
|
57 | + */ |
|
58 | + public function restoreItem(ITrashItem $item); |
|
59 | 59 | |
60 | - /** |
|
61 | - * Permanently remove an item from trash |
|
62 | - * |
|
63 | - * @param ITrashItem $item |
|
64 | - * @since 15.0.0 |
|
65 | - */ |
|
66 | - public function removeItem(ITrashItem $item); |
|
60 | + /** |
|
61 | + * Permanently remove an item from trash |
|
62 | + * |
|
63 | + * @param ITrashItem $item |
|
64 | + * @since 15.0.0 |
|
65 | + */ |
|
66 | + public function removeItem(ITrashItem $item); |
|
67 | 67 | |
68 | - /** |
|
69 | - * Move a file or folder to trash |
|
70 | - * |
|
71 | - * @param IStorage $storage |
|
72 | - * @param string $internalPath |
|
73 | - * @return boolean whether or not the file was moved to trash, if false then the file should be deleted normally |
|
74 | - * @since 15.0.0 |
|
75 | - */ |
|
76 | - public function moveToTrash(IStorage $storage, string $internalPath): bool; |
|
68 | + /** |
|
69 | + * Move a file or folder to trash |
|
70 | + * |
|
71 | + * @param IStorage $storage |
|
72 | + * @param string $internalPath |
|
73 | + * @return boolean whether or not the file was moved to trash, if false then the file should be deleted normally |
|
74 | + * @since 15.0.0 |
|
75 | + */ |
|
76 | + public function moveToTrash(IStorage $storage, string $internalPath): bool; |
|
77 | 77 | |
78 | - /** |
|
79 | - * @param IUser $user |
|
80 | - * @param int $fileId |
|
81 | - * @return Node|null |
|
82 | - */ |
|
83 | - public function getTrashNodeById(IUser $user, int $fileId); |
|
78 | + /** |
|
79 | + * @param IUser $user |
|
80 | + * @param int $fileId |
|
81 | + * @return Node|null |
|
82 | + */ |
|
83 | + public function getTrashNodeById(IUser $user, int $fileId); |
|
84 | 84 | } |
@@ -29,49 +29,49 @@ |
||
29 | 29 | use Sabre\DAV\ICollection; |
30 | 30 | |
31 | 31 | abstract class AbstractTrashFolder extends AbstractTrash implements ICollection, ITrash { |
32 | - public function getChildren(): array { |
|
33 | - $entries = $this->trashManager->listTrashFolder($this->data); |
|
32 | + public function getChildren(): array { |
|
33 | + $entries = $this->trashManager->listTrashFolder($this->data); |
|
34 | 34 | |
35 | - $children = array_map(function (ITrashItem $entry) { |
|
36 | - if ($entry->getType() === FileInfo::TYPE_FOLDER) { |
|
37 | - return new TrashFolderFolder($this->trashManager, $entry); |
|
38 | - } |
|
39 | - return new TrashFolderFile($this->trashManager, $entry); |
|
40 | - }, $entries); |
|
35 | + $children = array_map(function (ITrashItem $entry) { |
|
36 | + if ($entry->getType() === FileInfo::TYPE_FOLDER) { |
|
37 | + return new TrashFolderFolder($this->trashManager, $entry); |
|
38 | + } |
|
39 | + return new TrashFolderFile($this->trashManager, $entry); |
|
40 | + }, $entries); |
|
41 | 41 | |
42 | - return $children; |
|
43 | - } |
|
42 | + return $children; |
|
43 | + } |
|
44 | 44 | |
45 | - public function getChild($name): ITrash { |
|
46 | - $entries = $this->getChildren(); |
|
45 | + public function getChild($name): ITrash { |
|
46 | + $entries = $this->getChildren(); |
|
47 | 47 | |
48 | - foreach ($entries as $entry) { |
|
49 | - if ($entry->getName() === $name) { |
|
50 | - return $entry; |
|
51 | - } |
|
52 | - } |
|
48 | + foreach ($entries as $entry) { |
|
49 | + if ($entry->getName() === $name) { |
|
50 | + return $entry; |
|
51 | + } |
|
52 | + } |
|
53 | 53 | |
54 | - throw new NotFound(); |
|
55 | - } |
|
54 | + throw new NotFound(); |
|
55 | + } |
|
56 | 56 | |
57 | - public function childExists($name): bool { |
|
58 | - try { |
|
59 | - $this->getChild($name); |
|
60 | - return true; |
|
61 | - } catch (NotFound $e) { |
|
62 | - return false; |
|
63 | - } |
|
64 | - } |
|
57 | + public function childExists($name): bool { |
|
58 | + try { |
|
59 | + $this->getChild($name); |
|
60 | + return true; |
|
61 | + } catch (NotFound $e) { |
|
62 | + return false; |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | - public function setName($name) { |
|
67 | - throw new Forbidden(); |
|
68 | - } |
|
66 | + public function setName($name) { |
|
67 | + throw new Forbidden(); |
|
68 | + } |
|
69 | 69 | |
70 | - public function createFile($name, $data = null) { |
|
71 | - throw new Forbidden(); |
|
72 | - } |
|
70 | + public function createFile($name, $data = null) { |
|
71 | + throw new Forbidden(); |
|
72 | + } |
|
73 | 73 | |
74 | - public function createDirectory($name) { |
|
75 | - throw new Forbidden(); |
|
76 | - } |
|
74 | + public function createDirectory($name) { |
|
75 | + throw new Forbidden(); |
|
76 | + } |
|
77 | 77 | } |