Skip to content

Commit 7bb0f4e

Browse files
committed
Added isConnected
1 parent 5ef49c7 commit 7bb0f4e

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

src/Connection/Connection.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/**
1818
* Abstract an FTP connection class implementations.
1919
*
20-
* @since 1.2.4
20+
* @since 1.2.5
2121
* @author El Amrani Chakir <[email protected]>
2222
*/
2323
abstract class Connection implements ConnectionInterface
@@ -46,6 +46,9 @@ abstract class Connection implements ConnectionInterface
4646
/** @var bool */
4747
protected $isSecure;
4848

49+
/** @var bool */
50+
protected $isConnected;
51+
4952
/**
5053
* Prepares an FTP connection.
5154
*
@@ -143,6 +146,14 @@ public function isSecure()
143146
return $this->isSecure;
144147
}
145148

149+
/**
150+
* @inheritDoc
151+
*/
152+
public function isConnected()
153+
{
154+
return $this->isConnected;
155+
}
156+
146157
/**
147158
* @inheritDoc
148159
*/

src/Connection/ConnectionInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,9 @@ public function getPassword();
6767
* @return bool
6868
*/
6969
public function isSecure();
70+
71+
/**
72+
* @return bool
73+
*/
74+
public function isConnected();
7075
}

src/Connection/FtpConnection.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ protected function connect()
3333
?: "FTP connection failed to remote server.");
3434
}
3535

36-
$this->isSecure = false;
36+
$this->isConnected = true;
37+
$this->isSecure = false;
3738

3839
$this->wrapper->setConnection($this);
3940

src/Connection/FtpSSLConnection.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ protected function connect()
5050
?: "SSL connection failed to the FTP server.");
5151
}
5252

53-
$this->isSecure = true;
53+
$this->isConnected = true;
54+
$this->isSecure = true;
5455

5556
$this->wrapper->setConnection($this);
5657

0 commit comments

Comments
 (0)