Lint PHP code psr-12, add GH action

This commit is contained in:
Julien Nahum
2024-02-23 11:54:12 +01:00
parent e85e4df7fe
commit 62971a2ef4
226 changed files with 2338 additions and 2144 deletions

View File

@@ -7,8 +7,7 @@ use Faker;
class FormSubmissionDataFactory
{
private Faker\Generator|null $faker;
private ?Faker\Generator $faker;
public function __construct(private Form $form)
{
@@ -68,24 +67,27 @@ class FormSubmissionDataFactory
private function generateSelectValue($property)
{
$values = [];
if (isset($property["select"]["options"]) && count($property["select"]["options"]) > 0) {
$values = collect($property["select"]["options"])->map(function ($option) {
if (isset($property['select']['options']) && count($property['select']['options']) > 0) {
$values = collect($property['select']['options'])->map(function ($option) {
return $option['name'];
})->toArray();
}
return ($values) ? $this->faker->randomElement($values) : null;
}
private function generateMultiSelectValues($property)
{
$values = [];
if (isset($property["multi_select"]["options"]) && count($property["multi_select"]["options"]) > 0) {
$values = collect($property["multi_select"]["options"])->map(function ($option) {
if (isset($property['multi_select']['options']) && count($property['multi_select']['options']) > 0) {
$values = collect($property['multi_select']['options'])->map(function ($option) {
return $option['name'];
})->toArray();
}
return ($values) ? $this->faker->randomElements(
$values,
$this->faker->numberBetween(1, count($values))) : null;
$this->faker->numberBetween(1, count($values))
) : null;
}
}