/** * A mocked object will have a random name, that won't match the regex expression in the parent. * To prevent exceptions, we have to manually set the name * * @return string */ public function getName() { if (isset($this->methods['getName'])) { if ($this->methods['getName'] == 'parent') { return parent::getName(); } $func = $this->methods['getName']; return call_user_func_array($func, array()); } return $this->name; }
/** * Creates a view template finder object for a specific View * * The default configuration is: * Look for .php, .blade.php files; default layout "default"; no default subtemplate; * look only for the specified view; do NOT fall back to the default layout or subtemplate; * look for templates ONLY in site or admin, depending on where we're running from * * @param View $view The view this view template finder will be attached to * @param array $config Configuration variables for the object * * @return mixed */ public function viewFinder(View $view, array $config = array()) { // Initialise the configuration with the default values $defaultConfig = array('extensions' => array('.php', '.blade.php'), 'defaultLayout' => 'default', 'defaultTpl' => '', 'strictView' => true, 'strictTpl' => true, 'strictLayout' => true, 'sidePrefix' => 'auto'); $config = array_merge($defaultConfig, $config); // Apply fof.xml overrides $appConfig = $this->container->appConfig; $key = "views." . ucfirst($view->getName()) . ".config"; $fofXmlConfig = array('extensions' => $appConfig->get("{$key}.templateExtensions", $config['extensions']), 'strictView' => $appConfig->get("{$key}.templateStrictView", $config['strictView']), 'strictTpl' => $appConfig->get("{$key}.templateStrictTpl", $config['strictTpl']), 'strictLayout' => $appConfig->get("{$key}.templateStrictLayout", $config['strictLayout']), 'sidePrefix' => $appConfig->get("{$key}.templateLocation", $config['sidePrefix'])); $config = array_merge($config, $fofXmlConfig); // Create the new view template finder object return new ViewTemplateFinder($view, $config); }