Skip to content
This repository was archived by the owner on Aug 15, 2023. It is now read-only.

Commit 8d9c5dc

Browse files
committed
[TASK] code cleanup
1 parent 09de513 commit 8d9c5dc

File tree

6 files changed

+40
-97
lines changed

6 files changed

+40
-97
lines changed

Classes/Command/CacheApiCommandController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public function clearPageCacheCommand() {
6868

6969
$this->outputLine('Page cache has been cleared.');
7070
}
71-
7271
}
7372

7473
?>

Classes/Command/DatabaseApiCommandController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public function databaseCompareCommand($actions = '') {
5757
$this->quit();
5858
}
5959
}
60-
6160
}
6261

6362
?>

Classes/Command/ExtensionApiCommandController.php

Lines changed: 37 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/* * *************************************************************
3+
/***************************************************************
44
* Copyright notice
55
*
66
* (c) 2012 Georg Ringer <[email protected]>
@@ -21,7 +21,7 @@
2121
* GNU General Public License for more details.
2222
*
2323
* This copyright notice MUST APPEAR in all copies of the script!
24-
* ************************************************************* */
24+
***************************************************************/
2525

2626
/**
2727
* Extension API Command Controller
@@ -54,12 +54,12 @@ public function infoCommand($key) {
5454

5555
$outputInformation = array();
5656
$outputInformation['is installed'] = ($data['is_installed'] ? 'yes' : 'no');
57-
foreach($data['em_conf'] as $emConfKey => $emConfValue) {
58-
// Skip empty properties
57+
foreach ($data['em_conf'] as $emConfKey => $emConfValue) {
58+
// Skip empty properties
5959
if (empty($emConfValue)) {
6060
continue;
6161
}
62-
// Skip properties which are already handled
62+
// Skip properties which are already handled
6363
if ($emConfKey === 'title' || $emConfKey === 'version' || $emConfKey === 'state') {
6464
continue;
6565
}
@@ -72,7 +72,7 @@ public function infoCommand($key) {
7272
foreach ($outputValue as $additionalKey => $additionalValue) {
7373
if (is_array($additionalValue)) {
7474

75-
if (empty($additionalValue)) {
75+
if (empty($additionalValue)) {
7676
continue;
7777
}
7878
$description .= LF . str_repeat(' ', 28) . $additionalKey;
@@ -81,7 +81,7 @@ public function infoCommand($key) {
8181
$description .= str_repeat(' ', 30) . $ak . ': ' . $av . LF;
8282
}
8383
} else {
84-
$description .= LF . str_repeat(' ', 28) . $additionalKey . ': '. $additionalValue;
84+
$description .= LF . str_repeat(' ', 28) . $additionalKey . ': ' . $additionalValue;
8585
}
8686
}
8787
} else {
@@ -130,194 +130,142 @@ public function updateListCommand() {
130130

131131
$this->outputLine('Extension list has been updated.');
132132
}
133-
134-
133+
135134
/**
136135
* Install(activate) an extension
137136
*
138137
* @param string $key extension key
139138
* @return void
140139
*/
141140
public function installCommand($key) {
142-
143141
try {
144-
145142
/** @var $service Tx_Coreapi_Service_ExtensionApiService */
146143
$service = $this->objectManager->get('Tx_Coreapi_Service_ExtensionApiService');
147144
$data = $service->installExtension($key);
148-
149145
} catch (Exception $e) {
150-
151146
$this->outputLine($e->getMessage());
152147
$this->quit();
153-
154148
}
155-
156149
$this->outputLine(sprintf('Extension "%s" is now installed!', $key));
157-
158150
}
159151

160-
161152
/**
162153
* UnInstall(deactivate) an extension
163154
*
164155
* @param string $key extension key
165156
* @return void
166157
*/
167-
public function unInstallCommand($key) {
168-
158+
public function uninstallCommand($key) {
169159
try {
170-
171160
/** @var $service Tx_Coreapi_Service_ExtensionApiService */
172161
$service = $this->objectManager->get('Tx_Coreapi_Service_ExtensionApiService');
173-
$data = $service->unInstallExtension($key);
174-
162+
$data = $service->uninstallExtension($key);
175163
} catch (Exception $e) {
176-
177164
$this->outputLine($e->getMessage());
178165
$this->quit();
179-
180166
}
181-
182167
$this->outputLine(sprintf('Extension "%s" is now uninstalled!', $key));
183-
184168
}
185169

186-
187-
188170
/**
189171
* Configure an extension
190-
*
172+
*
191173
* This command enables you to configure an extension.
192-
*
174+
*
193175
* examples:
194-
*
176+
*
195177
* [1] Using a standard formatted ini-file
196178
* ./cli_dispatch.phpsh extbase extensionapi:configure rtehtmlarea --configfile=C:\rteconf.txt
197-
*
179+
*
198180
* [2] Adding configuration settings directly on the command line
199181
* ./cli_dispatch.phpsh extbase extensionapi:configure rtehtmlarea --settings="enableImages=1;allowStyleAttribute=0"
200182
*
201183
* [3] A combination of [1] and [2]
202184
* ./cli_dispatch.phpsh extbase extensionapi:configure rtehtmlarea --configfile=C:\rteconf.txt --settings="enableImages=1;allowStyleAttribute=0"
203-
*
204-
*
205-
*
185+
*
206186
* @param string $key extension key
207187
* @param string $configfile path to file containing configuration settings. Must be formatted as a standard ini-file
208188
* @param string $settings string containing configuration settings separated on the form "k1=v1;k2=v2;"
209189
* @return void
210190
*/
211-
public function configureCommand($key, $configfile='',$settings='') {
212-
191+
public function configureCommand($key, $configfile = '', $settings = '') {
213192
global $TYPO3_CONF_VARS;
214-
215193
try {
216-
217194
/** @var $service Tx_Coreapi_Service_ExtensionApiService */
218195
$service = $this->objectManager->get('Tx_Coreapi_Service_ExtensionApiService');
219-
220196
$conf = array();
221-
222-
if(is_file($configfile)){
223-
197+
if (is_file($configfile)) {
224198
$conf = parse_ini_file($configfile);
225-
226199
}
227-
228-
if(strlen($settings)){
229-
$arr = explode(';',$settings);
230-
foreach($arr as $v){
231-
if(strpos($v,'=') === FALSE){
232-
200+
201+
if (strlen($settings)) {
202+
$arr = explode(';', $settings);
203+
foreach ($arr as $v) {
204+
if (strpos($v, '=') === FALSE) {
233205
throw new InvalidArgumentException(sprintf('Ill-formed setting "%s"!', $v));
234-
235206
}
236-
$parts = t3lib_div::trimExplode('=', $v,FALSE,2);
237-
238-
if(!empty($parts[0])){
207+
$parts = t3lib_div::trimExplode('=', $v, FALSE, 2);
208+
if (!empty($parts[0])) {
239209
$conf[$parts[0]] = $parts[1];
240210
}
241211
}
242212
}
243-
244-
if(empty($conf)){
245-
213+
214+
if (empty($conf)) {
246215
throw new InvalidArgumentException(sprintf('No configuration settings!', $key));
247-
248216
}
249-
250-
$data = $service->configureExtension($key,$conf);
251-
217+
$data = $service->configureExtension($key, $conf);
218+
252219
} catch (Exception $e) {
253-
254220
$this->outputLine($e->getMessage());
255221
$this->quit();
256-
257222
}
258-
259223
$this->outputLine(sprintf('Extension "%s" has been configured!', $key));
260-
261224
}
262225

263226
/**
264227
* Fetch an extension from TER
265-
*
228+
*
266229
* @param string $key extension key
267230
* @param string $version the exact version of the extension, otherwise the latest will be picked
268231
* @param string $location where to put the extension. S = typo3/sysext, G = typo3/ext, L = typo3conf/ext
269-
* @param string $overwrite overwrite the extension if it already exists
232+
* @param bool $overwrite overwrite the extension if it already exists
270233
* @param string $mirror mirror to fetch the extension from, otherwise a random mirror will be selected
271234
* @return void
272235
*/
273-
274-
public function fetchCommand($key, $version='', $location='L', $overwrite = FALSE, $mirror = ''){
275-
236+
public function fetchCommand($key, $version = '', $location = 'L', $overwrite = FALSE, $mirror = '') {
276237
try {
277-
278238
/** @var $service Tx_Coreapi_Service_ExtensionApiService */
279239
$service = $this->objectManager->get('Tx_Coreapi_Service_ExtensionApiService');
280-
$data = $service->fetchExtension($key, $version, $location, $overwrite,$mirror);
281-
$this->outputLine(sprintf('Extension "%s" version %s has been fetched from repository!', $data['extKey'],$data['version']));
282-
240+
$data = $service->fetchExtension($key, $version, $location, $overwrite, $mirror);
241+
$this->outputLine(sprintf('Extension "%s" version %s has been fetched from repository!', $data['extKey'], $data['version']));
283242
} catch (Exception $e) {
284-
285243
$this->outputLine($e->getMessage());
286244
$this->quit();
287-
288245
}
289-
290246
}
291247

292-
293248
/**
294249
* Import extension from file
295-
*
250+
*
296251
* @param string $file path to t3x file
297252
* @param string $location where to import the extension. S = typo3/sysext, G = typo3/ext, L = typo3conf/ext
298253
* @param boolean $overwrite overwrite the extension if it already exists
299254
* @return void
300255
*/
301-
302-
public function importCommand($file, $location='L', $overwrite = FALSE){
303-
256+
public function importCommand($file, $location = 'L', $overwrite = FALSE) {
304257
try {
305-
306258
/** @var $service Tx_Coreapi_Service_ExtensionApiService */
307259
$service = $this->objectManager->get('Tx_Coreapi_Service_ExtensionApiService');
308-
$data = $service->importExtension($file,$location,$overwrite);
260+
$data = $service->importExtension($file, $location, $overwrite);
309261
$this->outputLine(sprintf('Extension "%s" has been imported!', $data['extKey']));
310-
262+
311263
} catch (Exception $e) {
312-
313264
$this->outputLine($e->getMessage());
314265
$this->quit();
315-
316266
}
317-
318267
}
319268

320-
321269
/**
322270
* createUploadFoldersCommand
323271
*
@@ -336,7 +284,6 @@ public function createUploadFoldersCommand() {
336284
$this->outputLine('no uploadFolder created');
337285
}
338286
}
339-
340287
}
341288

342289
?>

Classes/Command/SiteApiCommandController.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function infoCommand() {
4242
$service = $this->objectManager->get('Tx_Coreapi_Service_SiteApiService');
4343
$data = $service->getSiteInfo();
4444

45-
foreach($data as $key => $value) {
45+
foreach ($data as $key => $value) {
4646
$line = wordwrap($value, self::MAXIMUM_LINE_LENGTH - 43, PHP_EOL . str_repeat(' ', 43), TRUE);
4747
$this->outputLine('%-2s%-40s %s', array(' ', $key, $line));
4848
}
@@ -62,7 +62,6 @@ public function createSysNewsCommand($header, $text = '') {
6262
$service = $this->objectManager->get('Tx_Coreapi_Service_SiteApiService');
6363
$service->createSysNews($header, $text);
6464
}
65-
6665
}
6766

6867
?>

Classes/Service/CacheApiService.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ public function clearConfigurationCache() {
7777
}
7878
$this->tce->clear_cacheCmd('temp_cached');
7979
}
80-
8180
}
8281

8382
?>

Classes/Service/DatabaseApiService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/* * *************************************************************
3+
/***************************************************************
44
* Copyright notice
55
*
66
* (c) 2012 Georg Ringer <[email protected]>
@@ -21,7 +21,7 @@
2121
* GNU General Public License for more details.
2222
*
2323
* This copyright notice MUST APPEAR in all copies of the script!
24-
* ************************************************************* */
24+
***************************************************************/
2525

2626
/**
2727
* DB API service

0 commit comments

Comments
 (0)