This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/Workflow/Marking.php

53 lines
1.0 KiB
PHP
Raw Normal View History

2016-03-25 15:43:30 +00:00
<?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
{
2019-01-16 09:39:14 +00:00
private $places = [];
2016-03-25 15:43:30 +00:00
/**
* @param int[] $representation Keys are the place name and values should be 1
2016-03-25 15:43:30 +00:00
*/
2019-01-16 09:39:14 +00:00
public function __construct(array $representation = [])
2016-03-25 15:43:30 +00:00
{
foreach ($representation as $place => $nbToken) {
$this->mark($place);
}
}
public function mark($place)
{
$this->places[$place] = 1;
}
public function unmark($place)
{
unset($this->places[$place]);
}
public function has($place)
{
return isset($this->places[$place]);
}
public function getPlaces()
{
return $this->places;
}
}