for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace STS\StorageConnect\Models;
use Carbon\Carbon;
/**
* Class Quota
*/
class Quota
{
* @var int
protected $total;
protected $used;
* @var Carbon
protected $checked;
* Quota constructor.
*
* @param $total
* @param $used
public function __construct( $total, $used )
$this->total = $total;
$this->used = $used;
$this->checked = Carbon::now();
}
* @return int
public function getTotal()
return $this->total;
public function getUsed()
return $this->used;
public function getAvailable()
return $this->total - $this->used;
* @return float|int
public function getPercentFull()
return $this->total > 0
? round(($this->used / $this->total) * 100, 1)
: 0;
* @return Carbon
public function getCheckedAt()
return $this->checked;
* @return array
public function toArray()
return [
'total_space' => $this->getTotal(),
'space_used' => $this->getUsed(),
'space_available' => $this->getAvailable(),
'percent_full' => $this->getPercentFull(),
'space_checked_at' => $this->getCheckedAt()
];