123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?php
- /**
- * @package Grav\Common\GPM
- *
- * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
- * @license MIT License; see LICENSE file for details.
- */
- namespace Grav\Common\GPM\Common;
- use Grav\Common\Data\Data;
- /**
- * @property string $name
- */
- class Package
- {
- /** @var Data */
- protected $data;
- /**
- * Package constructor.
- * @param Data $package
- * @param string|null $type
- */
- 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;
- }
- /**
- * @param string $key
- * @return mixed
- */
- #[\ReturnTypeWillChange]
- public function __get($key)
- {
- return $this->data->get($key);
- }
- /**
- * @param string $key
- * @param mixed $value
- * @return void
- */
- #[\ReturnTypeWillChange]
- public function __set($key, $value)
- {
- $this->data->set($key, $value);
- }
- /**
- * @param string $key
- * @return bool
- */
- #[\ReturnTypeWillChange]
- public function __isset($key)
- {
- return isset($this->data->{$key});
- }
- /**
- * @return string
- */
- #[\ReturnTypeWillChange]
- public function __toString()
- {
- return $this->toJson();
- }
- /**
- * @return string
- */
- public function toJson()
- {
- return $this->data->toJson();
- }
- /**
- * @return array
- */
- public function toArray()
- {
- return $this->data->toArray();
- }
- }
|