12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- /**
- * @package Grav\Common\GPM
- *
- * @copyright Copyright (C) 2015 - 2019 Trilby Media, LLC. All rights reserved.
- * @license MIT License; see LICENSE file for details.
- */
- namespace Grav\Common\GPM\Common;
- use Grav\Common\Data\Data;
- class Package
- {
- /**
- * @var Data
- */
- protected $data;
- public function __construct(Data $package, $type = null)
- {
- $this->data = $package;
- if ($type) {
- $this->data->set('package_type', $type);
- }
- }
- /**
- * @return Data
- */
- public function getData()
- {
- return $this->data;
- }
- public function __get($key)
- {
- return $this->data->get($key);
- }
- public function __set($key, $value)
- {
- return $this->data->set($key, $value);
- }
- public function __isset($key)
- {
- return isset($this->data->{$key});
- }
- public function __toString()
- {
- return $this->toJson();
- }
- public function toJson()
- {
- return $this->data->toJson();
- }
- /**
- * @return array
- */
- public function toArray()
- {
- return $this->data->toArray();
- }
- }
|