-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
83 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
namespace Packaged\Context; | ||
|
||
interface Condition | ||
{ | ||
public function isSatisfied(Context $ctx); | ||
} |
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,55 @@ | ||
<?php | ||
namespace Packaged\Context\Conditions; | ||
|
||
use Packaged\Context\Condition; | ||
use Packaged\Context\Context; | ||
|
||
class ExpectEnvironment implements Condition | ||
{ | ||
protected $_environment; | ||
|
||
public function __construct($environment) | ||
{ | ||
$this->_environment = $environment; | ||
} | ||
|
||
public static function phpunit() | ||
{ | ||
return new static(Context::ENV_PHPUNIT); | ||
} | ||
|
||
public static function local() | ||
{ | ||
return new static(Context::ENV_LOCAL); | ||
} | ||
|
||
public static function dev() | ||
{ | ||
return new static(Context::ENV_DEV); | ||
} | ||
|
||
public static function qa() | ||
{ | ||
return new static(Context::ENV_QA); | ||
} | ||
|
||
public static function uat() | ||
{ | ||
return new static(Context::ENV_UAT); | ||
} | ||
|
||
public static function stage() | ||
{ | ||
return new static(Context::ENV_STAGE); | ||
} | ||
|
||
public static function prod() | ||
{ | ||
return new static(Context::ENV_PROD); | ||
} | ||
|
||
public function isSatisfied(Context $ctx) | ||
{ | ||
return $ctx->getEnvironment() == $this->_environment; | ||
} | ||
} |
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