Internal: Fix coding standards

pull/3466/head
Julio Montoya 5 years ago
parent c6cfcb0c50
commit 1d6d940bb7
  1. 31
      ecs.php
  2. 46
      src/CoreBundle/Component/Editor/Connector.php
  3. 6
      src/CoreBundle/Entity/Listener/ResourceListener.php
  4. 4
      src/CoreBundle/Entity/ResourceFile.php
  5. 10
      src/CoreBundle/Security/Authorization/Voter/CourseVoter.php
  6. 20
      src/CoreBundle/Security/Authorization/Voter/GroupVoter.php
  7. 8
      src/CoreBundle/Security/Authorization/Voter/SessionVoter.php
  8. 8
      src/CoreBundle/Security/Encoder.php
  9. 6
      src/CoreBundle/Security/LoginFormAuthenticator.php

@ -8,18 +8,43 @@
declare(strict_types=1);
use PhpCsFixer\Fixer\Operator\IncrementStyleFixer;
use SlevomatCodingStandard\Sniffs\Variables\UnusedVariableSniff;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\Configuration\Option;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::SETS, [
$parameters->set(
Option::SETS,
[
SetList::CLEAN_CODE,
SetList::SYMFONY,
//SetList::SYMFONY_RISKY,
]);
]
);
$parameters->set(
Option::PATHS,
[
__DIR__.'/src',
]
);
$parameters->set(
Option::EXCLUDE_PATHS,
[
__DIR__.'/src/CourseBundle/Component/*',
]
);
// use $a++ instead of ++$a
$parameters->set(Option::SKIP, [IncrementStyleFixer::class => 'post']);
$parameters->set(
Option::SKIP,
[
IncrementStyleFixer::class => 'post',
//UnusedVariableSniff::class . '.ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach' => true,
UnusedVariableSniff::class => 'ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach',
]
);
};

@ -329,52 +329,6 @@ class Connector
*/
public function manageCommands($cmd, $result, $args, $elFinder)
{
$cmd = ucfirst($cmd);
$cmd = 'after'.$cmd;
/*
if (isset($args['target'])) {
$driverName = $elFinder->getVolumeDriverNameByTarget($args['target']);
}
if (isset($args['targets'])) {
foreach ($args['targets'] as $target) {
$driverName = $elFinder->getVolumeDriverNameByTarget($target);
break;
}
}
*/
if (empty($driverName)) {
return false;
}
if (!empty($result['error'])) {
}
if (!empty($result['warning'])) {
}
if (!empty($result['removed'])) {
foreach ($result['removed'] as $file) {
/** @var Driver $driver */
// $driver = $this->getDriver($driverName);
// $driver->$cmd($file, $args, $elFinder);
// removed file contain additional field "realpath"
//$log .= "\tREMOVED: ".$file['realpath']."\n";
}
}
if (!empty($result['added'])) {
foreach ($result['added'] as $file) {
// $driver = $this->getDriver($driverName);
// $driver->$cmd($file, $args, $elFinder);
}
}
if (!empty($result['changed'])) {
foreach ($result['changed'] as $file) {
//$log .= "\tCHANGED: ".$elfinder->realpath($file['hash'])."\n";
}
}
}
/**

@ -298,11 +298,11 @@ class ResourceListener
$extension = $this->slugify->slugify(pathinfo($resourceName, PATHINFO_EXTENSION));
if (empty($extension)) {
$slug = $this->slugify->slugify($resourceName);
//$slug = $this->slugify->slugify($resourceName);
} else {
$originalExtension = pathinfo($resourceName, PATHINFO_EXTENSION);
/*$originalExtension = pathinfo($resourceName, PATHINFO_EXTENSION);
$originalBasename = \basename($resourceName, $originalExtension);
$slug = sprintf('%s.%s', $this->slugify->slugify($originalBasename), $originalExtension);
$slug = sprintf('%s.%s', $this->slugify->slugify($originalBasename), $originalExtension);*/
}
//error_log($resourceName); error_log($slug);
$resourceNode

@ -5,7 +5,6 @@
namespace Chamilo\CoreBundle\Entity;
use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
@ -139,7 +138,6 @@ class ResourceFile
* @var string
*
* @ORM\Column(name="crop", type="string", length=255, nullable=true)
*
*/
protected $crop;
@ -158,7 +156,7 @@ class ResourceFile
protected $metadata;
/**
* @var boolean
* @var bool
*
* @Groups({"resource_file:read", "resource_node:read", "document:read"})
*/

@ -22,17 +22,17 @@ class CourseVoter extends Voter
public const EDIT = 'EDIT';
public const DELETE = 'DELETE';
private $entityManager;
private $courseManager;
//private $entityManager;
//private $courseManager;
private $security;
public function __construct(
EntityManagerInterface $entityManager,
CourseRepository $courseManager,
// CourseRepository $courseManager,
Security $security
) {
$this->entityManager = $entityManager;
$this->courseManager = $courseManager;
//$this->entityManager = $entityManager;
//$this->courseManager = $courseManager;
$this->security = $security;
}

@ -22,20 +22,20 @@ class GroupVoter extends Voter
public const EDIT = 'EDIT';
public const DELETE = 'DELETE';
private $entityManager;
private $courseManager;
private $groupManager;
//private $entityManager;
//private $courseManager;
//private $groupManager;
private $security;
public function __construct(
EntityManager $entityManager,
CourseRepository $courseManager,
CGroupRepository $groupManager,
//EntityManager $entityManager,
//CourseRepository $courseManager,
//CGroupRepository $groupManager,
Security $security
) {
$this->entityManager = $entityManager;
$this->courseManager = $courseManager;
$this->groupManager = $groupManager;
//$this->entityManager = $entityManager;
//$this->courseManager = $courseManager;
//$this->groupManager = $groupManager;
$this->security = $security;
}
@ -80,7 +80,7 @@ class GroupVoter extends Voter
/** @var CGroup $group */
$group = $subject;
$groupInfo = [
'id' => $group->getIid(),
'iid' => $group->getIid(),
'session_id' => 0,
'status' => $group->getStatus(),
];

@ -23,19 +23,19 @@ class SessionVoter extends Voter
public const EDIT = 'EDIT';
public const DELETE = 'DELETE';
private $entityManager;
private $courseManager;
//private $entityManager;
//private $courseManager;
private $security;
private $settingsManager;
public function __construct(
EntityManagerInterface $entityManager,
CourseRepository $courseManager,
//CourseRepository $courseManager,
Security $security,
SettingsManager $settingsManager
) {
$this->entityManager = $entityManager;
$this->courseManager = $courseManager;
//$this->courseManager = $courseManager;
$this->security = $security;
$this->settingsManager = $settingsManager;
}

@ -14,12 +14,12 @@ use Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder;
*/
class Encoder extends BasePasswordEncoder
{
private $passwordEncrypt;
//private $passwordEncrypt;
public function __construct(string $passwordEncrypt)
public function __construct()
{
$passwordEncrypt = str_replace("'", '', trim($passwordEncrypt));
$this->passwordEncrypt = $passwordEncrypt;
/*$passwordEncrypt = str_replace("'", '', trim($passwordEncrypt));
$this->passwordEncrypt = $passwordEncrypt;*/
}
/**

@ -41,7 +41,7 @@ class LoginFormAuthenticator extends AbstractFormLoginAuthenticator implements P
//private $router;
private $passwordEncoder;
//private $formFactory;
private $hookFactory;
// private $hookFactory;
private $userRepository;
//private $csrfTokenManager;
private $urlGenerator;
@ -55,7 +55,7 @@ class LoginFormAuthenticator extends AbstractFormLoginAuthenticator implements P
RouterInterface $router,
UserPasswordEncoderInterface $passwordEncoder,
//FormFactoryInterface $formFactory,
HookFactory $hookFactory,
//HookFactory $hookFactory,
UserRepository $userRepository,
CsrfTokenManagerInterface $csrfTokenManager,
SerializerInterface $serializer
@ -63,7 +63,7 @@ class LoginFormAuthenticator extends AbstractFormLoginAuthenticator implements P
$this->router = $router;
$this->passwordEncoder = $passwordEncoder;
//$this->formFactory = $formFactory;
$this->hookFactory = $hookFactory;
//$this->hookFactory = $hookFactory;
$this->userRepository = $userRepository;
//$this->csrfTokenManager = $csrfTokenManager;
//$this->entityManager = $entityManager;

Loading…
Cancel
Save