diff options
Diffstat (limited to 'www/wiki/extensions/Translate/ffs/AppleFFS.php')
-rw-r--r-- | www/wiki/extensions/Translate/ffs/AppleFFS.php | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/www/wiki/extensions/Translate/ffs/AppleFFS.php b/www/wiki/extensions/Translate/ffs/AppleFFS.php index 111589d1..de0f79e3 100644 --- a/www/wiki/extensions/Translate/ffs/AppleFFS.php +++ b/www/wiki/extensions/Translate/ffs/AppleFFS.php @@ -17,19 +17,17 @@ class AppleFFS extends SimpleFFS { } public function getFileExtensions() { - return array( '.strings' ); + return [ '.strings' ]; } - // READ - /** - * @param array $data + * @param string $data * @return array Parsed data. * @throws MWException */ public function readFromVariable( $data ) { $lines = explode( "\n", $data ); - $authors = $messages = array(); + $authors = $messages = []; $linecontinuation = false; $value = ''; @@ -45,7 +43,7 @@ class AppleFFS extends SimpleFFS { if ( substr( $line, 0, 2 ) === '//' ) { // Single-line comment - $match = array(); + $match = []; $ok = preg_match( '~//\s*Author:\s*(.*)~', $line, $match ); if ( $ok ) { $authors[] = $match[1]; @@ -67,34 +65,32 @@ class AppleFFS extends SimpleFFS { $messages = $this->group->getMangler()->mangle( $messages ); - return array( + return [ 'AUTHORS' => $authors, 'MESSAGES' => $messages, - ); + ]; } /** * Parses non-empty strings file row to key and value. * @param string $line * @throws MWException - * @return array( string $key, string $val ) + * @return array array( string $key, string $val ) */ public static function readRow( $line ) { - $match = array(); + $match = []; if ( preg_match( '/^"((?:\\\"|[^"])*)"\s*=\s*"((?:\\\"|[^"])*)"\s*;\s*$/', $line, $match ) ) { $key = self::unescapeString( $match[1] ); $value = self::unescapeString( $match[2] ); if ( $key === '' ) { throw new MWException( "Empty key in line $line" ); } - return array( $key, $value ); + return [ $key, $value ]; } else { throw new MWException( "Unrecognized line format: $line" ); } } - // Write - /** * @param MessageCollection $collection * @return string |