@@ -95,38 +95,47 @@ private function filterToolinfo( $raw ) {
9595 $ info ['url ' ],
9696 $ m
9797 );
98- $ tool = $ m [2 ];
99- if ( !array_key_exists ( $ tool , $ toolinfo ) ) {
100- $ toolinfo [$ tool ] = [];
98+ if ( isset ( $ m [2 ] ) ) {
99+ $ tool = $ m [2 ];
100+ if ( !array_key_exists ( $ tool , $ toolinfo ) ) {
101+ $ toolinfo [$ tool ] = [];
102+ }
103+ $ toolinfo [$ tool ][] = [
104+ 'name ' => $ info ['name ' ],
105+ 'title ' => $ info ['title ' ],
106+ 'description ' => $ info ['description ' ],
107+ 'url ' => $ info ['url ' ],
108+ 'keywords ' => static ::aGet ( 'keywords ' , $ info ),
109+ 'author ' => static ::aGet ( 'author ' , $ info ),
110+ 'repository ' => static ::aGet ( 'repository ' , $ info ),
111+ ];
101112 }
102- $ toolinfo [$ tool ][] = [
103- 'name ' => $ info ['name ' ],
104- 'title ' => $ info ['title ' ],
105- 'description ' => $ info ['description ' ],
106- 'url ' => $ info ['url ' ],
107- 'keywords ' => static ::aGet ( 'keywords ' , $ info ),
108- 'author ' => static ::aGet ( 'author ' , $ info ),
109- 'repository ' => static ::aGet ( 'repository ' , $ info ),
110- ];
111113 } elseif ( false !== strpos ( $ info ['url ' ], 'toolforge.org ' ) ) {
112114 preg_match (
113115 '#^(https?:)?//([^.]+).toolforge.org/.*# ' ,
114116 $ info ['url ' ],
115117 $ m
116118 );
117- $ tool = $ m [2 ];
118- if ( !array_key_exists ( $ tool , $ toolinfo ) ) {
119- $ toolinfo [$ tool ] = [];
119+ if ( isset ( $ m [2 ] ) ) {
120+ $ tool = $ m [2 ];
121+ if ( !array_key_exists ( $ tool , $ toolinfo ) ) {
122+ $ toolinfo [$ tool ] = [];
123+ }
124+ $ toolinfo [$ tool ][] = [
125+ 'name ' => $ info ['name ' ],
126+ 'title ' => $ info ['title ' ],
127+ 'description ' => $ info ['description ' ],
128+ 'url ' => $ info ['url ' ],
129+ 'keywords ' => static ::aGet ( 'keywords ' , $ info ),
130+ 'author ' => static ::aGet ( 'author ' , $ info ),
131+ 'repository ' => static ::aGet ( 'repository ' , $ info ),
132+ ];
133+ } else {
134+ $ this ->logger ->warning (
135+ "Failed to guess toolname from {$ info ['url ' ]}" ,
136+ [ 'toolinfo ' => $ info ]
137+ );
120138 }
121- $ toolinfo [$ tool ][] = [
122- 'name ' => $ info ['name ' ],
123- 'title ' => $ info ['title ' ],
124- 'description ' => $ info ['description ' ],
125- 'url ' => $ info ['url ' ],
126- 'keywords ' => static ::aGet ( 'keywords ' , $ info ),
127- 'author ' => static ::aGet ( 'author ' , $ info ),
128- 'repository ' => static ::aGet ( 'repository ' , $ info ),
129- ];
130139 }
131140 }
132141 return $ toolinfo ;
0 commit comments