88class Sniff
99{
1010 private string $ code ;
11+ private string $ standardName ;
12+ private string $ categoryName ;
13+ private string $ sniffName ;
1114 private string $ docblock ;
1215 /**
1316 * @var Property[]
@@ -42,6 +45,11 @@ public function __construct(
4245 Assert::that ($ code )
4346 ->notBlank ();
4447
48+ $ sniffNameParts = explode ('. ' , $ code );
49+ Assert::that ($ sniffNameParts )
50+ ->isArray ()
51+ ->count (3 );
52+
4553 Assert::thatAll ($ properties )
4654 ->isInstanceOf (Property::class);
4755
@@ -52,6 +60,9 @@ public function __construct(
5260 ->isInstanceOf (Violation::class);
5361
5462 $ this ->code = $ code ;
63+ $ this ->standardName = $ sniffNameParts [0 ];
64+ $ this ->categoryName = $ sniffNameParts [1 ];
65+ $ this ->sniffName = $ sniffNameParts [2 ];
5566 $ this ->docblock = $ docblock ;
5667 $ this ->properties = array_values ($ properties );
5768 $ this ->urls = $ urls ;
@@ -65,6 +76,21 @@ public function getCode(): string
6576 return $ this ->code ;
6677 }
6778
79+ public function getStandardName (): string
80+ {
81+ return $ this ->standardName ;
82+ }
83+
84+ public function getCategoryName (): string
85+ {
86+ return $ this ->categoryName ;
87+ }
88+
89+ public function getSniffName (): string
90+ {
91+ return $ this ->sniffName ;
92+ }
93+
6894 public function getDocblock (): string
6995 {
7096 return $ this ->docblock ;
0 commit comments