M1\Vars\Vars::__construct PHP Method

__construct() public method

Creates a new instance of Vars
public __construct ( string | array $resource, array $options = [] )
$resource string | array The main configuration resource
$options array The options being used for Vars
    public function __construct($resource, $options = array())
    {
        $options = $this->parseOptions($options);
        $this->makeCache($options, $resource);
        $this->makePaths($options);
        if (!$this->cache->checkCache()) {
            $this->makeLoader($options);
            $this->makeVariables($options);
            $resource = new ResourceProvider($this, $resource);
        }
        if ($this->cache->isHit()) {
            $this->loadFromCache();
        } else {
            $resource->mergeParentContent();
            $this->content = $this->mergeGlobals($resource->getContent(), $options);
            $this->cache->setTime(time());
            $this->cache->makeCache($this);
        }
    }