Package.php 756 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace Grav\Common\GPM\Common;
  3. use Grav\Common\Data\Data;
  4. class Package {
  5. protected $data;
  6. public function __construct(Data $package, $type = null) {
  7. $this->data = $package;
  8. if ($type) {
  9. $this->data->set('package_type', $type);
  10. }
  11. }
  12. public function getData() {
  13. return $this->data;
  14. }
  15. public function __get($key) {
  16. return $this->data->get($key);
  17. }
  18. public function __isset($key) {
  19. return isset($this->data->$key);
  20. }
  21. public function __toString() {
  22. return $this->toJson();
  23. }
  24. public function toJson() {
  25. return $this->data->toJson();
  26. }
  27. public function toArray() {
  28. return $this->data->toArray();
  29. }
  30. }