From 13b462e079b881f866b0afbb08eee0f06966db38 Mon Sep 17 00:00:00 2001 From: Clivern Date: Wed, 9 Aug 2017 18:57:49 +0200 Subject: [PATCH] stats class added --- src/Core/Connection.php | 10 ++++++++++ src/Core/Stats.php | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 src/Core/Stats.php diff --git a/src/Core/Connection.php b/src/Core/Connection.php index 2659b3e..ee5bc60 100644 --- a/src/Core/Connection.php +++ b/src/Core/Connection.php @@ -90,6 +90,16 @@ class Connection return $this->stream; } + /** + * Get Server + * + * @return string + */ + public function getServer() + { + return $this->server; + } + /** * Check Connection * diff --git a/src/Core/Stats.php b/src/Core/Stats.php new file mode 100644 index 0000000..b0b8511 --- /dev/null +++ b/src/Core/Stats.php @@ -0,0 +1,33 @@ + + */ + +namespace Clivern\Imap\Core; +use Clivern\Imap\Core\Connection; + +/** + * Stats Class + * + * @package Clivern\Imap\Core + */ +class Stats +{ + protected $connection; + + public function __construct(Connection $connection) + { + $this->connection = $connection; + } + + public function getQuota($folder = 'INBOX') + { + return imap_get_quotaroot($this->connection->getStream(), $folder); + } + + + public function getStatus($folder = 'INBOX', $flag = SA_ALL) + { + return imap_status($this->connection->getStream(), "{" . $this->connection->getServer() . "}" . $folder, $flag); + } +} \ No newline at end of file