mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-19 16:21:46 +00:00
29 lines
699 B
PHP
29 lines
699 B
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace Helper;
|
|
|
|
// Check interface exists to fix "Fatal error: Interface 'JsonSerializable' not found in ../tests/PHPCurlClass/User.php
|
|
// on line X".
|
|
if (interface_exists('JsonSerializable')) {
|
|
class User implements \JsonSerializable
|
|
{
|
|
private $name;
|
|
private $email;
|
|
|
|
public function __construct($name = null, $email = null)
|
|
{
|
|
$this->name = $name;
|
|
$this->email = $email;
|
|
}
|
|
|
|
#[\ReturnTypeWillChange]
|
|
public function jsonSerialize()
|
|
{
|
|
return [
|
|
'name' => $this->name,
|
|
'email' => $this->email,
|
|
];
|
|
}
|
|
}
|
|
}
|