| Total Complexity | 14 |
| Total Lines | 82 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class Group |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var string |
||
| 12 | */ |
||
| 13 | private $name; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var string|callable |
||
| 17 | */ |
||
| 18 | private $rule; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var array |
||
| 22 | */ |
||
| 23 | private $files = []; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param string $name |
||
| 27 | * @param string|callable $rule |
||
| 28 | * |
||
| 29 | * @throws \InvalidArgumentException |
||
| 30 | */ |
||
| 31 | public function __construct($name, $rule) |
||
| 32 | { |
||
| 33 | if (!is_string($name) || empty($name)) { |
||
|
|
|||
| 34 | throw new \InvalidArgumentException($name . ' should be non-empty string'); |
||
| 35 | } |
||
| 36 | if (empty($rule) || !(is_string($rule) || is_callable($rule))) { |
||
| 37 | throw new \InvalidArgumentException($name . ' should be non-empty string or callable'); |
||
| 38 | } |
||
| 39 | $this->name = $name; |
||
| 40 | $this->rule = $rule; |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @param string $file |
||
| 45 | */ |
||
| 46 | public function addFile($file) |
||
| 47 | { |
||
| 48 | if (!in_array($file, $this->files)) { |
||
| 49 | $this->files[] = $file; |
||
| 50 | } |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @return string |
||
| 55 | */ |
||
| 56 | public function getName() |
||
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @return array |
||
| 63 | */ |
||
| 64 | public function getFiles() |
||
| 65 | { |
||
| 66 | return $this->files; |
||
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @return int |
||
| 71 | */ |
||
| 72 | public function getNumberOfClasses() |
||
| 75 | } |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @param \ReflectionClass $reflection |
||
| 79 | * |
||
| 80 | * @return boolean |
||
| 81 | */ |
||
| 82 | public function validate(\ReflectionClass $reflection) |
||
| 93 |