bencagri /
symfony4-ddd
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | namespace App\Authorization\Console; |
||||||
| 4 | |||||||
| 5 | use FOS\OAuthServerBundle\Entity\ClientManager; |
||||||
| 6 | use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
||||||
| 7 | use Symfony\Component\Console\Input\InputInterface; |
||||||
| 8 | use Symfony\Component\Console\Input\InputOption; |
||||||
| 9 | use Symfony\Component\Console\Output\OutputInterface; |
||||||
| 10 | class ClientCreateCommand extends ContainerAwareCommand |
||||||
|
0 ignored issues
–
show
Deprecated Code
introduced
by
Loading history...
|
|||||||
| 11 | |||||||
| 12 | { |
||||||
| 13 | |||||||
| 14 | /** |
||||||
| 15 | * @var ClientManager |
||||||
| 16 | */ |
||||||
| 17 | private $clientManager; |
||||||
| 18 | |||||||
| 19 | protected function configure() |
||||||
| 20 | { |
||||||
| 21 | |||||||
| 22 | $this |
||||||
| 23 | ->setName('oauth:client:create') |
||||||
| 24 | ->setDescription('Creates a new client') |
||||||
| 25 | ->addOption('redirect-uri', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_OPTIONAL, 'Sets the redirect uri. Use multiple times to set multiple uris.', []) |
||||||
| 26 | ->addOption('grant-type', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_OPTIONAL, 'Set allowed grant type. Use multiple times to set multiple grant types', 'client_credentials') |
||||||
| 27 | ; |
||||||
| 28 | } |
||||||
| 29 | protected function execute(InputInterface $input, OutputInterface $output) |
||||||
| 30 | { |
||||||
| 31 | |||||||
| 32 | $this->clientManager = $this->getContainer()->get('fos_oauth_server.client_manager.default'); ; |
||||||
| 33 | $client = $this->clientManager->createClient(); |
||||||
|
0 ignored issues
–
show
The method
createClient() does not exist on null.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||||
| 34 | $client->setRedirectUris($input->getOption('redirect-uri')); |
||||||
| 35 | $client->setAllowedGrantTypes([$input->getOption('grant-type')]); |
||||||
| 36 | $this->clientManager->updateClient($client); |
||||||
| 37 | $output->writeln(sprintf('Added a new client with public id <info>%s</info>.', $client->getPublicId())); |
||||||
| 38 | } |
||||||
| 39 | } |