Mecha CMS

Deep learning on using the API.

Class State

Author: Taufik Nurrohman · 96 Views

Tweet

Get states data.

Table of Content

Call Static 

$x = State::{$name}();

Load lot\state\config.php file:

$config = State::config();

Result:

echo $config['title']; // key `title` does exist, return the `title` value
echo $config['xyz']; // key `xyz` does not exist, broken!

Constructor 

$state = new State($x);

Convert $config array into safe object:

$config = new State($config);

Result:

echo $config->title; // key `title` does exist, return the `title` value
echo $config->xyz; // key `xyz` does not exist, return `null`