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,40 +1,56 @@
<?php
/*
/**
* Chill is a software for social workers
*
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* 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\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* CustomFieldGroup
* CustomFieldGroup.
*
* @ORM\Entity()
* @ORM\Entity
* @ORM\Table(name="customfieldsgroup")
*/
class CustomFieldsGroup
{
/**
* @var integer
* The custom fields of the group that are active.
* This variable if null, if this informations has not been computed.
*
* @var array|null
*/
private $activeCustomFields;
/**
* The custom fields of the group.
* The custom fields are asc-ordered regarding to their property "ordering".
*
* @var Collection
*
* @ORM\OneToMany(
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomField",
* mappedBy="customFieldGroup")
* @ORM\OrderBy({"ordering": "ASC"})
*/
private $customFields;
/**
* @var string
*
* @ORM\Column(type="string", length=255)
*/
private $entity;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
@@ -49,41 +65,12 @@ class CustomFieldsGroup
*/
private $name;
/**
* @var string
*
* @ORM\Column(type="string", length=255)
*/
private $entity;
/**
* The custom fields of the group.
* The custom fields are asc-ordered regarding to their property "ordering".
*
* @var Collection $customFields
*
* @ORM\OneToMany(
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomField",
* mappedBy="customFieldGroup")
* @ORM\OrderBy({"ordering" = "ASC"})
*/
private $customFields;
/**
* The custom fields of the group that are active.
* This variable if null, if this informations has not been computed.
*
* @var array|null
*/
private $activeCustomFields = null;
/**
* @var array
*
* @ORM\Column(type="json")
*/
private $options = array();
private $options = [];
/**
* CustomFieldsGroup constructor.
@@ -94,9 +81,8 @@ class CustomFieldsGroup
}
/**
* Add customField
* Add customField.
*
* @param CustomField $customField
* @return CustomFieldsGroup
*/
public function addCustomField(CustomField $customField)
@@ -107,34 +93,17 @@ class CustomFieldsGroup
}
/**
* Remove customField
*
* @param CustomField $customField
*/
public function removeCustomField(CustomField $customField)
{
$this->customFields->removeElement($customField);
}
/**
* @return Collection
*/
public function getCustomFields()
{
return $this->customFields;
}
/**
* Get all the custom
* Get all the custom.
*
* @return Collection
*/
public function getActiveCustomFields()
{
if($this->activeCustomFields === null) {
$this->activeCustomFields = array();
if (null === $this->activeCustomFields) {
$this->activeCustomFields = [];
foreach ($this->customFields as $cf) {
if($cf->isActive()) {
if ($cf->isActive()) {
array_push($this->activeCustomFields, $cf);
}
}
@@ -144,9 +113,27 @@ class CustomFieldsGroup
}
/**
* Get id
* @return Collection
*/
public function getCustomFields()
{
return $this->customFields;
}
/**
* Get entity.
*
* @return integer
* @return string
*/
public function getEntity()
{
return $this->entity;
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
@@ -154,48 +141,55 @@ class CustomFieldsGroup
}
/**
* Set name
* Get name.
*
* @param array $name
* @return CustomFieldsGroup
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
* @param mixed|null $language
*
* @return array
*/
public function getName($language = null)
{
//TODO set this in a service, PLUS twig function
if ($language) {
if (isset($this->name[$language])) {
return $this->name[$language];
} else {
foreach ($this->name as $name) {
//TODO set this in a service, PLUS twig function
if ($language) {
if (isset($this->name[$language])) {
return $this->name[$language];
}
foreach ($this->name as $name) {
if (!empty($name)) {
return $name;
return $name;
}
}
}
}
return '';
return '';
}
} else {
return $this->name;
}
return $this->name;
}
/**
* Set entity
* get options array.
*
* @return array
*/
public function getOptions()
{
return $this->options;
}
/**
* Remove customField.
*/
public function removeCustomField(CustomField $customField)
{
$this->customFields->removeElement($customField);
}
/**
* Set entity.
*
* @param string $entity
*
* @return CustomFieldsGroup
*/
public function setEntity($entity)
@@ -206,34 +200,28 @@ class CustomFieldsGroup
}
/**
* Get entity
* Set name.
*
* @return string
* @param array $name
*
* @return CustomFieldsGroup
*/
public function getEntity()
public function setName($name)
{
return $this->entity;
$this->name = $name;
return $this;
}
/**
* get options array
* set options array.
*
* @return array
*/
public function getOptions()
{
return $this->options;
}
/**
* set options array
*
* @param array $options
* @return CustomFieldsGroup
*/
public function setOptions(array $options)
{
$this->options = $options;
return $this;
}
}