generated from rich-id/bundle-template
-
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 #6 from rich-id/signature-generator
Signature generator
- Loading branch information
Showing
43 changed files
with
1,536 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RichId\TermsModuleBundle\Domain\Entity; | ||
|
||
interface TermsUserInterface | ||
{ | ||
public function getTermsDisplayName(): ?string; | ||
|
||
public function getTermsDisplayNameForSort(): ?string; | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RichId\TermsModuleBundle\Domain\Guard; | ||
|
||
use RichId\TermsModuleBundle\Domain\Entity\TermsSubjectInterface; | ||
|
||
class TermsGuardManager | ||
{ | ||
/** @var array<TermsGuardInterface> */ | ||
protected $guards; | ||
|
||
/** @param array<TermsGuardInterface> $guards */ | ||
public function setGuards(array $guards): void | ||
{ | ||
$this->guards = $guards; | ||
} | ||
|
||
public function getGuardFor(string $termsSlug, TermsSubjectInterface $subject): ?TermsGuardInterface | ||
{ | ||
foreach ($this->guards as $guard) { | ||
if ($guard->supports($termsSlug, $subject)) { | ||
return $guard; | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
} |
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,106 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RichId\TermsModuleBundle\Domain\Model; | ||
|
||
use RichId\TermsModuleBundle\Domain\Entity\Terms; | ||
|
||
class SignatureListForm | ||
{ | ||
public const SORT_SIGNATORY = 'signatory'; | ||
public const SORT_DATE = 'date'; | ||
|
||
public const SORT_ASC = 'asc'; | ||
public const SORT_DESC = 'desc'; | ||
|
||
/** @var string|null */ | ||
private $search; | ||
|
||
/** @var Terms|null */ | ||
private $terms; | ||
|
||
/** @var int */ | ||
private $page = 1; | ||
|
||
/** @var int */ | ||
private $numberItemsPerPage = 10; | ||
|
||
/** @var string */ | ||
private $sort = self::SORT_SIGNATORY; | ||
|
||
/** @var string */ | ||
private $sortDirection = self::SORT_DESC; | ||
|
||
public function getSearch(): ?string | ||
{ | ||
return $this->search; | ||
} | ||
|
||
public function setSearch(?string $search): self | ||
{ | ||
$this->search = $search; | ||
|
||
return $this; | ||
} | ||
|
||
public function getTerms(): ?Terms | ||
{ | ||
return $this->terms; | ||
} | ||
|
||
public function setTerms(?Terms $terms): self | ||
{ | ||
$this->terms = $terms; | ||
|
||
return $this; | ||
} | ||
|
||
public function getPage(): int | ||
{ | ||
return $this->page; | ||
} | ||
|
||
public function setPage(int $page): self | ||
{ | ||
$this->page = $page; | ||
|
||
return $this; | ||
} | ||
|
||
public function getNumberItemsPerPage(): int | ||
{ | ||
return $this->numberItemsPerPage; | ||
} | ||
|
||
public function setNumberItemsPerPage(int $numberItemsPerPage): self | ||
{ | ||
$this->numberItemsPerPage = $numberItemsPerPage; | ||
|
||
return $this; | ||
} | ||
|
||
public function getSort(): string | ||
{ | ||
return $this->sort; | ||
} | ||
|
||
public function setSort(string $sort): self | ||
{ | ||
$this->sort = $sort; | ||
|
||
return $this; | ||
} | ||
|
||
public function getSortDirection(): string | ||
{ | ||
return $this->sortDirection; | ||
} | ||
|
||
public function setSortDirection(string $sortDirection): self | ||
{ | ||
$this->sortDirection = $sortDirection; | ||
|
||
return $this; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Domain/Pdf/TermsVersionSignaturePdfGeneratorInterface.php
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,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RichId\TermsModuleBundle\Domain\Pdf; | ||
|
||
use RichId\TermsModuleBundle\Domain\Entity\TermsUserInterface; | ||
use RichId\TermsModuleBundle\Domain\Entity\TermsVersionSignature; | ||
|
||
interface TermsVersionSignaturePdfGeneratorInterface | ||
{ | ||
public function __invoke(TermsVersionSignature $termsVersionSignature, ?TermsUserInterface $editor = null): string; | ||
} |
49 changes: 49 additions & 0 deletions
49
src/Domain/Pdf/TermsVersionSignaturePdfGeneratorManager.php
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,49 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RichId\TermsModuleBundle\Domain\Pdf; | ||
|
||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; | ||
|
||
class TermsVersionSignaturePdfGeneratorManager | ||
{ | ||
/** @var array<TermsVersionSignaturePdfGeneratorInterface> */ | ||
protected $generators; | ||
|
||
/** @var ParameterBagInterface */ | ||
protected $parameterBag; | ||
|
||
public function __construct(ParameterBagInterface $parameterBag) | ||
{ | ||
$this->parameterBag = $parameterBag; | ||
} | ||
|
||
/** @param array<TermsVersionSignaturePdfGeneratorInterface> $generators */ | ||
public function setGenerators(array $generators): void | ||
{ | ||
$this->generators = $generators; | ||
} | ||
|
||
public function hasConfiguredGenerator(): bool | ||
{ | ||
return $this->getConfiguredGenerator() !== null; | ||
} | ||
|
||
public function getConfiguredGenerator(): ?TermsVersionSignaturePdfGeneratorInterface | ||
{ | ||
$selectedGenerator = $this->parameterBag->get('rich_id_terms_module.terms_version_signature_pdf_generator') ?? null; | ||
|
||
if (empty($selectedGenerator)) { | ||
return null; | ||
} | ||
|
||
foreach ($this->generators as $generator) { | ||
if ($selectedGenerator === \get_class($generator)) { | ||
return $generator; | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
} |
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,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RichId\TermsModuleBundle\Domain\Port; | ||
|
||
interface TranslatorInterface | ||
{ | ||
/** @param array<string, string> $parameters */ | ||
public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null): string; | ||
} |
Oops, something went wrong.