Completed
Push — master ( 532c9f...cac1be )
by Thomas
03:12
created
src/command/GenerateApiCommand.php 2 patches
Unused Use Statements   -6 removed lines patch added patch discarded remove patch
@@ -5,13 +5,7 @@
 block discarded – undo
5 5
 use keeko\tools\utils\NameUtils;
6 6
 use Symfony\Component\Console\Input\InputInterface;
7 7
 use Symfony\Component\Console\Output\OutputInterface;
8
-use Symfony\Component\Console\Command\Command;
9 8
 use Propel\Generator\Model\Table;
10
-use Propel\Generator\Model\Database;
11
-use phootwork\json\Json;
12
-use phootwork\json\JsonException;
13
-use keeko\tools\exceptions\JsonEmptyException;
14
-use Symfony\Component\Filesystem\Filesystem;
15 9
 
16 10
 class GenerateApiCommand extends AbstractGenerateCommand {
17 11
 
Please login to merge, or discard this patch.
Switch Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -158,20 +158,20 @@  discard block
 block discarded – undo
158 158
 		
159 159
 		// find path branch
160 160
 		switch ($type) {
161
-			case 'list':
162
-			case 'create':
163
-				$endpoint = '/' . $modelPlural;
164
-				break;
161
+		case 'list':
162
+		case 'create':
163
+			$endpoint = '/' . $modelPlural;
164
+			break;
165 165
 
166
-			case 'read':
167
-			case 'update':
168
-			case 'delete':
169
-				$endpoint = '/' . $modelPlural . '/{id}';
170
-				break;
166
+		case 'read':
167
+		case 'update':
168
+		case 'delete':
169
+			$endpoint = '/' . $modelPlural . '/{id}';
170
+			break;
171 171
 
172
-			default:
173
-				throw new \RuntimeException('type (%s) not found, can\'t continue.');
174
-				break;
172
+		default:
173
+			throw new \RuntimeException('type (%s) not found, can\'t continue.');
174
+			break;
175 175
 		}
176 176
 
177 177
 		$path = isset($paths[$endpoint]) ? $paths[$endpoint] : [];
@@ -185,58 +185,58 @@  discard block
 block discarded – undo
185 185
 		$responses = isset($operation['responses']) ? $operation['responses'] : [];
186 186
 		
187 187
 		switch ($type) {
188
-			case 'list':
189
-				$ok = isset($responses['200']) ? $responses['200'] : [];
190
-				$ok['description'] = sprintf('Array of %s', $modelPlural);
191
-				$ok['schema'] = ['$ref' => '#/definitions/' . 'Paged' . NameUtils::pluralize($modelObject)];
188
+		case 'list':
189
+			$ok = isset($responses['200']) ? $responses['200'] : [];
190
+			$ok['description'] = sprintf('Array of %s', $modelPlural);
191
+			$ok['schema'] = ['$ref' => '#/definitions/' . 'Paged' . NameUtils::pluralize($modelObject)];
192 192
 				
193
-				$responses['200'] = $ok;
194
-				break;
193
+			$responses['200'] = $ok;
194
+			break;
195 195
 				
196
-			case 'create':
197
-				// params
198
-				list($paramIndex, $param) = $this->findParam($params, 'body');
196
+		case 'create':
197
+			// params
198
+			list($paramIndex, $param) = $this->findParam($params, 'body');
199 199
 				
200
-				$param['name'] = 'body';
201
-				$param['in'] = 'body';
202
-				$param['description'] = sprintf('The new %s', $modelName);
203
-				$param['required'] = true;
204
-				$param['schema'] = ['$ref' => '#/definitions/Writable' . $modelObject];
200
+			$param['name'] = 'body';
201
+			$param['in'] = 'body';
202
+			$param['description'] = sprintf('The new %s', $modelName);
203
+			$param['required'] = true;
204
+			$param['schema'] = ['$ref' => '#/definitions/Writable' . $modelObject];
205 205
 				
206
-				$params = $this->updateArray($params, $paramIndex, $param);
206
+			$params = $this->updateArray($params, $paramIndex, $param);
207 207
 				
208
-				// response
209
-				$ok = isset($responses['201']) ? $responses['201'] : [];
210
-				$ok['description'] = sprintf('%s created', $modelName);
208
+			// response
209
+			$ok = isset($responses['201']) ? $responses['201'] : [];
210
+			$ok['description'] = sprintf('%s created', $modelName);
211 211
 				
212
-				$responses['201'] = $ok;
213
-				break;
212
+			$responses['201'] = $ok;
213
+			break;
214 214
 				
215
-			case 'read':
216
-				// response
217
-				$ok = isset($responses['200']) ? $responses['200'] : [];
218
-				$ok['description'] = sprintf('gets the %s', $modelName);
219
-				$ok['schema'] = ['$ref' => '#/definitions/' . $modelObject];
215
+		case 'read':
216
+			// response
217
+			$ok = isset($responses['200']) ? $responses['200'] : [];
218
+			$ok['description'] = sprintf('gets the %s', $modelName);
219
+			$ok['schema'] = ['$ref' => '#/definitions/' . $modelObject];
220 220
 				
221
-				$responses['200'] = $ok;
222
-				break;
221
+			$responses['200'] = $ok;
222
+			break;
223 223
 				
224
-			case 'update':
225
-				// response
226
-				$ok = isset($responses['200']) ? $responses['200'] : [];
227
-				$ok['description'] = sprintf('%s updated', $modelName);
228
-				$ok['schema'] = ['$ref' => '#/definitions/' . $modelObject];
224
+		case 'update':
225
+			// response
226
+			$ok = isset($responses['200']) ? $responses['200'] : [];
227
+			$ok['description'] = sprintf('%s updated', $modelName);
228
+			$ok['schema'] = ['$ref' => '#/definitions/' . $modelObject];
229 229
 				
230
-				$responses['200'] = $ok;
231
-				break;
230
+			$responses['200'] = $ok;
231
+			break;
232 232
 				
233
-			case 'delete':
234
-				// response
235
-				$ok = isset($responses['204']) ? $responses['204'] : [];
236
-				$ok['description'] = sprintf('%s deleted', $modelName);
233
+		case 'delete':
234
+			// response
235
+			$ok = isset($responses['204']) ? $responses['204'] : [];
236
+			$ok['description'] = sprintf('%s deleted', $modelName);
237 237
 				
238
-				$responses['204'] = $ok;
239
-				break;
238
+			$responses['204'] = $ok;
239
+			break;
240 240
 		}
241 241
 		
242 242
 		if ($type == 'read' || $type == 'update' || $type == 'delete') {
Please login to merge, or discard this patch.
src/command/MagicCommand.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 use keeko\tools\command\AbstractGenerateCommand;
5 5
 use Symfony\Component\Console\Output\OutputInterface;
6 6
 use Symfony\Component\Console\Input\InputInterface;
7
-use Symfony\Component\Console\Command\Command;
8 7
 use Symfony\Component\Console\Input\ArrayInput;
9 8
 
10 9
 class MagicCommand extends AbstractGenerateCommand {
Please login to merge, or discard this patch.
src/KeekoTools.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 		$this->setDispatcher($dispatcher);
29 29
 		$this->keekoDispatcher = $dispatcher;
30 30
 
31
-		$dispatcher->addListener(ConsoleEvents::TERMINATE, function (ConsoleTerminateEvent $event) {
31
+		$dispatcher->addListener(ConsoleEvents::TERMINATE, function(ConsoleTerminateEvent $event) {
32 32
 			$command = $event->getCommand();
33 33
 			$this->finishedCommands[] = $command->getName();
34 34
 		});
Please login to merge, or discard this patch.
src/command/GenerateActionCommand.php 1 patch
Switch Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -216,14 +216,14 @@
 block discarded – undo
216 216
 
217 217
 	private function getActionTitle($model, $type) {
218 218
 		switch ($type) {
219
-			case 'list':
220
-				return 'List all ' . NameUtils::pluralize($model);
219
+		case 'list':
220
+			return 'List all ' . NameUtils::pluralize($model);
221 221
 
222
-			case 'create':
223
-			case 'read':
224
-			case 'update':
225
-			case 'delete':
226
-				return ucfirst($type) . 's ' . (in_array($model[0], ['a', 'e', 'i', 'o', 'u']) ? 'an' : 'a') . ' ' . $model;
222
+		case 'create':
223
+		case 'read':
224
+		case 'update':
225
+		case 'delete':
226
+			return ucfirst($type) . 's ' . (in_array($model[0], ['a', 'e', 'i', 'o', 'u']) ? 'an' : 'a') . ' ' . $model;
227 227
 		}
228 228
 	}
229 229
 
Please login to merge, or discard this patch.
src/command/InitCommand.php 2 patches
Switch Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -358,13 +358,13 @@
 block discarded – undo
358 358
 		$type = $this->getPackageType();
359 359
 
360 360
 		switch ($type) {
361
-			case 'app':
362
-				$this->handleAppClass($class);
363
-				break;
361
+		case 'app':
362
+			$this->handleAppClass($class);
363
+			break;
364 364
 				
365
-			case 'module':
366
-				$this->handleModuleClass($class);
367
-				break;
365
+		case 'module':
366
+			$this->handleModuleClass($class);
367
+			break;
368 368
 		}
369 369
 
370 370
 		$this->codegenService->dumpStruct($class, true);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 			$types = ['module', 'app'];
175 175
 			$question = new Question('Package type (module|app)', $type);
176 176
 			$question->setAutocompleterValues($types);
177
-			$question->setValidator(function ($answer) use ($types) {
177
+			$question->setValidator(function($answer) use ($types) {
178 178
 				if (!in_array($answer, $types)) {
179 179
 					throw new \RuntimeException('The name of the type should be one of: ' . 
180 180
 							implode(',', $types));
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 	private function validateName($name) {
554 554
 		if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $name)) {
555 555
 			throw new \InvalidArgumentException(
556
-				'The package name '.$name.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
556
+				'The package name ' . $name . ' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
557 557
 			);
558 558
 		}
559 559
 	}
Please login to merge, or discard this patch.
src/generator/GeneratorFactory.php 1 patch
Switch Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -13,20 +13,20 @@  discard block
 block discarded – undo
13 13
 	 */
14 14
 	public static function createActionTraitGenerator($type, CommandService $service) {
15 15
 		switch ($type) {
16
-			case 'list':
17
-				return new ListActionTraitGenerator($service);
16
+		case 'list':
17
+			return new ListActionTraitGenerator($service);
18 18
 				
19
-			case 'create':
20
-				return new CreateActionTraitGenerator($service);
19
+		case 'create':
20
+			return new CreateActionTraitGenerator($service);
21 21
 				
22
-			case 'update':
23
-				return new UpdateActionTraitGenerator($service);
22
+		case 'update':
23
+			return new UpdateActionTraitGenerator($service);
24 24
 				
25
-			case 'read':
26
-				return new ReadActionTraitGenerator($service);
25
+		case 'read':
26
+			return new ReadActionTraitGenerator($service);
27 27
 				
28
-			case 'delete':
29
-				return new DeleteActionTraitGenerator($service);
28
+		case 'delete':
29
+			return new DeleteActionTraitGenerator($service);
30 30
 		}
31 31
 	}
32 32
 	
@@ -38,20 +38,20 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	public static function createJsonResponseGenerator($type, CommandService $service) {
40 40
 		switch ($type) {
41
-			case 'list':
42
-				return new ListJsonResponseGenerator($service);
41
+		case 'list':
42
+			return new ListJsonResponseGenerator($service);
43 43
 		
44
-			case 'create':
45
-				return new CreateJsonResponseGenerator($service);
44
+		case 'create':
45
+			return new CreateJsonResponseGenerator($service);
46 46
 		
47
-			case 'update':
48
-				return new UpdateJsonResponseGenerator($service);
47
+		case 'update':
48
+			return new UpdateJsonResponseGenerator($service);
49 49
 		
50
-			case 'read':
51
-				return new ReadJsonResponseGenerator($service);
50
+		case 'read':
51
+			return new ReadJsonResponseGenerator($service);
52 52
 		
53
-			case 'delete':
54
-				return new DeleteJsonResponseGenerator($service);
53
+		case 'delete':
54
+			return new DeleteJsonResponseGenerator($service);
55 55
 		}
56 56
 	}
57 57
 
Please login to merge, or discard this patch.
src/helpers/QuestionHelperTrait.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@
 block discarded – undo
24 24
 	 */
25 25
 	protected function getQuestion($question, $default = null, $sep = ':') {
26 26
 		return !empty($default) ?
27
-			sprintf('<info>%s</info> [<comment>%s</comment>]%s ', $question, $default, $sep) :
28
-			sprintf('<info>%s</info>%s ', $question, $sep);
27
+			sprintf('<info>%s</info> [<comment>%s</comment>]%s ', $question, $default, $sep) : sprintf('<info>%s</info>%s ', $question, $sep);
29 28
 	}
30 29
 	
31 30
 	/**
Please login to merge, or discard this patch.
src/services/CodeGeneratorService.php 2 patches
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -153,14 +153,14 @@
 block discarded – undo
153 153
 		// iterate over behaviors to get their respective columns
154 154
 		foreach ($table->getBehaviors() as $behavior) {
155 155
 			switch ($behavior->getName()) {
156
-				case 'timestampable':
157
-					$fields[] = $behavior->getParameter('create_column');
158
-					$fields[] = $behavior->getParameter('update_column');
159
-					break;
160
-	
161
-				case 'aggregate_column':
162
-					$fields[] = $behavior->getParameter('name');
163
-					break;
156
+			case 'timestampable':
157
+				$fields[] = $behavior->getParameter('create_column');
158
+				$fields[] = $behavior->getParameter('update_column');
159
+				break;
160
+	
161
+			case 'aggregate_column':
162
+				$fields[] = $behavior->getParameter('name');
163
+				break;
164 164
 			}
165 165
 		}
166 166
 	
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
 				$fields .= sprintf("'%s'", $prop);
106 106
 	
107 107
 				if (isset($conversions[$prop])) {
108
-					$fields .= ' => function($v) {'."\n\t".'return ' . $conversions[$prop] . ';'."\n".'}';
108
+					$fields .= ' => function($v) {' . "\n\t" . 'return ' . $conversions[$prop] . ';' . "\n" . '}';
109 109
 				}
110 110
 	
111 111
 				$fields .= ', ';
Please login to merge, or discard this patch.
src/utils/NameUtils.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 	public static function toStudlyCase($input) {
16 16
 		$input = trim($input, '-_');
17 17
 		return ucfirst(preg_replace_callback('/([A-Z-_][a-z]+)/', function($matches) {
18
-			return ucfirst(str_replace(['-','_'], '',$matches[0]));
18
+			return ucfirst(str_replace(['-', '_'], '', $matches[0]));
19 19
 		}, $input));
20 20
 	}
21 21
 	
Please login to merge, or discard this patch.