Example #1
0
 private function getEmptyService($name)
 {
     $sb = new StringBuilder();
     $sb->append("import BaseSvc from 'Scripts/Base/BaseSvc.js';");
     $sb->appendLine();
     $sb->appendLine();
     $sb->appendFormat("class %sSvc extends BaseSvc", $name);
     $sb->appendLine();
     $sb->append("{");
     $sb->appendLine()->appendTab()->append("constructor(http){");
     $sb->appendLine()->appendTab2()->append("super(http);");
     $sb->appendLine()->appendTab2()->append("this.http= http;");
     $sb->appendLine()->appendTab()->append("}");
     $sb->appendLine();
     $cname = ucfirst($name);
     $sb->appendTab()->appendFormat("static %sFactory(http)", $cname);
     $sb->appendTab()->append("{");
     $sb->appendLine();
     $sb->appendTab2()->appendFormat("return new %sSvc(http);", $name);
     $sb->appendLine()->appendTab()->append("}");
     $sb->appendLine()->append("}");
     $sb->appendLine()->appendFormat("%sSvc.%sFactory.\$inject=['\$http'];", $name, $cname);
     $sb->appendLine()->appendFormat("export default %sSvc.%sFactory;", $name, $cname);
     return $sb->toString();
 }