1
0
mirror of https://github.com/php/phd.git synced 2026-04-28 17:33:09 +02:00
Files
archived-phd/phpdotnet/phd/TestGenericChunkedXHTML.php
T
haszi 15284136ff Separate regular PhD output from error handling (#176)
- Move error handling code into a class and remove PhD message output handling from it.
- Introduce a new class to handle PhD message output.
- Make the implicit dependency on the output functionality of classes explicit.
- Update PEAR package.xml.
- Fix tests.
- Use proper variadic parameters
- Use class constants
- Use first-class callable syntax

---------

Co-authored-by: haszi <haszika80@gmail.com>
2024-11-10 17:57:05 +00:00

42 lines
1.1 KiB
PHP

<?php
namespace phpdotnet\phd;
class TestGenericChunkedXHTML extends Package_Generic_ChunkedXHTML {
public function __construct(
Config $config,
OutputHandler $outputHandler
) {
parent::__construct($config, $outputHandler);
}
public function update($event, $value = null) {
switch($event) {
case Render::CHUNK:
parent::update($event, $value);
break;
case Render::STANDALONE:
parent::update($event, $value);
break;
case Render::INIT:
$this->setOutputDir($this->config->output_dir() . strtolower($this->getFormatName()) . '/');
break;
//No verbose
}
}
public function writeChunk($id, $fp) {
$filename = $this->getOutputDir() . $id . $this->getExt();
rewind($fp);
$content = "\n";
$content .= stream_get_contents($fp);
if ($id === "") {
$filename = $this->config->xml_file();
}
echo "Filename: " . basename($filename) . "\n";
echo "Content:" . $content . "\n";
}
}