Reference.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace YahnisElsts\PluginUpdateChecker\v5p0\Vcs;
  3. if ( !class_exists(Reference::class, false) ):
  4. /**
  5. * This class represents a VCS branch or tag. It's intended as a read only, short-lived container
  6. * that only exists to provide a limited degree of type checking.
  7. *
  8. * @property string $name
  9. * @property string|null version
  10. * @property string $downloadUrl
  11. * @property string $updated
  12. *
  13. * @property string|null $changelog
  14. * @property int|null $downloadCount
  15. */
  16. class Reference {
  17. private $properties = array();
  18. public function __construct($properties = array()) {
  19. $this->properties = $properties;
  20. }
  21. /**
  22. * @param string $name
  23. * @return mixed|null
  24. */
  25. public function __get($name) {
  26. return array_key_exists($name, $this->properties) ? $this->properties[$name] : null;
  27. }
  28. /**
  29. * @param string $name
  30. * @param mixed $value
  31. */
  32. public function __set($name, $value) {
  33. $this->properties[$name] = $value;
  34. }
  35. /**
  36. * @param string $name
  37. * @return bool
  38. */
  39. public function __isset($name) {
  40. return isset($this->properties[$name]);
  41. }
  42. }
  43. endif;