WpsProcess.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. class Type_WpsProcess {
  3. var $_data = [];
  4. // Type_WpsProcessOutput: [ 'MimeType' => text/xml, 'Encoding' => base64, 'Schema' => http://foo.bar/gml/3.1.0/polygon.xsd ]
  5. // supportedOutput: [ Type_WpsProcessOutput, ... ]
  6. // [ 'MimeType' => "text/xml; subtype=wfs-collection/1.0" ],
  7. // [ 'MimeType' => "text/xml; subtype=wfs-collection/1.1" ],
  8. // [ 'MimeType' => "application/json" ],
  9. // [ 'MimeType' => "application/wfs-collection-1.0" ],
  10. // [ 'MimeType' => "application/wfs-collection-1.1" ],
  11. // [ 'MimeType' => "application/zip" ],
  12. static function build($conf) { // @return Type_WpsProcess
  13. $wpsProcess = new Type_WpsProcess();
  14. $wpsProcess->identifier = $conf['identifier'];
  15. $wpsProcess->title = $conf['title'];
  16. $wpsProcess->description = $conf['description'];
  17. $wpsProcess->maxOccurs = $conf['maxOccurs'];
  18. $wpsProcess->minOccurs = $conf['minOccurs'];
  19. $wpsProcess->dataInputs = array_map(function ($input) {
  20. // 'identifier' => $identifier,
  21. // 'title' => $title,
  22. // 'description' => $description,
  23. // 'type' => 'literal',
  24. return (object)$input;
  25. }, $conf['dataInputs']);
  26. $wpsProcess->defaultOutput = $conf['defaultOutput'];
  27. $wpsProcess->supportedOutput = $conf['supportedOutput'];
  28. return $wpsProcess;
  29. }
  30. function __isset($name) {
  31. return (array_key_exists($name, $this->_data));
  32. }
  33. function __get($name) {
  34. if (array_key_exists($name, $this->_data)) {
  35. return $this->_data[$name];
  36. }
  37. return null;
  38. }
  39. function __set($name, $value) {
  40. $this->_data[$name] = $value;
  41. }
  42. function toArray() {
  43. return $this->_data;
  44. }
  45. function __toString() {
  46. return str_replace('"', '',
  47. str_replace([ '{', '}', '":', ',"' ], [ '{ ', ' }', ': ', ', ' ], json_encode($this->_data))
  48. );
  49. }
  50. }