@@ -57,8 +57,8 @@ |
||
57 | 57 | * @deprecated 9.2.0 To implement an OCS endpoint extend the OCSController |
58 | 58 | */ |
59 | 59 | public function __construct($format, $statuscode, $message, |
60 | - $data=[], $itemscount='', |
|
61 | - $itemsperpage='') { |
|
60 | + $data = [], $itemscount = '', |
|
61 | + $itemsperpage = '') { |
|
62 | 62 | parent::__construct(); |
63 | 63 | |
64 | 64 | $this->format = $format; |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * @param array $headers additional key value based headers |
51 | 51 | * @since 8.0.0 |
52 | 52 | */ |
53 | - public function __construct($data=array(), $statusCode=Http::STATUS_OK, |
|
54 | - array $headers=array()) { |
|
53 | + public function __construct($data = array(), $statusCode = Http::STATUS_OK, |
|
54 | + array $headers = array()) { |
|
55 | 55 | parent::__construct(); |
56 | 56 | |
57 | 57 | $this->data = $data; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @return DataResponse Reference to this object |
67 | 67 | * @since 8.0.0 |
68 | 68 | */ |
69 | - public function setData($data){ |
|
69 | + public function setData($data) { |
|
70 | 70 | $this->data = $data; |
71 | 71 | |
72 | 72 | return $this; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @return array the data |
79 | 79 | * @since 8.0.0 |
80 | 80 | */ |
81 | - public function getData(){ |
|
81 | + public function getData() { |
|
82 | 82 | return $this->data; |
83 | 83 | } |
84 | 84 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param int $statusCode the Http status code, defaults to 200 |
53 | 53 | * @since 6.0.0 |
54 | 54 | */ |
55 | - public function __construct($data=array(), $statusCode=Http::STATUS_OK) { |
|
55 | + public function __construct($data = array(), $statusCode = Http::STATUS_OK) { |
|
56 | 56 | parent::__construct(); |
57 | 57 | |
58 | 58 | $this->data = $data; |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function render() { |
71 | 71 | $response = json_encode($this->data, JSON_HEX_TAG); |
72 | - if($response === false) { |
|
73 | - throw new \Exception(sprintf('Could not json_encode due to invalid ' . |
|
72 | + if ($response === false) { |
|
73 | + throw new \Exception(sprintf('Could not json_encode due to invalid '. |
|
74 | 74 | 'non UTF-8 characters in the array: %s', var_export($this->data, true))); |
75 | 75 | } |
76 | 76 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @return JSONResponse Reference to this object |
85 | 85 | * @since 6.0.0 - return value was added in 7.0.0 |
86 | 86 | */ |
87 | - public function setData($data){ |
|
87 | + public function setData($data) { |
|
88 | 88 | $this->data = $data; |
89 | 89 | |
90 | 90 | return $this; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @return array the data |
97 | 97 | * @since 6.0.0 |
98 | 98 | */ |
99 | - public function getData(){ |
|
99 | + public function getData() { |
|
100 | 100 | return $this->data; |
101 | 101 | } |
102 | 102 |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | */ |
38 | 38 | class TemplateResponse extends Response { |
39 | 39 | |
40 | - const EVENT_LOAD_ADDITIONAL_SCRIPTS = self::class . '::loadAdditionalScripts'; |
|
41 | - const EVENT_LOAD_ADDITIONAL_SCRIPTS_LOGGEDIN = self::class . '::loadAdditionalScriptsLoggedIn'; |
|
40 | + const EVENT_LOAD_ADDITIONAL_SCRIPTS = self::class.'::loadAdditionalScripts'; |
|
41 | + const EVENT_LOAD_ADDITIONAL_SCRIPTS_LOGGEDIN = self::class.'::loadAdditionalScriptsLoggedIn'; |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * name of the template |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * @param string $renderAs how the page should be rendered, defaults to user |
74 | 74 | * @since 6.0.0 - parameters $params and $renderAs were added in 7.0.0 |
75 | 75 | */ |
76 | - public function __construct($appName, $templateName, array $params=array(), |
|
77 | - $renderAs='user') { |
|
76 | + public function __construct($appName, $templateName, array $params = array(), |
|
77 | + $renderAs = 'user') { |
|
78 | 78 | parent::__construct(); |
79 | 79 | |
80 | 80 | $this->templateName = $templateName; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @return TemplateResponse Reference to this object |
94 | 94 | * @since 6.0.0 - return value was added in 7.0.0 |
95 | 95 | */ |
96 | - public function setParams(array $params){ |
|
96 | + public function setParams(array $params) { |
|
97 | 97 | $this->params = $params; |
98 | 98 | |
99 | 99 | return $this; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @return array the params |
106 | 106 | * @since 6.0.0 |
107 | 107 | */ |
108 | - public function getParams(){ |
|
108 | + public function getParams() { |
|
109 | 109 | return $this->params; |
110 | 110 | } |
111 | 111 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @return string the name of the used template |
116 | 116 | * @since 6.0.0 |
117 | 117 | */ |
118 | - public function getTemplateName(){ |
|
118 | + public function getTemplateName() { |
|
119 | 119 | return $this->templateName; |
120 | 120 | } |
121 | 121 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @return TemplateResponse Reference to this object |
130 | 130 | * @since 6.0.0 - return value was added in 7.0.0 |
131 | 131 | */ |
132 | - public function renderAs($renderAs){ |
|
132 | + public function renderAs($renderAs) { |
|
133 | 133 | $this->renderAs = $renderAs; |
134 | 134 | |
135 | 135 | return $this; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @return string the renderAs value |
142 | 142 | * @since 6.0.0 |
143 | 143 | */ |
144 | - public function getRenderAs(){ |
|
144 | + public function getRenderAs() { |
|
145 | 145 | return $this->renderAs; |
146 | 146 | } |
147 | 147 | |
@@ -151,13 +151,13 @@ discard block |
||
151 | 151 | * @return string the rendered html |
152 | 152 | * @since 6.0.0 |
153 | 153 | */ |
154 | - public function render(){ |
|
154 | + public function render() { |
|
155 | 155 | // \OCP\Template needs an empty string instead of 'blank' for an unwrapped response |
156 | 156 | $renderAs = $this->renderAs === 'blank' ? '' : $this->renderAs; |
157 | 157 | |
158 | 158 | $template = new \OCP\Template($this->appName, $this->templateName, $renderAs); |
159 | 159 | |
160 | - foreach($this->params as $key => $value){ |
|
160 | + foreach ($this->params as $key => $value) { |
|
161 | 161 | $template->assign($key, $value); |
162 | 162 | } |
163 | 163 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param string|resource $filePath the path to the file or a file handle which should be streamed |
42 | 42 | * @since 8.1.0 |
43 | 43 | */ |
44 | - public function __construct ($filePath) { |
|
44 | + public function __construct($filePath) { |
|
45 | 45 | parent::__construct(); |
46 | 46 | |
47 | 47 | $this->filePath = $filePath; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param IOutput $output a small wrapper that handles output |
55 | 55 | * @since 8.1.0 |
56 | 56 | */ |
57 | - public function callback (IOutput $output) { |
|
57 | + public function callback(IOutput $output) { |
|
58 | 58 | // handle caching |
59 | 59 | if ($output->getHttpResponseCode() !== Http::STATUS_NOT_MODIFIED) { |
60 | 60 | if (!(is_resource($this->filePath) || file_exists($this->filePath))) { |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @param array $headers additional key value based headers |
48 | 48 | * @since 8.1.0 |
49 | 49 | */ |
50 | - public function __construct($data='', $statusCode=Http::STATUS_OK, |
|
51 | - $headers=[]) { |
|
50 | + public function __construct($data = '', $statusCode = Http::STATUS_OK, |
|
51 | + $headers = []) { |
|
52 | 52 | parent::__construct(); |
53 | 53 | |
54 | 54 | $this->data = $data; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return DataDisplayResponse Reference to this object |
74 | 74 | * @since 8.1.0 |
75 | 75 | */ |
76 | - public function setData($data){ |
|
76 | + public function setData($data) { |
|
77 | 77 | $this->data = $data; |
78 | 78 | |
79 | 79 | return $this; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @return string the data |
86 | 86 | * @since 8.1.0 |
87 | 87 | */ |
88 | - public function getData(){ |
|
88 | + public function getData() { |
|
89 | 89 | return $this->data; |
90 | 90 | } |
91 | 91 |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | * @param array $headers |
44 | 44 | * @since 11.0.0 |
45 | 45 | */ |
46 | - public function __construct($file, $statusCode=Http::STATUS_OK, |
|
47 | - $headers=[]) { |
|
46 | + public function __construct($file, $statusCode = Http::STATUS_OK, |
|
47 | + $headers = []) { |
|
48 | 48 | parent::__construct(); |
49 | 49 | |
50 | 50 | $this->file = $file; |
51 | 51 | $this->setStatus($statusCode); |
52 | 52 | $this->setHeaders(array_merge($this->getHeaders(), $headers)); |
53 | - $this->addHeader('Content-Disposition', 'inline; filename="' . rawurldecode($file->getName()) . '"'); |
|
53 | + $this->addHeader('Content-Disposition', 'inline; filename="'.rawurldecode($file->getName()).'"'); |
|
54 | 54 | |
55 | 55 | $this->setETag($file->getEtag()); |
56 | 56 | $lastModified = new \DateTime(); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function callback(IOutput $output) { |
66 | 66 | if ($output->getHttpResponseCode() !== Http::STATUS_NOT_MODIFIED) { |
67 | - $output->setHeader('Content-Length: ' . $this->file->getSize()); |
|
67 | + $output->setHeader('Content-Length: '.$this->file->getSize()); |
|
68 | 68 | $output->setOutput($this->file->getContent()); |
69 | 69 | } |
70 | 70 | } |