File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -497,12 +497,18 @@ abstract class LocaleDisplayName extends Processor
497497 $ data = array ();
498498 $ xpath = new DOMXPath ($ doc );
499499 $ xElementList = $ xpath ->query ($ this ->getXPathSelector ());
500+ $ expectedKeys = array ();
500501 foreach ($ xElementList as $ xElement ) {
501502 $ type = (string ) $ xElement ->getAttribute ('type ' );
502503 if ($ type === '' ) {
503504 throw new RuntimeException ('Missing type attribute ' );
504505 }
505506 $ key = str_replace ('_ ' , '- ' , $ type );
507+ $ menu = (string ) $ xElement ->getAttribute ('menu ' );
508+ if ($ menu !== '' ) {
509+ $ expectedKeys [] = $ key ;
510+ continue ;
511+ }
506512 $ alt = (string ) $ xElement ->getAttribute ('alt ' );
507513 if ($ alt !== '' ) {
508514 $ key = "{$ key }-alt- {$ alt }" ;
@@ -512,6 +518,11 @@ abstract class LocaleDisplayName extends Processor
512518 }
513519 $ data [$ key ] = (string ) $ xElement ->textContent ;
514520 }
521+ foreach (array_unique ($ expectedKeys ) as $ expectedKey ) {
522+ if (!isset ($ data [$ expectedKey ])) {
523+ throw new RuntimeException ("Missing expected key {$ expectedKey }" );
524+ }
525+ }
515526 if ($ data === array ()) {
516527 throw new RuntimeException ('No elements found ' );
517528 }
You can’t perform that action at this time.
0 commit comments