stats class added

This commit is contained in:
Clivern 2017-08-09 18:57:49 +02:00
parent 12c9b73147
commit 13b462e079
2 changed files with 43 additions and 0 deletions

View file

@ -90,6 +90,16 @@ class Connection
return $this->stream;
}
/**
* Get Server
*
* @return string
*/
public function getServer()
{
return $this->server;
}
/**
* Check Connection
*

33
src/Core/Stats.php Normal file
View file

@ -0,0 +1,33 @@
<?php
/**
* @author clivern <hello@clivern.com>
*/
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);
}
}