Completed
Push — master ( 66405f...98cd2e )
by Thomas
06:52
created
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.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 	 * Adds authors to the docblock of the given struct
63 63
 	 *
64 64
 	 * @param AbstractPhpStruct $struct
65
-	 * @param array $package
65
+	 * @param PackageSchema $package
66 66
 	 */
67 67
 	public function addAuthors(AbstractPhpStruct $struct, PackageSchema $package) {
68 68
 		$docblock = $struct->getDocblock();
Please login to merge, or discard this patch.
src/command/AbstractGenerateCommand.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -91,6 +91,9 @@
 block discarded – undo
91 91
 		;
92 92
 	}
93 93
 	
94
+	/**
95
+	 * @param string $name
96
+	 */
94 97
 	protected function runCommand($name, InputInterface $input, OutputInterface $output) {
95 98
 		// return whether command has already executed
96 99
 		$app = $this->getApplication();
Please login to merge, or discard this patch.
src/command/GenerateActionCommand.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -283,7 +283,6 @@
 block discarded – undo
283 283
 	/**
284 284
 	 * Generates an action.
285 285
 	 *  
286
-	 * @param string $actionName
287 286
 	 * @param ActionSchema $action the action node from composer.json
288 287
 	 */
289 288
 	private function generateAction($actionName) {
Please login to merge, or discard this patch.
Switch Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -268,14 +268,14 @@
 block discarded – undo
268 268
 	private function getActionTitle($modelName, $type) {
269 269
 		$name = NameUtils::dasherize($modelName);
270 270
 		switch ($type) {
271
-			case 'list':
272
-				return 'List all ' . NameUtils::pluralize($name);
271
+		case 'list':
272
+			return 'List all ' . NameUtils::pluralize($name);
273 273
 
274
-			case 'create':
275
-			case 'read':
276
-			case 'update':
277
-			case 'delete':
278
-				return ucfirst($type) . 's ' . (in_array($name[0], ['a', 'e', 'i', 'o', 'u']) ? 'an' : 'a') . ' ' . $name;
274
+		case 'create':
275
+		case 'read':
276
+		case 'update':
277
+		case 'delete':
278
+			return ucfirst($type) . 's ' . (in_array($name[0], ['a', 'e', 'i', 'o', 'u']) ? 'an' : 'a') . ' ' . $name;
279 279
 		}
280 280
 	}
281 281
 
Please login to merge, or discard this patch.
src/generator/response/ToManyRelationshipJsonResponseGenerator.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -15,6 +15,9 @@
 block discarded – undo
15 15
 	/** @var Table */
16 16
 	private $model;
17 17
 	
18
+	/**
19
+	 * @param \keeko\tools\services\CommandService $service
20
+	 */
18 21
 	public function __construct($service, Table $model, Table $foreign) {
19 22
 		parent::__construct($service);
20 23
 		$this->model = $model;
Please login to merge, or discard this patch.
src/generator/response/ToOneRelationshipJsonResponseGenerator.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -14,6 +14,9 @@
 block discarded – undo
14 14
 	/** @var Table */
15 15
 	private $foreign;
16 16
 	
17
+	/**
18
+	 * @param \keeko\tools\services\CommandService $service
19
+	 */
17 20
 	public function __construct($service, Table $model, Table $foreign) {
18 21
 		parent::__construct($service);
19 22
 		$this->model = $model;
Please login to merge, or discard this patch.
src/command/GenerateApiCommand.php 1 patch
Switch Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -206,20 +206,20 @@  discard block
 block discarded – undo
206 206
 	
207 207
 		// find path branch
208 208
 		switch ($type) {
209
-			case 'list':
210
-			case 'create':
211
-				$endpoint = '/' . $modelPluralName;
212
-				break;
209
+		case 'list':
210
+		case 'create':
211
+			$endpoint = '/' . $modelPluralName;
212
+			break;
213 213
 	
214
-			case 'read':
215
-			case 'update':
216
-			case 'delete':
217
-				$endpoint = '/' . $modelPluralName . '/{id}';
218
-				break;
214
+		case 'read':
215
+		case 'update':
216
+		case 'delete':
217
+			$endpoint = '/' . $modelPluralName . '/{id}';
218
+			break;
219 219
 	
220
-			default:
221
-				throw new \RuntimeException(sprintf('type (%s) not found, can\'t continue.', $type));
222
-				break;
220
+		default:
221
+			throw new \RuntimeException(sprintf('type (%s) not found, can\'t continue.', $type));
222
+			break;
223 223
 		}
224 224
 
225 225
 		$path = $paths->get($endpoint);
@@ -234,45 +234,45 @@  discard block
 block discarded – undo
234 234
 		$responses = $operation->getResponses();
235 235
 	
236 236
 		switch ($type) {
237
-			case 'list':
238
-				$ok = $responses->get('200');
239
-				$ok->setDescription(sprintf('Array of %s', $modelPluralName));
240
-				$ok->getSchema()->setRef('#/definitions/' . 'Paged' . NameUtils::pluralize($modelObjectName));
241
-				break;
237
+		case 'list':
238
+			$ok = $responses->get('200');
239
+			$ok->setDescription(sprintf('Array of %s', $modelPluralName));
240
+			$ok->getSchema()->setRef('#/definitions/' . 'Paged' . NameUtils::pluralize($modelObjectName));
241
+			break;
242 242
 	
243
-			case 'create':
244
-				// params
245
-				$body = $params->getByName('body');
246
-				$body->setName('body');
247
-				$body->setIn('body');
248
-				$body->setDescription(sprintf('The new %s', $modelName));
249
-				$body->setRequired(true);
250
-				$body->getSchema()->setRef('#/definitions/Writable' . $modelObjectName);
243
+		case 'create':
244
+			// params
245
+			$body = $params->getByName('body');
246
+			$body->setName('body');
247
+			$body->setIn('body');
248
+			$body->setDescription(sprintf('The new %s', $modelName));
249
+			$body->setRequired(true);
250
+			$body->getSchema()->setRef('#/definitions/Writable' . $modelObjectName);
251 251
 	
252
-				// response
253
-				$ok = $responses->get('201');
254
-				$ok->setDescription(sprintf('%s created', $modelName));
255
-				break;
252
+			// response
253
+			$ok = $responses->get('201');
254
+			$ok->setDescription(sprintf('%s created', $modelName));
255
+			break;
256 256
 	
257
-			case 'read':
258
-				// response
259
-				$ok = $responses->get('200');
260
-				$ok->setDescription(sprintf('gets the %s', $modelName));
261
-				$ok->getSchema()->setRef('#/definitions/' . $modelObjectName);
262
-				break;
257
+		case 'read':
258
+			// response
259
+			$ok = $responses->get('200');
260
+			$ok->setDescription(sprintf('gets the %s', $modelName));
261
+			$ok->getSchema()->setRef('#/definitions/' . $modelObjectName);
262
+			break;
263 263
 	
264
-			case 'update':
265
-				// response
266
-				$ok = $responses->get('200');
267
-				$ok->setDescription(sprintf('%s updated', $modelName));
268
-				$ok->getSchema()->setRef('#/definitions/' . $modelObjectName);
269
-				break;
264
+		case 'update':
265
+			// response
266
+			$ok = $responses->get('200');
267
+			$ok->setDescription(sprintf('%s updated', $modelName));
268
+			$ok->getSchema()->setRef('#/definitions/' . $modelObjectName);
269
+			break;
270 270
 	
271
-			case 'delete':
272
-				// response
273
-				$ok = $responses->get('204');
274
-				$ok->setDescription(sprintf('%s deleted', $modelName));
275
-				break;
271
+		case 'delete':
272
+			// response
273
+			$ok = $responses->get('204');
274
+			$ok->setDescription(sprintf('%s deleted', $modelName));
275
+			break;
276 276
 		}
277 277
 	
278 278
 		if ($type == 'read' || $type == 'update' || $type == 'delete') {
Please login to merge, or discard this patch.
src/command/GenerateResponseCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -230,7 +230,7 @@
 block discarded – undo
230 230
 		$module = $this->packageService->getModule();
231 231
 		$action = $module->getAction($actionName);
232 232
 		$prefix = substr($actionName, 0, strpos($actionName, 'relationship') + 12);
233
-		$readAction = $module->getAction($prefix.'-read');
233
+		$readAction = $module->getAction($prefix . '-read');
234 234
 		
235 235
 		// get modules names
236 236
 		$matches = [];
Please login to merge, or discard this patch.
src/generator/SerializerGenerator.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 			foreach ($fields as $field) {
100 100
 				$code .= "'$field'";
101 101
 				if (isset($conversions[$field])) {
102
-					$code .= ' => function($v) {'."\n\t".'return ' . $conversions[$field] . ';'."\n".'}';
102
+					$code .= ' => function($v) {' . "\n\t" . 'return ' . $conversions[$field] . ';' . "\n" . '}';
103 103
 				}
104 104
 		
105 105
 				$code .= ', ';
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 				]);
159 159
 				
160 160
 				// set
161
-				$class->setMethod(PhpMethod::create('set'.$crudMethod)
161
+				$class->setMethod(PhpMethod::create('set' . $crudMethod)
162 162
 					->addParameter(PhpParameter::create('model'))
163 163
 					->addParameter(PhpParameter::create('data'))
164 164
 					->setBody($this->twig->render('to-one-set.twig', [
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
 				]);
192 192
 				
193 193
 				// set
194
-				$class->addUseStatement($rel['cfk']->getMiddleTable()->getNamespace() . '\\' .$rel['cfk']->getMiddleTable()->getPhpName() . 'Query');
195
-				$class->setMethod(PhpMethod::create('set'.$crudMethod)
194
+				$class->addUseStatement($rel['cfk']->getMiddleTable()->getNamespace() . '\\' . $rel['cfk']->getMiddleTable()->getPhpName() . 'Query');
195
+				$class->setMethod(PhpMethod::create('set' . $crudMethod)
196 196
 					->addParameter(PhpParameter::create('model'))
197 197
 					->addParameter(PhpParameter::create('data'))
198 198
 					->setBody($this->twig->render('to-many-set.twig', [
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 				);
204 204
 
205 205
 				// add
206
-				$class->setMethod(PhpMethod::create('add'.$crudMethod)
206
+				$class->setMethod(PhpMethod::create('add' . $crudMethod)
207 207
 					->addParameter(PhpParameter::create('model'))
208 208
 					->addParameter(PhpParameter::create('data'))
209 209
 					->setBody($this->twig->render('to-many-add.twig', [
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 				);
214 214
 				
215 215
 				// remove
216
-				$class->setMethod(PhpMethod::create('remove'.$crudMethod)
216
+				$class->setMethod(PhpMethod::create('remove' . $crudMethod)
217 217
 					->addParameter(PhpParameter::create('model'))
218 218
 					->addParameter(PhpParameter::create('data'))
219 219
 					->setBody($this->twig->render('to-many-remove.twig', [
Please login to merge, or discard this patch.