the-matrix/finite-state-machine

View on GitHub
src/StateMachine/Transitions.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php
/**
 * Finite State Machine
 *
 * @author    Ashley Kitson
 * @copyright Ashley Kitson, 2019, UK
 * @license   BSD 3 Clause See LICENSE.md
 */
namespace Chippyash\StateMachine;

use Monad\Map;

/**
 * A Map of Transition
 */
class Transitions extends Map
{
    public function __construct(array $value = [])
    {
        $transitionNames = array_map(
            function(Transition $transition) {return $transition->getName();},
            $value
        );
        parent::__construct(array_combine($transitionNames, $value), Transition::class);
    }
}