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