Passed
Push — master ( 44aa1b...73fa3e )
by Morris
19:45 queued 07:59
created
apps/files_external/lib/Command/Config.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -33,87 +33,87 @@
 block discarded – undo
33 33
 use Symfony\Component\Console\Output\OutputInterface;
34 34
 
35 35
 class Config extends Base {
36
-	/**
37
-	 * @var GlobalStoragesService
38
-	 */
39
-	protected $globalService;
36
+    /**
37
+     * @var GlobalStoragesService
38
+     */
39
+    protected $globalService;
40 40
 
41
-	function __construct(GlobalStoragesService $globalService) {
42
-		parent::__construct();
43
-		$this->globalService = $globalService;
44
-	}
41
+    function __construct(GlobalStoragesService $globalService) {
42
+        parent::__construct();
43
+        $this->globalService = $globalService;
44
+    }
45 45
 
46
-	protected function configure() {
47
-		$this
48
-			->setName('files_external:config')
49
-			->setDescription('Manage backend configuration for a mount')
50
-			->addArgument(
51
-				'mount_id',
52
-				InputArgument::REQUIRED,
53
-				'The id of the mount to edit'
54
-			)->addArgument(
55
-				'key',
56
-				InputArgument::REQUIRED,
57
-				'key of the config option to set/get'
58
-			)->addArgument(
59
-				'value',
60
-				InputArgument::OPTIONAL,
61
-				'value to set the config option to, when no value is provided the existing value will be printed'
62
-			);
63
-		parent::configure();
64
-	}
46
+    protected function configure() {
47
+        $this
48
+            ->setName('files_external:config')
49
+            ->setDescription('Manage backend configuration for a mount')
50
+            ->addArgument(
51
+                'mount_id',
52
+                InputArgument::REQUIRED,
53
+                'The id of the mount to edit'
54
+            )->addArgument(
55
+                'key',
56
+                InputArgument::REQUIRED,
57
+                'key of the config option to set/get'
58
+            )->addArgument(
59
+                'value',
60
+                InputArgument::OPTIONAL,
61
+                'value to set the config option to, when no value is provided the existing value will be printed'
62
+            );
63
+        parent::configure();
64
+    }
65 65
 
66
-	protected function execute(InputInterface $input, OutputInterface $output) {
67
-		$mountId = $input->getArgument('mount_id');
68
-		$key = $input->getArgument('key');
69
-		try {
70
-			$mount = $this->globalService->getStorage($mountId);
71
-		} catch (NotFoundException $e) {
72
-			$output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
73
-			return 404;
74
-		}
66
+    protected function execute(InputInterface $input, OutputInterface $output) {
67
+        $mountId = $input->getArgument('mount_id');
68
+        $key = $input->getArgument('key');
69
+        try {
70
+            $mount = $this->globalService->getStorage($mountId);
71
+        } catch (NotFoundException $e) {
72
+            $output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
73
+            return 404;
74
+        }
75 75
 
76
-		$value = $input->getArgument('value');
77
-		if ($value !== null) {
78
-			$this->setOption($mount, $key, $value, $output);
79
-		} else {
80
-			$this->getOption($mount, $key, $output);
81
-		}
82
-	}
76
+        $value = $input->getArgument('value');
77
+        if ($value !== null) {
78
+            $this->setOption($mount, $key, $value, $output);
79
+        } else {
80
+            $this->getOption($mount, $key, $output);
81
+        }
82
+    }
83 83
 
84
-	/**
85
-	 * @param StorageConfig $mount
86
-	 * @param string $key
87
-	 * @param OutputInterface $output
88
-	 */
89
-	protected function getOption(StorageConfig $mount, $key, OutputInterface $output) {
90
-		if ($key === 'mountpoint' || $key === 'mount_point') {
91
-			$value = $mount->getMountPoint();
92
-		} else {
93
-			$value = $mount->getBackendOption($key);
94
-		}
95
-		if (!is_string($value) && json_decode(json_encode($value)) === $value) { // show bools and objects correctly
96
- 			$value = json_encode($value);
97
- 		}
98
-		$output->writeln($value);
99
-	}
84
+    /**
85
+     * @param StorageConfig $mount
86
+     * @param string $key
87
+     * @param OutputInterface $output
88
+     */
89
+    protected function getOption(StorageConfig $mount, $key, OutputInterface $output) {
90
+        if ($key === 'mountpoint' || $key === 'mount_point') {
91
+            $value = $mount->getMountPoint();
92
+        } else {
93
+            $value = $mount->getBackendOption($key);
94
+        }
95
+        if (!is_string($value) && json_decode(json_encode($value)) === $value) { // show bools and objects correctly
96
+                $value = json_encode($value);
97
+            }
98
+        $output->writeln($value);
99
+    }
100 100
 
101
-	/**
102
-	 * @param StorageConfig $mount
103
-	 * @param string $key
104
-	 * @param string $value
105
-	 * @param OutputInterface $output
106
-	 */
107
-	protected function setOption(StorageConfig $mount, $key, $value, OutputInterface $output) {
108
-		$decoded = json_decode($value, true);
109
- 		if (!is_null($decoded) && json_encode($decoded) === $value) {
110
- 			$value = $decoded;
111
- 		}
112
-		if ($key === 'mountpoint' || $key === 'mount_point') {
113
-			$mount->setMountPoint($value);
114
-		} else {
115
-			$mount->setBackendOption($key, $value);
116
-		}
117
-		$this->globalService->updateStorage($mount);
118
-	}
101
+    /**
102
+     * @param StorageConfig $mount
103
+     * @param string $key
104
+     * @param string $value
105
+     * @param OutputInterface $output
106
+     */
107
+    protected function setOption(StorageConfig $mount, $key, $value, OutputInterface $output) {
108
+        $decoded = json_decode($value, true);
109
+            if (!is_null($decoded) && json_encode($decoded) === $value) {
110
+                $value = $decoded;
111
+            }
112
+        if ($key === 'mountpoint' || $key === 'mount_point') {
113
+            $mount->setMountPoint($value);
114
+        } else {
115
+            $mount->setBackendOption($key, $value);
116
+        }
117
+        $this->globalService->updateStorage($mount);
118
+    }
119 119
 }
Please login to merge, or discard this patch.