_memoryLimit = $memoryLimit; $this->_activationPolicy = $activationPolicy; } /** * Display memory usage statistics */ public function displayStats() { echo $this->_memoryLimit->printHeader() . $this->_memoryLimit->printStats() . PHP_EOL; } /** * Activate displaying of the memory usage statistics */ public function activateStatsDisplaying() { call_user_func($this->_activationPolicy, [$this, 'displayStats']); } /** * Activate validation of the memory usage/leak limitations */ public function activateLimitValidation() { call_user_func($this->_activationPolicy, [$this->_memoryLimit, 'validateUsage']); } }