Usage.php
49 lines
| 1 | <?php |
| 2 | namespace enshrined\svgSanitize\ElementReference; |
| 3 | |
| 4 | class Usage |
| 5 | { |
| 6 | /** |
| 7 | * @var Subject |
| 8 | */ |
| 9 | protected $subject; |
| 10 | |
| 11 | /** |
| 12 | * @var int |
| 13 | */ |
| 14 | protected $count; |
| 15 | |
| 16 | /** |
| 17 | * @param Subject $subject |
| 18 | * @param int $count |
| 19 | */ |
| 20 | public function __construct(Subject $subject, $count = 1) |
| 21 | { |
| 22 | $this->subject = $subject; |
| 23 | $this->count = (int)$count; |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * @param int $by |
| 28 | */ |
| 29 | public function increment($by = 1) |
| 30 | { |
| 31 | $this->count += (int)$by; |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * @return Subject |
| 36 | */ |
| 37 | public function getSubject() |
| 38 | { |
| 39 | return $this->subject; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * @return int |
| 44 | */ |
| 45 | public function getCount() |
| 46 | { |
| 47 | return $this->count; |
| 48 | } |
| 49 | } |