design-patterns/src/Pattern/Structural/Adapter/JsonReport.php
2025-07-03 23:46:08 +03:00

47 lines
999 B
PHP

<?php
/**
* @package: patterns
* @author: Yevhen Odynets
* @date: 2025-07-03
* @time: 21:59
*/
declare(strict_types = 1);
namespace Pattern\Structural\Adapter;
use JsonException;
class JsonReport
{
/**
* @throws JsonException
*/
public function buildJson(): string
{
return json_encode([
[
'name' => 'Mikrotik RB4011iGS+RM',
'price' => 9094,
'count' => 27,
],
[
'name' => 'Cisco ISR4331-VSEC/K9',
'price' => 167955,
'count' => 8,
],
[
'name' => 'TP-Link ER605 (TL-R605)',
'price' => 2499,
'count' => 895,
],
[
'name' => 'D-Link DSL-2500U/BRU/D',
'price' => 420,
'count' => 112,
],
], JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
}
}