Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backward compatibility layer for Symfony 4.3
- Loading branch information
1 parent
034f688
commit 7b59842
Showing
4 changed files
with
73 additions
and
20 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/SensioLabs/Connect/Security/Authentication/Token/AbstractConnectToken.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,27 @@ | ||
<?php | ||
|
||
namespace SensioLabs\Connect\Security\Authentication\Token; | ||
|
||
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken; | ||
|
||
if (method_exists(AbstractToken::class, '__serialize')) { | ||
abstract class AbstractConnectToken extends AbstractToken | ||
{ | ||
use SerializationConnectTokenTrait; | ||
} | ||
} else { | ||
abstract class AbstractConnectToken extends AbstractToken | ||
{ | ||
public function serialize() | ||
{ | ||
return serialize(array($this->apiUser, $this->accessToken, $this->providerKey, $this->scope, parent::serialize())); | ||
} | ||
|
||
public function unserialize($str) | ||
{ | ||
list($this->apiUser, $this->accessToken, $this->providerKey, $this->scope, $parentStr) = unserialize($str); | ||
|
||
parent::unserialize($parentStr); | ||
} | ||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
src/SensioLabs/Connect/Security/Authentication/Token/SerializationConnectTokenTrait.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,17 @@ | ||
<?php | ||
|
||
namespace SensioLabs\Connect\Security\Authentication\Token; | ||
|
||
trait SerializationConnectTokenTrait | ||
{ | ||
public function __serialize(): array | ||
{ | ||
return array($this->apiUser, $this->accessToken, $this->providerKey, $this->scope, parent::__serialize()); | ||
} | ||
|
||
public function __unserialize(array $data): void | ||
{ | ||
list($this->apiUser, $this->accessToken, $this->providerKey, $this->scope) = $data; | ||
parent::__serialize($data); | ||
} | ||
} |
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