-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Allow Symfony 7 * An empty commit * Try to fix tests with UriSignerFactory * Fix CS * Drop SensitiveParameter * Move UriSignerFactory into Factory namespace * Drop Psalm dependency - we set it up in the CI * Some minor tweaks + fix psalm issues * Simplify Psalm config * Create uri_signer service from the factory * Add uri_signer service to the tests too * Inject a specific service instead of factory * Fix CS
- Loading branch information
1 parent
9031eca
commit 10a11a6
Showing
11 changed files
with
94 additions
and
24 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
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,41 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the SymfonyCasts VerifyEmailBundle package. | ||
* Copyright (c) SymfonyCasts <https://symfonycasts.com/> | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace SymfonyCasts\Bundle\VerifyEmail\Factory; | ||
|
||
use Symfony\Component\HttpFoundation\UriSigner; | ||
use Symfony\Component\HttpKernel\UriSigner as LegacyUriSigner; | ||
|
||
/** | ||
* @author Victor Bocharsky <[email protected]> | ||
* @author Ryan Weaver <[email protected]> | ||
*/ | ||
class UriSignerFactory | ||
{ | ||
private $secret; | ||
private $parameter; | ||
|
||
public function __construct(string $secret, string $parameter = '_hash') | ||
{ | ||
$this->secret = $secret; | ||
$this->parameter = $parameter; | ||
} | ||
|
||
/** | ||
* @return UriSigner|LegacyUriSigner | ||
*/ | ||
public function createUriSigner(): object | ||
{ | ||
if (class_exists(UriSigner::class)) { | ||
return new UriSigner($this->secret, $this->parameter); | ||
} | ||
|
||
return new LegacyUriSigner($this->secret, $this->parameter); | ||
} | ||
} |
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
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