for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Core\Test\Services;
/**
* @author Arkadiusz Krakowiak <[email protected]>
class SharedStorage implements SharedStorageInterface
{
* @var array
private $clipboard = [];
* @var string|null
private $latestKey = null;
* {@inheritdoc}
public function get($key)
if (!isset($this->clipboard[$key])) {
throw new \InvalidArgumentException(sprintf('There is no current resource for "%s"!', $key));
}
return $this->clipboard[$key];
public function set($key, $resource)
$this->clipboard[$key] = $resource;
$this->latestKey = $key;
public function getLatestResource()
if (!isset($this->clipboard[$this->latestKey])) {
throw new \InvalidArgumentException(sprintf('There is no latest resource!', $this->latestKey));
return $this->clipboard[$this->latestKey];
public function setClipboard(array $clipboard)
$this->clipboard = $clipboard;