for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types = 1);
/*
* This file is part of the statemachine package
*
* (c) Michal Wachowski <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace StateMachine;
/**
* Container for additional attributes
* @package StateMachine
final class Attributes
{
private $attributes;
* Constructor
* @param array $attributes
public function __construct(array $attributes = [])
$this->attributes = $attributes;
}
* Check if attribute exists
* @param string $name
* @return bool
public function exists($name)
return array_key_exists($name, $this->attributes);
* Get attribute
* @param mixed $default
* @return mixed
public function get($name, $default = null)
if (!$this->exists($name)) {
return $default;
return $this->attributes[$name];