@@ -83,7 +83,10 @@ public function __construct(array $config = [])
83
83
}
84
84
85
85
$ this ->setObjectName ();
86
- $ this ->login ();
86
+
87
+ if ((\array_key_exists ('autologin ' , $ this ->config ) === false ) || $ this ->config ['autologin ' ]) {
88
+ $ this ->login ();
89
+ }
87
90
}
88
91
89
92
/**
@@ -111,11 +114,11 @@ public static function env2conf(): array
111
114
public function logBanner ($ additions = null )
112
115
{
113
116
return $ this ->addStatusMessage (
114
- 'API ' . str_replace (
117
+ 'API ' . str_replace (
115
118
':// ' ,
116
- ':// ' . $ this ->config ['login ' ]. '@ ' ,
119
+ ':// ' . $ this ->config ['login ' ] . '@ ' ,
117
120
$ this ->config ['uri ' ],
118
- ). ' php-subreg v ' . self ::$ libVersion. ' ' . $ additions ,
121
+ ) . ' php-subreg v ' . self ::$ libVersion . ' ' . $ additions ,
119
122
'debug ' ,
120
123
);
121
124
}
@@ -156,7 +159,7 @@ public function call(string $command, array $params = [])
156
159
$ this ->logError ($ responseRaw ['error ' ]);
157
160
$ this ->lastResult = ['error ' => $ responseRaw ['error ' ]];
158
161
159
- break ;
162
+ throw new \ RuntimeException ( $ responseRaw [ ' error ' ][ ' errormsg ' ], ( int ) $ responseRaw [ ' error ' ][ ' errorcode ' ][ ' major ' ]) ;
160
163
}
161
164
}
162
165
@@ -172,7 +175,7 @@ public function logError(array $errorData): void
172
175
{
173
176
$ this ->lastError = $ errorData ;
174
177
$ this ->addStatusMessage (
175
- $ errorData ['errorcode ' ]['major ' ]. ' ' . $ errorData ['errorcode ' ]['minor ' ]. ': ' . $ errorData ['errormsg ' ],
178
+ $ errorData ['errorcode ' ]['major ' ] . ' ' . $ errorData ['errorcode ' ]['minor ' ] . ': ' . $ errorData ['errormsg ' ],
176
179
'error ' ,
177
180
);
178
181
}
@@ -194,7 +197,7 @@ public function login()
194
197
if (\array_key_exists ('ssid ' , $ loginResponse )) {
195
198
$ this ->token = $ loginResponse ['ssid ' ];
196
199
$ result = true ;
197
- $ this ->setObjectName ($ params ['login ' ]. '@ ' . $ this ->getObjectName ());
200
+ $ this ->setObjectName ($ params ['login ' ] . '@ ' . $ this ->getObjectName ());
198
201
}
199
202
200
203
return $ result ;
0 commit comments