File tree Expand file tree Collapse file tree 3 files changed +10
-9
lines changed Expand file tree Collapse file tree 3 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ abstract class <?= $model->getClassName() ?> extends \yii\db\ActiveRecord
5252<?php if ($ scenarios = $ model ->getScenarios ()):
5353foreach ($ scenarios as $ scenario ): ?>
5454 /**
55- * <?= $ scenario ['description ' ] ?>
55+ *<?= $ scenario ['description ' ] ?>
5656
5757 */
5858 public const <?= $ scenario ['const ' ] ?> = '<?= $ scenario ['name ' ] ?> ';
Original file line number Diff line number Diff line change 55class FormatHelper
66{
77 /**
8- * @param $description
8+ * @param string $description
9+ * @param int $spacing
910 * @return string
1011 */
11- public static function getFormattedDescription ($ description ): string
12+ public static function getFormattedDescription (string $ description, int $ spacing = 1 ): string
1213 {
1314 $ descriptionArr = explode ("\n" , trim ($ description ));
14- $ descriptionArr = array_map (function ($ item ) {
15- return $ item !== '' ? ' ' . $ item : $ item ;
15+ $ descriptionArr = array_map (function ($ item ) {
16+ return $ item === '' ? '' : ' ' . $ item ;
1617 }, $ descriptionArr );
17- return implode ("\n * " , $ descriptionArr );
18+ return implode ("\n" . str_repeat ( " " , $ spacing ). " * " , $ descriptionArr );
1819 }
1920}
Original file line number Diff line number Diff line change @@ -227,9 +227,9 @@ private function getScenariosByOpenapiSchema(): array
227227
228228 foreach ($ scenarios as $ key => $ scenario ) {
229229 $ scenarios [$ key ]['const ' ] = 'SCENARIO_ ' . strtoupper ($ scenario ['name ' ]);
230- if ( empty ($ scenario ['description ' ])) {
231- $ scenarios [ $ key ][ 'description ' ] = ' Scenario ' . $ scenario [ ' name ' ];
232- }
230+ $ scenarios [ $ key ][ ' description ' ] = ! empty ($ scenario ['description ' ]) ?
231+ FormatHelper:: getFormattedDescription ( $ scenario [ 'description ' ], 5 )
232+ : ' Scenario ' . $ scenario [ ' name ' ];
233233 }
234234
235235 return $ scenarios ;
You can’t perform that action at this time.
0 commit comments