/**
  *  Extract the metadata in English reference file
  *
  * @param array $file_content Content of a lang file
  *
  * @return array Parsed lang file with the associated reference metadata
  */
 private static function extractReferenceMetaData($file_content)
 {
     $dotlang_data = [];
     $parsed_strings = false;
     for ($i = 0, $lines = count($file_content); $i < $lines; $i++) {
         $current_line = $file_content[$i];
         if (!$parsed_strings) {
             // Get file descriptions (always before strings)
             if (Utils::startsWith($current_line, '## NOTE:')) {
                 $dotlang_data['filedescription'][] = trim(Utils::leftStrip($current_line, '## NOTE:'));
                 continue;
             }
             // Get demo URL (always before strings)
             if (Utils::startsWith($current_line, '## URL:')) {
                 $dotlang_data['url'] = trim(Utils::leftStrip($current_line, '## URL:'));
                 continue;
             }
         }
         if (Utils::startsWith($current_line, ';')) {
             // I have a reference string
             $parsed_strings = true;
             $reference = Utils::leftStrip($current_line, ';');
             $j = $i - 1;
             while ($j >= 0) {
                 // Stop if I find a line not starting with #
                 if (!Utils::startsWith($file_content[$j], '#')) {
                     break;
                 }
                 // Comments
                 if (Utils::startsWith($file_content[$j], '#') && !Utils::startsWith($file_content[$j], '##')) {
                     $dotlang_data['comments'][$reference][] = Utils::leftStrip($file_content[$j], '#');
                 } else {
                     // Tag bindings
                     if (Utils::startsWith($file_content[$j], '## TAG:')) {
                         $dotlang_data['tag_bindings'][$reference] = Utils::leftStrip($file_content[$j], '## TAG:');
                     }
                     // Length limits
                     if (Utils::startsWith($file_content[$j], '## MAX_LENGTH:')) {
                         $dotlang_data['max_lengths'][$reference] = intval(Utils::leftStrip($file_content[$j], '## MAX_LENGTH:'));
                     }
                 }
                 $j--;
             }
             // Invert order of comments if available
             if (isset($dotlang_data['comments'][$reference])) {
                 $dotlang_data['comments'][$reference] = array_reverse($dotlang_data['comments'][$reference]);
             }
         }
     }
     return $dotlang_data;
 }
 /**
  *  Extract the metadata in English reference file
  *
  * @param array $file_content Content of a lang file
  *
  * @return array Parsed lang file with the associated reference metadata
  */
 private static function extractReferenceMetaData($file_content)
 {
     $dotlang_data = [];
     for ($i = 0, $lines = count($file_content); $i < $lines; $i++) {
         $current_line = $file_content[$i];
         if (Utils::startsWith($current_line, ';')) {
             // I have a reference string
             $reference = Utils::leftStrip($current_line, ';');
             $j = $i - 1;
             while ($j > 0) {
                 // Stop if I find a line not starting with #
                 if (!Utils::startsWith($file_content[$j], '#')) {
                     break;
                 }
                 // Comments
                 if (Utils::startsWith($file_content[$j], '#') && !Utils::startsWith($file_content[$j], '##')) {
                     $dotlang_data['comments'][$reference][] = Utils::leftStrip($file_content[$j], '#');
                 } else {
                     // Tag bindings
                     if (Utils::startsWith($file_content[$j], '## TAG:')) {
                         $dotlang_data['tag_bindings'][$reference] = Utils::leftStrip($file_content[$j], '## TAG:');
                     }
                     // Length limits
                     if (Utils::startsWith($file_content[$j], '## MAX_LENGTH:')) {
                         $dotlang_data['max_lengths'][$reference] = intval(Utils::leftStrip($file_content[$j], '## MAX_LENGTH:'));
                     }
                 }
                 $j--;
             }
             // Invert order of comments if available
             if (isset($dotlang_data['comments'][$reference])) {
                 $dotlang_data['comments'][$reference] = array_reverse($dotlang_data['comments'][$reference]);
             }
         }
     }
     return $dotlang_data;
 }