/** @test */ public function TestStackedAreaFileFinding() { $surface = new Nether\Surface(); $this->AssertTrue($surface->GetArea('testing-also:index') === 'this is the index page also'); $this->AssertTrue($surface->GetArea('testing-also:about') === 'this is the about page also'); return; }
protected function RenderHtmlVersion() : self { $Printer = NULL; $Printer = function (Nether\Senpai\Struct $Struct, int $Level = 1) use(&$Printer) { $File = sprintf('%s%s%s', $this->GetConfig()->GetOutputDir(), DIRECTORY_SEPARATOR, $Struct->GetAbsolutePath($Struct->GetRenderFilename('html'))); $Dir = dirname($File); //////// if (!is_dir($Dir)) { @mkdir($Dir, 0777, TRUE); } touch($File); echo "Writing {$File}", PHP_EOL; //////// $Surface = new Nether\Surface(['AutoStash' => FALSE, 'AutoRender' => FALSE, 'AutoCapture' => FALSE, 'ThemeRoot' => sprintf('%s%sthemes', dirname(__FILE__, 4), DIRECTORY_SEPARATOR)]); $Surface->Start(); $Surface->Set('Level', $Level); $Surface->Set('Root', $this->Root); //////// if ($Struct instanceof NamespaceObject) { $Surface->Set('Namespace', $Struct); echo $Surface->GetArea('code/namespace'); } elseif ($Struct instanceof ClassObject) { $Surface->Set('Class', $Struct); echo $Surface->GetArea('code/class'); } //////// file_put_contents($File, $Surface->Render(TRUE)); unset($Surface); //////// if ($Struct instanceof NamespaceObject) { foreach ($Struct->GetNamespaces()->GetData() as $Struck) { $Printer($Struck, $Level + 1); } foreach ($Struct->GetClasses()->GetData() as $Struck) { $Printer($Struck, $Level); } } //////// return; }; $Printer($this->Root); return $this; }