/** * @param array $config * @return Proxy */ public static function getInstance(array $config = []) { $proxy = new self($config); if (isset($config['getter'])) { $getter = $config['getter']; if (!is_callable($getter)) { throw new InvalidProxyGetterException('getter must be a callable'); } $realProxy = $getter(); if (!$realProxy) { throw new NotAvailableProxyException(); } $proxy->bindProxy($realProxy); } return $proxy; }