private function AddSchemaSingleton(Php\Writer $writer, $schemaClass) { $writer->StartDocComment(); $writer->AddDocComment($schemaClass, 'var'); $writer->EndDocComment(); $writer->AddCommand('private static $singleton'); $writer->StartDocComment(); $writer->AddDocComment('Get unique ' . $schemaClass . '.'); $writer->AddDocComment($schemaClass, 'return'); $writer->EndDocComment(); $writer->StartFunction('static function Singleton'); $writer->Start_If('self::$singleton === null'); $writer->AddCommand('self::$singleton = new self()'); $writer->End_If(); $writer->AddCommand('return self::$singleton'); $writer->EndFunction(); }