You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wizardresult.php 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. /**
  34. * @param string $key
  35. * @param array|string $values
  36. */
  37. public function addOptions($key, $values) {
  38. if(!is_array($values)) {
  39. $values = array($values);
  40. }
  41. $this->options[$key] = $values;
  42. }
  43. public function hasChanges() {
  44. return (count($this->changes) > 0 || $this->markedChange);
  45. }
  46. public function getResultArray() {
  47. $result = array();
  48. $result['changes'] = $this->changes;
  49. if(count($this->options) > 0) {
  50. $result['options'] = $this->options;
  51. }
  52. return $result;
  53. }
  54. }