-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #383 from itk-dev/release/1.5.3
Release 1.5.3
- Loading branch information
Showing
6 changed files
with
113 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
namespace App\Command; | ||
|
||
use App\Service\SF1601\DigitalPoster; | ||
use Symfony\Component\Console\Attribute\AsCommand; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
#[AsCommand( | ||
name: 'tvist1:digital-post:debug', | ||
description: 'Add a short description for your command', | ||
)] | ||
class DigitalPostDebugCommand extends Command | ||
{ | ||
public function __construct( | ||
readonly private DigitalPoster $digitalPoster | ||
) { | ||
parent::__construct(null); | ||
} | ||
|
||
protected function configure(): void | ||
{ | ||
$this->addArgument('action', InputArgument::REQUIRED, 'The action'); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$action = $input->getArgument('action'); | ||
|
||
switch ($action) { | ||
case 'getSAMLToken': | ||
case 'fetchSAMLToken': | ||
$sf1601 = $this->invoke($this->digitalPoster, 'getSF1601'); | ||
$entityId = 'http://entityid.kombit.dk/service/kombipostafsend/1'; | ||
$samlToken = $this->invoke($sf1601, $action, [$entityId]); | ||
|
||
$output->write(json_encode($samlToken)); | ||
|
||
return Command::SUCCESS; | ||
} | ||
} | ||
|
||
/** | ||
* Invoke method on an object. | ||
*/ | ||
private function invoke(object $object, string $method, array $args = []): mixed | ||
{ | ||
$method = new \ReflectionMethod($object, $method); | ||
$method->setAccessible(true); | ||
|
||
return $method->invoke($object, ...$args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters