function write($file, array $data = NULL)
{
if (!$this->dir) {
return count($this->data[$file] = $data);
}
$fw = \Base::instance();
switch ($this->format) {
case self::FORMAT_JSON:
$out = json_encode($data, @constant('JSON_PRETTY_PRINT'));
break;
case self::FORMAT_Serialized:
$out = $fw->serialize($data);
break;
}
return $fw->write($this->dir . '/' . $file, $out);
}