/**
* Public constructor. The config array can contain the following keys
* extensions array
* defaultLayout string
* defaultTpl string
* strictView bool
* strictTpl bool
* strictLayout bool
* sidePrefix string
* For the descriptions of each key please see the same-named property of this class
*
* @param View $view The view we are attached to
* @param array $config The configuration for this view template finder
*/
function __construct(View $view, array $config = array())
{
$this->view = $view;
$this->container = $view->getContainer();
if (isset($config['extensions'])) {
if (!is_array($config['extensions'])) {
$config['extensions'] = trim($config['extensions']);
$config['extensions'] = explode(',', $config['extensions']);
$config['extensions'] = array_map(function ($x) {
return trim($x);
}, $config['extensions']);
}
$this->setExtensions($config['extensions']);
}
if (isset($config['defaultLayout'])) {
$this->setDefaultLayout($config['defaultLayout']);
}
if (isset($config['defaultTpl'])) {
$this->setDefaultTpl($config['defaultTpl']);
}
if (isset($config['strictView'])) {
$config['strictView'] = in_array($config['strictView'], array(true, 'true', 'yes', 'on', 1));
$this->setStrictView($config['strictView']);
}
if (isset($config['strictTpl'])) {
$config['strictTpl'] = in_array($config['strictTpl'], array(true, 'true', 'yes', 'on', 1));
$this->setStrictTpl($config['strictTpl']);
}
if (isset($config['strictLayout'])) {
$config['strictLayout'] = in_array($config['strictLayout'], array(true, 'true', 'yes', 'on', 1));
$this->setStrictLayout($config['strictLayout']);
}
if (isset($config['sidePrefix'])) {
$this->setSidePrefix($config['sidePrefix']);
}
}