public static function getInstance() { // проверяем актуальность экземпляра if (null === self::$_instance) { // создаем новый экземпляр self::$_instance = new self(); } // возвращаем созданный или существующий экземпляр return self::$_instance; }
/** * Add data to response output. * If JSON mode is on, array data will be attached to output-array * If JSON mode is off, data will be flatten, and attached as string to output * * @param mixed $data * @return void */ public static function add($data) { if (self::$outJson and is_array($data)) { self::$data = self::$data + $data; } else { if (is_array($data)) { $data = implode('', array_values($data)); } self::$data .= $data; } }