: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
protected $file_extension = '.php';
* Equivalent to the constructor but allows for call chaining.
public static function create($view, $data = array()) {
return new self($view, $data);
public function __construct($view, $data = array()) {
$this->path = WORDFENCE_LS_PATH . 'views';
* @throws ViewNotFoundException
public function render() {
$view = preg_replace('/\.{2,}/', '.', $this->view);
$path = $this->path . '/' . $view . $this->file_extension;
if (!file_exists($path)) {
throw new ViewNotFoundException('The view ' . $path . ' does not exist or is not readable.');
extract($this->data, EXTR_SKIP);
/** @noinspection PhpIncludeInspection */
public function __toString() {
catch (ViewNotFoundException $e) {
return defined('WP_DEBUG') && WP_DEBUG ? $e->getMessage() : 'The view could not be loaded.';
public function addData($data) {
$this->data = array_merge($data, $this->data);
public function getData() {
public function setData($data) {
public function getView() {
public function setView($view) {
public function __wakeup() {
$this->path = WORDFENCE_LS_PATH . 'views';
$this->file_extension = '.php';
class ViewNotFoundException extends \Exception { }