wizardresult.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * ownCloud – LDAP Wizard Result
  4. *
  5. * @author Arthur Schiwon
  6. * @copyright 2013 Arthur Schiwon blizzz@owncloud.com
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  10. * License as published by the Free Software Foundation; either
  11. * version 3 of the License, or any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public
  19. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. namespace OCA\user_ldap\lib;
  23. class WizardResult {
  24. protected $changes = array();
  25. protected $options = array();
  26. protected $markedChange = false;
  27. public function addChange($key, $value) {
  28. $this->changes[$key] = $value;
  29. }
  30. public function markChange() {
  31. $this->markedChange = true;
  32. }
  33. public function addOptions($key, $values) {
  34. if(!is_array($values)) {
  35. $values = array($values);
  36. }
  37. $this->options[$key] = $values;
  38. }
  39. public function hasChanges() {
  40. return (count($this->changes) > 0 || $this->markedChange);
  41. }
  42. public function getResultArray() {
  43. $result = array();
  44. $result['changes'] = $this->changes;
  45. if(count($this->options) > 0) {
  46. $result['options'] = $this->options;
  47. }
  48. return $result;
  49. }
  50. }