@@ -94,7 +94,7 @@ private function __construct(array $config)
9494 {
9595 $ this ->validateConfiguration ($ config );
9696 $ this ->config = $ this ->normalizeConfiguration ($ config );
97- $ this ->use_passive_mode = (bool )($ this ->config [self ::CONFIG_PASSIVE ] ?? self ::DEFAULT_PASSIVE );
97+ $ this ->use_passive_mode = (bool ) ($ this ->config [self ::CONFIG_PASSIVE ] ?? self ::DEFAULT_PASSIVE );
9898
9999 $ this ->connect ();
100100 }
@@ -147,9 +147,9 @@ public function connect(): void
147147 }
148148
149149 $ host = $ this ->config [self ::CONFIG_HOSTNAME ];
150- $ port = (int )$ this ->config [self ::CONFIG_PORT ];
151- $ timeout = (int )$ this ->config [self ::CONFIG_TIMEOUT ];
152- $ use_tls = (bool )$ this ->config [self ::CONFIG_TLS ];
150+ $ port = (int ) $ this ->config [self ::CONFIG_PORT ];
151+ $ timeout = (int ) $ this ->config [self ::CONFIG_TIMEOUT ];
152+ $ use_tls = (bool ) $ this ->config [self ::CONFIG_TLS ];
153153
154154 $ connection = $ this ->attemptConnection ($ host , $ port , $ timeout , $ use_tls );
155155
@@ -171,7 +171,6 @@ public function connect(): void
171171 $ this ->login ();
172172 $ this ->changePath ();
173173 $ this ->activePassiveMode ();
174- $ this ->is_connected = true ;
175174 } catch (RuntimeException $ e ) {
176175 $ this ->disconnect ();
177176 throw $ e ;
@@ -251,7 +250,6 @@ public function disconnect(): void
251250 {
252251 if ($ this ->connection !== null ) {
253252 @ftp_close ($ this ->connection );
254- $ this ->is_connected = false ;
255253 }
256254 }
257255
@@ -283,7 +281,7 @@ public function changePath(?string $path = null): void
283281 */
284282 private function ensureConnection (): void
285283 {
286- if (! $ this -> is_connected || $ this ->connection === null ) {
284+ if ($ this ->connection === null ) {
287285 throw new RuntimeException ('FTP connection is not established ' );
288286 }
289287 }
0 commit comments