This repository has been archived on 2023-10-21. You can view files and clone it, but cannot push or open issues or pull requests.
patchouli/src/Dummy/DummyPackage.php
2020-12-24 03:25:10 +00:00

60 lines
1.7 KiB
PHP

<?php
namespace Patchouli\Dummy;
use Patchouli\IPackage;
use Patchouli\Version;
class DummyPackage implements IPackage, \JsonSerializable {
public function getId(): string {
return 'package-id';
}
public function getName(): string {
return 'Human Readable Name';
}
public function getVersion(): Version {
return new Version;
}
public function getDependencies(): array {
return [];
}
public function fwifSerialize(): array {
$data = [
'null' => null,
'zero' => 0,
'u8' => 0x42,
'u16' => 0x4344,
'u24' => 0x454647,
'u32' => 0x58596061,
'u40' => 0x6263646566,
'u48' => 0x676869707172,
'u56' => 0x73747576777879,
'u64' => 0x7481828384858687,
'neg32' => -12345678,
'neg64' => -1234567890987654,
'float' => 12345.6789,
'invalid' => "\xFF\x25\x25\x02\xFF御坂e美琴\xFF\xFF\xFF",
'datetime' => new \DateTime('2013-01-27 23:14:44 CET'),
'datetimeNegative' => new \DateTime('-2013-01-27 23:14:44 CET'),
'datetimeNow' => new \DateTime(),
'array' => ['e', 'a', 0x55],
'object' => new \stdClass,
'misaka' => '御坂 美琴',
'id' => $this->getId(),
'name' => $this->getName(),
'version' => $this->getVersion(),
'deps' => [],
];
foreach($this->getDependencies() as $dependency)
$data['deps'][] = $dependency->getName();
return $data;
}
public function jsonSerialize() {
return $this->fwifSerialize();
}
}