-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow for service providers to be added multiple times by giving them…
… a signature
- Loading branch information
1 parent
76deb40
commit aae4af9
Showing
7 changed files
with
75 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace League\Container\ServiceProvider; | ||
|
||
abstract class AbstractSignatureServiceProvider | ||
extends AbstractServiceProvider | ||
implements SignatureServiceProviderInterface | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $signature; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function withSignature($signature) | ||
{ | ||
$this->signature = $signature; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getSignature() | ||
{ | ||
return (is_null($this->signature)) ? get_class($this) : $this->signature; | ||
} | ||
} |
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 was deleted.
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,26 @@ | ||
<?php | ||
|
||
namespace League\Container\ServiceProvider; | ||
|
||
use League\Container\ContainerAwareInterface; | ||
|
||
interface SignatureServiceProviderInterface | ||
{ | ||
/** | ||
* Set a custom signature for the service provider. This enables | ||
* registering the same service provider multiple times. | ||
* | ||
* @param string $signature | ||
* @return self | ||
*/ | ||
public function withSignature($signature); | ||
|
||
/** | ||
* The signature of the service provider uniquely identifies it, so | ||
* that we can quickly determine if it has already been registered. | ||
* Defaults to get_class($provider). | ||
* | ||
* @return string | ||
*/ | ||
public function getSignature(); | ||
} |
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