<?php
namespace Fifa\ConnectId\Sdk\Registration\Event\Handler;

use Fifa\ConnectId\Sdk\Model\PersonDetails;
use Fifa\ConnectId\Sdk\Storage\PersonDetailsStorageInterface;

/**
 * Class DefaultPersonDetailsReceivedHandler
 * @package Fifa\ConnectId\Sdk\Registration\Event\Handler
 */
class DefaultPersonDetailsReceivedHandler implements EventHandlerInterface
{
    /**
     * @var PersonDetailsStorageInterface
     */
    private $storage;

    /**
     * Constructor
     *
     * @param PersonDetailsStorageInterface $storage
     */
    public function __construct(PersonDetailsStorageInterface $storage)
    {
        $this->storage = $storage;
    }

    /**
     * Code that will be executed when Event will be raised
     *
     * @param PersonDetails $personDetails
     */
    public function execute($personDetails)
    {
        $this->storage->put($personDetails);
    }
}