Sepia\PoParser::parseFile PHP Méthode

parseFile() public static méthode

Reads and parses a file
public static parseFile ( string $filepath, array $options = [] ) : array.
$filepath string
$options array
Résultat array.
    public static function parseFile($filepath, $options = array())
    {
        $parser = new PoParser(new FileHandler($filepath), $options);
        $parser->parse();
        return $parser;
    }

Usage Example

 private function _getPoParsers($source, $targetLanguage)
 {
     $files = array();
     if ($source == Kwf_Trl::SOURCE_WEB) {
         if (file_exists('trl/' . $targetLanguage . '.po')) {
             $files = array('trl/' . $targetLanguage . '.po');
         }
     } else {
         if ($source == Kwf_Trl::SOURCE_KWF) {
             // check all composer packages
             $this->_checkPackagesForTrlFilesAndTryDownloadFromKoalaWebsiteIfNotExisting($targetLanguage);
             $files = glob(VENDOR_PATH . '/*/*/trl/' . $targetLanguage . '.po');
         }
     }
     require_once VENDOR_PATH . '/autoload.php';
     $poParsers = array();
     foreach ($files as $file) {
         $poParser = \Sepia\PoParser::parseFile($file);
         array_push($poParsers, $poParser);
     }
     return $poParsers;
 }
All Usage Examples Of Sepia\PoParser::parseFile