@@ -30,81 +30,81 @@ |
||
30 | 30 | * @since 8.0.0 |
31 | 31 | */ |
32 | 32 | interface IGroup { |
33 | - /** |
|
34 | - * @return string |
|
35 | - * @since 8.0.0 |
|
36 | - */ |
|
37 | - public function getGID(); |
|
33 | + /** |
|
34 | + * @return string |
|
35 | + * @since 8.0.0 |
|
36 | + */ |
|
37 | + public function getGID(); |
|
38 | 38 | |
39 | - /** |
|
40 | - * get all users in the group |
|
41 | - * |
|
42 | - * @return \OCP\IUser[] |
|
43 | - * @since 8.0.0 |
|
44 | - */ |
|
45 | - public function getUsers(); |
|
39 | + /** |
|
40 | + * get all users in the group |
|
41 | + * |
|
42 | + * @return \OCP\IUser[] |
|
43 | + * @since 8.0.0 |
|
44 | + */ |
|
45 | + public function getUsers(); |
|
46 | 46 | |
47 | - /** |
|
48 | - * check if a user is in the group |
|
49 | - * |
|
50 | - * @param \OCP\IUser $user |
|
51 | - * @return bool |
|
52 | - * @since 8.0.0 |
|
53 | - */ |
|
54 | - public function inGroup($user); |
|
47 | + /** |
|
48 | + * check if a user is in the group |
|
49 | + * |
|
50 | + * @param \OCP\IUser $user |
|
51 | + * @return bool |
|
52 | + * @since 8.0.0 |
|
53 | + */ |
|
54 | + public function inGroup($user); |
|
55 | 55 | |
56 | - /** |
|
57 | - * add a user to the group |
|
58 | - * |
|
59 | - * @param \OCP\IUser $user |
|
60 | - * @since 8.0.0 |
|
61 | - */ |
|
62 | - public function addUser($user); |
|
56 | + /** |
|
57 | + * add a user to the group |
|
58 | + * |
|
59 | + * @param \OCP\IUser $user |
|
60 | + * @since 8.0.0 |
|
61 | + */ |
|
62 | + public function addUser($user); |
|
63 | 63 | |
64 | - /** |
|
65 | - * remove a user from the group |
|
66 | - * |
|
67 | - * @param \OCP\IUser $user |
|
68 | - * @since 8.0.0 |
|
69 | - */ |
|
70 | - public function removeUser($user); |
|
64 | + /** |
|
65 | + * remove a user from the group |
|
66 | + * |
|
67 | + * @param \OCP\IUser $user |
|
68 | + * @since 8.0.0 |
|
69 | + */ |
|
70 | + public function removeUser($user); |
|
71 | 71 | |
72 | - /** |
|
73 | - * search for users in the group by userid |
|
74 | - * |
|
75 | - * @param string $search |
|
76 | - * @param int $limit |
|
77 | - * @param int $offset |
|
78 | - * @return \OCP\IUser[] |
|
79 | - * @since 8.0.0 |
|
80 | - */ |
|
81 | - public function searchUsers($search, $limit = null, $offset = null); |
|
72 | + /** |
|
73 | + * search for users in the group by userid |
|
74 | + * |
|
75 | + * @param string $search |
|
76 | + * @param int $limit |
|
77 | + * @param int $offset |
|
78 | + * @return \OCP\IUser[] |
|
79 | + * @since 8.0.0 |
|
80 | + */ |
|
81 | + public function searchUsers($search, $limit = null, $offset = null); |
|
82 | 82 | |
83 | - /** |
|
84 | - * returns the number of users matching the search string |
|
85 | - * |
|
86 | - * @param string $search |
|
87 | - * @return int|bool |
|
88 | - * @since 8.0.0 |
|
89 | - */ |
|
90 | - public function count($search = ''); |
|
83 | + /** |
|
84 | + * returns the number of users matching the search string |
|
85 | + * |
|
86 | + * @param string $search |
|
87 | + * @return int|bool |
|
88 | + * @since 8.0.0 |
|
89 | + */ |
|
90 | + public function count($search = ''); |
|
91 | 91 | |
92 | - /** |
|
93 | - * search for users in the group by displayname |
|
94 | - * |
|
95 | - * @param string $search |
|
96 | - * @param int $limit |
|
97 | - * @param int $offset |
|
98 | - * @return \OCP\IUser[] |
|
99 | - * @since 8.0.0 |
|
100 | - */ |
|
101 | - public function searchDisplayName($search, $limit = null, $offset = null); |
|
92 | + /** |
|
93 | + * search for users in the group by displayname |
|
94 | + * |
|
95 | + * @param string $search |
|
96 | + * @param int $limit |
|
97 | + * @param int $offset |
|
98 | + * @return \OCP\IUser[] |
|
99 | + * @since 8.0.0 |
|
100 | + */ |
|
101 | + public function searchDisplayName($search, $limit = null, $offset = null); |
|
102 | 102 | |
103 | - /** |
|
104 | - * delete the group |
|
105 | - * |
|
106 | - * @return bool |
|
107 | - * @since 8.0.0 |
|
108 | - */ |
|
109 | - public function delete(); |
|
103 | + /** |
|
104 | + * delete the group |
|
105 | + * |
|
106 | + * @return bool |
|
107 | + * @since 8.0.0 |
|
108 | + */ |
|
109 | + public function delete(); |
|
110 | 110 | } |
@@ -29,44 +29,44 @@ |
||
29 | 29 | * @since 8.0.0 |
30 | 30 | */ |
31 | 31 | interface ICertificateManager { |
32 | - /** |
|
33 | - * Returns all certificates trusted by the user |
|
34 | - * |
|
35 | - * @return \OCP\ICertificate[] |
|
36 | - * @since 8.0.0 |
|
37 | - */ |
|
38 | - public function listCertificates(); |
|
32 | + /** |
|
33 | + * Returns all certificates trusted by the user |
|
34 | + * |
|
35 | + * @return \OCP\ICertificate[] |
|
36 | + * @since 8.0.0 |
|
37 | + */ |
|
38 | + public function listCertificates(); |
|
39 | 39 | |
40 | - /** |
|
41 | - * @param string $certificate the certificate data |
|
42 | - * @param string $name the filename for the certificate |
|
43 | - * @return \OCP\ICertificate |
|
44 | - * @throws \Exception If the certificate could not get added |
|
45 | - * @since 8.0.0 - since 8.1.0 throws exception instead of returning false |
|
46 | - */ |
|
47 | - public function addCertificate($certificate, $name); |
|
40 | + /** |
|
41 | + * @param string $certificate the certificate data |
|
42 | + * @param string $name the filename for the certificate |
|
43 | + * @return \OCP\ICertificate |
|
44 | + * @throws \Exception If the certificate could not get added |
|
45 | + * @since 8.0.0 - since 8.1.0 throws exception instead of returning false |
|
46 | + */ |
|
47 | + public function addCertificate($certificate, $name); |
|
48 | 48 | |
49 | - /** |
|
50 | - * @param string $name |
|
51 | - * @since 8.0.0 |
|
52 | - */ |
|
53 | - public function removeCertificate($name); |
|
49 | + /** |
|
50 | + * @param string $name |
|
51 | + * @since 8.0.0 |
|
52 | + */ |
|
53 | + public function removeCertificate($name); |
|
54 | 54 | |
55 | - /** |
|
56 | - * Get the path to the certificate bundle for this user |
|
57 | - * |
|
58 | - * @param string $uid (optional) user to get the certificate bundle for, use `null` to get the system bundle (since 9.0.0) |
|
59 | - * @return string |
|
60 | - * @since 8.0.0 |
|
61 | - */ |
|
62 | - public function getCertificateBundle($uid = ''); |
|
55 | + /** |
|
56 | + * Get the path to the certificate bundle for this user |
|
57 | + * |
|
58 | + * @param string $uid (optional) user to get the certificate bundle for, use `null` to get the system bundle (since 9.0.0) |
|
59 | + * @return string |
|
60 | + * @since 8.0.0 |
|
61 | + */ |
|
62 | + public function getCertificateBundle($uid = ''); |
|
63 | 63 | |
64 | - /** |
|
65 | - * Get the full local path to the certificate bundle for this user |
|
66 | - * |
|
67 | - * @param string $uid (optional) user to get the certificate bundle for, use `null` to get the system bundle |
|
68 | - * @return string |
|
69 | - * @since 9.0.0 |
|
70 | - */ |
|
71 | - public function getAbsoluteBundlePath($uid = ''); |
|
64 | + /** |
|
65 | + * Get the full local path to the certificate bundle for this user |
|
66 | + * |
|
67 | + * @param string $uid (optional) user to get the certificate bundle for, use `null` to get the system bundle |
|
68 | + * @return string |
|
69 | + * @since 9.0.0 |
|
70 | + */ |
|
71 | + public function getAbsoluteBundlePath($uid = ''); |
|
72 | 72 | } |
@@ -32,56 +32,56 @@ |
||
32 | 32 | * @since 7.0.0 |
33 | 33 | */ |
34 | 34 | interface IJob { |
35 | - /** |
|
36 | - * Run the background job with the registered argument |
|
37 | - * |
|
38 | - * @param \OCP\BackgroundJob\IJobList $jobList The job list that manages the state of this job |
|
39 | - * @param ILogger $logger |
|
40 | - * @since 7.0.0 |
|
41 | - */ |
|
42 | - public function execute($jobList, ILogger $logger = null); |
|
35 | + /** |
|
36 | + * Run the background job with the registered argument |
|
37 | + * |
|
38 | + * @param \OCP\BackgroundJob\IJobList $jobList The job list that manages the state of this job |
|
39 | + * @param ILogger $logger |
|
40 | + * @since 7.0.0 |
|
41 | + */ |
|
42 | + public function execute($jobList, ILogger $logger = null); |
|
43 | 43 | |
44 | - /** |
|
45 | - * @param int $id |
|
46 | - * @since 7.0.0 |
|
47 | - */ |
|
48 | - public function setId($id); |
|
44 | + /** |
|
45 | + * @param int $id |
|
46 | + * @since 7.0.0 |
|
47 | + */ |
|
48 | + public function setId($id); |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param int $lastRun |
|
52 | - * @since 7.0.0 |
|
53 | - */ |
|
54 | - public function setLastRun($lastRun); |
|
50 | + /** |
|
51 | + * @param int $lastRun |
|
52 | + * @since 7.0.0 |
|
53 | + */ |
|
54 | + public function setLastRun($lastRun); |
|
55 | 55 | |
56 | - /** |
|
57 | - * @param mixed $argument |
|
58 | - * @since 7.0.0 |
|
59 | - */ |
|
60 | - public function setArgument($argument); |
|
56 | + /** |
|
57 | + * @param mixed $argument |
|
58 | + * @since 7.0.0 |
|
59 | + */ |
|
60 | + public function setArgument($argument); |
|
61 | 61 | |
62 | - /** |
|
63 | - * Get the id of the background job |
|
64 | - * This id is determined by the job list when a job is added to the list |
|
65 | - * |
|
66 | - * @return int |
|
67 | - * @since 7.0.0 |
|
68 | - */ |
|
69 | - public function getId(); |
|
62 | + /** |
|
63 | + * Get the id of the background job |
|
64 | + * This id is determined by the job list when a job is added to the list |
|
65 | + * |
|
66 | + * @return int |
|
67 | + * @since 7.0.0 |
|
68 | + */ |
|
69 | + public function getId(); |
|
70 | 70 | |
71 | - /** |
|
72 | - * Get the last time this job was run as unix timestamp |
|
73 | - * |
|
74 | - * @return int |
|
75 | - * @since 7.0.0 |
|
76 | - */ |
|
77 | - public function getLastRun(); |
|
71 | + /** |
|
72 | + * Get the last time this job was run as unix timestamp |
|
73 | + * |
|
74 | + * @return int |
|
75 | + * @since 7.0.0 |
|
76 | + */ |
|
77 | + public function getLastRun(); |
|
78 | 78 | |
79 | - /** |
|
80 | - * Get the argument associated with the background job |
|
81 | - * This is the argument that will be passed to the background job |
|
82 | - * |
|
83 | - * @return mixed |
|
84 | - * @since 7.0.0 |
|
85 | - */ |
|
86 | - public function getArgument(); |
|
79 | + /** |
|
80 | + * Get the argument associated with the background job |
|
81 | + * This is the argument that will be passed to the background job |
|
82 | + * |
|
83 | + * @return mixed |
|
84 | + * @since 7.0.0 |
|
85 | + */ |
|
86 | + public function getArgument(); |
|
87 | 87 | } |
@@ -32,80 +32,80 @@ |
||
32 | 32 | * @since 7.0.0 |
33 | 33 | */ |
34 | 34 | interface IJobList { |
35 | - /** |
|
36 | - * Add a job to the list |
|
37 | - * |
|
38 | - * @param \OCP\BackgroundJob\IJob|string $job |
|
39 | - * @param mixed $argument The argument to be passed to $job->run() when the job is exectured |
|
40 | - * @since 7.0.0 |
|
41 | - */ |
|
42 | - public function add($job, $argument = null); |
|
35 | + /** |
|
36 | + * Add a job to the list |
|
37 | + * |
|
38 | + * @param \OCP\BackgroundJob\IJob|string $job |
|
39 | + * @param mixed $argument The argument to be passed to $job->run() when the job is exectured |
|
40 | + * @since 7.0.0 |
|
41 | + */ |
|
42 | + public function add($job, $argument = null); |
|
43 | 43 | |
44 | - /** |
|
45 | - * Remove a job from the list |
|
46 | - * |
|
47 | - * @param \OCP\BackgroundJob\IJob|string $job |
|
48 | - * @param mixed $argument |
|
49 | - * @since 7.0.0 |
|
50 | - */ |
|
51 | - public function remove($job, $argument = null); |
|
44 | + /** |
|
45 | + * Remove a job from the list |
|
46 | + * |
|
47 | + * @param \OCP\BackgroundJob\IJob|string $job |
|
48 | + * @param mixed $argument |
|
49 | + * @since 7.0.0 |
|
50 | + */ |
|
51 | + public function remove($job, $argument = null); |
|
52 | 52 | |
53 | - /** |
|
54 | - * check if a job is in the list |
|
55 | - * |
|
56 | - * @param \OCP\BackgroundJob\IJob|string $job |
|
57 | - * @param mixed $argument |
|
58 | - * @return bool |
|
59 | - * @since 7.0.0 |
|
60 | - */ |
|
61 | - public function has($job, $argument); |
|
53 | + /** |
|
54 | + * check if a job is in the list |
|
55 | + * |
|
56 | + * @param \OCP\BackgroundJob\IJob|string $job |
|
57 | + * @param mixed $argument |
|
58 | + * @return bool |
|
59 | + * @since 7.0.0 |
|
60 | + */ |
|
61 | + public function has($job, $argument); |
|
62 | 62 | |
63 | - /** |
|
64 | - * get all jobs in the list |
|
65 | - * |
|
66 | - * @return \OCP\BackgroundJob\IJob[] |
|
67 | - * @since 7.0.0 |
|
68 | - * @deprecated 9.0.0 - This method is dangerous since it can cause load and |
|
69 | - * memory problems when creating too many instances. |
|
70 | - */ |
|
71 | - public function getAll(); |
|
63 | + /** |
|
64 | + * get all jobs in the list |
|
65 | + * |
|
66 | + * @return \OCP\BackgroundJob\IJob[] |
|
67 | + * @since 7.0.0 |
|
68 | + * @deprecated 9.0.0 - This method is dangerous since it can cause load and |
|
69 | + * memory problems when creating too many instances. |
|
70 | + */ |
|
71 | + public function getAll(); |
|
72 | 72 | |
73 | - /** |
|
74 | - * get the next job in the list |
|
75 | - * |
|
76 | - * @return \OCP\BackgroundJob\IJob|null |
|
77 | - * @since 7.0.0 |
|
78 | - */ |
|
79 | - public function getNext(); |
|
73 | + /** |
|
74 | + * get the next job in the list |
|
75 | + * |
|
76 | + * @return \OCP\BackgroundJob\IJob|null |
|
77 | + * @since 7.0.0 |
|
78 | + */ |
|
79 | + public function getNext(); |
|
80 | 80 | |
81 | - /** |
|
82 | - * @param int $id |
|
83 | - * @return \OCP\BackgroundJob\IJob|null |
|
84 | - * @since 7.0.0 |
|
85 | - */ |
|
86 | - public function getById($id); |
|
81 | + /** |
|
82 | + * @param int $id |
|
83 | + * @return \OCP\BackgroundJob\IJob|null |
|
84 | + * @since 7.0.0 |
|
85 | + */ |
|
86 | + public function getById($id); |
|
87 | 87 | |
88 | - /** |
|
89 | - * set the job that was last ran to the current time |
|
90 | - * |
|
91 | - * @param \OCP\BackgroundJob\IJob $job |
|
92 | - * @since 7.0.0 |
|
93 | - */ |
|
94 | - public function setLastJob($job); |
|
88 | + /** |
|
89 | + * set the job that was last ran to the current time |
|
90 | + * |
|
91 | + * @param \OCP\BackgroundJob\IJob $job |
|
92 | + * @since 7.0.0 |
|
93 | + */ |
|
94 | + public function setLastJob($job); |
|
95 | 95 | |
96 | - /** |
|
97 | - * get the id of the last ran job |
|
98 | - * |
|
99 | - * @return int |
|
100 | - * @since 7.0.0 |
|
101 | - */ |
|
102 | - public function getLastJob(); |
|
96 | + /** |
|
97 | + * get the id of the last ran job |
|
98 | + * |
|
99 | + * @return int |
|
100 | + * @since 7.0.0 |
|
101 | + */ |
|
102 | + public function getLastJob(); |
|
103 | 103 | |
104 | - /** |
|
105 | - * set the lastRun of $job to now |
|
106 | - * |
|
107 | - * @param \OCP\BackgroundJob\IJob $job |
|
108 | - * @since 7.0.0 |
|
109 | - */ |
|
110 | - public function setLastRun($job); |
|
104 | + /** |
|
105 | + * set the lastRun of $job to now |
|
106 | + * |
|
107 | + * @param \OCP\BackgroundJob\IJob $job |
|
108 | + * @since 7.0.0 |
|
109 | + */ |
|
110 | + public function setLastRun($job); |
|
111 | 111 | } |
@@ -47,57 +47,57 @@ |
||
47 | 47 | */ |
48 | 48 | interface IContainer { |
49 | 49 | |
50 | - /** |
|
51 | - * If a parameter is not registered in the container try to instantiate it |
|
52 | - * by using reflection to find out how to build the class |
|
53 | - * @param string $name the class name to resolve |
|
54 | - * @return \stdClass |
|
55 | - * @since 8.2.0 |
|
56 | - * @throws QueryException if the class could not be found or instantiated |
|
57 | - */ |
|
58 | - public function resolve($name); |
|
50 | + /** |
|
51 | + * If a parameter is not registered in the container try to instantiate it |
|
52 | + * by using reflection to find out how to build the class |
|
53 | + * @param string $name the class name to resolve |
|
54 | + * @return \stdClass |
|
55 | + * @since 8.2.0 |
|
56 | + * @throws QueryException if the class could not be found or instantiated |
|
57 | + */ |
|
58 | + public function resolve($name); |
|
59 | 59 | |
60 | - /** |
|
61 | - * Look up a service for a given name in the container. |
|
62 | - * |
|
63 | - * @param string $name |
|
64 | - * @return mixed |
|
65 | - * @since 6.0.0 |
|
66 | - */ |
|
67 | - public function query($name); |
|
60 | + /** |
|
61 | + * Look up a service for a given name in the container. |
|
62 | + * |
|
63 | + * @param string $name |
|
64 | + * @return mixed |
|
65 | + * @since 6.0.0 |
|
66 | + */ |
|
67 | + public function query($name); |
|
68 | 68 | |
69 | - /** |
|
70 | - * A value is stored in the container with it's corresponding name |
|
71 | - * |
|
72 | - * @param string $name |
|
73 | - * @param mixed $value |
|
74 | - * @return void |
|
75 | - * @since 6.0.0 |
|
76 | - */ |
|
77 | - public function registerParameter($name, $value); |
|
69 | + /** |
|
70 | + * A value is stored in the container with it's corresponding name |
|
71 | + * |
|
72 | + * @param string $name |
|
73 | + * @param mixed $value |
|
74 | + * @return void |
|
75 | + * @since 6.0.0 |
|
76 | + */ |
|
77 | + public function registerParameter($name, $value); |
|
78 | 78 | |
79 | - /** |
|
80 | - * A service is registered in the container where a closure is passed in which will actually |
|
81 | - * create the service on demand. |
|
82 | - * In case the parameter $shared is set to true (the default usage) the once created service will remain in |
|
83 | - * memory and be reused on subsequent calls. |
|
84 | - * In case the parameter is false the service will be recreated on every call. |
|
85 | - * |
|
86 | - * @param string $name |
|
87 | - * @param \Closure $closure |
|
88 | - * @param bool $shared |
|
89 | - * @return void |
|
90 | - * @since 6.0.0 |
|
91 | - */ |
|
92 | - public function registerService($name, Closure $closure, $shared = true); |
|
79 | + /** |
|
80 | + * A service is registered in the container where a closure is passed in which will actually |
|
81 | + * create the service on demand. |
|
82 | + * In case the parameter $shared is set to true (the default usage) the once created service will remain in |
|
83 | + * memory and be reused on subsequent calls. |
|
84 | + * In case the parameter is false the service will be recreated on every call. |
|
85 | + * |
|
86 | + * @param string $name |
|
87 | + * @param \Closure $closure |
|
88 | + * @param bool $shared |
|
89 | + * @return void |
|
90 | + * @since 6.0.0 |
|
91 | + */ |
|
92 | + public function registerService($name, Closure $closure, $shared = true); |
|
93 | 93 | |
94 | - /** |
|
95 | - * Shortcut for returning a service from a service under a different key, |
|
96 | - * e.g. to tell the container to return a class when queried for an |
|
97 | - * interface |
|
98 | - * @param string $alias the alias that should be registered |
|
99 | - * @param string $target the target that should be resolved instead |
|
100 | - * @since 8.2.0 |
|
101 | - */ |
|
102 | - public function registerAlias($alias, $target); |
|
94 | + /** |
|
95 | + * Shortcut for returning a service from a service under a different key, |
|
96 | + * e.g. to tell the container to return a class when queried for an |
|
97 | + * interface |
|
98 | + * @param string $alias the alias that should be registered |
|
99 | + * @param string $target the target that should be resolved instead |
|
100 | + * @since 8.2.0 |
|
101 | + */ |
|
102 | + public function registerAlias($alias, $target); |
|
103 | 103 | } |
@@ -43,69 +43,69 @@ |
||
43 | 43 | abstract class Middleware { |
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * This is being run in normal order before the controller is being |
|
48 | - * called which allows several modifications and checks |
|
49 | - * |
|
50 | - * @param Controller $controller the controller that is being called |
|
51 | - * @param string $methodName the name of the method that will be called on |
|
52 | - * the controller |
|
53 | - * @since 6.0.0 |
|
54 | - */ |
|
55 | - public function beforeController($controller, $methodName){ |
|
46 | + /** |
|
47 | + * This is being run in normal order before the controller is being |
|
48 | + * called which allows several modifications and checks |
|
49 | + * |
|
50 | + * @param Controller $controller the controller that is being called |
|
51 | + * @param string $methodName the name of the method that will be called on |
|
52 | + * the controller |
|
53 | + * @since 6.0.0 |
|
54 | + */ |
|
55 | + public function beforeController($controller, $methodName){ |
|
56 | 56 | |
57 | - } |
|
57 | + } |
|
58 | 58 | |
59 | 59 | |
60 | - /** |
|
61 | - * This is being run when either the beforeController method or the |
|
62 | - * controller method itself is throwing an exception. The middleware is |
|
63 | - * asked in reverse order to handle the exception and to return a response. |
|
64 | - * If the response is null, it is assumed that the exception could not be |
|
65 | - * handled and the error will be thrown again |
|
66 | - * |
|
67 | - * @param Controller $controller the controller that is being called |
|
68 | - * @param string $methodName the name of the method that will be called on |
|
69 | - * the controller |
|
70 | - * @param \Exception $exception the thrown exception |
|
71 | - * @throws \Exception the passed in exception if it cant handle it |
|
72 | - * @return Response a Response object in case that the exception was handled |
|
73 | - * @since 6.0.0 |
|
74 | - */ |
|
75 | - public function afterException($controller, $methodName, \Exception $exception){ |
|
76 | - throw $exception; |
|
77 | - } |
|
60 | + /** |
|
61 | + * This is being run when either the beforeController method or the |
|
62 | + * controller method itself is throwing an exception. The middleware is |
|
63 | + * asked in reverse order to handle the exception and to return a response. |
|
64 | + * If the response is null, it is assumed that the exception could not be |
|
65 | + * handled and the error will be thrown again |
|
66 | + * |
|
67 | + * @param Controller $controller the controller that is being called |
|
68 | + * @param string $methodName the name of the method that will be called on |
|
69 | + * the controller |
|
70 | + * @param \Exception $exception the thrown exception |
|
71 | + * @throws \Exception the passed in exception if it cant handle it |
|
72 | + * @return Response a Response object in case that the exception was handled |
|
73 | + * @since 6.0.0 |
|
74 | + */ |
|
75 | + public function afterException($controller, $methodName, \Exception $exception){ |
|
76 | + throw $exception; |
|
77 | + } |
|
78 | 78 | |
79 | 79 | |
80 | - /** |
|
81 | - * This is being run after a successful controllermethod call and allows |
|
82 | - * the manipulation of a Response object. The middleware is run in reverse order |
|
83 | - * |
|
84 | - * @param Controller $controller the controller that is being called |
|
85 | - * @param string $methodName the name of the method that will be called on |
|
86 | - * the controller |
|
87 | - * @param Response $response the generated response from the controller |
|
88 | - * @return Response a Response object |
|
89 | - * @since 6.0.0 |
|
90 | - */ |
|
91 | - public function afterController($controller, $methodName, Response $response){ |
|
92 | - return $response; |
|
93 | - } |
|
80 | + /** |
|
81 | + * This is being run after a successful controllermethod call and allows |
|
82 | + * the manipulation of a Response object. The middleware is run in reverse order |
|
83 | + * |
|
84 | + * @param Controller $controller the controller that is being called |
|
85 | + * @param string $methodName the name of the method that will be called on |
|
86 | + * the controller |
|
87 | + * @param Response $response the generated response from the controller |
|
88 | + * @return Response a Response object |
|
89 | + * @since 6.0.0 |
|
90 | + */ |
|
91 | + public function afterController($controller, $methodName, Response $response){ |
|
92 | + return $response; |
|
93 | + } |
|
94 | 94 | |
95 | 95 | |
96 | - /** |
|
97 | - * This is being run after the response object has been rendered and |
|
98 | - * allows the manipulation of the output. The middleware is run in reverse order |
|
99 | - * |
|
100 | - * @param Controller $controller the controller that is being called |
|
101 | - * @param string $methodName the name of the method that will be called on |
|
102 | - * the controller |
|
103 | - * @param string $output the generated output from a response |
|
104 | - * @return string the output that should be printed |
|
105 | - * @since 6.0.0 |
|
106 | - */ |
|
107 | - public function beforeOutput($controller, $methodName, $output){ |
|
108 | - return $output; |
|
109 | - } |
|
96 | + /** |
|
97 | + * This is being run after the response object has been rendered and |
|
98 | + * allows the manipulation of the output. The middleware is run in reverse order |
|
99 | + * |
|
100 | + * @param Controller $controller the controller that is being called |
|
101 | + * @param string $methodName the name of the method that will be called on |
|
102 | + * the controller |
|
103 | + * @param string $output the generated output from a response |
|
104 | + * @return string the output that should be printed |
|
105 | + * @since 6.0.0 |
|
106 | + */ |
|
107 | + public function beforeOutput($controller, $methodName, $output){ |
|
108 | + return $output; |
|
109 | + } |
|
110 | 110 | |
111 | 111 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * the controller |
54 | 54 | * @since 6.0.0 |
55 | 55 | */ |
56 | - public function beforeController($controller, $methodName){ |
|
56 | + public function beforeController($controller, $methodName) { |
|
57 | 57 | |
58 | 58 | } |
59 | 59 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return Response a Response object in case that the exception was handled |
74 | 74 | * @since 6.0.0 |
75 | 75 | */ |
76 | - public function afterException($controller, $methodName, \Exception $exception){ |
|
76 | + public function afterException($controller, $methodName, \Exception $exception) { |
|
77 | 77 | throw $exception; |
78 | 78 | } |
79 | 79 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return Response a Response object |
90 | 90 | * @since 6.0.0 |
91 | 91 | */ |
92 | - public function afterController($controller, $methodName, Response $response){ |
|
92 | + public function afterController($controller, $methodName, Response $response) { |
|
93 | 93 | return $response; |
94 | 94 | } |
95 | 95 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @return string the output that should be printed |
106 | 106 | * @since 6.0.0 |
107 | 107 | */ |
108 | - public function beforeOutput($controller, $methodName, $output){ |
|
108 | + public function beforeOutput($controller, $methodName, $output) { |
|
109 | 109 | return $output; |
110 | 110 | } |
111 | 111 |
@@ -38,61 +38,61 @@ |
||
38 | 38 | interface IApi { |
39 | 39 | |
40 | 40 | |
41 | - /** |
|
42 | - * Gets the userid of the current user |
|
43 | - * @return string the user id of the current user |
|
44 | - * @deprecated 8.0.0 Use \OC::$server->getUserSession()->getUser()->getUID() |
|
45 | - */ |
|
46 | - function getUserId(); |
|
47 | - |
|
48 | - |
|
49 | - /** |
|
50 | - * Adds a new javascript file |
|
51 | - * @deprecated 8.0.0 include javascript and css in template files |
|
52 | - * @param string $scriptName the name of the javascript in js/ without the suffix |
|
53 | - * @param string $appName the name of the app, defaults to the current one |
|
54 | - * @return void |
|
55 | - */ |
|
56 | - function addScript($scriptName, $appName = null); |
|
57 | - |
|
58 | - |
|
59 | - /** |
|
60 | - * Adds a new css file |
|
61 | - * @deprecated 8.0.0 include javascript and css in template files |
|
62 | - * @param string $styleName the name of the css file in css/without the suffix |
|
63 | - * @param string $appName the name of the app, defaults to the current one |
|
64 | - * @return void |
|
65 | - */ |
|
66 | - function addStyle($styleName, $appName = null); |
|
67 | - |
|
68 | - |
|
69 | - /** |
|
70 | - * @deprecated 8.0.0 include javascript and css in template files |
|
71 | - * shorthand for addScript for files in the 3rdparty directory |
|
72 | - * @param string $name the name of the file without the suffix |
|
73 | - * @return void |
|
74 | - */ |
|
75 | - function add3rdPartyScript($name); |
|
76 | - |
|
77 | - |
|
78 | - /** |
|
79 | - * @deprecated 8.0.0 include javascript and css in template files |
|
80 | - * shorthand for addStyle for files in the 3rdparty directory |
|
81 | - * @param string $name the name of the file without the suffix |
|
82 | - * @return void |
|
83 | - */ |
|
84 | - function add3rdPartyStyle($name); |
|
85 | - |
|
86 | - |
|
87 | - /** |
|
88 | - * Checks if an app is enabled |
|
89 | - * @deprecated 8.0.0 communication between apps should happen over built in |
|
90 | - * callbacks or interfaces (check the contacts and calendar managers) |
|
91 | - * Checks if an app is enabled |
|
92 | - * also use \OC::$server->getAppManager()->isEnabledForUser($appName) |
|
93 | - * @param string $appName the name of an app |
|
94 | - * @return bool true if app is enabled |
|
95 | - */ |
|
96 | - public function isAppEnabled($appName); |
|
41 | + /** |
|
42 | + * Gets the userid of the current user |
|
43 | + * @return string the user id of the current user |
|
44 | + * @deprecated 8.0.0 Use \OC::$server->getUserSession()->getUser()->getUID() |
|
45 | + */ |
|
46 | + function getUserId(); |
|
47 | + |
|
48 | + |
|
49 | + /** |
|
50 | + * Adds a new javascript file |
|
51 | + * @deprecated 8.0.0 include javascript and css in template files |
|
52 | + * @param string $scriptName the name of the javascript in js/ without the suffix |
|
53 | + * @param string $appName the name of the app, defaults to the current one |
|
54 | + * @return void |
|
55 | + */ |
|
56 | + function addScript($scriptName, $appName = null); |
|
57 | + |
|
58 | + |
|
59 | + /** |
|
60 | + * Adds a new css file |
|
61 | + * @deprecated 8.0.0 include javascript and css in template files |
|
62 | + * @param string $styleName the name of the css file in css/without the suffix |
|
63 | + * @param string $appName the name of the app, defaults to the current one |
|
64 | + * @return void |
|
65 | + */ |
|
66 | + function addStyle($styleName, $appName = null); |
|
67 | + |
|
68 | + |
|
69 | + /** |
|
70 | + * @deprecated 8.0.0 include javascript and css in template files |
|
71 | + * shorthand for addScript for files in the 3rdparty directory |
|
72 | + * @param string $name the name of the file without the suffix |
|
73 | + * @return void |
|
74 | + */ |
|
75 | + function add3rdPartyScript($name); |
|
76 | + |
|
77 | + |
|
78 | + /** |
|
79 | + * @deprecated 8.0.0 include javascript and css in template files |
|
80 | + * shorthand for addStyle for files in the 3rdparty directory |
|
81 | + * @param string $name the name of the file without the suffix |
|
82 | + * @return void |
|
83 | + */ |
|
84 | + function add3rdPartyStyle($name); |
|
85 | + |
|
86 | + |
|
87 | + /** |
|
88 | + * Checks if an app is enabled |
|
89 | + * @deprecated 8.0.0 communication between apps should happen over built in |
|
90 | + * callbacks or interfaces (check the contacts and calendar managers) |
|
91 | + * Checks if an app is enabled |
|
92 | + * also use \OC::$server->getAppManager()->isEnabledForUser($appName) |
|
93 | + * @param string $appName the name of an app |
|
94 | + * @return bool true if app is enabled |
|
95 | + */ |
|
96 | + public function isAppEnabled($appName); |
|
97 | 97 | |
98 | 98 | } |
@@ -45,220 +45,220 @@ |
||
45 | 45 | */ |
46 | 46 | abstract class Controller { |
47 | 47 | |
48 | - /** |
|
49 | - * app name |
|
50 | - * @var string |
|
51 | - * @since 7.0.0 |
|
52 | - */ |
|
53 | - protected $appName; |
|
54 | - |
|
55 | - /** |
|
56 | - * current request |
|
57 | - * @var \OCP\IRequest |
|
58 | - * @since 6.0.0 |
|
59 | - */ |
|
60 | - protected $request; |
|
61 | - |
|
62 | - /** |
|
63 | - * @var array |
|
64 | - * @since 7.0.0 |
|
65 | - */ |
|
66 | - private $responders; |
|
67 | - |
|
68 | - /** |
|
69 | - * constructor of the controller |
|
70 | - * @param string $appName the name of the app |
|
71 | - * @param IRequest $request an instance of the request |
|
72 | - * @since 6.0.0 - parameter $appName was added in 7.0.0 - parameter $app was removed in 7.0.0 |
|
73 | - */ |
|
74 | - public function __construct($appName, |
|
75 | - IRequest $request) { |
|
76 | - $this->appName = $appName; |
|
77 | - $this->request = $request; |
|
78 | - |
|
79 | - // default responders |
|
80 | - $this->responders = array( |
|
81 | - 'json' => function ($data) { |
|
82 | - if ($data instanceof DataResponse) { |
|
83 | - $response = new JSONResponse( |
|
84 | - $data->getData(), |
|
85 | - $data->getStatus() |
|
86 | - ); |
|
87 | - $dataHeaders = $data->getHeaders(); |
|
88 | - $headers = $response->getHeaders(); |
|
89 | - // do not overwrite Content-Type if it already exists |
|
90 | - if (isset($dataHeaders['Content-Type'])) { |
|
91 | - unset($headers['Content-Type']); |
|
92 | - } |
|
93 | - $response->setHeaders(array_merge($dataHeaders, $headers)); |
|
94 | - return $response; |
|
95 | - } else { |
|
96 | - return new JSONResponse($data); |
|
97 | - } |
|
98 | - } |
|
99 | - ); |
|
100 | - } |
|
101 | - |
|
102 | - |
|
103 | - /** |
|
104 | - * Parses an HTTP accept header and returns the supported responder type |
|
105 | - * @param string $acceptHeader |
|
106 | - * @return string the responder type |
|
107 | - * @since 7.0.0 |
|
108 | - */ |
|
109 | - public function getResponderByHTTPHeader($acceptHeader) { |
|
110 | - $headers = explode(',', $acceptHeader); |
|
111 | - |
|
112 | - // return the first matching responder |
|
113 | - foreach ($headers as $header) { |
|
114 | - $header = strtolower(trim($header)); |
|
115 | - |
|
116 | - $responder = str_replace('application/', '', $header); |
|
117 | - |
|
118 | - if (array_key_exists($responder, $this->responders)) { |
|
119 | - return $responder; |
|
120 | - } |
|
121 | - } |
|
122 | - |
|
123 | - // no matching header defaults to json |
|
124 | - return 'json'; |
|
125 | - } |
|
126 | - |
|
127 | - |
|
128 | - /** |
|
129 | - * Registers a formatter for a type |
|
130 | - * @param string $format |
|
131 | - * @param \Closure $responder |
|
132 | - * @since 7.0.0 |
|
133 | - */ |
|
134 | - protected function registerResponder($format, \Closure $responder) { |
|
135 | - $this->responders[$format] = $responder; |
|
136 | - } |
|
137 | - |
|
138 | - |
|
139 | - /** |
|
140 | - * Serializes and formats a response |
|
141 | - * @param mixed $response the value that was returned from a controller and |
|
142 | - * is not a Response instance |
|
143 | - * @param string $format the format for which a formatter has been registered |
|
144 | - * @throws \DomainException if format does not match a registered formatter |
|
145 | - * @return Response |
|
146 | - * @since 7.0.0 |
|
147 | - */ |
|
148 | - public function buildResponse($response, $format='json') { |
|
149 | - if(array_key_exists($format, $this->responders)) { |
|
150 | - |
|
151 | - $responder = $this->responders[$format]; |
|
152 | - |
|
153 | - return $responder($response); |
|
154 | - |
|
155 | - } else { |
|
156 | - throw new \DomainException('No responder registered for format ' . |
|
157 | - $format . '!'); |
|
158 | - } |
|
159 | - } |
|
160 | - |
|
161 | - |
|
162 | - /** |
|
163 | - * Lets you access post and get parameters by the index |
|
164 | - * @deprecated 7.0.0 write your parameters as method arguments instead |
|
165 | - * @param string $key the key which you want to access in the URL Parameter |
|
166 | - * placeholder, $_POST or $_GET array. |
|
167 | - * The priority how they're returned is the following: |
|
168 | - * 1. URL parameters |
|
169 | - * 2. POST parameters |
|
170 | - * 3. GET parameters |
|
171 | - * @param string $default If the key is not found, this value will be returned |
|
172 | - * @return mixed the content of the array |
|
173 | - * @since 6.0.0 |
|
174 | - */ |
|
175 | - public function params($key, $default=null){ |
|
176 | - return $this->request->getParam($key, $default); |
|
177 | - } |
|
178 | - |
|
179 | - |
|
180 | - /** |
|
181 | - * Returns all params that were received, be it from the request |
|
182 | - * (as GET or POST) or through the URL by the route |
|
183 | - * @deprecated 7.0.0 use $this->request instead |
|
184 | - * @return array the array with all parameters |
|
185 | - * @since 6.0.0 |
|
186 | - */ |
|
187 | - public function getParams() { |
|
188 | - return $this->request->getParams(); |
|
189 | - } |
|
190 | - |
|
191 | - |
|
192 | - /** |
|
193 | - * Returns the method of the request |
|
194 | - * @deprecated 7.0.0 use $this->request instead |
|
195 | - * @return string the method of the request (POST, GET, etc) |
|
196 | - * @since 6.0.0 |
|
197 | - */ |
|
198 | - public function method() { |
|
199 | - return $this->request->getMethod(); |
|
200 | - } |
|
201 | - |
|
202 | - |
|
203 | - /** |
|
204 | - * Shortcut for accessing an uploaded file through the $_FILES array |
|
205 | - * @deprecated 7.0.0 use $this->request instead |
|
206 | - * @param string $key the key that will be taken from the $_FILES array |
|
207 | - * @return array the file in the $_FILES element |
|
208 | - * @since 6.0.0 |
|
209 | - */ |
|
210 | - public function getUploadedFile($key) { |
|
211 | - return $this->request->getUploadedFile($key); |
|
212 | - } |
|
213 | - |
|
214 | - |
|
215 | - /** |
|
216 | - * Shortcut for getting env variables |
|
217 | - * @deprecated 7.0.0 use $this->request instead |
|
218 | - * @param string $key the key that will be taken from the $_ENV array |
|
219 | - * @return array the value in the $_ENV element |
|
220 | - * @since 6.0.0 |
|
221 | - */ |
|
222 | - public function env($key) { |
|
223 | - return $this->request->getEnv($key); |
|
224 | - } |
|
225 | - |
|
226 | - |
|
227 | - /** |
|
228 | - * Shortcut for getting cookie variables |
|
229 | - * @deprecated 7.0.0 use $this->request instead |
|
230 | - * @param string $key the key that will be taken from the $_COOKIE array |
|
231 | - * @return array the value in the $_COOKIE element |
|
232 | - * @since 6.0.0 |
|
233 | - */ |
|
234 | - public function cookie($key) { |
|
235 | - return $this->request->getCookie($key); |
|
236 | - } |
|
237 | - |
|
238 | - |
|
239 | - /** |
|
240 | - * Shortcut for rendering a template |
|
241 | - * @deprecated 7.0.0 return a template response instead |
|
242 | - * @param string $templateName the name of the template |
|
243 | - * @param array $params the template parameters in key => value structure |
|
244 | - * @param string $renderAs user renders a full page, blank only your template |
|
245 | - * admin an entry in the admin settings |
|
246 | - * @param string[] $headers set additional headers in name/value pairs |
|
247 | - * @return \OCP\AppFramework\Http\TemplateResponse containing the page |
|
248 | - * @since 6.0.0 |
|
249 | - */ |
|
250 | - public function render($templateName, array $params=array(), |
|
251 | - $renderAs='user', array $headers=array()){ |
|
252 | - $response = new TemplateResponse($this->appName, $templateName); |
|
253 | - $response->setParams($params); |
|
254 | - $response->renderAs($renderAs); |
|
255 | - |
|
256 | - foreach($headers as $name => $value){ |
|
257 | - $response->addHeader($name, $value); |
|
258 | - } |
|
259 | - |
|
260 | - return $response; |
|
261 | - } |
|
48 | + /** |
|
49 | + * app name |
|
50 | + * @var string |
|
51 | + * @since 7.0.0 |
|
52 | + */ |
|
53 | + protected $appName; |
|
54 | + |
|
55 | + /** |
|
56 | + * current request |
|
57 | + * @var \OCP\IRequest |
|
58 | + * @since 6.0.0 |
|
59 | + */ |
|
60 | + protected $request; |
|
61 | + |
|
62 | + /** |
|
63 | + * @var array |
|
64 | + * @since 7.0.0 |
|
65 | + */ |
|
66 | + private $responders; |
|
67 | + |
|
68 | + /** |
|
69 | + * constructor of the controller |
|
70 | + * @param string $appName the name of the app |
|
71 | + * @param IRequest $request an instance of the request |
|
72 | + * @since 6.0.0 - parameter $appName was added in 7.0.0 - parameter $app was removed in 7.0.0 |
|
73 | + */ |
|
74 | + public function __construct($appName, |
|
75 | + IRequest $request) { |
|
76 | + $this->appName = $appName; |
|
77 | + $this->request = $request; |
|
78 | + |
|
79 | + // default responders |
|
80 | + $this->responders = array( |
|
81 | + 'json' => function ($data) { |
|
82 | + if ($data instanceof DataResponse) { |
|
83 | + $response = new JSONResponse( |
|
84 | + $data->getData(), |
|
85 | + $data->getStatus() |
|
86 | + ); |
|
87 | + $dataHeaders = $data->getHeaders(); |
|
88 | + $headers = $response->getHeaders(); |
|
89 | + // do not overwrite Content-Type if it already exists |
|
90 | + if (isset($dataHeaders['Content-Type'])) { |
|
91 | + unset($headers['Content-Type']); |
|
92 | + } |
|
93 | + $response->setHeaders(array_merge($dataHeaders, $headers)); |
|
94 | + return $response; |
|
95 | + } else { |
|
96 | + return new JSONResponse($data); |
|
97 | + } |
|
98 | + } |
|
99 | + ); |
|
100 | + } |
|
101 | + |
|
102 | + |
|
103 | + /** |
|
104 | + * Parses an HTTP accept header and returns the supported responder type |
|
105 | + * @param string $acceptHeader |
|
106 | + * @return string the responder type |
|
107 | + * @since 7.0.0 |
|
108 | + */ |
|
109 | + public function getResponderByHTTPHeader($acceptHeader) { |
|
110 | + $headers = explode(',', $acceptHeader); |
|
111 | + |
|
112 | + // return the first matching responder |
|
113 | + foreach ($headers as $header) { |
|
114 | + $header = strtolower(trim($header)); |
|
115 | + |
|
116 | + $responder = str_replace('application/', '', $header); |
|
117 | + |
|
118 | + if (array_key_exists($responder, $this->responders)) { |
|
119 | + return $responder; |
|
120 | + } |
|
121 | + } |
|
122 | + |
|
123 | + // no matching header defaults to json |
|
124 | + return 'json'; |
|
125 | + } |
|
126 | + |
|
127 | + |
|
128 | + /** |
|
129 | + * Registers a formatter for a type |
|
130 | + * @param string $format |
|
131 | + * @param \Closure $responder |
|
132 | + * @since 7.0.0 |
|
133 | + */ |
|
134 | + protected function registerResponder($format, \Closure $responder) { |
|
135 | + $this->responders[$format] = $responder; |
|
136 | + } |
|
137 | + |
|
138 | + |
|
139 | + /** |
|
140 | + * Serializes and formats a response |
|
141 | + * @param mixed $response the value that was returned from a controller and |
|
142 | + * is not a Response instance |
|
143 | + * @param string $format the format for which a formatter has been registered |
|
144 | + * @throws \DomainException if format does not match a registered formatter |
|
145 | + * @return Response |
|
146 | + * @since 7.0.0 |
|
147 | + */ |
|
148 | + public function buildResponse($response, $format='json') { |
|
149 | + if(array_key_exists($format, $this->responders)) { |
|
150 | + |
|
151 | + $responder = $this->responders[$format]; |
|
152 | + |
|
153 | + return $responder($response); |
|
154 | + |
|
155 | + } else { |
|
156 | + throw new \DomainException('No responder registered for format ' . |
|
157 | + $format . '!'); |
|
158 | + } |
|
159 | + } |
|
160 | + |
|
161 | + |
|
162 | + /** |
|
163 | + * Lets you access post and get parameters by the index |
|
164 | + * @deprecated 7.0.0 write your parameters as method arguments instead |
|
165 | + * @param string $key the key which you want to access in the URL Parameter |
|
166 | + * placeholder, $_POST or $_GET array. |
|
167 | + * The priority how they're returned is the following: |
|
168 | + * 1. URL parameters |
|
169 | + * 2. POST parameters |
|
170 | + * 3. GET parameters |
|
171 | + * @param string $default If the key is not found, this value will be returned |
|
172 | + * @return mixed the content of the array |
|
173 | + * @since 6.0.0 |
|
174 | + */ |
|
175 | + public function params($key, $default=null){ |
|
176 | + return $this->request->getParam($key, $default); |
|
177 | + } |
|
178 | + |
|
179 | + |
|
180 | + /** |
|
181 | + * Returns all params that were received, be it from the request |
|
182 | + * (as GET or POST) or through the URL by the route |
|
183 | + * @deprecated 7.0.0 use $this->request instead |
|
184 | + * @return array the array with all parameters |
|
185 | + * @since 6.0.0 |
|
186 | + */ |
|
187 | + public function getParams() { |
|
188 | + return $this->request->getParams(); |
|
189 | + } |
|
190 | + |
|
191 | + |
|
192 | + /** |
|
193 | + * Returns the method of the request |
|
194 | + * @deprecated 7.0.0 use $this->request instead |
|
195 | + * @return string the method of the request (POST, GET, etc) |
|
196 | + * @since 6.0.0 |
|
197 | + */ |
|
198 | + public function method() { |
|
199 | + return $this->request->getMethod(); |
|
200 | + } |
|
201 | + |
|
202 | + |
|
203 | + /** |
|
204 | + * Shortcut for accessing an uploaded file through the $_FILES array |
|
205 | + * @deprecated 7.0.0 use $this->request instead |
|
206 | + * @param string $key the key that will be taken from the $_FILES array |
|
207 | + * @return array the file in the $_FILES element |
|
208 | + * @since 6.0.0 |
|
209 | + */ |
|
210 | + public function getUploadedFile($key) { |
|
211 | + return $this->request->getUploadedFile($key); |
|
212 | + } |
|
213 | + |
|
214 | + |
|
215 | + /** |
|
216 | + * Shortcut for getting env variables |
|
217 | + * @deprecated 7.0.0 use $this->request instead |
|
218 | + * @param string $key the key that will be taken from the $_ENV array |
|
219 | + * @return array the value in the $_ENV element |
|
220 | + * @since 6.0.0 |
|
221 | + */ |
|
222 | + public function env($key) { |
|
223 | + return $this->request->getEnv($key); |
|
224 | + } |
|
225 | + |
|
226 | + |
|
227 | + /** |
|
228 | + * Shortcut for getting cookie variables |
|
229 | + * @deprecated 7.0.0 use $this->request instead |
|
230 | + * @param string $key the key that will be taken from the $_COOKIE array |
|
231 | + * @return array the value in the $_COOKIE element |
|
232 | + * @since 6.0.0 |
|
233 | + */ |
|
234 | + public function cookie($key) { |
|
235 | + return $this->request->getCookie($key); |
|
236 | + } |
|
237 | + |
|
238 | + |
|
239 | + /** |
|
240 | + * Shortcut for rendering a template |
|
241 | + * @deprecated 7.0.0 return a template response instead |
|
242 | + * @param string $templateName the name of the template |
|
243 | + * @param array $params the template parameters in key => value structure |
|
244 | + * @param string $renderAs user renders a full page, blank only your template |
|
245 | + * admin an entry in the admin settings |
|
246 | + * @param string[] $headers set additional headers in name/value pairs |
|
247 | + * @return \OCP\AppFramework\Http\TemplateResponse containing the page |
|
248 | + * @since 6.0.0 |
|
249 | + */ |
|
250 | + public function render($templateName, array $params=array(), |
|
251 | + $renderAs='user', array $headers=array()){ |
|
252 | + $response = new TemplateResponse($this->appName, $templateName); |
|
253 | + $response->setParams($params); |
|
254 | + $response->renderAs($renderAs); |
|
255 | + |
|
256 | + foreach($headers as $name => $value){ |
|
257 | + $response->addHeader($name, $value); |
|
258 | + } |
|
259 | + |
|
260 | + return $response; |
|
261 | + } |
|
262 | 262 | |
263 | 263 | |
264 | 264 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | // default responders |
80 | 80 | $this->responders = array( |
81 | - 'json' => function ($data) { |
|
81 | + 'json' => function($data) { |
|
82 | 82 | if ($data instanceof DataResponse) { |
83 | 83 | $response = new JSONResponse( |
84 | 84 | $data->getData(), |
@@ -145,16 +145,16 @@ discard block |
||
145 | 145 | * @return Response |
146 | 146 | * @since 7.0.0 |
147 | 147 | */ |
148 | - public function buildResponse($response, $format='json') { |
|
149 | - if(array_key_exists($format, $this->responders)) { |
|
148 | + public function buildResponse($response, $format = 'json') { |
|
149 | + if (array_key_exists($format, $this->responders)) { |
|
150 | 150 | |
151 | 151 | $responder = $this->responders[$format]; |
152 | 152 | |
153 | 153 | return $responder($response); |
154 | 154 | |
155 | 155 | } else { |
156 | - throw new \DomainException('No responder registered for format ' . |
|
157 | - $format . '!'); |
|
156 | + throw new \DomainException('No responder registered for format '. |
|
157 | + $format.'!'); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @return mixed the content of the array |
173 | 173 | * @since 6.0.0 |
174 | 174 | */ |
175 | - public function params($key, $default=null){ |
|
175 | + public function params($key, $default = null) { |
|
176 | 176 | return $this->request->getParam($key, $default); |
177 | 177 | } |
178 | 178 | |
@@ -247,13 +247,13 @@ discard block |
||
247 | 247 | * @return \OCP\AppFramework\Http\TemplateResponse containing the page |
248 | 248 | * @since 6.0.0 |
249 | 249 | */ |
250 | - public function render($templateName, array $params=array(), |
|
251 | - $renderAs='user', array $headers=array()){ |
|
250 | + public function render($templateName, array $params = array(), |
|
251 | + $renderAs = 'user', array $headers = array()) { |
|
252 | 252 | $response = new TemplateResponse($this->appName, $templateName); |
253 | 253 | $response->setParams($params); |
254 | 254 | $response->renderAs($renderAs); |
255 | 255 | |
256 | - foreach($headers as $name => $value){ |
|
256 | + foreach ($headers as $name => $value) { |
|
257 | 257 | $response->addHeader($name, $value); |
258 | 258 | } |
259 | 259 |
@@ -34,38 +34,38 @@ |
||
34 | 34 | */ |
35 | 35 | interface IControllerMethodReflector { |
36 | 36 | |
37 | - /** |
|
38 | - * @param object $object an object or classname |
|
39 | - * @param string $method the method which we want to inspect |
|
40 | - * @return void |
|
41 | - * @since 8.0.0 |
|
42 | - */ |
|
43 | - public function reflect($object, $method); |
|
37 | + /** |
|
38 | + * @param object $object an object or classname |
|
39 | + * @param string $method the method which we want to inspect |
|
40 | + * @return void |
|
41 | + * @since 8.0.0 |
|
42 | + */ |
|
43 | + public function reflect($object, $method); |
|
44 | 44 | |
45 | - /** |
|
46 | - * Inspects the PHPDoc parameters for types |
|
47 | - * |
|
48 | - * @param string $parameter the parameter whose type comments should be |
|
49 | - * parsed |
|
50 | - * @return string|null type in the type parameters (@param int $something) |
|
51 | - * would return int or null if not existing |
|
52 | - * @since 8.0.0 |
|
53 | - */ |
|
54 | - public function getType($parameter); |
|
45 | + /** |
|
46 | + * Inspects the PHPDoc parameters for types |
|
47 | + * |
|
48 | + * @param string $parameter the parameter whose type comments should be |
|
49 | + * parsed |
|
50 | + * @return string|null type in the type parameters (@param int $something) |
|
51 | + * would return int or null if not existing |
|
52 | + * @since 8.0.0 |
|
53 | + */ |
|
54 | + public function getType($parameter); |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return array the arguments of the method with key => default value |
|
58 | - * @since 8.0.0 |
|
59 | - */ |
|
60 | - public function getParameters(); |
|
56 | + /** |
|
57 | + * @return array the arguments of the method with key => default value |
|
58 | + * @since 8.0.0 |
|
59 | + */ |
|
60 | + public function getParameters(); |
|
61 | 61 | |
62 | - /** |
|
63 | - * Check if a method contains an annotation |
|
64 | - * |
|
65 | - * @param string $name the name of the annotation |
|
66 | - * @return bool true if the annotation is found |
|
67 | - * @since 8.0.0 |
|
68 | - */ |
|
69 | - public function hasAnnotation($name); |
|
62 | + /** |
|
63 | + * Check if a method contains an annotation |
|
64 | + * |
|
65 | + * @param string $name the name of the annotation |
|
66 | + * @return bool true if the annotation is found |
|
67 | + * @since 8.0.0 |
|
68 | + */ |
|
69 | + public function hasAnnotation($name); |
|
70 | 70 | |
71 | 71 | } |