![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/dvdoug/boxpacker/tests/Test/ |
<?php /** * Box packing (3D bin packing, knapsack problem). * * @author Doug Wright */ declare(strict_types=1); namespace DVDoug\BoxPacker\Test; use DVDoug\BoxPacker\Item; use JsonSerializable; use ReturnTypeWillChange; use stdClass; class TestItem implements Item, JsonSerializable { /** * @var string */ private $description; /** * @var int */ private $width; /** * @var int */ private $length; /** * @var int */ private $depth; /** * @var int */ private $weight; /** * @var int */ private $keepFlat; /** * Test objects that recurse. * * @var stdClass */ private $a; /** * Test objects that recurse. * * @var stdClass */ private $b; /** * TestItem constructor. */ public function __construct( string $description, int $width, int $length, int $depth, int $weight, int $allowedRotation ) { $this->description = $description; $this->width = $width; $this->length = $length; $this->depth = $depth; $this->weight = $weight; $this->keepFlat = $allowedRotation <= 2; $this->a = new stdClass(); $this->b = new stdClass(); $this->a->b = $this->b; $this->b->a = $this->a; } public function getDescription(): string { return $this->description; } public function getWidth(): int { return $this->width; } public function getLength(): int { return $this->length; } public function getDepth(): int { return $this->depth; } public function getWeight(): int { return $this->weight; } public function getKeepFlat(): bool { return $this->keepFlat; } #[ReturnTypeWillChange] public function jsonSerialize()/* : mixed */ { return [ 'description' => $this->description, 'width' => $this->width, 'length' => $this->length, 'depth' => $this->depth, 'weight' => $this->weight, 'keepFlat' => $this->keepFlat, ]; } }