wi-events/classes/Jsonfile.php

40 lines
773 B
PHP

<?php
namespace Zoomyboy\Event\Classes;
use Cms\Classes\CmsCompoundObject;
use File;
/**
* The CMS content file class.
*
* @author Alexey Bobkov, Samuel Georges
*/
class Jsonfile extends CmsCompoundObject
{
/**
* @var string the container name associated with the model, eg: pages
*/
protected $dirName = 'json';
/**
* @var array allowable file extensions
*/
protected $allowedExtensions = ['json'];
/**
* @var array list of attribute names which are not considered "settings"
*/
protected $purgeable = [];
public function markup(): array
{
return json_decode($this->content, true);
}
public function getVar(string $var)
{
return array_get($this->markup(), $var);
}
}