mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-10 21:19:30 +00:00
Applied symplify rules to codebase.
This commit is contained in:
parent
2f20d90041
commit
388e847b17
136 changed files with 1370 additions and 789 deletions
|
|
@ -34,6 +34,8 @@ use App\Entity\Parts\Storelocation;
|
|||
use App\Entity\Parts\Supplier;
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
use App\Entity\UserSystem\User;
|
||||
use function get_class;
|
||||
use function is_object;
|
||||
|
||||
class StructureVoter extends ExtendedVoter
|
||||
{
|
||||
|
|
@ -47,7 +49,7 @@ class StructureVoter extends ExtendedVoter
|
|||
*/
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
if (\is_object($subject)) {
|
||||
if (is_object($subject)) {
|
||||
$permission_name = $this->instanceToPermissionName($subject);
|
||||
//If permission name is null, then the subject is not supported
|
||||
return (null !== $permission_name) && $this->resolver->isValidOperation($permission_name, $attribute);
|
||||
|
|
@ -63,7 +65,7 @@ class StructureVoter extends ExtendedVoter
|
|||
*/
|
||||
protected function instanceToPermissionName($subject): ?string
|
||||
{
|
||||
$class_name = \get_class($subject);
|
||||
$class_name = get_class($subject);
|
||||
switch ($class_name) {
|
||||
case AttachmentType::class:
|
||||
return 'attachment_types';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue