Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
sten authored and github-actions[bot] committed Nov 6, 2024
1 parent 5ef6bc3 commit 041137e
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/Commands/SurveyheroResponseImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function handle(): int
$this->deleteResponses();
}

$importInfo = new ResponseImportInfo();
$importInfo = new ResponseImportInfo;

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

Expand Down
2 changes: 1 addition & 1 deletion src/Services/AbstractSurveyheroAPIService.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class AbstractSurveyheroAPIService

public function __construct()
{
$this->client = new SurveyheroClient();
$this->client = new SurveyheroClient;
}

public function getApiClient(): SurveyheroClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ public function updateOrCreateQuestion(SurveyContract $survey, string $lang, str
$lang => $label ?? '',
],
'surveyhero_element_id' => $questionId,
'field' => (new SurveyMappingService())->findQuestionField($survey, $questionId, $subquestionId),
'field' => (new SurveyMappingService)->findQuestionField($survey, $questionId, $subquestionId),
]);
}

protected function getChoiceMapping(string|int $choiceId, string|int $questionId, array $questionMapping): int|string|null
{
$answerMapping = $questionMapping['answer_mapping'];
$mappingService = new SurveyMappingService();
$mappingService = new SurveyMappingService;

if ($questionMapping['question_id'] !== $questionId && isset($questionMapping['subquestion_mapping'])) {
$subquestionMapping = $mappingService->getSubquestionMapping($questionId, $questionMapping);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function updateOrCreateQuestionAndAnswer(\stdClass $question, SurveyContr
],
];

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

$this->setChoiceAndConvertToDataType($mappedChoice, $questionMapping['mapped_data_type'], $responseData, $choice);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function updateOrCreateQuestionAndAnswer(\stdClass $question, SurveyContr
],
];

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

$this->setChoiceAndConvertToDataType($mappedChoice, $questionMapping['mapped_data_type'], $responseData, $choice);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function updateOrCreateQuestionAndAnswer(\stdClass $question, SurveyContr
$maxValue = $ratingScale->right->value;
$stepSize = $ratingScale->step_size;

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

for ($i = $minValue; $i <= $maxValue; $i += $stepSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function updateOrCreateQuestionResponse(\stdClass $surveyheroQuestionResp
*/

$responseList = [];
$mappingService = new SurveyMappingService();
$mappingService = new SurveyMappingService;

foreach ($surveyheroQuestionResponse->choice_table as $surveyheroChoiceQuestion) {
$subquestionMapping = $mappingService->getSubquestionMapping($surveyheroChoiceQuestion->row_id, $questionMapping);
Expand Down
8 changes: 4 additions & 4 deletions src/Services/SurveyMappingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ public function findQuestionField(SurveyContract $survey, string $questionId, ?s
private function getQuestionMapper(string $surveyheroFieldType): ?QuestionMapper
{
return match ($surveyheroFieldType) {
InputQuestionMapper::TYPE => new InputQuestionMapper(),
RatingScaleQuestionMapper::TYPE => new RatingScaleQuestionMapper(),
ChoiceListQuestionMapper::TYPE => new ChoiceListQuestionMapper(),
ChoiceTableQuestionMapper::TYPE => new ChoiceTableQuestionMapper(),
InputQuestionMapper::TYPE => new InputQuestionMapper,
RatingScaleQuestionMapper::TYPE => new RatingScaleQuestionMapper,
ChoiceListQuestionMapper::TYPE => new ChoiceListQuestionMapper,
ChoiceTableQuestionMapper::TYPE => new ChoiceTableQuestionMapper,
default => null,
};
}
Expand Down
8 changes: 4 additions & 4 deletions src/Services/SurveyQuestionsAndAnswersImportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ public function importSurveyQuestionsAndAnswers(SurveyContract $survey): array
private function getQuestionAndAnswerCreator(string $surveyheroFieldType): ?QuestionAndAnswerCreator
{
return match ($surveyheroFieldType) {
ChoiceListQuestionAndAnswerCreator::TYPE => new ChoiceListQuestionAndAnswerCreator(),
ChoiceTableQuestionAndAnswerCreator::TYPE => new ChoiceTableQuestionAndAnswerCreator(),
RatingScaleQuestionAndAnswerCreator::TYPE => new RatingScaleQuestionAndAnswerCreator(),
InputQuestionAndAnswerCreator::TYPE => new InputQuestionAndAnswerCreator(),
ChoiceListQuestionAndAnswerCreator::TYPE => new ChoiceListQuestionAndAnswerCreator,
ChoiceTableQuestionAndAnswerCreator::TYPE => new ChoiceTableQuestionAndAnswerCreator,
RatingScaleQuestionAndAnswerCreator::TYPE => new RatingScaleQuestionAndAnswerCreator,
InputQuestionAndAnswerCreator::TYPE => new InputQuestionAndAnswerCreator,
default => null,
};
}
Expand Down
12 changes: 6 additions & 6 deletions src/Services/SurveyResponseImportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function importSurveyResponses(SurveyContract $survey): ResponseImportInf
{
$surveyCollectorIds = $this->surveyMappingService->getSurveyCollectors($survey);
$surveyQuestionMapping = $this->surveyMappingService->getSurveyQuestionMapping($survey);
$responseImportInfo = new ResponseImportInfo();
$responseImportInfo = new ResponseImportInfo;

try {
DB::beginTransaction();
Expand Down Expand Up @@ -78,7 +78,7 @@ public function importSurveyResponses(SurveyContract $survey): ResponseImportInf
*/
public function importSurveyResponse($responseId, SurveyContract $survey, ?array $surveyQuestionMapping = null): ?ResponseImportInfo
{
$importInfo = new ResponseImportInfo();
$importInfo = new ResponseImportInfo;

if (! $surveyQuestionMapping) {
$surveyQuestionMapping = $this->surveyMappingService->getSurveyQuestionMapping($survey);
Expand Down Expand Up @@ -187,10 +187,10 @@ public function deleteSurveyResponse($surveyId, $responseId)
private function getQuestionResponseCreator(string $surveyheroFieldType): ?QuestionResponseCreator
{
return match ($surveyheroFieldType) {
TextResponseCreator::TYPE => new TextResponseCreator(),
NumberResponseCreator::TYPE => new NumberResponseCreator(),
ChoicesResponseCreator::TYPE => new ChoicesResponseCreator(),
ChoiceTableResponseCreator::TYPE => new ChoiceTableResponseCreator(),
TextResponseCreator::TYPE => new TextResponseCreator,
NumberResponseCreator::TYPE => new NumberResponseCreator,
ChoicesResponseCreator::TYPE => new ChoicesResponseCreator,
ChoiceTableResponseCreator::TYPE => new ChoiceTableResponseCreator,
default => null,
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/SurveyheroServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function packageBooted()
parent::packageBooted();

$this->app->singleton(SurveyheroRegistrar::class, function ($app) {
return new SurveyheroRegistrar();
return new SurveyheroRegistrar;
});
}
}
2 changes: 1 addition & 1 deletion src/Traits/HasCollectors.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trait HasCollectors
public function getCollectors(): array
{
if (! $this->collectors) {
$surveyMappingService = new SurveyMappingService();
$surveyMappingService = new SurveyMappingService;
$surveyMappingConfig = $surveyMappingService->getSurveyMappingFromConfig($this);
$surveyCollectors = $this->collector_ids;

Expand Down
2 changes: 1 addition & 1 deletion src/Traits/HasQuestionMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trait HasQuestionMapping
public function getQuestionMapping(): array
{
if (! $this->mergedQuestionMapping) {
$surveyMappingService = new SurveyMappingService();
$surveyMappingService = new SurveyMappingService;
$surveyMappingConfig = $surveyMappingService->getSurveyMappingFromConfig($this);
$surveyMappingDatabase = $this->question_mapping;

Expand Down

0 comments on commit 041137e

Please sign in to comment.