, , . . - . , ,
class Foo
{
public function doSomething()
{
if (ENV === ENV_DEV) {
} else {
}
}
}
doSomething, , . , , , .
, ,
public function log($message)
{
fwrite(LOGFILE, $message);
}
, - ,
define('LOGFILE', fopen('/path/to/logfile'));
, ENV. , , - . , . , , , -, , , , . , LOGFILE . .
, . , , , , , , .
, . , . , .
, - , . , , , . API.
Value, :
class Environment
{
private $value;
public function __construct($value)
{
$this->assertValueIsAllowedValue($value);
$this->value = $value;
}
public function getValue() {
, , , , , . , YMMV. . , , , .
: