| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Copyright Andreas Heigl <andreas@heigl.org> |
| 5 |
* |
| 6 |
* Licensed under the MIT-license. For details see the included file LICENSE.md |
| 7 |
*/ |
| 8 |
|
| 9 |
declare(strict_types=1); |
| 10 |
|
| 11 |
namespace Org_Heigl\AuthLdap; |
| 12 |
|
| 13 |
use function json_decode; |
| 14 |
|
| 15 |
class OptionFactory |
| 16 |
{ |
| 17 |
public function fromJson(string $json): Options |
| 18 |
{ |
| 19 |
$option = new Options(); |
| 20 |
$content = json_decode($json, true); |
| 21 |
foreach ($content as $key => $value) { |
| 22 |
$option->set($key, $value); |
| 23 |
} |
| 24 |
|
| 25 |
return $option; |
| 26 |
} |
| 27 |
} |
| 28 |
|