public function writeTo($outputFunction) { if (Nife_Util::isEchoFunction($outputFunction)) { call_user_func($this->outputtable); } else { call_user_func($outputFunction, $this->__toString()); } }
public function testEchoOutputFunction() { $collector = new Nife_Collector(); $echoer = Nife_Util::getEchoFunction(); $blob = new Nife_FooBarBazBlob(); $this->assertTrue(Nife_Util::isEchoFunction($echoer)); $this->assertFalse(Nife_Util::isEchoFunction($collector)); $blob->writeTo($collector); $this->assertEquals("FooBarBaz", (string) $collector); ob_start(); $blob->writeTo($echoer); $echoed = ob_get_contents(); ob_end_clean(); $this->assertEquals("FooBarBaz", $echoed); }