Skip to content

Commit 041137e

Browse files
stengithub-actions[bot]
authored andcommitted
Fix styling
1 parent 5ef6bc3 commit 041137e

13 files changed

+25
-25
lines changed

src/Commands/SurveyheroResponseImportCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function handle(): int
3434
$this->deleteResponses();
3535
}
3636

37-
$importInfo = new ResponseImportInfo();
37+
$importInfo = new ResponseImportInfo;
3838

3939
$surveyId = trim($this->option('survey'));
4040

src/Services/AbstractSurveyheroAPIService.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class AbstractSurveyheroAPIService
1010

1111
public function __construct()
1212
{
13-
$this->client = new SurveyheroClient();
13+
$this->client = new SurveyheroClient;
1414
}
1515

1616
public function getApiClient(): SurveyheroClient

src/Services/Factories/QuestionAndAnswerCreator/AbstractQuestionAndAnswerCreator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ public function updateOrCreateQuestion(SurveyContract $survey, string $lang, str
2727
$lang => $label ?? '',
2828
],
2929
'surveyhero_element_id' => $questionId,
30-
'field' => (new SurveyMappingService())->findQuestionField($survey, $questionId, $subquestionId),
30+
'field' => (new SurveyMappingService)->findQuestionField($survey, $questionId, $subquestionId),
3131
]);
3232
}
3333

3434
protected function getChoiceMapping(string|int $choiceId, string|int $questionId, array $questionMapping): int|string|null
3535
{
3636
$answerMapping = $questionMapping['answer_mapping'];
37-
$mappingService = new SurveyMappingService();
37+
$mappingService = new SurveyMappingService;
3838

3939
if ($questionMapping['question_id'] !== $questionId && isset($questionMapping['subquestion_mapping'])) {
4040
$subquestionMapping = $mappingService->getSubquestionMapping($questionId, $questionMapping);

src/Services/Factories/QuestionAndAnswerCreator/ChoiceListQuestionAndAnswerCreator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function updateOrCreateQuestionAndAnswer(\stdClass $question, SurveyContr
2929
],
3030
];
3131

32-
$questionMapping = (new SurveyMappingService())->getQuestionMappingForSurvey($survey, $question->element_id);
32+
$questionMapping = (new SurveyMappingService)->getQuestionMappingForSurvey($survey, $question->element_id);
3333
$mappedChoice = $this->getChoiceMapping($choice->choice_id, $question->element_id, $questionMapping);
3434

3535
$this->setChoiceAndConvertToDataType($mappedChoice, $questionMapping['mapped_data_type'], $responseData, $choice);

src/Services/Factories/QuestionAndAnswerCreator/ChoiceTableQuestionAndAnswerCreator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function updateOrCreateQuestionAndAnswer(\stdClass $question, SurveyContr
2626
],
2727
];
2828

29-
$questionMapping = (new SurveyMappingService())->getQuestionMappingForSurvey($survey, $question->element_id);
29+
$questionMapping = (new SurveyMappingService)->getQuestionMappingForSurvey($survey, $question->element_id);
3030
$mappedChoice = $this->getChoiceMapping($choice->choice_id, $rowQuestion->row_id, $questionMapping);
3131

3232
$this->setChoiceAndConvertToDataType($mappedChoice, $questionMapping['mapped_data_type'], $responseData, $choice);

src/Services/Factories/QuestionAndAnswerCreator/RatingScaleQuestionAndAnswerCreator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function updateOrCreateQuestionAndAnswer(\stdClass $question, SurveyContr
2525
$maxValue = $ratingScale->right->value;
2626
$stepSize = $ratingScale->step_size;
2727

28-
$questionMapping = (new SurveyMappingService())->getQuestionMappingForSurvey($survey, $question->element_id);
28+
$questionMapping = (new SurveyMappingService)->getQuestionMappingForSurvey($survey, $question->element_id);
2929
$mappedDataType = $questionMapping['mapped_data_type'] ?? SurveyAnswerContract::CONVERTED_TYPE_INT;
3030

3131
for ($i = $minValue; $i <= $maxValue; $i += $stepSize) {

src/Services/Factories/ResponseCreator/ChoiceTableResponseCreator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function updateOrCreateQuestionResponse(\stdClass $surveyheroQuestionResp
7878
*/
7979

8080
$responseList = [];
81-
$mappingService = new SurveyMappingService();
81+
$mappingService = new SurveyMappingService;
8282

8383
foreach ($surveyheroQuestionResponse->choice_table as $surveyheroChoiceQuestion) {
8484
$subquestionMapping = $mappingService->getSubquestionMapping($surveyheroChoiceQuestion->row_id, $questionMapping);

src/Services/SurveyMappingService.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,10 @@ public function findQuestionField(SurveyContract $survey, string $questionId, ?s
201201
private function getQuestionMapper(string $surveyheroFieldType): ?QuestionMapper
202202
{
203203
return match ($surveyheroFieldType) {
204-
InputQuestionMapper::TYPE => new InputQuestionMapper(),
205-
RatingScaleQuestionMapper::TYPE => new RatingScaleQuestionMapper(),
206-
ChoiceListQuestionMapper::TYPE => new ChoiceListQuestionMapper(),
207-
ChoiceTableQuestionMapper::TYPE => new ChoiceTableQuestionMapper(),
204+
InputQuestionMapper::TYPE => new InputQuestionMapper,
205+
RatingScaleQuestionMapper::TYPE => new RatingScaleQuestionMapper,
206+
ChoiceListQuestionMapper::TYPE => new ChoiceListQuestionMapper,
207+
ChoiceTableQuestionMapper::TYPE => new ChoiceTableQuestionMapper,
208208
default => null,
209209
};
210210
}

src/Services/SurveyQuestionsAndAnswersImportService.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ public function importSurveyQuestionsAndAnswers(SurveyContract $survey): array
5050
private function getQuestionAndAnswerCreator(string $surveyheroFieldType): ?QuestionAndAnswerCreator
5151
{
5252
return match ($surveyheroFieldType) {
53-
ChoiceListQuestionAndAnswerCreator::TYPE => new ChoiceListQuestionAndAnswerCreator(),
54-
ChoiceTableQuestionAndAnswerCreator::TYPE => new ChoiceTableQuestionAndAnswerCreator(),
55-
RatingScaleQuestionAndAnswerCreator::TYPE => new RatingScaleQuestionAndAnswerCreator(),
56-
InputQuestionAndAnswerCreator::TYPE => new InputQuestionAndAnswerCreator(),
53+
ChoiceListQuestionAndAnswerCreator::TYPE => new ChoiceListQuestionAndAnswerCreator,
54+
ChoiceTableQuestionAndAnswerCreator::TYPE => new ChoiceTableQuestionAndAnswerCreator,
55+
RatingScaleQuestionAndAnswerCreator::TYPE => new RatingScaleQuestionAndAnswerCreator,
56+
InputQuestionAndAnswerCreator::TYPE => new InputQuestionAndAnswerCreator,
5757
default => null,
5858
};
5959
}

src/Services/SurveyResponseImportService.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function importSurveyResponses(SurveyContract $survey): ResponseImportInf
4040
{
4141
$surveyCollectorIds = $this->surveyMappingService->getSurveyCollectors($survey);
4242
$surveyQuestionMapping = $this->surveyMappingService->getSurveyQuestionMapping($survey);
43-
$responseImportInfo = new ResponseImportInfo();
43+
$responseImportInfo = new ResponseImportInfo;
4444

4545
try {
4646
DB::beginTransaction();
@@ -78,7 +78,7 @@ public function importSurveyResponses(SurveyContract $survey): ResponseImportInf
7878
*/
7979
public function importSurveyResponse($responseId, SurveyContract $survey, ?array $surveyQuestionMapping = null): ?ResponseImportInfo
8080
{
81-
$importInfo = new ResponseImportInfo();
81+
$importInfo = new ResponseImportInfo;
8282

8383
if (! $surveyQuestionMapping) {
8484
$surveyQuestionMapping = $this->surveyMappingService->getSurveyQuestionMapping($survey);
@@ -187,10 +187,10 @@ public function deleteSurveyResponse($surveyId, $responseId)
187187
private function getQuestionResponseCreator(string $surveyheroFieldType): ?QuestionResponseCreator
188188
{
189189
return match ($surveyheroFieldType) {
190-
TextResponseCreator::TYPE => new TextResponseCreator(),
191-
NumberResponseCreator::TYPE => new NumberResponseCreator(),
192-
ChoicesResponseCreator::TYPE => new ChoicesResponseCreator(),
193-
ChoiceTableResponseCreator::TYPE => new ChoiceTableResponseCreator(),
190+
TextResponseCreator::TYPE => new TextResponseCreator,
191+
NumberResponseCreator::TYPE => new NumberResponseCreator,
192+
ChoicesResponseCreator::TYPE => new ChoicesResponseCreator,
193+
ChoiceTableResponseCreator::TYPE => new ChoiceTableResponseCreator,
194194
default => null,
195195
};
196196
}

src/SurveyheroServiceProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function packageBooted()
4545
parent::packageBooted();
4646

4747
$this->app->singleton(SurveyheroRegistrar::class, function ($app) {
48-
return new SurveyheroRegistrar();
48+
return new SurveyheroRegistrar;
4949
});
5050
}
5151
}

src/Traits/HasCollectors.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ trait HasCollectors
1111
public function getCollectors(): array
1212
{
1313
if (! $this->collectors) {
14-
$surveyMappingService = new SurveyMappingService();
14+
$surveyMappingService = new SurveyMappingService;
1515
$surveyMappingConfig = $surveyMappingService->getSurveyMappingFromConfig($this);
1616
$surveyCollectors = $this->collector_ids;
1717

src/Traits/HasQuestionMapping.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ trait HasQuestionMapping
1111
public function getQuestionMapping(): array
1212
{
1313
if (! $this->mergedQuestionMapping) {
14-
$surveyMappingService = new SurveyMappingService();
14+
$surveyMappingService = new SurveyMappingService;
1515
$surveyMappingConfig = $surveyMappingService->getSurveyMappingFromConfig($this);
1616
$surveyMappingDatabase = $this->question_mapping;
1717

0 commit comments

Comments
 (0)