Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
IsResizable
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
4 / 4
8
100.00% covered (success)
100.00%
1 / 1
 columns
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
5
 getColumns
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getMin
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getResponsive
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Cosray\Field\Capability\Blocks;
6
7use Cosray\Schema\Responsive;
8use ValueError;
9
10trait IsResizable
11{
12    protected int $columns = 1;
13    protected int $min = 1;
14    protected Responsive $responsive = Responsive::Stack;
15
16    public function columns(int $columns, int $min = 1, Responsive $responsive = Responsive::Stack): static
17    {
18        if ($columns < 1 || $columns > 25) {
19            throw new ValueError('The value of $columns must be >= 1 and <= 25');
20        }
21
22        if ($min < 1 || $min > $columns) {
23            throw new ValueError('The value of $min must be >= 1 and <= ' . (string) $columns);
24        }
25
26        $this->columns = $columns;
27        $this->min = $min;
28        $this->responsive = $responsive;
29
30        return $this;
31    }
32
33    public function getColumns(): int
34    {
35        return $this->columns;
36    }
37
38    public function getMin(): int
39    {
40        return $this->min;
41    }
42
43    public function getResponsive(): Responsive
44    {
45        return $this->responsive;
46    }
47}