File tree Expand file tree Collapse file tree 1 file changed +3
-13
lines changed
SlevomatCodingStandard/Sniffs/Files Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change 22
33namespace SlevomatCodingStandard \Sniffs \Files ;
44
5+ use SlevomatCodingStandard \Helpers \StringHelper ;
6+
57class FilepathNamespaceExtractor
68{
79
@@ -35,7 +37,7 @@ public function getTypeNameFromProjectPath($path)
3537 while (count ($ pathParts ) > 0 ) {
3638 array_shift ($ pathParts );
3739 foreach ($ this ->rootNamespaces as $ directory => $ namespace ) {
38- if (self ::startsWith (implode ('/ ' , $ pathParts ) . '/ ' , $ directory . '/ ' )) {
40+ if (StringHelper ::startsWith (implode ('/ ' , $ pathParts ) . '/ ' , $ directory . '/ ' )) {
3941 for ($ i = 0 ; $ i < count (explode ('/ ' , $ directory )); $ i ++) {
4042 array_shift ($ pathParts );
4143 }
@@ -71,16 +73,4 @@ public function getTypeNameFromProjectPath($path)
7173 return pathinfo ($ typeName , PATHINFO_FILENAME );
7274 }
7375
74- /**
75- * @param string $haystack
76- * @param string $needle
77- * @return boolean
78- */
79- private static function startsWith ($ haystack , $ needle )
80- {
81- // todo do helperu
82-
83- return strncmp ($ haystack , $ needle , strlen ($ needle )) === 0 ;
84- }
85-
8676}
You can’t perform that action at this time.
0 commit comments