for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* WebHemi.
*
* PHP version 7.1
* @copyright 2012 - 2017 Gixx-web (http://www.gixx-web.com)
* @license https://opensource.org/licenses/MIT The MIT License (MIT)
* @link http://www.gixx-web.com
*/
declare(strict_types = 1);
namespace WebHemi\Data\Connector;
use InvalidArgumentException;
use WebHemi\Data\ConnectorInterface;
use WebHemi\Data\MultiConnectorContainerInterface;
* Class MultiConnectorContainer
class MultiConnectorContainer implements MultiConnectorContainerInterface
{
/** @var array */
private $connectors = [];
* MultiConnectorInterface constructor.
* @param ConnectorInterface[] ...$connectorInterfaces
public function __construct(ConnectorInterface ...$connectorInterfaces)
/** @var ConnectorInterface $connector */
foreach ($connectorInterfaces as $connector) {
$this->connectors[$connector->getConnectorName()] = $connector;
getConnectorName
$connector
array<integer,object<Web...ta\ConnectorInterface>>
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.
}
* Returns a Connector instance by name.
* @param string $name
* @throws InvalidArgumentException
* @return ConnectorInterface
public function getConnectorByName(string $name) : ConnectorInterface
if (!isset($this->connectors[$name])) {
throw new InvalidArgumentException(
sprintf('% is not a registered connector name.', $name),
1000
);
return clone $this->connectors[$name];
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.