public appendCallback ( callable $callback ) : boolean | ||
$callback | callable | |
리턴 | boolean |
public function appendCallback(callable $callback)
{
// @codeCoverageIgnoreStart
if (!$this->enabled) {
return false;
}
// @codeCoverageIgnoreEnd
if (!$this->inloop) {
return false;
}
$data = ob_get_contents();
ob_clean();
$this->loopdata[$this->inloop]->appendData($data);
$this->loopdata[$this->inloop]->appendCallback($callback);
return true;
}
protected function _startcallback(CacheAbstract $cache) { $key = new CacheKey("startcallback", 1); $cache->clean($key); $this->assertFalse($cache->start($key)); echo "something "; $this->assertTrue($cache->appendCallback('callbackTesterStart')); echo " otherthing"; $output = $cache->end(false); $this->assertContains(CALLBACKVALUE, $output); // run again, we should have another value $second = $cache->start($key, null, false); $this->assertNotFalse($second); $this->assertContains(CALLBACKVALUE, $second); $this->assertNotEquals($second, $output); }