1: <?php
2: 3: 4:
5: class QRestServiceCodeGen extends QCodeGen {
6:
7: protected $strServiceUrl;
8:
9: public function __construct($objSettingsXml) {
10: parent::__construct($objSettingsXml);
11:
12: $this->strServiceUrl = QCodeGen::LookupSetting($objSettingsXml, null, 'serviceUrl');
13: }
14:
15: public function GetTitle() {
16: return sprintf('REST Service (%s)', $this->strServiceUrl);
17: }
18:
19: public function GetConfigXml() {
20: $strCrLf = "\r\n";
21: $strToReturn = sprintf(' <restService url="%s">%s', $this->strServiceUrl, $strCrLf);
22: $strToReturn .= sprintf(' </restService>%s', $strCrLf);
23: return $strToReturn;
24: }
25:
26: public function GetReportLabel() {
27: return 'There were 2 REST Services available to attempt code generation:';
28: }
29:
30: public function GenerateAll() {
31: $strReport = '';
32: $strReport .= "Successfully generated REST Service Class: TestBlahservice\r\n";
33: return $strReport;
34: }
35:
36:
37:
38:
39:
40:
41: 42: 43: 44: 45: 46: 47:
48: public function __get($strName) {
49: switch ($strName) {
50: case 'ServiceUrl':
51: return $this->strServiceUrl;
52: default:
53: try {
54: return parent::__get($strName);
55: } catch (QCallerException $objExc) {
56: $objExc->IncrementOffset();
57: throw $objExc;
58: }
59: }
60: }
61:
62: public function __set($strName, $mixValue) {
63: try {
64: switch($strName) {
65: default:
66: return parent::__set($strName, $mixValue);
67: }
68: } catch (QCallerException $objExc) {
69: $objExc->IncrementOffset();
70: }
71: }
72: }