Passed
Push — master ( 61a02b...010b07 )
by Roeland
19:08 queued 08:59
created
apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -26,54 +26,54 @@
 block discarded – undo
26 26
 
27 27
 class InvalidPath extends Exception {
28 28
 
29
-	const NS_OWNCLOUD = 'http://owncloud.org/ns';
29
+    const NS_OWNCLOUD = 'http://owncloud.org/ns';
30 30
 
31
-	/**
32
-	 * @var bool
33
-	 */
34
-	private $retry;
31
+    /**
32
+     * @var bool
33
+     */
34
+    private $retry;
35 35
 
36
-	/**
37
-	 * @param string $message
38
-	 * @param bool $retry
39
-	 * @param \Exception|null $previous
40
-	 */
41
-	public function __construct($message, $retry = false, \Exception $previous = null) {
42
-		parent::__construct($message, 0, $previous);
43
-		$this->retry = $retry;
44
-	}
36
+    /**
37
+     * @param string $message
38
+     * @param bool $retry
39
+     * @param \Exception|null $previous
40
+     */
41
+    public function __construct($message, $retry = false, \Exception $previous = null) {
42
+        parent::__construct($message, 0, $previous);
43
+        $this->retry = $retry;
44
+    }
45 45
 
46
-	/**
47
-	 * Returns the HTTP status code for this exception
48
-	 *
49
-	 * @return int
50
-	 */
51
-	public function getHTTPCode() {
46
+    /**
47
+     * Returns the HTTP status code for this exception
48
+     *
49
+     * @return int
50
+     */
51
+    public function getHTTPCode() {
52 52
 
53
-		return 400;
53
+        return 400;
54 54
 
55
-	}
55
+    }
56 56
 
57
-	/**
58
-	 * This method allows the exception to include additional information
59
-	 * into the WebDAV error response
60
-	 *
61
-	 * @param \Sabre\DAV\Server $server
62
-	 * @param \DOMElement $errorNode
63
-	 * @return void
64
-	 */
65
-	public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) {
57
+    /**
58
+     * This method allows the exception to include additional information
59
+     * into the WebDAV error response
60
+     *
61
+     * @param \Sabre\DAV\Server $server
62
+     * @param \DOMElement $errorNode
63
+     * @return void
64
+     */
65
+    public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) {
66 66
 
67
-		// set ownCloud namespace
68
-		$errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
67
+        // set ownCloud namespace
68
+        $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
69 69
 
70
-		// adding the retry node
71
-		$error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true));
72
-		$errorNode->appendChild($error);
70
+        // adding the retry node
71
+        $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true));
72
+        $errorNode->appendChild($error);
73 73
 
74
-		// adding the message node
75
-		$error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
76
-		$errorNode->appendChild($error);
77
-	}
74
+        // adding the message node
75
+        $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
76
+        $errorNode->appendChild($error);
77
+    }
78 78
 
79 79
 }
Please login to merge, or discard this patch.
core/Controller/OCJSController.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -43,62 +43,62 @@
 block discarded – undo
43 43
 
44 44
 class OCJSController extends Controller {
45 45
 
46
-	/** @var JSConfigHelper */
47
-	private $helper;
46
+    /** @var JSConfigHelper */
47
+    private $helper;
48 48
 
49
-	/**
50
-	 * OCJSController constructor.
51
-	 *
52
-	 * @param string $appName
53
-	 * @param IRequest $request
54
-	 * @param IFactory $l10nFactory
55
-	 * @param Defaults $defaults
56
-	 * @param IAppManager $appManager
57
-	 * @param ISession $session
58
-	 * @param IUserSession $userSession
59
-	 * @param IConfig $config
60
-	 * @param IGroupManager $groupManager
61
-	 * @param IniGetWrapper $iniWrapper
62
-	 * @param IURLGenerator $urlGenerator
63
-	 * @param CapabilitiesManager $capabilitiesManager
64
-	 */
65
-	public function __construct($appName,
66
-								IRequest $request,
67
-								IFactory $l10nFactory,
68
-								Defaults $defaults,
69
-								IAppManager $appManager,
70
-								ISession $session,
71
-								IUserSession $userSession,
72
-								IConfig $config,
73
-								IGroupManager $groupManager,
74
-								IniGetWrapper $iniWrapper,
75
-								IURLGenerator $urlGenerator,
76
-								CapabilitiesManager $capabilitiesManager) {
77
-		parent::__construct($appName, $request);
49
+    /**
50
+     * OCJSController constructor.
51
+     *
52
+     * @param string $appName
53
+     * @param IRequest $request
54
+     * @param IFactory $l10nFactory
55
+     * @param Defaults $defaults
56
+     * @param IAppManager $appManager
57
+     * @param ISession $session
58
+     * @param IUserSession $userSession
59
+     * @param IConfig $config
60
+     * @param IGroupManager $groupManager
61
+     * @param IniGetWrapper $iniWrapper
62
+     * @param IURLGenerator $urlGenerator
63
+     * @param CapabilitiesManager $capabilitiesManager
64
+     */
65
+    public function __construct($appName,
66
+                                IRequest $request,
67
+                                IFactory $l10nFactory,
68
+                                Defaults $defaults,
69
+                                IAppManager $appManager,
70
+                                ISession $session,
71
+                                IUserSession $userSession,
72
+                                IConfig $config,
73
+                                IGroupManager $groupManager,
74
+                                IniGetWrapper $iniWrapper,
75
+                                IURLGenerator $urlGenerator,
76
+                                CapabilitiesManager $capabilitiesManager) {
77
+        parent::__construct($appName, $request);
78 78
 
79
-		$this->helper = new JSConfigHelper(
80
-			$l10nFactory->get('lib'),
81
-			$defaults,
82
-			$appManager,
83
-			$session,
84
-			$userSession->getUser(),
85
-			$config,
86
-			$groupManager,
87
-			$iniWrapper,
88
-			$urlGenerator,
89
-			$capabilitiesManager
90
-		);
91
-	}
79
+        $this->helper = new JSConfigHelper(
80
+            $l10nFactory->get('lib'),
81
+            $defaults,
82
+            $appManager,
83
+            $session,
84
+            $userSession->getUser(),
85
+            $config,
86
+            $groupManager,
87
+            $iniWrapper,
88
+            $urlGenerator,
89
+            $capabilitiesManager
90
+        );
91
+    }
92 92
 
93
-	/**
94
-	 * @NoCSRFRequired
95
-	 * @PublicPage
96
-	 *
97
-	 * @return DataDisplayResponse
98
-	 */
99
-	public function getConfig() {
100
-		$data = $this->helper->getConfig();
93
+    /**
94
+     * @NoCSRFRequired
95
+     * @PublicPage
96
+     *
97
+     * @return DataDisplayResponse
98
+     */
99
+    public function getConfig() {
100
+        $data = $this->helper->getConfig();
101 101
 
102
-		return new DataDisplayResponse($data, Http::STATUS_OK, ['Content-type' => 'text/javascript']);
103
-	}
102
+        return new DataDisplayResponse($data, Http::STATUS_OK, ['Content-type' => 'text/javascript']);
103
+    }
104 104
 }
Please login to merge, or discard this patch.
lib/private/App/Platform.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -35,65 +35,65 @@
 block discarded – undo
35 35
  */
36 36
 class Platform {
37 37
 
38
-	/**
39
-	 * @param IConfig $config
40
-	 */
41
-	function __construct(IConfig $config) {
42
-		$this->config = $config;
43
-	}
38
+    /**
39
+     * @param IConfig $config
40
+     */
41
+    function __construct(IConfig $config) {
42
+        $this->config = $config;
43
+    }
44 44
 
45
-	/**
46
-	 * @return string
47
-	 */
48
-	public function getPhpVersion() {
49
-		return phpversion();
50
-	}
45
+    /**
46
+     * @return string
47
+     */
48
+    public function getPhpVersion() {
49
+        return phpversion();
50
+    }
51 51
 
52
-	/**
53
-	 * @return int
54
-	 */
55
-	public function getIntSize() {
56
-		return PHP_INT_SIZE;
57
-	}
52
+    /**
53
+     * @return int
54
+     */
55
+    public function getIntSize() {
56
+        return PHP_INT_SIZE;
57
+    }
58 58
 
59
-	/**
60
-	 * @return string
61
-	 */
62
-	public function getOcVersion() {
63
-		$v = \OCP\Util::getVersion();
64
-		return implode('.', $v);
65
-	}
59
+    /**
60
+     * @return string
61
+     */
62
+    public function getOcVersion() {
63
+        $v = \OCP\Util::getVersion();
64
+        return implode('.', $v);
65
+    }
66 66
 
67
-	/**
68
-	 * @return string
69
-	 */
70
-	public function getDatabase() {
71
-		$dbType = $this->config->getSystemValue('dbtype', 'sqlite');
72
-		if ($dbType === 'sqlite3') {
73
-			$dbType = 'sqlite';
74
-		}
67
+    /**
68
+     * @return string
69
+     */
70
+    public function getDatabase() {
71
+        $dbType = $this->config->getSystemValue('dbtype', 'sqlite');
72
+        if ($dbType === 'sqlite3') {
73
+            $dbType = 'sqlite';
74
+        }
75 75
 
76
-		return $dbType;
77
-	}
76
+        return $dbType;
77
+    }
78 78
 
79
-	/**
80
-	 * @return string
81
-	 */
82
-	public function getOS() {
83
-		return php_uname('s');
84
-	}
79
+    /**
80
+     * @return string
81
+     */
82
+    public function getOS() {
83
+        return php_uname('s');
84
+    }
85 85
 
86
-	/**
87
-	 * @param $command
88
-	 * @return bool
89
-	 */
90
-	public function isCommandKnown($command) {
91
-		$path = \OC_Helper::findBinaryPath($command);
92
-		return ($path !== null);
93
-	}
86
+    /**
87
+     * @param $command
88
+     * @return bool
89
+     */
90
+    public function isCommandKnown($command) {
91
+        $path = \OC_Helper::findBinaryPath($command);
92
+        return ($path !== null);
93
+    }
94 94
 
95
-	public function getLibraryVersion($name) {
96
-		$repo = new PlatformRepository();
97
-		return $repo->findLibrary($name);
98
-	}
95
+    public function getLibraryVersion($name) {
96
+        $repo = new PlatformRepository();
97
+        return $repo->findLibrary($name);
98
+    }
99 99
 }
Please login to merge, or discard this patch.
core/Command/Config/System/DeleteConfig.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -29,89 +29,89 @@
 block discarded – undo
29 29
 use Symfony\Component\Console\Output\OutputInterface;
30 30
 
31 31
 class DeleteConfig extends Base {
32
-	/** * @var SystemConfig */
33
-	protected $systemConfig;
32
+    /** * @var SystemConfig */
33
+    protected $systemConfig;
34 34
 
35
-	/**
36
-	 * @param SystemConfig $systemConfig
37
-	 */
38
-	public function __construct(SystemConfig $systemConfig) {
39
-		parent::__construct();
40
-		$this->systemConfig = $systemConfig;
41
-	}
35
+    /**
36
+     * @param SystemConfig $systemConfig
37
+     */
38
+    public function __construct(SystemConfig $systemConfig) {
39
+        parent::__construct();
40
+        $this->systemConfig = $systemConfig;
41
+    }
42 42
 
43
-	protected function configure() {
44
-		parent::configure();
43
+    protected function configure() {
44
+        parent::configure();
45 45
 
46
-		$this
47
-			->setName('config:system:delete')
48
-			->setDescription('Delete a system config value')
49
-			->addArgument(
50
-				'name',
51
-				InputArgument::REQUIRED | InputArgument::IS_ARRAY,
52
-				'Name of the config to delete, specify multiple for array parameter'
53
-			)
54
-			->addOption(
55
-				'error-if-not-exists',
56
-				null,
57
-				InputOption::VALUE_NONE,
58
-				'Checks whether the config exists before deleting it'
59
-			)
60
-		;
61
-	}
46
+        $this
47
+            ->setName('config:system:delete')
48
+            ->setDescription('Delete a system config value')
49
+            ->addArgument(
50
+                'name',
51
+                InputArgument::REQUIRED | InputArgument::IS_ARRAY,
52
+                'Name of the config to delete, specify multiple for array parameter'
53
+            )
54
+            ->addOption(
55
+                'error-if-not-exists',
56
+                null,
57
+                InputOption::VALUE_NONE,
58
+                'Checks whether the config exists before deleting it'
59
+            )
60
+        ;
61
+    }
62 62
 
63
-	protected function execute(InputInterface $input, OutputInterface $output) {
64
-		$configNames = $input->getArgument('name');
65
-		$configName = $configNames[0];
63
+    protected function execute(InputInterface $input, OutputInterface $output) {
64
+        $configNames = $input->getArgument('name');
65
+        $configName = $configNames[0];
66 66
 
67
-		if (count($configNames) > 1) {
68
-			if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->systemConfig->getKeys())) {
69
-				$output->writeln('<error>System config ' . implode(' => ', $configNames) . ' could not be deleted because it did not exist</error>');
70
-				return 1;
71
-			}
67
+        if (count($configNames) > 1) {
68
+            if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->systemConfig->getKeys())) {
69
+                $output->writeln('<error>System config ' . implode(' => ', $configNames) . ' could not be deleted because it did not exist</error>');
70
+                return 1;
71
+            }
72 72
 
73
-			$value = $this->systemConfig->getValue($configName);
73
+            $value = $this->systemConfig->getValue($configName);
74 74
 
75
-			try {
76
-				$value = $this->removeSubValue(array_slice($configNames, 1), $value, $input->hasParameterOption('--error-if-not-exists'));
77
-			}
78
-			catch (\UnexpectedValueException $e) {
79
-				$output->writeln('<error>System config ' . implode(' => ', $configNames) . ' could not be deleted because it did not exist</error>');
80
-				return 1;
81
-			}
75
+            try {
76
+                $value = $this->removeSubValue(array_slice($configNames, 1), $value, $input->hasParameterOption('--error-if-not-exists'));
77
+            }
78
+            catch (\UnexpectedValueException $e) {
79
+                $output->writeln('<error>System config ' . implode(' => ', $configNames) . ' could not be deleted because it did not exist</error>');
80
+                return 1;
81
+            }
82 82
 
83
-			$this->systemConfig->setValue($configName, $value);
84
-			$output->writeln('<info>System config value ' . implode(' => ', $configNames) . ' deleted</info>');
85
-			return 0;
86
-		} else {
87
-			if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->systemConfig->getKeys())) {
88
-				$output->writeln('<error>System config ' . $configName . ' could not be deleted because it did not exist</error>');
89
-				return 1;
90
-			}
83
+            $this->systemConfig->setValue($configName, $value);
84
+            $output->writeln('<info>System config value ' . implode(' => ', $configNames) . ' deleted</info>');
85
+            return 0;
86
+        } else {
87
+            if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->systemConfig->getKeys())) {
88
+                $output->writeln('<error>System config ' . $configName . ' could not be deleted because it did not exist</error>');
89
+                return 1;
90
+            }
91 91
 
92
-			$this->systemConfig->deleteValue($configName);
93
-			$output->writeln('<info>System config value ' . $configName . ' deleted</info>');
94
-			return 0;
95
-		}
96
-	}
92
+            $this->systemConfig->deleteValue($configName);
93
+            $output->writeln('<info>System config value ' . $configName . ' deleted</info>');
94
+            return 0;
95
+        }
96
+    }
97 97
 
98
-	protected function removeSubValue($keys, $currentValue, $throwError) {
99
-		$nextKey = array_shift($keys);
98
+    protected function removeSubValue($keys, $currentValue, $throwError) {
99
+        $nextKey = array_shift($keys);
100 100
 
101
-		if (is_array($currentValue)) {
102
-			if (isset($currentValue[$nextKey])) {
103
-				if (empty($keys)) {
104
-					unset($currentValue[$nextKey]);
105
-				} else {
106
-					$currentValue[$nextKey] = $this->removeSubValue($keys, $currentValue[$nextKey], $throwError);
107
-				}
108
-			} else if ($throwError) {
109
-				throw new \UnexpectedValueException('Config parameter does not exist');
110
-			}
111
-		} else if ($throwError) {
112
-			throw new \UnexpectedValueException('Config parameter does not exist');
113
-		}
101
+        if (is_array($currentValue)) {
102
+            if (isset($currentValue[$nextKey])) {
103
+                if (empty($keys)) {
104
+                    unset($currentValue[$nextKey]);
105
+                } else {
106
+                    $currentValue[$nextKey] = $this->removeSubValue($keys, $currentValue[$nextKey], $throwError);
107
+                }
108
+            } else if ($throwError) {
109
+                throw new \UnexpectedValueException('Config parameter does not exist');
110
+            }
111
+        } else if ($throwError) {
112
+            throw new \UnexpectedValueException('Config parameter does not exist');
113
+        }
114 114
 
115
-		return $currentValue;
116
-	}
115
+        return $currentValue;
116
+    }
117 117
 }
Please login to merge, or discard this patch.
core/Command/Config/System/SetConfig.php 1 patch
Indentation   +176 added lines, -176 removed lines patch added patch discarded remove patch
@@ -31,180 +31,180 @@
 block discarded – undo
31 31
 use Symfony\Component\Console\Output\OutputInterface;
32 32
 
33 33
 class SetConfig extends Base {
34
-	/** * @var SystemConfig */
35
-	protected $systemConfig;
36
-
37
-	/**
38
-	 * @param SystemConfig $systemConfig
39
-	 */
40
-	public function __construct(SystemConfig $systemConfig) {
41
-		parent::__construct();
42
-		$this->systemConfig = $systemConfig;
43
-	}
44
-
45
-	protected function configure() {
46
-		parent::configure();
47
-
48
-		$this
49
-			->setName('config:system:set')
50
-			->setDescription('Set a system config value')
51
-			->addArgument(
52
-				'name',
53
-				InputArgument::REQUIRED | InputArgument::IS_ARRAY,
54
-				'Name of the config parameter, specify multiple for array parameter'
55
-			)
56
-			->addOption(
57
-				'type',
58
-				null,
59
-				InputOption::VALUE_REQUIRED,
60
-				'Value type [string, integer, double, boolean]',
61
-				'string'
62
-			)
63
-			->addOption(
64
-				'value',
65
-				null,
66
-				InputOption::VALUE_REQUIRED,
67
-				'The new value of the config'
68
-			)
69
-			->addOption(
70
-				'update-only',
71
-				null,
72
-				InputOption::VALUE_NONE,
73
-				'Only updates the value, if it is not set before, it is not being added'
74
-			)
75
-		;
76
-	}
77
-
78
-	protected function execute(InputInterface $input, OutputInterface $output) {
79
-		$configNames = $input->getArgument('name');
80
-		$configName = $configNames[0];
81
-		$configValue = $this->castValue($input->getOption('value'), $input->getOption('type'));
82
-		$updateOnly = $input->getOption('update-only');
83
-
84
-		if (count($configNames) > 1) {
85
-			$existingValue = $this->systemConfig->getValue($configName);
86
-
87
-			$newValue = $this->mergeArrayValue(
88
-				array_slice($configNames, 1), $existingValue, $configValue['value'], $updateOnly
89
-			);
90
-
91
-			$this->systemConfig->setValue($configName, $newValue);
92
-		} else {
93
-			if ($updateOnly && !in_array($configName, $this->systemConfig->getKeys(), true)) {
94
-				throw new \UnexpectedValueException('Config parameter does not exist');
95
-			}
96
-
97
-			$this->systemConfig->setValue($configName, $configValue['value']);
98
-		}
99
-
100
-		$output->writeln('<info>System config value ' . implode(' => ', $configNames) . ' set to ' . $configValue['readable-value'] . '</info>');
101
-		return 0;
102
-	}
103
-
104
-	/**
105
-	 * @param string $value
106
-	 * @param string $type
107
-	 * @return mixed
108
-	 * @throws \InvalidArgumentException
109
-	 */
110
-	protected function castValue($value, $type) {
111
-		switch ($type) {
112
-			case 'integer':
113
-			case 'int':
114
-				if (!is_numeric($value)) {
115
-					throw new \InvalidArgumentException('Non-numeric value specified');
116
-				}
117
-				return [
118
-					'value' => (int) $value,
119
-					'readable-value' => 'integer ' . (int) $value,
120
-				];
121
-
122
-			case 'double':
123
-			case 'float':
124
-				if (!is_numeric($value)) {
125
-					throw new \InvalidArgumentException('Non-numeric value specified');
126
-				}
127
-				return [
128
-					'value' => (double) $value,
129
-					'readable-value' => 'double ' . (double) $value,
130
-				];
131
-
132
-			case 'boolean':
133
-			case 'bool':
134
-				$value = strtolower($value);
135
-				switch ($value) {
136
-					case 'true':
137
-						return [
138
-							'value' => true,
139
-							'readable-value' => 'boolean ' . $value,
140
-						];
141
-
142
-					case 'false':
143
-						return [
144
-							'value' => false,
145
-							'readable-value' => 'boolean ' . $value,
146
-						];
147
-
148
-					default:
149
-						throw new \InvalidArgumentException('Unable to parse value as boolean');
150
-				}
151
-
152
-			case 'null':
153
-				return [
154
-					'value' => null,
155
-					'readable-value' => 'null',
156
-				];
157
-
158
-			case 'string':
159
-				$value = (string) $value;
160
-				return [
161
-					'value' => $value,
162
-					'readable-value' => ($value === '') ? 'empty string' : 'string ' . $value,
163
-				];
164
-
165
-			default:
166
-				throw new \InvalidArgumentException('Invalid type');
167
-		}
168
-	}
169
-
170
-	/**
171
-	 * @param array $configNames
172
-	 * @param mixed $existingValues
173
-	 * @param mixed $value
174
-	 * @param bool $updateOnly
175
-	 * @return array merged value
176
-	 * @throws \UnexpectedValueException
177
-	 */
178
-	protected function mergeArrayValue(array $configNames, $existingValues, $value, $updateOnly) {
179
-		$configName = array_shift($configNames);
180
-		if (!is_array($existingValues)) {
181
-			$existingValues = [];
182
-		}
183
-		if (!empty($configNames)) {
184
-			if (isset($existingValues[$configName])) {
185
-				$existingValue = $existingValues[$configName];
186
-			} else {
187
-				$existingValue = [];
188
-			}
189
-			$existingValues[$configName] = $this->mergeArrayValue($configNames, $existingValue, $value, $updateOnly);
190
-		} else {
191
-			if (!isset($existingValues[$configName]) && $updateOnly) {
192
-				throw new \UnexpectedValueException('Config parameter does not exist');
193
-			}
194
-			$existingValues[$configName] = $value;
195
-		}
196
-		return $existingValues;
197
-	}
198
-
199
-	/**
200
-	 * @param string $optionName
201
-	 * @param CompletionContext $context
202
-	 * @return string[]
203
-	 */
204
-	public function completeOptionValues($optionName, CompletionContext $context) {
205
-		if ($optionName === 'type') {
206
-			return ['string', 'integer', 'double', 'boolean'];
207
-		}
208
-		return parent::completeOptionValues($optionName, $context);
209
-	}
34
+    /** * @var SystemConfig */
35
+    protected $systemConfig;
36
+
37
+    /**
38
+     * @param SystemConfig $systemConfig
39
+     */
40
+    public function __construct(SystemConfig $systemConfig) {
41
+        parent::__construct();
42
+        $this->systemConfig = $systemConfig;
43
+    }
44
+
45
+    protected function configure() {
46
+        parent::configure();
47
+
48
+        $this
49
+            ->setName('config:system:set')
50
+            ->setDescription('Set a system config value')
51
+            ->addArgument(
52
+                'name',
53
+                InputArgument::REQUIRED | InputArgument::IS_ARRAY,
54
+                'Name of the config parameter, specify multiple for array parameter'
55
+            )
56
+            ->addOption(
57
+                'type',
58
+                null,
59
+                InputOption::VALUE_REQUIRED,
60
+                'Value type [string, integer, double, boolean]',
61
+                'string'
62
+            )
63
+            ->addOption(
64
+                'value',
65
+                null,
66
+                InputOption::VALUE_REQUIRED,
67
+                'The new value of the config'
68
+            )
69
+            ->addOption(
70
+                'update-only',
71
+                null,
72
+                InputOption::VALUE_NONE,
73
+                'Only updates the value, if it is not set before, it is not being added'
74
+            )
75
+        ;
76
+    }
77
+
78
+    protected function execute(InputInterface $input, OutputInterface $output) {
79
+        $configNames = $input->getArgument('name');
80
+        $configName = $configNames[0];
81
+        $configValue = $this->castValue($input->getOption('value'), $input->getOption('type'));
82
+        $updateOnly = $input->getOption('update-only');
83
+
84
+        if (count($configNames) > 1) {
85
+            $existingValue = $this->systemConfig->getValue($configName);
86
+
87
+            $newValue = $this->mergeArrayValue(
88
+                array_slice($configNames, 1), $existingValue, $configValue['value'], $updateOnly
89
+            );
90
+
91
+            $this->systemConfig->setValue($configName, $newValue);
92
+        } else {
93
+            if ($updateOnly && !in_array($configName, $this->systemConfig->getKeys(), true)) {
94
+                throw new \UnexpectedValueException('Config parameter does not exist');
95
+            }
96
+
97
+            $this->systemConfig->setValue($configName, $configValue['value']);
98
+        }
99
+
100
+        $output->writeln('<info>System config value ' . implode(' => ', $configNames) . ' set to ' . $configValue['readable-value'] . '</info>');
101
+        return 0;
102
+    }
103
+
104
+    /**
105
+     * @param string $value
106
+     * @param string $type
107
+     * @return mixed
108
+     * @throws \InvalidArgumentException
109
+     */
110
+    protected function castValue($value, $type) {
111
+        switch ($type) {
112
+            case 'integer':
113
+            case 'int':
114
+                if (!is_numeric($value)) {
115
+                    throw new \InvalidArgumentException('Non-numeric value specified');
116
+                }
117
+                return [
118
+                    'value' => (int) $value,
119
+                    'readable-value' => 'integer ' . (int) $value,
120
+                ];
121
+
122
+            case 'double':
123
+            case 'float':
124
+                if (!is_numeric($value)) {
125
+                    throw new \InvalidArgumentException('Non-numeric value specified');
126
+                }
127
+                return [
128
+                    'value' => (double) $value,
129
+                    'readable-value' => 'double ' . (double) $value,
130
+                ];
131
+
132
+            case 'boolean':
133
+            case 'bool':
134
+                $value = strtolower($value);
135
+                switch ($value) {
136
+                    case 'true':
137
+                        return [
138
+                            'value' => true,
139
+                            'readable-value' => 'boolean ' . $value,
140
+                        ];
141
+
142
+                    case 'false':
143
+                        return [
144
+                            'value' => false,
145
+                            'readable-value' => 'boolean ' . $value,
146
+                        ];
147
+
148
+                    default:
149
+                        throw new \InvalidArgumentException('Unable to parse value as boolean');
150
+                }
151
+
152
+            case 'null':
153
+                return [
154
+                    'value' => null,
155
+                    'readable-value' => 'null',
156
+                ];
157
+
158
+            case 'string':
159
+                $value = (string) $value;
160
+                return [
161
+                    'value' => $value,
162
+                    'readable-value' => ($value === '') ? 'empty string' : 'string ' . $value,
163
+                ];
164
+
165
+            default:
166
+                throw new \InvalidArgumentException('Invalid type');
167
+        }
168
+    }
169
+
170
+    /**
171
+     * @param array $configNames
172
+     * @param mixed $existingValues
173
+     * @param mixed $value
174
+     * @param bool $updateOnly
175
+     * @return array merged value
176
+     * @throws \UnexpectedValueException
177
+     */
178
+    protected function mergeArrayValue(array $configNames, $existingValues, $value, $updateOnly) {
179
+        $configName = array_shift($configNames);
180
+        if (!is_array($existingValues)) {
181
+            $existingValues = [];
182
+        }
183
+        if (!empty($configNames)) {
184
+            if (isset($existingValues[$configName])) {
185
+                $existingValue = $existingValues[$configName];
186
+            } else {
187
+                $existingValue = [];
188
+            }
189
+            $existingValues[$configName] = $this->mergeArrayValue($configNames, $existingValue, $value, $updateOnly);
190
+        } else {
191
+            if (!isset($existingValues[$configName]) && $updateOnly) {
192
+                throw new \UnexpectedValueException('Config parameter does not exist');
193
+            }
194
+            $existingValues[$configName] = $value;
195
+        }
196
+        return $existingValues;
197
+    }
198
+
199
+    /**
200
+     * @param string $optionName
201
+     * @param CompletionContext $context
202
+     * @return string[]
203
+     */
204
+    public function completeOptionValues($optionName, CompletionContext $context) {
205
+        if ($optionName === 'type') {
206
+            return ['string', 'integer', 'double', 'boolean'];
207
+        }
208
+        return parent::completeOptionValues($optionName, $context);
209
+    }
210 210
 }
Please login to merge, or discard this patch.
core/Command/L10n/CreateJs.php 1 patch
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -36,134 +36,134 @@
 block discarded – undo
36 36
 
37 37
 class CreateJs extends Command implements CompletionAwareInterface {
38 38
 
39
-	protected function configure() {
40
-		$this
41
-			->setName('l10n:createjs')
42
-			->setDescription('Create javascript translation files for a given app')
43
-			->addArgument(
44
-				'app',
45
-				InputOption::VALUE_REQUIRED,
46
-				'name of the app'
47
-			)
48
-			->addArgument(
49
-				'lang',
50
-				InputOption::VALUE_OPTIONAL,
51
-				'name of the language'
52
-			);
53
-	}
54
-
55
-	protected function execute(InputInterface $input, OutputInterface $output) {
56
-		$app = $input->getArgument('app');
57
-		$lang = $input->getArgument('lang');
58
-
59
-		$path = \OC_App::getAppPath($app);
60
-		if ($path === false) {
61
-			$output->writeln("The app <$app> is unknown.");
62
-			return;
63
-		}
64
-		$languages = $lang;
65
-		if (empty($lang)) {
66
-			$languages= $this->getAllLanguages($path);
67
-		}
68
-
69
-		foreach($languages as $lang) {
70
-			$this->writeFiles($app, $path, $lang, $output);
71
-		}
72
-	}
73
-
74
-	private function getAllLanguages($path) {
75
-		$result = array();
76
-		foreach (new DirectoryIterator("$path/l10n") as $fileInfo) {
77
-			if($fileInfo->isDot()) {
78
-				continue;
79
-			}
80
-			if($fileInfo->isDir()) {
81
-				continue;
82
-			}
83
-			if($fileInfo->getExtension() !== 'php') {
84
-				continue;
85
-			}
86
-			$result[]= substr($fileInfo->getBasename(), 0, -4);
87
-		}
88
-
89
-		return $result;
90
-	}
91
-
92
-	private function writeFiles($app, $path, $lang, OutputInterface $output) {
93
-		list($translations, $plurals) = $this->loadTranslations($path, $lang);
94
-		$this->writeJsFile($app, $path, $lang, $output, $translations, $plurals);
95
-		$this->writeJsonFile($path, $lang, $output, $translations, $plurals);
96
-	}
97
-
98
-	private function writeJsFile($app, $path, $lang, OutputInterface $output, $translations, $plurals) {
99
-		$jsFile = "$path/l10n/$lang.js";
100
-		if (file_exists($jsFile)) {
101
-			$output->writeln("File already exists: $jsFile");
102
-			return;
103
-		}
104
-		$content = "OC.L10N.register(\n    \"$app\",\n    {\n    ";
105
-		$jsTrans = array();
106
-		foreach ($translations as $id => $val) {
107
-			if (is_array($val)) {
108
-				$val = '[ ' . implode(',', $val) . ']';
109
-			}
110
-			$jsTrans[] = "\"$id\" : \"$val\"";
111
-		}
112
-		$content .= implode(",\n    ", $jsTrans);
113
-		$content .= "\n},\n\"$plurals\");\n";
114
-
115
-		file_put_contents($jsFile, $content);
116
-		$output->writeln("Javascript translation file generated: $jsFile");
117
-	}
118
-
119
-	private function writeJsonFile($path, $lang, OutputInterface $output, $translations, $plurals) {
120
-		$jsFile = "$path/l10n/$lang.json";
121
-		if (file_exists($jsFile)) {
122
-			$output->writeln("File already exists: $jsFile");
123
-			return;
124
-		}
125
-		$content = array('translations' => $translations, 'pluralForm' => $plurals);
126
-		file_put_contents($jsFile, json_encode($content));
127
-		$output->writeln("Json translation file generated: $jsFile");
128
-	}
129
-
130
-	private function loadTranslations($path, $lang) {
131
-		$phpFile = "$path/l10n/$lang.php";
132
-		$TRANSLATIONS = array();
133
-		$PLURAL_FORMS = '';
134
-		if (!file_exists($phpFile)) {
135
-			throw new UnexpectedValueException("PHP translation file <$phpFile> does not exist.");
136
-		}
137
-		require $phpFile;
138
-
139
-		return array($TRANSLATIONS, $PLURAL_FORMS);
140
-	}
141
-
142
-	/**
143
-	 * Return possible values for the named option
144
-	 *
145
-	 * @param string $optionName
146
-	 * @param CompletionContext $context
147
-	 * @return string[]
148
-	 */
149
-	public function completeOptionValues($optionName, CompletionContext $context) {
150
-		return [];
151
-	}
152
-
153
-	/**
154
-	 * Return possible values for the named argument
155
-	 *
156
-	 * @param string $argumentName
157
-	 * @param CompletionContext $context
158
-	 * @return string[]
159
-	 */
160
-	public function completeArgumentValues($argumentName, CompletionContext $context) {
161
-		if ($argumentName === 'app') {
162
-			return \OC_App::getAllApps();
163
-		} else if ($argumentName === 'lang') {
164
-			$appName = $context->getWordAtIndex($context->getWordIndex() - 1);
165
-			return $this->getAllLanguages(\OC_App::getAppPath($appName));
166
-		}
167
-		return [];
168
-	}
39
+    protected function configure() {
40
+        $this
41
+            ->setName('l10n:createjs')
42
+            ->setDescription('Create javascript translation files for a given app')
43
+            ->addArgument(
44
+                'app',
45
+                InputOption::VALUE_REQUIRED,
46
+                'name of the app'
47
+            )
48
+            ->addArgument(
49
+                'lang',
50
+                InputOption::VALUE_OPTIONAL,
51
+                'name of the language'
52
+            );
53
+    }
54
+
55
+    protected function execute(InputInterface $input, OutputInterface $output) {
56
+        $app = $input->getArgument('app');
57
+        $lang = $input->getArgument('lang');
58
+
59
+        $path = \OC_App::getAppPath($app);
60
+        if ($path === false) {
61
+            $output->writeln("The app <$app> is unknown.");
62
+            return;
63
+        }
64
+        $languages = $lang;
65
+        if (empty($lang)) {
66
+            $languages= $this->getAllLanguages($path);
67
+        }
68
+
69
+        foreach($languages as $lang) {
70
+            $this->writeFiles($app, $path, $lang, $output);
71
+        }
72
+    }
73
+
74
+    private function getAllLanguages($path) {
75
+        $result = array();
76
+        foreach (new DirectoryIterator("$path/l10n") as $fileInfo) {
77
+            if($fileInfo->isDot()) {
78
+                continue;
79
+            }
80
+            if($fileInfo->isDir()) {
81
+                continue;
82
+            }
83
+            if($fileInfo->getExtension() !== 'php') {
84
+                continue;
85
+            }
86
+            $result[]= substr($fileInfo->getBasename(), 0, -4);
87
+        }
88
+
89
+        return $result;
90
+    }
91
+
92
+    private function writeFiles($app, $path, $lang, OutputInterface $output) {
93
+        list($translations, $plurals) = $this->loadTranslations($path, $lang);
94
+        $this->writeJsFile($app, $path, $lang, $output, $translations, $plurals);
95
+        $this->writeJsonFile($path, $lang, $output, $translations, $plurals);
96
+    }
97
+
98
+    private function writeJsFile($app, $path, $lang, OutputInterface $output, $translations, $plurals) {
99
+        $jsFile = "$path/l10n/$lang.js";
100
+        if (file_exists($jsFile)) {
101
+            $output->writeln("File already exists: $jsFile");
102
+            return;
103
+        }
104
+        $content = "OC.L10N.register(\n    \"$app\",\n    {\n    ";
105
+        $jsTrans = array();
106
+        foreach ($translations as $id => $val) {
107
+            if (is_array($val)) {
108
+                $val = '[ ' . implode(',', $val) . ']';
109
+            }
110
+            $jsTrans[] = "\"$id\" : \"$val\"";
111
+        }
112
+        $content .= implode(",\n    ", $jsTrans);
113
+        $content .= "\n},\n\"$plurals\");\n";
114
+
115
+        file_put_contents($jsFile, $content);
116
+        $output->writeln("Javascript translation file generated: $jsFile");
117
+    }
118
+
119
+    private function writeJsonFile($path, $lang, OutputInterface $output, $translations, $plurals) {
120
+        $jsFile = "$path/l10n/$lang.json";
121
+        if (file_exists($jsFile)) {
122
+            $output->writeln("File already exists: $jsFile");
123
+            return;
124
+        }
125
+        $content = array('translations' => $translations, 'pluralForm' => $plurals);
126
+        file_put_contents($jsFile, json_encode($content));
127
+        $output->writeln("Json translation file generated: $jsFile");
128
+    }
129
+
130
+    private function loadTranslations($path, $lang) {
131
+        $phpFile = "$path/l10n/$lang.php";
132
+        $TRANSLATIONS = array();
133
+        $PLURAL_FORMS = '';
134
+        if (!file_exists($phpFile)) {
135
+            throw new UnexpectedValueException("PHP translation file <$phpFile> does not exist.");
136
+        }
137
+        require $phpFile;
138
+
139
+        return array($TRANSLATIONS, $PLURAL_FORMS);
140
+    }
141
+
142
+    /**
143
+     * Return possible values for the named option
144
+     *
145
+     * @param string $optionName
146
+     * @param CompletionContext $context
147
+     * @return string[]
148
+     */
149
+    public function completeOptionValues($optionName, CompletionContext $context) {
150
+        return [];
151
+    }
152
+
153
+    /**
154
+     * Return possible values for the named argument
155
+     *
156
+     * @param string $argumentName
157
+     * @param CompletionContext $context
158
+     * @return string[]
159
+     */
160
+    public function completeArgumentValues($argumentName, CompletionContext $context) {
161
+        if ($argumentName === 'app') {
162
+            return \OC_App::getAllApps();
163
+        } else if ($argumentName === 'lang') {
164
+            $appName = $context->getWordAtIndex($context->getWordIndex() - 1);
165
+            return $this->getAllLanguages(\OC_App::getAppPath($appName));
166
+        }
167
+        return [];
168
+    }
169 169
 }
Please login to merge, or discard this patch.
apps/comments/lib/Activity/Listener.php 1 patch
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -34,101 +34,101 @@
 block discarded – undo
34 34
 use OCP\Share\IShareHelper;
35 35
 
36 36
 class Listener {
37
-	/** @var IManager */
38
-	protected $activityManager;
39
-	/** @var IUserSession */
40
-	protected $session;
41
-	/** @var \OCP\App\IAppManager */
42
-	protected $appManager;
43
-	/** @var \OCP\Files\Config\IMountProviderCollection */
44
-	protected $mountCollection;
45
-	/** @var \OCP\Files\IRootFolder */
46
-	protected $rootFolder;
47
-	/** @var IShareHelper */
48
-	protected $shareHelper;
37
+    /** @var IManager */
38
+    protected $activityManager;
39
+    /** @var IUserSession */
40
+    protected $session;
41
+    /** @var \OCP\App\IAppManager */
42
+    protected $appManager;
43
+    /** @var \OCP\Files\Config\IMountProviderCollection */
44
+    protected $mountCollection;
45
+    /** @var \OCP\Files\IRootFolder */
46
+    protected $rootFolder;
47
+    /** @var IShareHelper */
48
+    protected $shareHelper;
49 49
 
50
-	/**
51
-	 * Listener constructor.
52
-	 *
53
-	 * @param IManager $activityManager
54
-	 * @param IUserSession $session
55
-	 * @param IAppManager $appManager
56
-	 * @param IMountProviderCollection $mountCollection
57
-	 * @param IRootFolder $rootFolder
58
-	 * @param IShareHelper $shareHelper
59
-	 */
60
-	public function __construct(IManager $activityManager,
61
-								IUserSession $session,
62
-								IAppManager $appManager,
63
-								IMountProviderCollection $mountCollection,
64
-								IRootFolder $rootFolder,
65
-								IShareHelper $shareHelper) {
66
-		$this->activityManager = $activityManager;
67
-		$this->session = $session;
68
-		$this->appManager = $appManager;
69
-		$this->mountCollection = $mountCollection;
70
-		$this->rootFolder = $rootFolder;
71
-		$this->shareHelper = $shareHelper;
72
-	}
50
+    /**
51
+     * Listener constructor.
52
+     *
53
+     * @param IManager $activityManager
54
+     * @param IUserSession $session
55
+     * @param IAppManager $appManager
56
+     * @param IMountProviderCollection $mountCollection
57
+     * @param IRootFolder $rootFolder
58
+     * @param IShareHelper $shareHelper
59
+     */
60
+    public function __construct(IManager $activityManager,
61
+                                IUserSession $session,
62
+                                IAppManager $appManager,
63
+                                IMountProviderCollection $mountCollection,
64
+                                IRootFolder $rootFolder,
65
+                                IShareHelper $shareHelper) {
66
+        $this->activityManager = $activityManager;
67
+        $this->session = $session;
68
+        $this->appManager = $appManager;
69
+        $this->mountCollection = $mountCollection;
70
+        $this->rootFolder = $rootFolder;
71
+        $this->shareHelper = $shareHelper;
72
+    }
73 73
 
74
-	/**
75
-	 * @param CommentsEvent $event
76
-	 */
77
-	public function commentEvent(CommentsEvent $event) {
78
-		if ($event->getComment()->getObjectType() !== 'files'
79
-			|| $event->getEvent() !== CommentsEvent::EVENT_ADD
80
-			|| !$this->appManager->isInstalled('activity')) {
81
-			// Comment not for file, not adding a comment or no activity-app enabled (save the energy)
82
-			return;
83
-		}
74
+    /**
75
+     * @param CommentsEvent $event
76
+     */
77
+    public function commentEvent(CommentsEvent $event) {
78
+        if ($event->getComment()->getObjectType() !== 'files'
79
+            || $event->getEvent() !== CommentsEvent::EVENT_ADD
80
+            || !$this->appManager->isInstalled('activity')) {
81
+            // Comment not for file, not adding a comment or no activity-app enabled (save the energy)
82
+            return;
83
+        }
84 84
 
85
-		// Get all mount point owners
86
-		$cache = $this->mountCollection->getMountCache();
87
-		$mounts = $cache->getMountsForFileId((int)$event->getComment()->getObjectId());
88
-		if (empty($mounts)) {
89
-			return;
90
-		}
85
+        // Get all mount point owners
86
+        $cache = $this->mountCollection->getMountCache();
87
+        $mounts = $cache->getMountsForFileId((int)$event->getComment()->getObjectId());
88
+        if (empty($mounts)) {
89
+            return;
90
+        }
91 91
 
92
-		$users = [];
93
-		foreach ($mounts as $mount) {
94
-			$owner = $mount->getUser()->getUID();
95
-			$ownerFolder = $this->rootFolder->getUserFolder($owner);
96
-			$nodes = $ownerFolder->getById((int)$event->getComment()->getObjectId());
97
-			if (!empty($nodes)) {
98
-				/** @var Node $node */
99
-				$node = array_shift($nodes);
100
-				$al = $this->shareHelper->getPathsForAccessList($node);
101
-				$users += $al['users'];
102
-			}
103
-		}
92
+        $users = [];
93
+        foreach ($mounts as $mount) {
94
+            $owner = $mount->getUser()->getUID();
95
+            $ownerFolder = $this->rootFolder->getUserFolder($owner);
96
+            $nodes = $ownerFolder->getById((int)$event->getComment()->getObjectId());
97
+            if (!empty($nodes)) {
98
+                /** @var Node $node */
99
+                $node = array_shift($nodes);
100
+                $al = $this->shareHelper->getPathsForAccessList($node);
101
+                $users += $al['users'];
102
+            }
103
+        }
104 104
 
105
-		$actor = $this->session->getUser();
106
-		if ($actor instanceof IUser) {
107
-			$actor = $actor->getUID();
108
-		} else {
109
-			$actor = '';
110
-		}
105
+        $actor = $this->session->getUser();
106
+        if ($actor instanceof IUser) {
107
+            $actor = $actor->getUID();
108
+        } else {
109
+            $actor = '';
110
+        }
111 111
 
112
-		$activity = $this->activityManager->generateEvent();
113
-		$activity->setApp('comments')
114
-			->setType('comments')
115
-			->setAuthor($actor)
116
-			->setObject($event->getComment()->getObjectType(), (int) $event->getComment()->getObjectId())
117
-			->setMessage('add_comment_message', [
118
-				'commentId' => $event->getComment()->getId(),
119
-			]);
112
+        $activity = $this->activityManager->generateEvent();
113
+        $activity->setApp('comments')
114
+            ->setType('comments')
115
+            ->setAuthor($actor)
116
+            ->setObject($event->getComment()->getObjectType(), (int) $event->getComment()->getObjectId())
117
+            ->setMessage('add_comment_message', [
118
+                'commentId' => $event->getComment()->getId(),
119
+            ]);
120 120
 
121
-		foreach ($users as $user => $path) {
122
-			// numerical user ids end up as integers from array keys, but string
123
-			// is required
124
-			$activity->setAffectedUser((string)$user);
121
+        foreach ($users as $user => $path) {
122
+            // numerical user ids end up as integers from array keys, but string
123
+            // is required
124
+            $activity->setAffectedUser((string)$user);
125 125
 
126
-			$activity->setSubject('add_comment_subject', [
127
-				'actor' => $actor,
128
-				'fileId' => (int) $event->getComment()->getObjectId(),
129
-				'filePath' => trim($path, '/'),
130
-			]);
131
-			$this->activityManager->publish($activity);
132
-		}
133
-	}
126
+            $activity->setSubject('add_comment_subject', [
127
+                'actor' => $actor,
128
+                'fileId' => (int) $event->getComment()->getObjectId(),
129
+                'filePath' => trim($path, '/'),
130
+            ]);
131
+            $this->activityManager->publish($activity);
132
+        }
133
+    }
134 134
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV2.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -31,19 +31,19 @@
 block discarded – undo
31 31
  */
32 32
 class OpenStackV2 extends AuthMechanism {
33 33
 
34
-	public function __construct(IL10N $l) {
35
-		$this
36
-			->setIdentifier('openstack::openstack')
37
-			->setScheme(self::SCHEME_OPENSTACK)
38
-			->setText($l->t('OpenStack v2'))
39
-			->addParameters([
40
-				new DefinitionParameter('user', $l->t('Username')),
41
-				(new DefinitionParameter('password', $l->t('Password')))
42
-					->setType(DefinitionParameter::VALUE_PASSWORD),
43
-				new DefinitionParameter('tenant', $l->t('Tenant name')),
44
-				new DefinitionParameter('url', $l->t('Identity endpoint URL')),
45
-			])
46
-		;
47
-	}
34
+    public function __construct(IL10N $l) {
35
+        $this
36
+            ->setIdentifier('openstack::openstack')
37
+            ->setScheme(self::SCHEME_OPENSTACK)
38
+            ->setText($l->t('OpenStack v2'))
39
+            ->addParameters([
40
+                new DefinitionParameter('user', $l->t('Username')),
41
+                (new DefinitionParameter('password', $l->t('Password')))
42
+                    ->setType(DefinitionParameter::VALUE_PASSWORD),
43
+                new DefinitionParameter('tenant', $l->t('Tenant name')),
44
+                new DefinitionParameter('url', $l->t('Identity endpoint URL')),
45
+            ])
46
+        ;
47
+    }
48 48
 
49 49
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Backend/Swift.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -33,31 +33,31 @@
 block discarded – undo
33 33
 
34 34
 class Swift extends Backend {
35 35
 
36
-	use LegacyDependencyCheckPolyfill;
36
+    use LegacyDependencyCheckPolyfill;
37 37
 
38
-	public function __construct(IL10N $l, OpenStackV2 $openstackAuth, Rackspace $rackspaceAuth) {
39
-		$this
40
-			->setIdentifier('swift')
41
-			->addIdentifierAlias('\OC\Files\Storage\Swift') // legacy compat
42
-			->setStorageClass('\OCA\Files_External\Lib\Storage\Swift')
43
-			->setText($l->t('OpenStack Object Storage'))
44
-			->addParameters([
45
-				(new DefinitionParameter('service_name', $l->t('Service name')))
46
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
47
-				(new DefinitionParameter('region', $l->t('Region')))
48
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
49
-				new DefinitionParameter('bucket', $l->t('Bucket')),
50
-				(new DefinitionParameter('timeout', $l->t('Request timeout (seconds)')))
51
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
52
-			])
53
-			->addAuthScheme(AuthMechanism::SCHEME_OPENSTACK)
54
-			->setLegacyAuthMechanismCallback(function(array $params) use ($openstackAuth, $rackspaceAuth) {
55
-				if (isset($params['options']['key']) && $params['options']['key']) {
56
-					return $rackspaceAuth;
57
-				}
58
-				return $openstackAuth;
59
-			})
60
-		;
61
-	}
38
+    public function __construct(IL10N $l, OpenStackV2 $openstackAuth, Rackspace $rackspaceAuth) {
39
+        $this
40
+            ->setIdentifier('swift')
41
+            ->addIdentifierAlias('\OC\Files\Storage\Swift') // legacy compat
42
+            ->setStorageClass('\OCA\Files_External\Lib\Storage\Swift')
43
+            ->setText($l->t('OpenStack Object Storage'))
44
+            ->addParameters([
45
+                (new DefinitionParameter('service_name', $l->t('Service name')))
46
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
47
+                (new DefinitionParameter('region', $l->t('Region')))
48
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
49
+                new DefinitionParameter('bucket', $l->t('Bucket')),
50
+                (new DefinitionParameter('timeout', $l->t('Request timeout (seconds)')))
51
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
52
+            ])
53
+            ->addAuthScheme(AuthMechanism::SCHEME_OPENSTACK)
54
+            ->setLegacyAuthMechanismCallback(function(array $params) use ($openstackAuth, $rackspaceAuth) {
55
+                if (isset($params['options']['key']) && $params['options']['key']) {
56
+                    return $rackspaceAuth;
57
+                }
58
+                return $openstackAuth;
59
+            })
60
+        ;
61
+    }
62 62
 
63 63
 }
Please login to merge, or discard this patch.