Passed
Push — master ( f0dd71...c56a27 )
by Christoph
11:49 queued 12s
created
apps/files_external/lib/Lib/Backend/AmazonS3.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -33,32 +33,32 @@
 block discarded – undo
33 33
 
34 34
 class AmazonS3 extends Backend {
35 35
 
36
-	use LegacyDependencyCheckPolyfill;
36
+    use LegacyDependencyCheckPolyfill;
37 37
 
38
-	public function __construct(IL10N $l, AccessKey $legacyAuth) {
39
-		$this
40
-			->setIdentifier('amazons3')
41
-			->addIdentifierAlias('\OC\Files\Storage\AmazonS3') // legacy compat
42
-			->setStorageClass('\OCA\Files_External\Lib\Storage\AmazonS3')
43
-			->setText($l->t('Amazon S3'))
44
-			->addParameters([
45
-				new DefinitionParameter('bucket', $l->t('Bucket')),
46
-				(new DefinitionParameter('hostname', $l->t('Hostname')))
47
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
48
-				(new DefinitionParameter('port', $l->t('Port')))
49
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
50
-				(new DefinitionParameter('region', $l->t('Region')))
51
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
52
-				(new DefinitionParameter('use_ssl', $l->t('Enable SSL')))
53
-					->setType(DefinitionParameter::VALUE_BOOLEAN),
54
-				(new DefinitionParameter('use_path_style', $l->t('Enable Path Style')))
55
-					->setType(DefinitionParameter::VALUE_BOOLEAN),
56
-				(new DefinitionParameter('legacy_auth', $l->t('Legacy (v2) authentication')))
57
-					->setType(DefinitionParameter::VALUE_BOOLEAN),
58
-			])
59
-			->addAuthScheme(AccessKey::SCHEME_AMAZONS3_ACCESSKEY)
60
-			->setLegacyAuthMechanism($legacyAuth)
61
-		;
62
-	}
38
+    public function __construct(IL10N $l, AccessKey $legacyAuth) {
39
+        $this
40
+            ->setIdentifier('amazons3')
41
+            ->addIdentifierAlias('\OC\Files\Storage\AmazonS3') // legacy compat
42
+            ->setStorageClass('\OCA\Files_External\Lib\Storage\AmazonS3')
43
+            ->setText($l->t('Amazon S3'))
44
+            ->addParameters([
45
+                new DefinitionParameter('bucket', $l->t('Bucket')),
46
+                (new DefinitionParameter('hostname', $l->t('Hostname')))
47
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
48
+                (new DefinitionParameter('port', $l->t('Port')))
49
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
50
+                (new DefinitionParameter('region', $l->t('Region')))
51
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
52
+                (new DefinitionParameter('use_ssl', $l->t('Enable SSL')))
53
+                    ->setType(DefinitionParameter::VALUE_BOOLEAN),
54
+                (new DefinitionParameter('use_path_style', $l->t('Enable Path Style')))
55
+                    ->setType(DefinitionParameter::VALUE_BOOLEAN),
56
+                (new DefinitionParameter('legacy_auth', $l->t('Legacy (v2) authentication')))
57
+                    ->setType(DefinitionParameter::VALUE_BOOLEAN),
58
+            ])
59
+            ->addAuthScheme(AccessKey::SCHEME_AMAZONS3_ACCESSKEY)
60
+            ->setLegacyAuthMechanism($legacyAuth)
61
+        ;
62
+    }
63 63
 
64 64
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Backend/SFTP.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -29,21 +29,21 @@
 block discarded – undo
29 29
 
30 30
 class SFTP extends Backend {
31 31
 
32
-	public function __construct(IL10N $l, Password $legacyAuth) {
33
-		$this
34
-			->setIdentifier('sftp')
35
-			->addIdentifierAlias('\OC\Files\Storage\SFTP') // legacy compat
36
-			->setStorageClass('\OCA\Files_External\Lib\Storage\SFTP')
37
-			->setText($l->t('SFTP'))
38
-			->addParameters([
39
-				new DefinitionParameter('host', $l->t('Host')),
40
-				(new DefinitionParameter('root', $l->t('Root')))
41
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
42
-			])
43
-			->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
44
-			->addAuthScheme(AuthMechanism::SCHEME_PUBLICKEY)
45
-			->setLegacyAuthMechanism($legacyAuth)
46
-		;
47
-	}
32
+    public function __construct(IL10N $l, Password $legacyAuth) {
33
+        $this
34
+            ->setIdentifier('sftp')
35
+            ->addIdentifierAlias('\OC\Files\Storage\SFTP') // legacy compat
36
+            ->setStorageClass('\OCA\Files_External\Lib\Storage\SFTP')
37
+            ->setText($l->t('SFTP'))
38
+            ->addParameters([
39
+                new DefinitionParameter('host', $l->t('Host')),
40
+                (new DefinitionParameter('root', $l->t('Root')))
41
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
42
+            ])
43
+            ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
44
+            ->addAuthScheme(AuthMechanism::SCHEME_PUBLICKEY)
45
+            ->setLegacyAuthMechanism($legacyAuth)
46
+        ;
47
+    }
48 48
 
49 49
 }
Please login to merge, or discard this patch.
core/Command/User/Info.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -34,57 +34,57 @@
 block discarded – undo
34 34
 use Symfony\Component\Console\Output\OutputInterface;
35 35
 
36 36
 class Info extends Base {
37
-	/** @var IUserManager */
38
-	protected $userManager;
39
-	/** @var IGroupManager */
40
-	protected $groupManager;
37
+    /** @var IUserManager */
38
+    protected $userManager;
39
+    /** @var IGroupManager */
40
+    protected $groupManager;
41 41
 
42
-	/**
43
-	 * @param IUserManager $userManager
44
-	 * @param IGroupManager $groupManager
45
-	 */
46
-	public function __construct(IUserManager $userManager, IGroupManager $groupManager) {
47
-		$this->userManager = $userManager;
48
-		$this->groupManager = $groupManager;
49
-		parent::__construct();
50
-	}
42
+    /**
43
+     * @param IUserManager $userManager
44
+     * @param IGroupManager $groupManager
45
+     */
46
+    public function __construct(IUserManager $userManager, IGroupManager $groupManager) {
47
+        $this->userManager = $userManager;
48
+        $this->groupManager = $groupManager;
49
+        parent::__construct();
50
+    }
51 51
 
52
-	protected function configure() {
53
-		$this
54
-			->setName('user:info')
55
-			->setDescription('show user info')
56
-			->addArgument(
57
-				'user',
58
-				InputArgument::REQUIRED,
59
-				'user to show'
60
-			)->addOption(
61
-				'output',
62
-				null,
63
-				InputOption::VALUE_OPTIONAL,
64
-				'Output format (plain, json or json_pretty, default is plain)',
65
-				$this->defaultOutputFormat
66
-			);
67
-	}
52
+    protected function configure() {
53
+        $this
54
+            ->setName('user:info')
55
+            ->setDescription('show user info')
56
+            ->addArgument(
57
+                'user',
58
+                InputArgument::REQUIRED,
59
+                'user to show'
60
+            )->addOption(
61
+                'output',
62
+                null,
63
+                InputOption::VALUE_OPTIONAL,
64
+                'Output format (plain, json or json_pretty, default is plain)',
65
+                $this->defaultOutputFormat
66
+            );
67
+    }
68 68
 
69
-	protected function execute(InputInterface $input, OutputInterface $output) {
70
-		$user = $this->userManager->get($input->getArgument('user'));
71
-		if (is_null($user)) {
72
-			$output->writeln('<error>user not found</error>');
73
-			return 1;
74
-		}
75
-		$groups = $this->groupManager->getUserGroupIds($user);
76
-		$data = [
77
-			'user_id' => $user->getUID(),
78
-			'display_name' => $user->getDisplayName(),
79
-			'email' => $user->getEMailAddress() ? $user->getEMailAddress() : '',
80
-			'cloud_id' => $user->getCloudId(),
81
-			'enabled' => $user->isEnabled(),
82
-			'groups' => $groups,
83
-			'quota' => $user->getQuota(),
84
-			'last_seen' => date(\DateTime::ATOM, $user->getLastLogin()), // ISO-8601
85
-			'user_directory' => $user->getHome(),
86
-			'backend' => $user->getBackendClassName()
87
-		];
88
-		$this->writeArrayInOutputFormat($input, $output, $data);
89
-	}
69
+    protected function execute(InputInterface $input, OutputInterface $output) {
70
+        $user = $this->userManager->get($input->getArgument('user'));
71
+        if (is_null($user)) {
72
+            $output->writeln('<error>user not found</error>');
73
+            return 1;
74
+        }
75
+        $groups = $this->groupManager->getUserGroupIds($user);
76
+        $data = [
77
+            'user_id' => $user->getUID(),
78
+            'display_name' => $user->getDisplayName(),
79
+            'email' => $user->getEMailAddress() ? $user->getEMailAddress() : '',
80
+            'cloud_id' => $user->getCloudId(),
81
+            'enabled' => $user->isEnabled(),
82
+            'groups' => $groups,
83
+            'quota' => $user->getQuota(),
84
+            'last_seen' => date(\DateTime::ATOM, $user->getLastLogin()), // ISO-8601
85
+            'user_directory' => $user->getHome(),
86
+            'backend' => $user->getBackendClassName()
87
+        ];
88
+        $this->writeArrayInOutputFormat($input, $output, $data);
89
+    }
90 90
 }
Please login to merge, or discard this patch.
lib/public/Files/SimpleFS/ISimpleRoot.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -34,35 +34,35 @@
 block discarded – undo
34 34
  * @since 11.0.0
35 35
  */
36 36
 interface ISimpleRoot {
37
-	/**
38
-	 * Get the folder with name $name
39
-	 *
40
-	 * @param string $name
41
-	 * @return ISimpleFolder
42
-	 * @throws NotFoundException
43
-	 * @throws \RuntimeException
44
-	 * @since 11.0.0
45
-	 */
46
-	public function getFolder(string $name): ISimpleFolder;
37
+    /**
38
+     * Get the folder with name $name
39
+     *
40
+     * @param string $name
41
+     * @return ISimpleFolder
42
+     * @throws NotFoundException
43
+     * @throws \RuntimeException
44
+     * @since 11.0.0
45
+     */
46
+    public function getFolder(string $name): ISimpleFolder;
47 47
 
48
-	/**
49
-	 * Get all the Folders
50
-	 *
51
-	 * @return ISimpleFolder[]
52
-	 * @throws NotFoundException
53
-	 * @throws \RuntimeException
54
-	 * @since 11.0.0
55
-	 */
56
-	public function getDirectoryListing(): array;
48
+    /**
49
+     * Get all the Folders
50
+     *
51
+     * @return ISimpleFolder[]
52
+     * @throws NotFoundException
53
+     * @throws \RuntimeException
54
+     * @since 11.0.0
55
+     */
56
+    public function getDirectoryListing(): array;
57 57
 
58
-	/**
59
-	 * Create a new folder named $name
60
-	 *
61
-	 * @param string $name
62
-	 * @return ISimpleFolder
63
-	 * @throws NotPermittedException
64
-	 * @throws \RuntimeException
65
-	 * @since 11.0.0
66
-	 */
67
-	public function newFolder(string $name): ISimpleFolder;
58
+    /**
59
+     * Create a new folder named $name
60
+     *
61
+     * @param string $name
62
+     * @return ISimpleFolder
63
+     * @throws NotPermittedException
64
+     * @throws \RuntimeException
65
+     * @since 11.0.0
66
+     */
67
+    public function newFolder(string $name): ISimpleFolder;
68 68
 }
Please login to merge, or discard this patch.
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.