Skip to content

Commit a064414

Browse files
committed
Check if a requested account exist before returning or merging the account config
1 parent 3ea650c commit a064414

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/ClientManager.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ public static function get(string $key, $default = null) {
105105
public function account(string $name = null): Client {
106106
$name = $name ?: $this->getDefaultAccount();
107107

108-
// If the connection has not been resolved yet we will resolve it now as all
109-
// of the connections are resolved when they are actually needed so we do
108+
// If the connection has not been resolved we will resolve it now as all
109+
// the connections are resolved when they are actually needed, so we do
110110
// not make any unnecessary connection to the various queue end-points.
111111
if (!isset($this->accounts[$name])) {
112112
$this->accounts[$name] = $this->resolve($name);
@@ -139,7 +139,7 @@ protected function getClientConfig($name): array {
139139
return ['driver' => 'null'];
140140
}
141141

142-
return self::$config["accounts"][$name];
142+
return is_array(self::$config["accounts"][$name]) ? self::$config["accounts"][$name] : [];
143143
}
144144

145145
/**
@@ -187,7 +187,7 @@ public function setConfig($config): ClientManager {
187187

188188
if(is_array($config)){
189189
if(isset($config['default'])){
190-
if(isset($config['accounts']) && $config['default'] != false){
190+
if(isset($config['accounts']) && $config['default']){
191191

192192
$default_config = $vendor_config['accounts']['default'];
193193
if(isset($config['accounts'][$config['default']])){

0 commit comments

Comments
 (0)