mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-28 10:40:17 +02:00
18 lines
330 B
PHP
18 lines
330 B
PHP
<?php
|
|
|
|
namespace DesignPatterns\Creational\AbstractFactory;
|
|
|
|
class WinJsonWriter implements JsonWriter
|
|
{
|
|
public function write(array $data, bool $formatted): string
|
|
{
|
|
$options = 0;
|
|
|
|
if ($formatted) {
|
|
$options = JSON_PRETTY_PRINT;
|
|
}
|
|
|
|
return json_encode($data, $options);
|
|
}
|
|
}
|