for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the XabbuhPandaClient package.
*
* (c) Christian Flothmann <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\PandaClient\Api;
/**
* Manages all configured Panda clouds.
* @author Christian Flothmann <[email protected]>
class CloudManager implements CloudManagerInterface
{
* Key to which the default Cloud is being mapped
* @var string
private $defaultCloudKey;
* The Clouds being managed by this CloudManager
* @var CloudInterface[]
private $clouds = array();
* {@inheritDoc}
public function registerCloud($key, CloudInterface $cloud)
$this->clouds[$key] = $cloud;
}
public function hasCloud($key)
return isset($this->clouds[$key]);
public function getCloud($key = null)
if (null === $key) {
$key = $this->defaultCloudKey;
if (!$this->hasCloud($key)) {
throw new \InvalidArgumentException('No cloud for key '.$key.' configured.');
return $this->clouds[$key];
public function setDefaultCloud($key)
$this->defaultCloudKey = $key;
public function getDefaultCloud()
return $this->getCloud($this->defaultCloudKey);
public function getClouds()
return $this->clouds;