fix(continuous-integration): correction php-cs-fixer
All checks were successful
Cadoles/nineskeletor/pipeline/pr-master This commit looks good

This commit is contained in:
2022-09-23 16:14:15 +02:00
parent 5f3cc51f5c
commit b78f54b76c
70 changed files with 5943 additions and 5549 deletions

View File

@ -1,17 +1,15 @@
<?php
namespace App\Command;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Filesystem\Filesystem;
use Cadoles\CoreBundle\Entity\User;
class SetPasswordCommand extends Command
{
private $container;
@ -20,7 +18,7 @@ class SetPasswordCommand extends Command
private $filesystem;
private $rootlog;
public function __construct(ContainerInterface $container,EntityManagerInterface $em)
public function __construct(ContainerInterface $container, EntityManagerInterface $em)
{
parent::__construct();
$this->container = $container;
@ -33,21 +31,19 @@ class SetPasswordCommand extends Command
->setName('app:SetPassword')
->setDescription("Modifier le password d'un utilisateur")
->setHelp("Modifier le password d'un utilisateur")
->addArgument('username', InputArgument::OPTIONAL, 'username')
->addArgument('username', InputArgument::OPTIONAL, 'username')
->addArgument('password', InputArgument::OPTIONAL, 'password')
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->output = $output;
$this->filesystem = new Filesystem();
$this->rootlog = $this->container->get('kernel')->getLogDir()."/";
$this->output = $output;
$this->filesystem = new Filesystem();
$this->rootlog = $this->container->get('kernel')->getLogDir().'/';
$this->writelnred('');
$this->writelnred('== app:SetPasword');
$this->writelnred('== app:SetPasword');
$this->writelnred('==========================================================================================================');
$username = $input->getArgument('username');
@ -56,28 +52,31 @@ class SetPasswordCommand extends Command
$password = $input->getArgument('password');
$this->writeln($password);
$user = $this->em->getRepository('App\Entity\User')->findOneBy(array('username' => $username));
if($user) {
$user = $this->em->getRepository('App\Entity\User')->findOneBy(['username' => $username]);
if ($user) {
// Set Password
$user->setPassword($password);
$this->em->persist($user);
$this->em->flush();
$this->em->flush();
}
$this->writeln('');
return Command::SUCCESS;
}
private function writelnred($string) {
private function writelnred($string)
{
$this->output->writeln('<fg=red>'.$string.'</>');
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
}
private function writeln($string) {
if(!$string) $string=" ";
private function writeln($string)
{
if (!$string) {
$string = ' ';
}
$this->output->writeln($string);
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
}
}
}