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-28 23:28:27 +00:00

85 lines
2.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace Patchouli\Dummy;
use Patchouli\IPackage;
use Patchouli\Version;
class DummyPackage implements IPackage {
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 = [
'id' => $this->getId(),
'name' => $this->getName(),
'version' => $this->getVersion(),
'deps' => [],
/*'null' => null,
'true' => true,
'false' => false,
'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,
'float2' => 8.0,
'floatNeg' => -12345.6789,
'floatPi' => M_PI,
'floatE' => M_E,
'floatLog2E' => M_LOG2E,
'floatLog10E' => M_LOG10E,
'floatLn2' => M_LN2,
'floatLn10' => M_LN10,
'floatPi2' => M_PI_2,
'floatPi4' => M_PI_4,
'floatM1Pi' => M_1_PI,
'floatM2Pi' => M_2_PI,
'floatSqrtPi' => M_SQRTPI,
'float2SqrtPi' => M_2_SQRTPI,
'floatSqrt2' => M_SQRT2,
'floatSqrt3' => M_SQRT3,
'floatSqrt12' => M_SQRT1_2,
'floatLnPi' => M_LNPI,
'floatEuler' => M_EULER,
'floatNaN' => NAN,
'floatInf' => INF,
'floatNegInf' => -INF,
'floatZero' => 0.0,
'floatNegZero' => -0.0,
'invalid' => "\xFF\x25\x25\x02\xFF蠕。蝮鄒守清\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(),
'period' => (new \DateTime())->diff(new \DateTime('2013-01-27 23:14:44 CET')),
'periodNegative' => (new \DateTime('2013-01-27 23:14:44 CET'))->diff(new \DateTime()),
'periodZero' => (new \DateTime())->diff(new \DateTime()),
'array' => ['e', 'a', 0x55],
'object' => new \stdClass,
'misaka' => '御坂 美琴',*/
];
foreach($this->getDependencies() as $dependency)
$data['deps'][] = $dependency->getName();
return $data;
}
}