function findMacroFile($tagName)
 {
     $tagName = normalizeTagName($tagName);
     $filename = $tagName . $this->matisseSettings->macrosExt();
     foreach ($this->matisseSettings->getMacrosDirectories() as $dir) {
         $path = "{$dir}/{$filename}";
         if (file_exists($path)) {
             return $path;
         }
     }
     throw new FileIOException($filename);
 }
 /**
  * DocumentContext constructor.
  *
  * @param AssetsService        $assetsService
  * @param BlocksService        $blocksService
  * @param MacrosService        $macrosService
  * @param DataBinderInterface  $dataBinder
  * @param InjectorInterface    $injector
  * @param MatisseSettings      $matisseSettings
  * @param ViewServiceInterface $viewService
  */
 function __construct(AssetsService $assetsService, BlocksService $blocksService, MacrosService $macrosService, DataBinderInterface $dataBinder, InjectorInterface $injector, MatisseSettings $matisseSettings, ViewServiceInterface $viewService)
 {
     $this->tags = self::$coreTags;
     $this->dataBinder = $dataBinder;
     $this->assetsService = $assetsService;
     $this->blocksService = $blocksService;
     $this->macrosService = $macrosService;
     $this->injector = $injector;
     $this->viewService = $viewService;
     $this->matisseSettings = $matisseSettings;
     $this->presets = map($matisseSettings->getPresets(), function ($class) {
         return $this->injector->make($class);
     });
     $matisseSettings->initContext($this);
 }
 protected function afterRender()
 {
     parent::afterRender();
     //----------------------------------------------------------------------------------------
     // View Model panel
     // (MUST run before the DOM panel to capture the data-binding stack at its current state)
     //----------------------------------------------------------------------------------------
     DebugConsole::registerPanel('view', new ConsoleLogger('View', 'fa fa-eye'));
     $VMFilter = function ($k, $v, $o) {
         if ($v instanceof DocumentContext || $v instanceof Component || $k === 'parent' || $k === 'model') {
             return '...';
         }
         return true;
     };
     $expMap = Expression::$inspectionMap;
     ksort($expMap);
     DebugConsole::logger('view')->withFilter($VMFilter, $this->context)->write('<#section|Compiled expressions>')->inspect($expMap)->write('</#section>');
     //------------
     // Model panel
     //------------
     DebugConsole::registerPanel('model', new ConsoleLogger('Model', 'fa fa-table'));
     $shadowDOM = $this->getShadowDOM();
     if ($shadowDOM) {
         $VMFilter = function ($k, $v, $o) {
             if ($v instanceof KernelSettings || $v instanceof NavigationInterface || $v instanceof NavigationLinkInterface || $v instanceof SessionInterface || $v instanceof ServerRequestInterface || $v instanceof DocumentContext || $v instanceof Component) {
                 return '...';
             }
             return true;
         };
         $binder = $shadowDOM->getDataBinder();
         DebugConsole::logger('model')->write('<#i>PAGE DATA BINDER: ' . Debug::getType($binder) . "</#i>")->write("<#section|PAGE VIEW MODEL>")->withFilter($VMFilter, $binder->getViewModel())->write("</#section>");
     }
     //-----------
     // DOM panel
     //-----------
     if ($this->matisseSettings->inspectDOM()) {
         DebugConsole::registerPanel('DOM', new ConsoleLogger('Server-side DOM', 'fa fa-sitemap'));
         $insp = $this->inspect(true);
         DebugConsole::logger('DOM')->write($insp);
     }
 }