Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
5 / 5
CRAP
100.00% covered (success)
100.00%
9 / 9
Marking
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
5 / 5
6
100.00% covered (success)
100.00%
9 / 9
 __construct
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
3 / 3
 mark
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 unmark
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 has
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getPlaces
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
<?php
/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Symfony\Component\Workflow;
/**
 * Marking contains the place of every tokens.
 *
 * @author GrĂ©goire Pineau <lyrixx@lyrixx.info>
 */
class Marking
{
    private $places = [];
    /**
     * @param int[] $representation Keys are the place name and values should be 1
     */
    public function __construct(array $representation = [])
    {
        foreach ($representation as $place => $nbToken) {
            $this->mark($place);
        }
    }
    public function mark(string $place)
    {
        $this->places[$place] = 1;
    }
    public function unmark(string $place)
    {
        unset($this->places[$place]);
    }
    public function has(string $place)
    {
        return isset($this->places[$place]);
    }
    public function getPlaces()
    {
        return $this->places;
    }
}