56 lines
1.5 KiB
PHP
56 lines
1.5 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,
|
|
'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();
|
|
}
|
|
}
|