Passed
Push — master ( 48bdd3...b53a48 )
by Blizzz
16:20 queued 13s
created
apps/workflowengine/lib/Settings/ASettings.php 1 patch
Indentation   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -40,156 +40,156 @@
 block discarded – undo
40 40
 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
41 41
 
42 42
 abstract class ASettings implements ISettings {
43
-	/** @var IL10N */
44
-	private $l10n;
45
-
46
-	/** @var string */
47
-	private $appName;
48
-
49
-	/** @var EventDispatcherInterface */
50
-	private $eventDispatcher;
51
-
52
-	/** @var Manager */
53
-	private $manager;
54
-
55
-	/** @var IInitialStateService */
56
-	private $initialStateService;
57
-
58
-	/** @var IConfig */
59
-	private $config;
60
-
61
-	/**
62
-	 * @param string $appName
63
-	 * @param IL10N $l
64
-	 * @param EventDispatcherInterface $eventDispatcher
65
-	 * @param Manager $manager
66
-	 * @param IInitialStateService $initialStateService
67
-	 * @param IConfig $config
68
-	 */
69
-	public function __construct(
70
-		$appName,
71
-		IL10N $l,
72
-		EventDispatcherInterface $eventDispatcher,
73
-		Manager $manager,
74
-		IInitialStateService $initialStateService,
75
-		IConfig $config
76
-	) {
77
-		$this->appName = $appName;
78
-		$this->l10n = $l;
79
-		$this->eventDispatcher = $eventDispatcher;
80
-		$this->manager = $manager;
81
-		$this->initialStateService = $initialStateService;
82
-		$this->config = $config;
83
-	}
84
-
85
-	abstract function getScope(): int;
86
-
87
-	/**
88
-	 * @return TemplateResponse
89
-	 */
90
-	public function getForm() {
91
-		$this->eventDispatcher->dispatch('OCP\WorkflowEngine::loadAdditionalSettingScripts');
92
-
93
-		$entities = $this->manager->getEntitiesList();
94
-		$this->initialStateService->provideInitialState(
95
-			Application::APP_ID,
96
-			'entities',
97
-			$this->entitiesToArray($entities)
98
-		);
99
-
100
-		$operators = $this->manager->getOperatorList();
101
-		$this->initialStateService->provideInitialState(
102
-			Application::APP_ID,
103
-			'operators',
104
-			$this->operatorsToArray($operators)
105
-		);
106
-
107
-		$checks = $this->manager->getCheckList();
108
-		$this->initialStateService->provideInitialState(
109
-			Application::APP_ID,
110
-			'checks',
111
-			$this->checksToArray($checks)
112
-		);
113
-
114
-		$this->initialStateService->provideInitialState(
115
-			Application::APP_ID,
116
-			'scope',
117
-			$this->getScope()
118
-		);
119
-
120
-		$this->initialStateService->provideInitialState(
121
-			Application::APP_ID,
122
-			'appstoreenabled',
123
-			$this->config->getSystemValueBool('appstoreenabled', true)
124
-		);
125
-
126
-		return new TemplateResponse(Application::APP_ID, 'settings', [], 'blank');
127
-	}
128
-
129
-	/**
130
-	 * @return string the section ID, e.g. 'sharing'
131
-	 */
132
-	public function getSection() {
133
-		return 'workflow';
134
-	}
135
-
136
-	/**
137
-	 * @return int whether the form should be rather on the top or bottom of
138
-	 * the admin section. The forms are arranged in ascending order of the
139
-	 * priority values. It is required to return a value between 0 and 100.
140
-	 *
141
-	 * E.g.: 70
142
-	 */
143
-	public function getPriority() {
144
-		return 0;
145
-	}
146
-
147
-	private function entitiesToArray(array $entities) {
148
-		return array_map(function (IEntity $entity) {
149
-			$events = array_map(function(IEntityEvent $entityEvent) {
150
-				return [
151
-					'eventName' => $entityEvent->getEventName(),
152
-					'displayName' => $entityEvent->getDisplayName()
153
-				];
154
-			}, $entity->getEvents());
155
-
156
-			return [
157
-				'id' => get_class($entity),
158
-				'icon' => $entity->getIcon(),
159
-				'name' => $entity->getName(),
160
-				'events' => $events,
161
-			];
162
-		}, $entities);
163
-	}
164
-
165
-	private function operatorsToArray(array $operators) {
166
-		$operators = array_filter($operators, function(IOperation $operator) {
167
-			return $operator->isAvailableForScope($this->getScope());
168
-		});
169
-
170
-		return array_map(function (IOperation $operator) {
171
-			return [
172
-				'id' => get_class($operator),
173
-				'icon' => $operator->getIcon(),
174
-				'name' => $operator->getDisplayName(),
175
-				'description' => $operator->getDescription(),
176
-				'fixedEntity' => $operator instanceof ISpecificOperation ? $operator->getEntityId() : '',
177
-				'isComplex' => $operator instanceof IComplexOperation,
178
-				'triggerHint' => $operator instanceof IComplexOperation ? $operator->getTriggerHint() : '',
179
-			];
180
-		}, $operators);
181
-	}
182
-
183
-	private function checksToArray(array $checks) {
184
-		$checks = array_filter($checks, function(ICheck $check) {
185
-			return $check->isAvailableForScope($this->getScope());
186
-		});
187
-
188
-		return array_map(function (ICheck $check) {
189
-			return [
190
-				'id' => get_class($check),
191
-				'supportedEntities' => $check->supportedEntities(),
192
-			];
193
-		}, $checks);
194
-	}
43
+    /** @var IL10N */
44
+    private $l10n;
45
+
46
+    /** @var string */
47
+    private $appName;
48
+
49
+    /** @var EventDispatcherInterface */
50
+    private $eventDispatcher;
51
+
52
+    /** @var Manager */
53
+    private $manager;
54
+
55
+    /** @var IInitialStateService */
56
+    private $initialStateService;
57
+
58
+    /** @var IConfig */
59
+    private $config;
60
+
61
+    /**
62
+     * @param string $appName
63
+     * @param IL10N $l
64
+     * @param EventDispatcherInterface $eventDispatcher
65
+     * @param Manager $manager
66
+     * @param IInitialStateService $initialStateService
67
+     * @param IConfig $config
68
+     */
69
+    public function __construct(
70
+        $appName,
71
+        IL10N $l,
72
+        EventDispatcherInterface $eventDispatcher,
73
+        Manager $manager,
74
+        IInitialStateService $initialStateService,
75
+        IConfig $config
76
+    ) {
77
+        $this->appName = $appName;
78
+        $this->l10n = $l;
79
+        $this->eventDispatcher = $eventDispatcher;
80
+        $this->manager = $manager;
81
+        $this->initialStateService = $initialStateService;
82
+        $this->config = $config;
83
+    }
84
+
85
+    abstract function getScope(): int;
86
+
87
+    /**
88
+     * @return TemplateResponse
89
+     */
90
+    public function getForm() {
91
+        $this->eventDispatcher->dispatch('OCP\WorkflowEngine::loadAdditionalSettingScripts');
92
+
93
+        $entities = $this->manager->getEntitiesList();
94
+        $this->initialStateService->provideInitialState(
95
+            Application::APP_ID,
96
+            'entities',
97
+            $this->entitiesToArray($entities)
98
+        );
99
+
100
+        $operators = $this->manager->getOperatorList();
101
+        $this->initialStateService->provideInitialState(
102
+            Application::APP_ID,
103
+            'operators',
104
+            $this->operatorsToArray($operators)
105
+        );
106
+
107
+        $checks = $this->manager->getCheckList();
108
+        $this->initialStateService->provideInitialState(
109
+            Application::APP_ID,
110
+            'checks',
111
+            $this->checksToArray($checks)
112
+        );
113
+
114
+        $this->initialStateService->provideInitialState(
115
+            Application::APP_ID,
116
+            'scope',
117
+            $this->getScope()
118
+        );
119
+
120
+        $this->initialStateService->provideInitialState(
121
+            Application::APP_ID,
122
+            'appstoreenabled',
123
+            $this->config->getSystemValueBool('appstoreenabled', true)
124
+        );
125
+
126
+        return new TemplateResponse(Application::APP_ID, 'settings', [], 'blank');
127
+    }
128
+
129
+    /**
130
+     * @return string the section ID, e.g. 'sharing'
131
+     */
132
+    public function getSection() {
133
+        return 'workflow';
134
+    }
135
+
136
+    /**
137
+     * @return int whether the form should be rather on the top or bottom of
138
+     * the admin section. The forms are arranged in ascending order of the
139
+     * priority values. It is required to return a value between 0 and 100.
140
+     *
141
+     * E.g.: 70
142
+     */
143
+    public function getPriority() {
144
+        return 0;
145
+    }
146
+
147
+    private function entitiesToArray(array $entities) {
148
+        return array_map(function (IEntity $entity) {
149
+            $events = array_map(function(IEntityEvent $entityEvent) {
150
+                return [
151
+                    'eventName' => $entityEvent->getEventName(),
152
+                    'displayName' => $entityEvent->getDisplayName()
153
+                ];
154
+            }, $entity->getEvents());
155
+
156
+            return [
157
+                'id' => get_class($entity),
158
+                'icon' => $entity->getIcon(),
159
+                'name' => $entity->getName(),
160
+                'events' => $events,
161
+            ];
162
+        }, $entities);
163
+    }
164
+
165
+    private function operatorsToArray(array $operators) {
166
+        $operators = array_filter($operators, function(IOperation $operator) {
167
+            return $operator->isAvailableForScope($this->getScope());
168
+        });
169
+
170
+        return array_map(function (IOperation $operator) {
171
+            return [
172
+                'id' => get_class($operator),
173
+                'icon' => $operator->getIcon(),
174
+                'name' => $operator->getDisplayName(),
175
+                'description' => $operator->getDescription(),
176
+                'fixedEntity' => $operator instanceof ISpecificOperation ? $operator->getEntityId() : '',
177
+                'isComplex' => $operator instanceof IComplexOperation,
178
+                'triggerHint' => $operator instanceof IComplexOperation ? $operator->getTriggerHint() : '',
179
+            ];
180
+        }, $operators);
181
+    }
182
+
183
+    private function checksToArray(array $checks) {
184
+        $checks = array_filter($checks, function(ICheck $check) {
185
+            return $check->isAvailableForScope($this->getScope());
186
+        });
187
+
188
+        return array_map(function (ICheck $check) {
189
+            return [
190
+                'id' => get_class($check),
191
+                'supportedEntities' => $check->supportedEntities(),
192
+            ];
193
+        }, $checks);
194
+    }
195 195
 }
Please login to merge, or discard this patch.