xprt64/cqrs-es

View on GitHub
src/Dudulina/Command/CommandWithMetadata.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php
/**
 * Copyright (c) 2017 Constantin Galbenu <xprt64@gmail.com>
 */

namespace Dudulina\Command;


use Dudulina\Command;

class CommandWithMetadata
{

    /**
     * @var Command
     */
    private $command;

    /** @var array|null */
    private $metadata;

    public function __construct(
        Command $command,
        $metadata = null
    ) {
        $this->command = $command;
        $this->metadata = $metadata;
    }

    public function getCommand(): Command
    {
        return $this->command;
    }

    public function getMetadata()
    {
        return $this->metadata;
    }

    public function getAggregateId()
    {
        return $this->getCommand()->getAggregateId();
    }
}