cs: Fix code style (safe rules only).

This commit is contained in:
Pol Dellaiera
2021-11-23 14:06:38 +01:00
parent 149d7ce991
commit 8f96a1121d
1223 changed files with 65199 additions and 64625 deletions

View File

@@ -1,56 +1,42 @@
<?php
/*
* Copyright (C) 2015 Julien Fastré <julien.fastre@champs-libres.coop>
/**
* Chill is a software for social workers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\DataFixtures\ORM;
use Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option;
use Doctrine\Persistence\ObjectManager;
error_reporting(0);
/**
* Load some Options
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
* Load some Options.
*/
class LoadOption extends AbstractFixture implements OrderedFixtureInterface
{
/**
*
* @var \Faker\Generator
*/
public $fakerFr;
/**
*
* @var \Faker\Generator
*/
public $fakerEn;
/**
*
* @var \Faker\Generator
*/
public $fakerFr;
/**
* @var \Faker\Generator
*/
public $fakerNl;
private $counter = 0;
public function __construct()
{
$this->fakerFr = \Faker\Factory::create('fr_FR');
@@ -72,110 +58,99 @@ class LoadOption extends AbstractFixture implements OrderedFixtureInterface
$this->loadingWords($manager);
$manager->flush();
}
private function loadingWords(\Doctrine\Persistence\ObjectManager $manager)
{
echo "Loading some words...\n";
$parents = array(
array(
'fr' => 'Categorie 1',
'nl' => 'Categorie 1',
'en' => 'Category 1'
),
array(
'fr' => 'Categorie 2',
'nl' => 'Categorie 2',
'en' => 'Category 2'
)
);
foreach ($parents as $text) {
$parent = (new Option())
->setText($text)
->setKey('word')
;
$manager->persist($parent);
//Load children
$expected_nb_children = rand(10, 50);
for ($i=0; $i < $expected_nb_children; $i++) {
$manager->persist($this->createChildOption($parent, array(
'fr' => $this->fakerFr->word,
'nl' => $this->fakerNl->word,
'en' => $this->fakerEn->word
)));
}
}
}
private function loadingCompanies(\Doctrine\Persistence\ObjectManager $manager)
{
echo "Loading companies \n";
$companiesParents = array(
array(
'fr' => 'Grandes Entreprises',
'nl' => 'Grotes Bedrijven',
'en' => 'Big Companies'
),
array(
'fr' => 'Moyennes Entreprises',
'nl' => 'Middelbare Bedrijven',
'en' => 'Middle Companies'
),
array(
'fr' => 'Petites Entreprises',
'nl' => 'Kleine Bedrijven',
'en' => 'Little Companies'
)
);
foreach ($companiesParents as $text) {
$parent = (new Option())
->setText($text)
->setKey('company')
;
$manager->persist($parent);
//Load children
$expected_nb_children = rand(10, 50);
for ($i=0; $i < $expected_nb_children; $i++) {
$companyName = $this->fakerFr->company;
$manager->persist(
$this->createChildOption($parent, array(
'fr' => $companyName,
'nl' => $companyName,
'en' => $companyName
)));
}
}
}
private $counter = 0;
/**
*
* @param Option $parent
* @param array $text
* @return Option
*/
private function createChildOption(Option $parent, array $text)
{
$this->counter ++;
++$this->counter;
return (new Option())
->setText($text)
->setParent($parent)
->setActive(true)
->setInternalKey($parent->getKey().'-'.$this->counter);
;
->setText($text)
->setParent($parent)
->setActive(true)
->setInternalKey($parent->getKey() . '-' . $this->counter);
}
private function loadingCompanies(ObjectManager $manager)
{
echo "Loading companies \n";
$companiesParents = [
[
'fr' => 'Grandes Entreprises',
'nl' => 'Grotes Bedrijven',
'en' => 'Big Companies',
],
[
'fr' => 'Moyennes Entreprises',
'nl' => 'Middelbare Bedrijven',
'en' => 'Middle Companies',
],
[
'fr' => 'Petites Entreprises',
'nl' => 'Kleine Bedrijven',
'en' => 'Little Companies',
],
];
foreach ($companiesParents as $text) {
$parent = (new Option())
->setText($text)
->setKey('company');
$manager->persist($parent);
//Load children
$expected_nb_children = rand(10, 50);
for ($i = 0; $i < $expected_nb_children; ++$i) {
$companyName = $this->fakerFr->company;
$manager->persist(
$this->createChildOption($parent, [
'fr' => $companyName,
'nl' => $companyName,
'en' => $companyName,
])
);
}
}
}
private function loadingWords(ObjectManager $manager)
{
echo "Loading some words...\n";
$parents = [
[
'fr' => 'Categorie 1',
'nl' => 'Categorie 1',
'en' => 'Category 1',
],
[
'fr' => 'Categorie 2',
'nl' => 'Categorie 2',
'en' => 'Category 2',
],
];
foreach ($parents as $text) {
$parent = (new Option())
->setText($text)
->setKey('word');
$manager->persist($parent);
//Load children
$expected_nb_children = rand(10, 50);
for ($i = 0; $i < $expected_nb_children; ++$i) {
$manager->persist($this->createChildOption($parent, [
'fr' => $this->fakerFr->word,
'nl' => $this->fakerNl->word,
'en' => $this->fakerEn->word,
]));
}
}
}
}