Env
in package
A global environment repository.
In old code, use this instead of global variables - allows central tracking of dependencies. Do NOT use this in new code, inject dependencies instead. Example: WRONG: public function __construct() { $this->entityManager = Env::get('em'); } RIGHT: public function __construct($em) { $this->entityManager = $em; } Reason: Global state is untestable and leads to inflexible code.
Tags
Table of Contents
Properties
Methods
Properties
$em
protected
static mixed
$em
$props
protected
static mixed
$props
= array()
Methods
clear()
Clear the value of a prop
public
static clear(mixed $prop) : void
Parameters
- $prop : mixed
-
indexname we want to unset
Tags
get()
public
static get(mixed $prop) : mixed
Parameters
- $prop : mixed
set()
public
static set(mixed $prop, mixed &$val) : mixed
Parameters
- $prop : mixed
- $val : mixed