EditPollCommand.php 620 Bytes
<?php

namespace FootyRoom\App\Poll;

use FootyRoom\App\Command;

class EditPollCommand extends Command
{
    /**
     * Consturctor.
     *
     * @param array $data
     */
    public function __construct(array $data = [])
    {
        if (is_array($data['choices'])) {
            foreach ($data['choices'] as $choice) {
                $this->choices[] = new Choice($choice);
            }

            unset($data['choices']);
        }

        parent::__construct($data);
    }

    /**
     * @var int
     */
    public $pollId;

    /**
     * @var \FootyRoom\App\Poll\Choice[]
     */
    public $choices;
}