3 * This file is part of vfsStream.
5 * For the full copyright and license information, please view the LICENSE
6 * file that was distributed with this source code.
8 * @package org\bovigo\vfs
10 namespace org\bovigo\vfs;
12 * Represents a quota for disk space.
26 * A value of -1 is treated as unlimited.
35 * @param int $amount quota in bytes
37 public function __construct($amount)
39 $this->amount = $amount;
43 * create with unlimited space
47 public static function unlimited()
49 return new self(self::UNLIMITED);
53 * checks if a quota is set
57 public function isLimited()
59 return self::UNLIMITED < $this->amount;
63 * checks if given used space exceeda quota limit
66 * @param int $usedSpace
69 public function spaceLeft($usedSpace)
71 if (self::UNLIMITED === $this->amount) {
75 if ($usedSpace >= $this->amount) {
79 $spaceLeft = $this->amount - $usedSpace;
80 if (0 >= $spaceLeft) {