@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | // autoload-classmap.php @generated by Strauss |
| 4 | 4 | |
| 5 | -$vendorprefixed = dirname(__FILE__); |
|
| 5 | +$vendorprefixed = dirname( __FILE__ ); |
|
| 6 | 6 | |
| 7 | 7 | return array( |
| 8 | 8 | 'GravityKit\GravityView\Katzgrau\KLogger\Logger' => $vendorprefixed . '/katzgrau/klogger/src/Logger.php', |
@@ -10,57 +10,57 @@ |
||
| 10 | 10 | |
| 11 | 11 | class Xml extends Exporter |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * {@inheritdoc} |
|
| 15 | - * |
|
| 16 | - * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
|
| 17 | - */ |
|
| 18 | - public static function getDescription() |
|
| 19 | - { |
|
| 20 | - return 'Build an XML file - schema available at http://mlocati.github.io/cldr-to-gettext-plural-rules/GettextLanguages.xsd'; |
|
| 21 | - } |
|
| 13 | + /** |
|
| 14 | + * {@inheritdoc} |
|
| 15 | + * |
|
| 16 | + * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
|
| 17 | + */ |
|
| 18 | + public static function getDescription() |
|
| 19 | + { |
|
| 20 | + return 'Build an XML file - schema available at http://mlocati.github.io/cldr-to-gettext-plural-rules/GettextLanguages.xsd'; |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * {@inheritdoc} |
|
| 25 | - * |
|
| 26 | - * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
|
| 27 | - */ |
|
| 28 | - protected static function toStringDo($languages) |
|
| 29 | - { |
|
| 30 | - $xml = new \DOMDocument('1.0', 'UTF-8'); |
|
| 31 | - $xml->loadXML('<languages |
|
| 23 | + /** |
|
| 24 | + * {@inheritdoc} |
|
| 25 | + * |
|
| 26 | + * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
|
| 27 | + */ |
|
| 28 | + protected static function toStringDo($languages) |
|
| 29 | + { |
|
| 30 | + $xml = new \DOMDocument('1.0', 'UTF-8'); |
|
| 31 | + $xml->loadXML('<languages |
|
| 32 | 32 | xmlns="https://github.com/mlocati/cldr-to-gettext-plural-rules" |
| 33 | 33 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 34 | 34 | xsi:schemaLocation="https://github.com/mlocati/cldr-to-gettext-plural-rules http://mlocati.github.io/cldr-to-gettext-plural-rules/GettextLanguages.xsd" |
| 35 | 35 | />'); |
| 36 | - $xLanguages = $xml->firstChild; |
|
| 37 | - foreach ($languages as $language) { |
|
| 38 | - $xLanguage = $xml->createElement('language'); |
|
| 39 | - $xLanguage->setAttribute('id', $language->id); |
|
| 40 | - $xLanguage->setAttribute('name', $language->name); |
|
| 41 | - if (isset($language->supersededBy)) { |
|
| 42 | - $xLanguage->setAttribute('supersededBy', $language->supersededBy); |
|
| 43 | - } |
|
| 44 | - if (isset($language->script)) { |
|
| 45 | - $xLanguage->setAttribute('script', $language->script); |
|
| 46 | - } |
|
| 47 | - if (isset($language->territory)) { |
|
| 48 | - $xLanguage->setAttribute('territory', $language->territory); |
|
| 49 | - } |
|
| 50 | - if (isset($language->baseLanguage)) { |
|
| 51 | - $xLanguage->setAttribute('baseLanguage', $language->baseLanguage); |
|
| 52 | - } |
|
| 53 | - $xLanguage->setAttribute('formula', $language->formula); |
|
| 54 | - foreach ($language->categories as $category) { |
|
| 55 | - $xCategory = $xml->createElement('category'); |
|
| 56 | - $xCategory->setAttribute('id', $category->id); |
|
| 57 | - $xCategory->setAttribute('examples', $category->examples); |
|
| 58 | - $xLanguage->appendChild($xCategory); |
|
| 59 | - } |
|
| 60 | - $xLanguages->appendChild($xLanguage); |
|
| 61 | - } |
|
| 62 | - $xml->formatOutput = true; |
|
| 36 | + $xLanguages = $xml->firstChild; |
|
| 37 | + foreach ($languages as $language) { |
|
| 38 | + $xLanguage = $xml->createElement('language'); |
|
| 39 | + $xLanguage->setAttribute('id', $language->id); |
|
| 40 | + $xLanguage->setAttribute('name', $language->name); |
|
| 41 | + if (isset($language->supersededBy)) { |
|
| 42 | + $xLanguage->setAttribute('supersededBy', $language->supersededBy); |
|
| 43 | + } |
|
| 44 | + if (isset($language->script)) { |
|
| 45 | + $xLanguage->setAttribute('script', $language->script); |
|
| 46 | + } |
|
| 47 | + if (isset($language->territory)) { |
|
| 48 | + $xLanguage->setAttribute('territory', $language->territory); |
|
| 49 | + } |
|
| 50 | + if (isset($language->baseLanguage)) { |
|
| 51 | + $xLanguage->setAttribute('baseLanguage', $language->baseLanguage); |
|
| 52 | + } |
|
| 53 | + $xLanguage->setAttribute('formula', $language->formula); |
|
| 54 | + foreach ($language->categories as $category) { |
|
| 55 | + $xCategory = $xml->createElement('category'); |
|
| 56 | + $xCategory->setAttribute('id', $category->id); |
|
| 57 | + $xCategory->setAttribute('examples', $category->examples); |
|
| 58 | + $xLanguage->appendChild($xCategory); |
|
| 59 | + } |
|
| 60 | + $xLanguages->appendChild($xLanguage); |
|
| 61 | + } |
|
| 62 | + $xml->formatOutput = true; |
|
| 63 | 63 | |
| 64 | - return $xml->saveXML(); |
|
| 65 | - } |
|
| 64 | + return $xml->saveXML(); |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -25,39 +25,39 @@ |
||
| 25 | 25 | * |
| 26 | 26 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
| 27 | 27 | */ |
| 28 | - protected static function toStringDo($languages) |
|
| 28 | + protected static function toStringDo( $languages ) |
|
| 29 | 29 | { |
| 30 | - $xml = new \DOMDocument('1.0', 'UTF-8'); |
|
| 31 | - $xml->loadXML('<languages |
|
| 30 | + $xml = new \DOMDocument( '1.0', 'UTF-8' ); |
|
| 31 | + $xml->loadXML( '<languages |
|
| 32 | 32 | xmlns="https://github.com/mlocati/cldr-to-gettext-plural-rules" |
| 33 | 33 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 34 | 34 | xsi:schemaLocation="https://github.com/mlocati/cldr-to-gettext-plural-rules http://mlocati.github.io/cldr-to-gettext-plural-rules/GettextLanguages.xsd" |
| 35 | 35 | />'); |
| 36 | 36 | $xLanguages = $xml->firstChild; |
| 37 | - foreach ($languages as $language) { |
|
| 38 | - $xLanguage = $xml->createElement('language'); |
|
| 39 | - $xLanguage->setAttribute('id', $language->id); |
|
| 40 | - $xLanguage->setAttribute('name', $language->name); |
|
| 41 | - if (isset($language->supersededBy)) { |
|
| 42 | - $xLanguage->setAttribute('supersededBy', $language->supersededBy); |
|
| 37 | + foreach ( $languages as $language ) { |
|
| 38 | + $xLanguage = $xml->createElement( 'language' ); |
|
| 39 | + $xLanguage->setAttribute( 'id', $language->id ); |
|
| 40 | + $xLanguage->setAttribute( 'name', $language->name ); |
|
| 41 | + if ( isset( $language->supersededBy ) ) { |
|
| 42 | + $xLanguage->setAttribute( 'supersededBy', $language->supersededBy ); |
|
| 43 | 43 | } |
| 44 | - if (isset($language->script)) { |
|
| 45 | - $xLanguage->setAttribute('script', $language->script); |
|
| 44 | + if ( isset( $language->script ) ) { |
|
| 45 | + $xLanguage->setAttribute( 'script', $language->script ); |
|
| 46 | 46 | } |
| 47 | - if (isset($language->territory)) { |
|
| 48 | - $xLanguage->setAttribute('territory', $language->territory); |
|
| 47 | + if ( isset( $language->territory ) ) { |
|
| 48 | + $xLanguage->setAttribute( 'territory', $language->territory ); |
|
| 49 | 49 | } |
| 50 | - if (isset($language->baseLanguage)) { |
|
| 51 | - $xLanguage->setAttribute('baseLanguage', $language->baseLanguage); |
|
| 50 | + if ( isset( $language->baseLanguage ) ) { |
|
| 51 | + $xLanguage->setAttribute( 'baseLanguage', $language->baseLanguage ); |
|
| 52 | 52 | } |
| 53 | - $xLanguage->setAttribute('formula', $language->formula); |
|
| 54 | - foreach ($language->categories as $category) { |
|
| 55 | - $xCategory = $xml->createElement('category'); |
|
| 56 | - $xCategory->setAttribute('id', $category->id); |
|
| 57 | - $xCategory->setAttribute('examples', $category->examples); |
|
| 58 | - $xLanguage->appendChild($xCategory); |
|
| 53 | + $xLanguage->setAttribute( 'formula', $language->formula ); |
|
| 54 | + foreach ( $language->categories as $category ) { |
|
| 55 | + $xCategory = $xml->createElement( 'category' ); |
|
| 56 | + $xCategory->setAttribute( 'id', $category->id ); |
|
| 57 | + $xCategory->setAttribute( 'examples', $category->examples ); |
|
| 58 | + $xLanguage->appendChild( $xCategory ); |
|
| 59 | 59 | } |
| 60 | - $xLanguages->appendChild($xLanguage); |
|
| 60 | + $xLanguages->appendChild( $xLanguage ); |
|
| 61 | 61 | } |
| 62 | 62 | $xml->formatOutput = true; |
| 63 | 63 | |
@@ -8,15 +8,13 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | namespace GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter; |
| 10 | 10 | |
| 11 | -class Xml extends Exporter |
|
| 12 | -{ |
|
| 11 | +class Xml extends Exporter { |
|
| 13 | 12 | /** |
| 14 | 13 | * {@inheritdoc} |
| 15 | 14 | * |
| 16 | 15 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
| 17 | 16 | */ |
| 18 | - public static function getDescription() |
|
| 19 | - { |
|
| 17 | + public static function getDescription() { |
|
| 20 | 18 | return 'Build an XML file - schema available at http://mlocati.github.io/cldr-to-gettext-plural-rules/GettextLanguages.xsd'; |
| 21 | 19 | } |
| 22 | 20 | |
@@ -25,8 +23,7 @@ discard block |
||
| 25 | 23 | * |
| 26 | 24 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
| 27 | 25 | */ |
| 28 | - protected static function toStringDo($languages) |
|
| 29 | - { |
|
| 26 | + protected static function toStringDo($languages) { |
|
| 30 | 27 | $xml = new \DOMDocument('1.0', 'UTF-8'); |
| 31 | 28 | $xml->loadXML('<languages |
| 32 | 29 | xmlns="https://github.com/mlocati/cldr-to-gettext-plural-rules" |
@@ -12,27 +12,27 @@ |
||
| 12 | 12 | |
| 13 | 13 | class Prettyjson extends Json |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * {@inheritdoc} |
|
| 17 | - * |
|
| 18 | - * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
|
| 19 | - */ |
|
| 20 | - public static function getDescription() |
|
| 21 | - { |
|
| 22 | - return 'Build an uncompressed JSON-encoded file (PHP 5.4 or later is needed)'; |
|
| 23 | - } |
|
| 15 | + /** |
|
| 16 | + * {@inheritdoc} |
|
| 17 | + * |
|
| 18 | + * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
|
| 19 | + */ |
|
| 20 | + public static function getDescription() |
|
| 21 | + { |
|
| 22 | + return 'Build an uncompressed JSON-encoded file (PHP 5.4 or later is needed)'; |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * {@inheritdoc} |
|
| 27 | - * |
|
| 28 | - * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Json::getEncodeOptions() |
|
| 29 | - */ |
|
| 30 | - protected static function getEncodeOptions() |
|
| 31 | - { |
|
| 32 | - if (!(defined('\JSON_PRETTY_PRINT') && defined('\JSON_UNESCAPED_SLASHES') && defined('\JSON_UNESCAPED_UNICODE'))) { |
|
| 33 | - throw new Exception('PHP 5.4 or later is required to export uncompressed JSON'); |
|
| 34 | - } |
|
| 25 | + /** |
|
| 26 | + * {@inheritdoc} |
|
| 27 | + * |
|
| 28 | + * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Json::getEncodeOptions() |
|
| 29 | + */ |
|
| 30 | + protected static function getEncodeOptions() |
|
| 31 | + { |
|
| 32 | + if (!(defined('\JSON_PRETTY_PRINT') && defined('\JSON_UNESCAPED_SLASHES') && defined('\JSON_UNESCAPED_UNICODE'))) { |
|
| 33 | + throw new Exception('PHP 5.4 or later is required to export uncompressed JSON'); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - return \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE; |
|
| 37 | - } |
|
| 36 | + return \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE; |
|
| 37 | + } |
|
| 38 | 38 | } |
@@ -10,15 +10,13 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | use Exception; |
| 12 | 12 | |
| 13 | -class Prettyjson extends Json |
|
| 14 | -{ |
|
| 13 | +class Prettyjson extends Json { |
|
| 15 | 14 | /** |
| 16 | 15 | * {@inheritdoc} |
| 17 | 16 | * |
| 18 | 17 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
| 19 | 18 | */ |
| 20 | - public static function getDescription() |
|
| 21 | - { |
|
| 19 | + public static function getDescription() { |
|
| 22 | 20 | return 'Build an uncompressed JSON-encoded file (PHP 5.4 or later is needed)'; |
| 23 | 21 | } |
| 24 | 22 | |
@@ -27,8 +25,7 @@ discard block |
||
| 27 | 25 | * |
| 28 | 26 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Json::getEncodeOptions() |
| 29 | 27 | */ |
| 30 | - protected static function getEncodeOptions() |
|
| 31 | - { |
|
| 28 | + protected static function getEncodeOptions() { |
|
| 32 | 29 | if (!(defined('\JSON_PRETTY_PRINT') && defined('\JSON_UNESCAPED_SLASHES') && defined('\JSON_UNESCAPED_UNICODE'))) { |
| 33 | 30 | throw new Exception('PHP 5.4 or later is required to export uncompressed JSON'); |
| 34 | 31 | } |
@@ -10,66 +10,66 @@ |
||
| 10 | 10 | |
| 11 | 11 | class Html extends Exporter |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * {@inheritdoc} |
|
| 15 | - * |
|
| 16 | - * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
|
| 17 | - */ |
|
| 18 | - public static function getDescription() |
|
| 19 | - { |
|
| 20 | - return 'Build a HTML table'; |
|
| 21 | - } |
|
| 13 | + /** |
|
| 14 | + * {@inheritdoc} |
|
| 15 | + * |
|
| 16 | + * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
|
| 17 | + */ |
|
| 18 | + public static function getDescription() |
|
| 19 | + { |
|
| 20 | + return 'Build a HTML table'; |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * {@inheritdoc} |
|
| 25 | - * |
|
| 26 | - * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
|
| 27 | - */ |
|
| 28 | - protected static function toStringDo($languages) |
|
| 29 | - { |
|
| 30 | - return self::buildTable($languages, false); |
|
| 31 | - } |
|
| 23 | + /** |
|
| 24 | + * {@inheritdoc} |
|
| 25 | + * |
|
| 26 | + * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
|
| 27 | + */ |
|
| 28 | + protected static function toStringDo($languages) |
|
| 29 | + { |
|
| 30 | + return self::buildTable($languages, false); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - protected static function h($str) |
|
| 34 | - { |
|
| 35 | - return htmlspecialchars($str, ENT_COMPAT, 'UTF-8'); |
|
| 36 | - } |
|
| 33 | + protected static function h($str) |
|
| 34 | + { |
|
| 35 | + return htmlspecialchars($str, ENT_COMPAT, 'UTF-8'); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - protected static function buildTable($languages, $forDocs) |
|
| 39 | - { |
|
| 40 | - $prefix = $forDocs ? ' ' : ''; |
|
| 41 | - $lines = array(); |
|
| 42 | - $lines[] = $prefix . '<table' . ($forDocs ? ' class="table table-bordered table-condensed table-striped"' : '') . '>'; |
|
| 43 | - $lines[] = $prefix . ' <thead>'; |
|
| 44 | - $lines[] = $prefix . ' <tr>'; |
|
| 45 | - $lines[] = $prefix . ' <th>Language code</th>'; |
|
| 46 | - $lines[] = $prefix . ' <th>Language name</th>'; |
|
| 47 | - $lines[] = $prefix . ' <th># plurals</th>'; |
|
| 48 | - $lines[] = $prefix . ' <th>Formula</th>'; |
|
| 49 | - $lines[] = $prefix . ' <th>Plurals</th>'; |
|
| 50 | - $lines[] = $prefix . ' </tr>'; |
|
| 51 | - $lines[] = $prefix . ' </thead>'; |
|
| 52 | - $lines[] = $prefix . ' <tbody>'; |
|
| 53 | - foreach ($languages as $lc) { |
|
| 54 | - $lines[] = $prefix . ' <tr>'; |
|
| 55 | - $lines[] = $prefix . ' <td>' . $lc->id . '</td>'; |
|
| 56 | - $name = self::h($lc->name); |
|
| 57 | - if (isset($lc->supersededBy)) { |
|
| 58 | - $name .= '<br /><small><span>Superseded by</span> ' . $lc->supersededBy . '</small>'; |
|
| 59 | - } |
|
| 60 | - $lines[] = $prefix . ' <td>' . $name . '</td>'; |
|
| 61 | - $lines[] = $prefix . ' <td>' . count($lc->categories) . '</td>'; |
|
| 62 | - $lines[] = $prefix . ' <td>' . self::h($lc->formula) . '</td>'; |
|
| 63 | - $cases = array(); |
|
| 64 | - foreach ($lc->categories as $c) { |
|
| 65 | - $cases[] = '<li><span>' . $c->id . '</span><code>' . self::h($c->examples) . '</code></li>'; |
|
| 66 | - } |
|
| 67 | - $lines[] = $prefix . ' <td><ol' . ($forDocs ? ' class="cases"' : '') . ' start="0">' . implode('', $cases) . '</ol></td>'; |
|
| 68 | - $lines[] = $prefix . ' </tr>'; |
|
| 69 | - } |
|
| 70 | - $lines[] = $prefix . ' </tbody>'; |
|
| 71 | - $lines[] = $prefix . '</table>'; |
|
| 38 | + protected static function buildTable($languages, $forDocs) |
|
| 39 | + { |
|
| 40 | + $prefix = $forDocs ? ' ' : ''; |
|
| 41 | + $lines = array(); |
|
| 42 | + $lines[] = $prefix . '<table' . ($forDocs ? ' class="table table-bordered table-condensed table-striped"' : '') . '>'; |
|
| 43 | + $lines[] = $prefix . ' <thead>'; |
|
| 44 | + $lines[] = $prefix . ' <tr>'; |
|
| 45 | + $lines[] = $prefix . ' <th>Language code</th>'; |
|
| 46 | + $lines[] = $prefix . ' <th>Language name</th>'; |
|
| 47 | + $lines[] = $prefix . ' <th># plurals</th>'; |
|
| 48 | + $lines[] = $prefix . ' <th>Formula</th>'; |
|
| 49 | + $lines[] = $prefix . ' <th>Plurals</th>'; |
|
| 50 | + $lines[] = $prefix . ' </tr>'; |
|
| 51 | + $lines[] = $prefix . ' </thead>'; |
|
| 52 | + $lines[] = $prefix . ' <tbody>'; |
|
| 53 | + foreach ($languages as $lc) { |
|
| 54 | + $lines[] = $prefix . ' <tr>'; |
|
| 55 | + $lines[] = $prefix . ' <td>' . $lc->id . '</td>'; |
|
| 56 | + $name = self::h($lc->name); |
|
| 57 | + if (isset($lc->supersededBy)) { |
|
| 58 | + $name .= '<br /><small><span>Superseded by</span> ' . $lc->supersededBy . '</small>'; |
|
| 59 | + } |
|
| 60 | + $lines[] = $prefix . ' <td>' . $name . '</td>'; |
|
| 61 | + $lines[] = $prefix . ' <td>' . count($lc->categories) . '</td>'; |
|
| 62 | + $lines[] = $prefix . ' <td>' . self::h($lc->formula) . '</td>'; |
|
| 63 | + $cases = array(); |
|
| 64 | + foreach ($lc->categories as $c) { |
|
| 65 | + $cases[] = '<li><span>' . $c->id . '</span><code>' . self::h($c->examples) . '</code></li>'; |
|
| 66 | + } |
|
| 67 | + $lines[] = $prefix . ' <td><ol' . ($forDocs ? ' class="cases"' : '') . ' start="0">' . implode('', $cases) . '</ol></td>'; |
|
| 68 | + $lines[] = $prefix . ' </tr>'; |
|
| 69 | + } |
|
| 70 | + $lines[] = $prefix . ' </tbody>'; |
|
| 71 | + $lines[] = $prefix . '</table>'; |
|
| 72 | 72 | |
| 73 | - return implode("\n", $lines); |
|
| 74 | - } |
|
| 73 | + return implode("\n", $lines); |
|
| 74 | + } |
|
| 75 | 75 | } |
@@ -25,51 +25,51 @@ |
||
| 25 | 25 | * |
| 26 | 26 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
| 27 | 27 | */ |
| 28 | - protected static function toStringDo($languages) |
|
| 28 | + protected static function toStringDo( $languages ) |
|
| 29 | 29 | { |
| 30 | - return self::buildTable($languages, false); |
|
| 30 | + return self::buildTable( $languages, false ); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - protected static function h($str) |
|
| 33 | + protected static function h( $str ) |
|
| 34 | 34 | { |
| 35 | - return htmlspecialchars($str, ENT_COMPAT, 'UTF-8'); |
|
| 35 | + return htmlspecialchars( $str, ENT_COMPAT, 'UTF-8' ); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - protected static function buildTable($languages, $forDocs) |
|
| 38 | + protected static function buildTable( $languages, $forDocs ) |
|
| 39 | 39 | { |
| 40 | 40 | $prefix = $forDocs ? ' ' : ''; |
| 41 | 41 | $lines = array(); |
| 42 | - $lines[] = $prefix . '<table' . ($forDocs ? ' class="table table-bordered table-condensed table-striped"' : '') . '>'; |
|
| 43 | - $lines[] = $prefix . ' <thead>'; |
|
| 44 | - $lines[] = $prefix . ' <tr>'; |
|
| 45 | - $lines[] = $prefix . ' <th>Language code</th>'; |
|
| 46 | - $lines[] = $prefix . ' <th>Language name</th>'; |
|
| 47 | - $lines[] = $prefix . ' <th># plurals</th>'; |
|
| 48 | - $lines[] = $prefix . ' <th>Formula</th>'; |
|
| 49 | - $lines[] = $prefix . ' <th>Plurals</th>'; |
|
| 50 | - $lines[] = $prefix . ' </tr>'; |
|
| 51 | - $lines[] = $prefix . ' </thead>'; |
|
| 52 | - $lines[] = $prefix . ' <tbody>'; |
|
| 53 | - foreach ($languages as $lc) { |
|
| 54 | - $lines[] = $prefix . ' <tr>'; |
|
| 55 | - $lines[] = $prefix . ' <td>' . $lc->id . '</td>'; |
|
| 56 | - $name = self::h($lc->name); |
|
| 57 | - if (isset($lc->supersededBy)) { |
|
| 42 | + $lines[ ] = $prefix . '<table' . ( $forDocs ? ' class="table table-bordered table-condensed table-striped"' : '' ) . '>'; |
|
| 43 | + $lines[ ] = $prefix . ' <thead>'; |
|
| 44 | + $lines[ ] = $prefix . ' <tr>'; |
|
| 45 | + $lines[ ] = $prefix . ' <th>Language code</th>'; |
|
| 46 | + $lines[ ] = $prefix . ' <th>Language name</th>'; |
|
| 47 | + $lines[ ] = $prefix . ' <th># plurals</th>'; |
|
| 48 | + $lines[ ] = $prefix . ' <th>Formula</th>'; |
|
| 49 | + $lines[ ] = $prefix . ' <th>Plurals</th>'; |
|
| 50 | + $lines[ ] = $prefix . ' </tr>'; |
|
| 51 | + $lines[ ] = $prefix . ' </thead>'; |
|
| 52 | + $lines[ ] = $prefix . ' <tbody>'; |
|
| 53 | + foreach ( $languages as $lc ) { |
|
| 54 | + $lines[ ] = $prefix . ' <tr>'; |
|
| 55 | + $lines[ ] = $prefix . ' <td>' . $lc->id . '</td>'; |
|
| 56 | + $name = self::h( $lc->name ); |
|
| 57 | + if ( isset( $lc->supersededBy ) ) { |
|
| 58 | 58 | $name .= '<br /><small><span>Superseded by</span> ' . $lc->supersededBy . '</small>'; |
| 59 | 59 | } |
| 60 | - $lines[] = $prefix . ' <td>' . $name . '</td>'; |
|
| 61 | - $lines[] = $prefix . ' <td>' . count($lc->categories) . '</td>'; |
|
| 62 | - $lines[] = $prefix . ' <td>' . self::h($lc->formula) . '</td>'; |
|
| 60 | + $lines[ ] = $prefix . ' <td>' . $name . '</td>'; |
|
| 61 | + $lines[ ] = $prefix . ' <td>' . count( $lc->categories ) . '</td>'; |
|
| 62 | + $lines[ ] = $prefix . ' <td>' . self::h( $lc->formula ) . '</td>'; |
|
| 63 | 63 | $cases = array(); |
| 64 | - foreach ($lc->categories as $c) { |
|
| 65 | - $cases[] = '<li><span>' . $c->id . '</span><code>' . self::h($c->examples) . '</code></li>'; |
|
| 64 | + foreach ( $lc->categories as $c ) { |
|
| 65 | + $cases[ ] = '<li><span>' . $c->id . '</span><code>' . self::h( $c->examples ) . '</code></li>'; |
|
| 66 | 66 | } |
| 67 | - $lines[] = $prefix . ' <td><ol' . ($forDocs ? ' class="cases"' : '') . ' start="0">' . implode('', $cases) . '</ol></td>'; |
|
| 68 | - $lines[] = $prefix . ' </tr>'; |
|
| 67 | + $lines[ ] = $prefix . ' <td><ol' . ( $forDocs ? ' class="cases"' : '' ) . ' start="0">' . implode( '', $cases ) . '</ol></td>'; |
|
| 68 | + $lines[ ] = $prefix . ' </tr>'; |
|
| 69 | 69 | } |
| 70 | - $lines[] = $prefix . ' </tbody>'; |
|
| 71 | - $lines[] = $prefix . '</table>'; |
|
| 70 | + $lines[ ] = $prefix . ' </tbody>'; |
|
| 71 | + $lines[ ] = $prefix . '</table>'; |
|
| 72 | 72 | |
| 73 | - return implode("\n", $lines); |
|
| 73 | + return implode( "\n", $lines ); |
|
| 74 | 74 | } |
| 75 | 75 | } |
@@ -8,15 +8,13 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | namespace GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter; |
| 10 | 10 | |
| 11 | -class Html extends Exporter |
|
| 12 | -{ |
|
| 11 | +class Html extends Exporter { |
|
| 13 | 12 | /** |
| 14 | 13 | * {@inheritdoc} |
| 15 | 14 | * |
| 16 | 15 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
| 17 | 16 | */ |
| 18 | - public static function getDescription() |
|
| 19 | - { |
|
| 17 | + public static function getDescription() { |
|
| 20 | 18 | return 'Build a HTML table'; |
| 21 | 19 | } |
| 22 | 20 | |
@@ -25,18 +23,15 @@ discard block |
||
| 25 | 23 | * |
| 26 | 24 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
| 27 | 25 | */ |
| 28 | - protected static function toStringDo($languages) |
|
| 29 | - { |
|
| 26 | + protected static function toStringDo($languages) { |
|
| 30 | 27 | return self::buildTable($languages, false); |
| 31 | 28 | } |
| 32 | 29 | |
| 33 | - protected static function h($str) |
|
| 34 | - { |
|
| 30 | + protected static function h($str) { |
|
| 35 | 31 | return htmlspecialchars($str, ENT_COMPAT, 'UTF-8'); |
| 36 | 32 | } |
| 37 | 33 | |
| 38 | - protected static function buildTable($languages, $forDocs) |
|
| 39 | - { |
|
| 34 | + protected static function buildTable($languages, $forDocs) { |
|
| 40 | 35 | $prefix = $forDocs ? ' ' : ''; |
| 41 | 36 | $lines = array(); |
| 42 | 37 | $lines[] = $prefix . '<table' . ($forDocs ? ' class="table table-bordered table-condensed table-striped"' : '') . '>'; |
@@ -12,32 +12,32 @@ |
||
| 12 | 12 | |
| 13 | 13 | class Po extends Exporter |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * {@inheritdoc} |
|
| 17 | - * |
|
| 18 | - * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
|
| 19 | - */ |
|
| 20 | - public static function getDescription() |
|
| 21 | - { |
|
| 22 | - return 'Build a string to be used for gettext .po files'; |
|
| 23 | - } |
|
| 15 | + /** |
|
| 16 | + * {@inheritdoc} |
|
| 17 | + * |
|
| 18 | + * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
|
| 19 | + */ |
|
| 20 | + public static function getDescription() |
|
| 21 | + { |
|
| 22 | + return 'Build a string to be used for gettext .po files'; |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * {@inheritdoc} |
|
| 27 | - * |
|
| 28 | - * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
|
| 29 | - */ |
|
| 30 | - protected static function toStringDo($languages) |
|
| 31 | - { |
|
| 32 | - if (count($languages) !== 1) { |
|
| 33 | - throw new Exception('The ' . get_called_class() . ' exporter can only export one language'); |
|
| 34 | - } |
|
| 35 | - $language = $languages[0]; |
|
| 36 | - $lines = array(); |
|
| 37 | - $lines[] = '"Language: ' . $language->id . '\n"'; |
|
| 38 | - $lines[] = '"Plural-Forms: nplurals=' . count($language->categories) . '; plural=' . $language->formula . '\n"'; |
|
| 39 | - $lines[] = ''; |
|
| 25 | + /** |
|
| 26 | + * {@inheritdoc} |
|
| 27 | + * |
|
| 28 | + * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
|
| 29 | + */ |
|
| 30 | + protected static function toStringDo($languages) |
|
| 31 | + { |
|
| 32 | + if (count($languages) !== 1) { |
|
| 33 | + throw new Exception('The ' . get_called_class() . ' exporter can only export one language'); |
|
| 34 | + } |
|
| 35 | + $language = $languages[0]; |
|
| 36 | + $lines = array(); |
|
| 37 | + $lines[] = '"Language: ' . $language->id . '\n"'; |
|
| 38 | + $lines[] = '"Plural-Forms: nplurals=' . count($language->categories) . '; plural=' . $language->formula . '\n"'; |
|
| 39 | + $lines[] = ''; |
|
| 40 | 40 | |
| 41 | - return implode("\n", $lines); |
|
| 42 | - } |
|
| 41 | + return implode("\n", $lines); |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -27,17 +27,17 @@ |
||
| 27 | 27 | * |
| 28 | 28 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
| 29 | 29 | */ |
| 30 | - protected static function toStringDo($languages) |
|
| 30 | + protected static function toStringDo( $languages ) |
|
| 31 | 31 | { |
| 32 | - if (count($languages) !== 1) { |
|
| 33 | - throw new Exception('The ' . get_called_class() . ' exporter can only export one language'); |
|
| 32 | + if ( count( $languages ) !== 1 ) { |
|
| 33 | + throw new Exception( 'The ' . get_called_class() . ' exporter can only export one language' ); |
|
| 34 | 34 | } |
| 35 | - $language = $languages[0]; |
|
| 35 | + $language = $languages[ 0 ]; |
|
| 36 | 36 | $lines = array(); |
| 37 | - $lines[] = '"Language: ' . $language->id . '\n"'; |
|
| 38 | - $lines[] = '"Plural-Forms: nplurals=' . count($language->categories) . '; plural=' . $language->formula . '\n"'; |
|
| 39 | - $lines[] = ''; |
|
| 37 | + $lines[ ] = '"Language: ' . $language->id . '\n"'; |
|
| 38 | + $lines[ ] = '"Plural-Forms: nplurals=' . count( $language->categories ) . '; plural=' . $language->formula . '\n"'; |
|
| 39 | + $lines[ ] = ''; |
|
| 40 | 40 | |
| 41 | - return implode("\n", $lines); |
|
| 41 | + return implode( "\n", $lines ); |
|
| 42 | 42 | } |
| 43 | 43 | } |
@@ -10,15 +10,13 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | use Exception; |
| 12 | 12 | |
| 13 | -class Po extends Exporter |
|
| 14 | -{ |
|
| 13 | +class Po extends Exporter { |
|
| 15 | 14 | /** |
| 16 | 15 | * {@inheritdoc} |
| 17 | 16 | * |
| 18 | 17 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
| 19 | 18 | */ |
| 20 | - public static function getDescription() |
|
| 21 | - { |
|
| 19 | + public static function getDescription() { |
|
| 22 | 20 | return 'Build a string to be used for gettext .po files'; |
| 23 | 21 | } |
| 24 | 22 | |
@@ -27,8 +25,7 @@ discard block |
||
| 27 | 25 | * |
| 28 | 26 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
| 29 | 27 | */ |
| 30 | - protected static function toStringDo($languages) |
|
| 31 | - { |
|
| 28 | + protected static function toStringDo($languages) { |
|
| 32 | 29 | if (count($languages) !== 1) { |
| 33 | 30 | throw new Exception('The ' . get_called_class() . ' exporter can only export one language'); |
| 34 | 31 | } |
@@ -10,58 +10,58 @@ |
||
| 10 | 10 | |
| 11 | 11 | class Php extends Exporter |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * {@inheritdoc} |
|
| 15 | - * |
|
| 16 | - * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
|
| 17 | - */ |
|
| 18 | - public static function getDescription() |
|
| 19 | - { |
|
| 20 | - return 'Build a PHP array'; |
|
| 21 | - } |
|
| 13 | + /** |
|
| 14 | + * {@inheritdoc} |
|
| 15 | + * |
|
| 16 | + * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
|
| 17 | + */ |
|
| 18 | + public static function getDescription() |
|
| 19 | + { |
|
| 20 | + return 'Build a PHP array'; |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * {@inheritdoc} |
|
| 25 | - * |
|
| 26 | - * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
|
| 27 | - */ |
|
| 28 | - protected static function toStringDo($languages) |
|
| 29 | - { |
|
| 30 | - $lines = array(); |
|
| 31 | - $lines[] = '<?php'; |
|
| 32 | - $lines[] = 'return array('; |
|
| 33 | - foreach ($languages as $lc) { |
|
| 34 | - $lines[] = ' \'' . $lc->id . '\' => array('; |
|
| 35 | - $lines[] = ' \'name\' => \'' . addslashes($lc->name) . '\','; |
|
| 36 | - if (isset($lc->supersededBy)) { |
|
| 37 | - $lines[] = ' \'supersededBy\' => \'' . $lc->supersededBy . '\','; |
|
| 38 | - } |
|
| 39 | - if (isset($lc->script)) { |
|
| 40 | - $lines[] = ' \'script\' => \'' . addslashes($lc->script) . '\','; |
|
| 41 | - } |
|
| 42 | - if (isset($lc->territory)) { |
|
| 43 | - $lines[] = ' \'territory\' => \'' . addslashes($lc->territory) . '\','; |
|
| 44 | - } |
|
| 45 | - if (isset($lc->baseLanguage)) { |
|
| 46 | - $lines[] = ' \'baseLanguage\' => \'' . addslashes($lc->baseLanguage) . '\','; |
|
| 47 | - } |
|
| 48 | - $lines[] = ' \'formula\' => \'' . $lc->formula . '\','; |
|
| 49 | - $lines[] = ' \'plurals\' => ' . count($lc->categories) . ','; |
|
| 50 | - $catNames = array(); |
|
| 51 | - foreach ($lc->categories as $c) { |
|
| 52 | - $catNames[] = "'{$c->id}'"; |
|
| 53 | - } |
|
| 54 | - $lines[] = ' \'cases\' => array(' . implode(', ', $catNames) . '),'; |
|
| 55 | - $lines[] = ' \'examples\' => array('; |
|
| 56 | - foreach ($lc->categories as $c) { |
|
| 57 | - $lines[] = ' \'' . $c->id . '\' => \'' . $c->examples . '\','; |
|
| 58 | - } |
|
| 59 | - $lines[] = ' ),'; |
|
| 60 | - $lines[] = ' ),'; |
|
| 61 | - } |
|
| 62 | - $lines[] = ');'; |
|
| 63 | - $lines[] = ''; |
|
| 23 | + /** |
|
| 24 | + * {@inheritdoc} |
|
| 25 | + * |
|
| 26 | + * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
|
| 27 | + */ |
|
| 28 | + protected static function toStringDo($languages) |
|
| 29 | + { |
|
| 30 | + $lines = array(); |
|
| 31 | + $lines[] = '<?php'; |
|
| 32 | + $lines[] = 'return array('; |
|
| 33 | + foreach ($languages as $lc) { |
|
| 34 | + $lines[] = ' \'' . $lc->id . '\' => array('; |
|
| 35 | + $lines[] = ' \'name\' => \'' . addslashes($lc->name) . '\','; |
|
| 36 | + if (isset($lc->supersededBy)) { |
|
| 37 | + $lines[] = ' \'supersededBy\' => \'' . $lc->supersededBy . '\','; |
|
| 38 | + } |
|
| 39 | + if (isset($lc->script)) { |
|
| 40 | + $lines[] = ' \'script\' => \'' . addslashes($lc->script) . '\','; |
|
| 41 | + } |
|
| 42 | + if (isset($lc->territory)) { |
|
| 43 | + $lines[] = ' \'territory\' => \'' . addslashes($lc->territory) . '\','; |
|
| 44 | + } |
|
| 45 | + if (isset($lc->baseLanguage)) { |
|
| 46 | + $lines[] = ' \'baseLanguage\' => \'' . addslashes($lc->baseLanguage) . '\','; |
|
| 47 | + } |
|
| 48 | + $lines[] = ' \'formula\' => \'' . $lc->formula . '\','; |
|
| 49 | + $lines[] = ' \'plurals\' => ' . count($lc->categories) . ','; |
|
| 50 | + $catNames = array(); |
|
| 51 | + foreach ($lc->categories as $c) { |
|
| 52 | + $catNames[] = "'{$c->id}'"; |
|
| 53 | + } |
|
| 54 | + $lines[] = ' \'cases\' => array(' . implode(', ', $catNames) . '),'; |
|
| 55 | + $lines[] = ' \'examples\' => array('; |
|
| 56 | + foreach ($lc->categories as $c) { |
|
| 57 | + $lines[] = ' \'' . $c->id . '\' => \'' . $c->examples . '\','; |
|
| 58 | + } |
|
| 59 | + $lines[] = ' ),'; |
|
| 60 | + $lines[] = ' ),'; |
|
| 61 | + } |
|
| 62 | + $lines[] = ');'; |
|
| 63 | + $lines[] = ''; |
|
| 64 | 64 | |
| 65 | - return implode("\n", $lines); |
|
| 66 | - } |
|
| 65 | + return implode("\n", $lines); |
|
| 66 | + } |
|
| 67 | 67 | } |
@@ -25,43 +25,43 @@ |
||
| 25 | 25 | * |
| 26 | 26 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
| 27 | 27 | */ |
| 28 | - protected static function toStringDo($languages) |
|
| 28 | + protected static function toStringDo( $languages ) |
|
| 29 | 29 | { |
| 30 | 30 | $lines = array(); |
| 31 | - $lines[] = '<?php'; |
|
| 32 | - $lines[] = 'return array('; |
|
| 33 | - foreach ($languages as $lc) { |
|
| 34 | - $lines[] = ' \'' . $lc->id . '\' => array('; |
|
| 35 | - $lines[] = ' \'name\' => \'' . addslashes($lc->name) . '\','; |
|
| 36 | - if (isset($lc->supersededBy)) { |
|
| 37 | - $lines[] = ' \'supersededBy\' => \'' . $lc->supersededBy . '\','; |
|
| 31 | + $lines[ ] = '<?php'; |
|
| 32 | + $lines[ ] = 'return array('; |
|
| 33 | + foreach ( $languages as $lc ) { |
|
| 34 | + $lines[ ] = ' \'' . $lc->id . '\' => array('; |
|
| 35 | + $lines[ ] = ' \'name\' => \'' . addslashes( $lc->name ) . '\','; |
|
| 36 | + if ( isset( $lc->supersededBy ) ) { |
|
| 37 | + $lines[ ] = ' \'supersededBy\' => \'' . $lc->supersededBy . '\','; |
|
| 38 | 38 | } |
| 39 | - if (isset($lc->script)) { |
|
| 40 | - $lines[] = ' \'script\' => \'' . addslashes($lc->script) . '\','; |
|
| 39 | + if ( isset( $lc->script ) ) { |
|
| 40 | + $lines[ ] = ' \'script\' => \'' . addslashes( $lc->script ) . '\','; |
|
| 41 | 41 | } |
| 42 | - if (isset($lc->territory)) { |
|
| 43 | - $lines[] = ' \'territory\' => \'' . addslashes($lc->territory) . '\','; |
|
| 42 | + if ( isset( $lc->territory ) ) { |
|
| 43 | + $lines[ ] = ' \'territory\' => \'' . addslashes( $lc->territory ) . '\','; |
|
| 44 | 44 | } |
| 45 | - if (isset($lc->baseLanguage)) { |
|
| 46 | - $lines[] = ' \'baseLanguage\' => \'' . addslashes($lc->baseLanguage) . '\','; |
|
| 45 | + if ( isset( $lc->baseLanguage ) ) { |
|
| 46 | + $lines[ ] = ' \'baseLanguage\' => \'' . addslashes( $lc->baseLanguage ) . '\','; |
|
| 47 | 47 | } |
| 48 | - $lines[] = ' \'formula\' => \'' . $lc->formula . '\','; |
|
| 49 | - $lines[] = ' \'plurals\' => ' . count($lc->categories) . ','; |
|
| 48 | + $lines[ ] = ' \'formula\' => \'' . $lc->formula . '\','; |
|
| 49 | + $lines[ ] = ' \'plurals\' => ' . count( $lc->categories ) . ','; |
|
| 50 | 50 | $catNames = array(); |
| 51 | - foreach ($lc->categories as $c) { |
|
| 52 | - $catNames[] = "'{$c->id}'"; |
|
| 51 | + foreach ( $lc->categories as $c ) { |
|
| 52 | + $catNames[ ] = "'{$c->id}'"; |
|
| 53 | 53 | } |
| 54 | - $lines[] = ' \'cases\' => array(' . implode(', ', $catNames) . '),'; |
|
| 55 | - $lines[] = ' \'examples\' => array('; |
|
| 56 | - foreach ($lc->categories as $c) { |
|
| 57 | - $lines[] = ' \'' . $c->id . '\' => \'' . $c->examples . '\','; |
|
| 54 | + $lines[ ] = ' \'cases\' => array(' . implode( ', ', $catNames ) . '),'; |
|
| 55 | + $lines[ ] = ' \'examples\' => array('; |
|
| 56 | + foreach ( $lc->categories as $c ) { |
|
| 57 | + $lines[ ] = ' \'' . $c->id . '\' => \'' . $c->examples . '\','; |
|
| 58 | 58 | } |
| 59 | - $lines[] = ' ),'; |
|
| 60 | - $lines[] = ' ),'; |
|
| 59 | + $lines[ ] = ' ),'; |
|
| 60 | + $lines[ ] = ' ),'; |
|
| 61 | 61 | } |
| 62 | - $lines[] = ');'; |
|
| 63 | - $lines[] = ''; |
|
| 62 | + $lines[ ] = ');'; |
|
| 63 | + $lines[ ] = ''; |
|
| 64 | 64 | |
| 65 | - return implode("\n", $lines); |
|
| 65 | + return implode( "\n", $lines ); |
|
| 66 | 66 | } |
| 67 | 67 | } |
@@ -8,15 +8,13 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | namespace GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter; |
| 10 | 10 | |
| 11 | -class Php extends Exporter |
|
| 12 | -{ |
|
| 11 | +class Php extends Exporter { |
|
| 13 | 12 | /** |
| 14 | 13 | * {@inheritdoc} |
| 15 | 14 | * |
| 16 | 15 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
| 17 | 16 | */ |
| 18 | - public static function getDescription() |
|
| 19 | - { |
|
| 17 | + public static function getDescription() { |
|
| 20 | 18 | return 'Build a PHP array'; |
| 21 | 19 | } |
| 22 | 20 | |
@@ -25,8 +23,7 @@ discard block |
||
| 25 | 23 | * |
| 26 | 24 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
| 27 | 25 | */ |
| 28 | - protected static function toStringDo($languages) |
|
| 29 | - { |
|
| 26 | + protected static function toStringDo($languages) { |
|
| 30 | 27 | $lines = array(); |
| 31 | 28 | $lines[] = '<?php'; |
| 32 | 29 | $lines[] = 'return array('; |
@@ -10,57 +10,57 @@ |
||
| 10 | 10 | |
| 11 | 11 | class Ruby extends Exporter |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * {@inheritdoc} |
|
| 15 | - * |
|
| 16 | - * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
|
| 17 | - */ |
|
| 18 | - public static function getDescription() |
|
| 19 | - { |
|
| 20 | - return 'Build a Ruby hash'; |
|
| 21 | - } |
|
| 13 | + /** |
|
| 14 | + * {@inheritdoc} |
|
| 15 | + * |
|
| 16 | + * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
|
| 17 | + */ |
|
| 18 | + public static function getDescription() |
|
| 19 | + { |
|
| 20 | + return 'Build a Ruby hash'; |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * {@inheritdoc} |
|
| 25 | - * |
|
| 26 | - * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
|
| 27 | - */ |
|
| 28 | - protected static function toStringDo($languages) |
|
| 29 | - { |
|
| 30 | - $lines = array(); |
|
| 31 | - $lines[] = 'PLURAL_RULES = {'; |
|
| 32 | - foreach ($languages as $lc) { |
|
| 33 | - $lines[] = ' \'' . $lc->id . '\' => {'; |
|
| 34 | - $lines[] = ' \'name\' => \'' . addslashes($lc->name) . '\','; |
|
| 35 | - if (isset($lc->supersededBy)) { |
|
| 36 | - $lines[] = ' \'supersededBy\' => \'' . $lc->supersededBy . '\','; |
|
| 37 | - } |
|
| 38 | - if (isset($lc->script)) { |
|
| 39 | - $lines[] = ' \'script\' => \'' . addslashes($lc->script) . '\','; |
|
| 40 | - } |
|
| 41 | - if (isset($lc->territory)) { |
|
| 42 | - $lines[] = ' \'territory\' => \'' . addslashes($lc->territory) . '\','; |
|
| 43 | - } |
|
| 44 | - if (isset($lc->baseLanguage)) { |
|
| 45 | - $lines[] = ' \'baseLanguage\' => \'' . addslashes($lc->baseLanguage) . '\','; |
|
| 46 | - } |
|
| 47 | - $lines[] = ' \'formula\' => \'' . $lc->formula . '\','; |
|
| 48 | - $lines[] = ' \'plurals\' => ' . count($lc->categories) . ','; |
|
| 49 | - $catNames = array(); |
|
| 50 | - foreach ($lc->categories as $c) { |
|
| 51 | - $catNames[] = "'{$c->id}'"; |
|
| 52 | - } |
|
| 53 | - $lines[] = ' \'cases\' => [' . implode(', ', $catNames) . '],'; |
|
| 54 | - $lines[] = ' \'examples\' => {'; |
|
| 55 | - foreach ($lc->categories as $c) { |
|
| 56 | - $lines[] = ' \'' . $c->id . '\' => \'' . $c->examples . '\','; |
|
| 57 | - } |
|
| 58 | - $lines[] = ' },'; |
|
| 59 | - $lines[] = ' },'; |
|
| 60 | - } |
|
| 61 | - $lines[] = '}'; |
|
| 62 | - $lines[] = ''; |
|
| 23 | + /** |
|
| 24 | + * {@inheritdoc} |
|
| 25 | + * |
|
| 26 | + * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
|
| 27 | + */ |
|
| 28 | + protected static function toStringDo($languages) |
|
| 29 | + { |
|
| 30 | + $lines = array(); |
|
| 31 | + $lines[] = 'PLURAL_RULES = {'; |
|
| 32 | + foreach ($languages as $lc) { |
|
| 33 | + $lines[] = ' \'' . $lc->id . '\' => {'; |
|
| 34 | + $lines[] = ' \'name\' => \'' . addslashes($lc->name) . '\','; |
|
| 35 | + if (isset($lc->supersededBy)) { |
|
| 36 | + $lines[] = ' \'supersededBy\' => \'' . $lc->supersededBy . '\','; |
|
| 37 | + } |
|
| 38 | + if (isset($lc->script)) { |
|
| 39 | + $lines[] = ' \'script\' => \'' . addslashes($lc->script) . '\','; |
|
| 40 | + } |
|
| 41 | + if (isset($lc->territory)) { |
|
| 42 | + $lines[] = ' \'territory\' => \'' . addslashes($lc->territory) . '\','; |
|
| 43 | + } |
|
| 44 | + if (isset($lc->baseLanguage)) { |
|
| 45 | + $lines[] = ' \'baseLanguage\' => \'' . addslashes($lc->baseLanguage) . '\','; |
|
| 46 | + } |
|
| 47 | + $lines[] = ' \'formula\' => \'' . $lc->formula . '\','; |
|
| 48 | + $lines[] = ' \'plurals\' => ' . count($lc->categories) . ','; |
|
| 49 | + $catNames = array(); |
|
| 50 | + foreach ($lc->categories as $c) { |
|
| 51 | + $catNames[] = "'{$c->id}'"; |
|
| 52 | + } |
|
| 53 | + $lines[] = ' \'cases\' => [' . implode(', ', $catNames) . '],'; |
|
| 54 | + $lines[] = ' \'examples\' => {'; |
|
| 55 | + foreach ($lc->categories as $c) { |
|
| 56 | + $lines[] = ' \'' . $c->id . '\' => \'' . $c->examples . '\','; |
|
| 57 | + } |
|
| 58 | + $lines[] = ' },'; |
|
| 59 | + $lines[] = ' },'; |
|
| 60 | + } |
|
| 61 | + $lines[] = '}'; |
|
| 62 | + $lines[] = ''; |
|
| 63 | 63 | |
| 64 | - return implode("\n", $lines); |
|
| 65 | - } |
|
| 64 | + return implode("\n", $lines); |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -25,42 +25,42 @@ |
||
| 25 | 25 | * |
| 26 | 26 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
| 27 | 27 | */ |
| 28 | - protected static function toStringDo($languages) |
|
| 28 | + protected static function toStringDo( $languages ) |
|
| 29 | 29 | { |
| 30 | 30 | $lines = array(); |
| 31 | - $lines[] = 'PLURAL_RULES = {'; |
|
| 32 | - foreach ($languages as $lc) { |
|
| 33 | - $lines[] = ' \'' . $lc->id . '\' => {'; |
|
| 34 | - $lines[] = ' \'name\' => \'' . addslashes($lc->name) . '\','; |
|
| 35 | - if (isset($lc->supersededBy)) { |
|
| 36 | - $lines[] = ' \'supersededBy\' => \'' . $lc->supersededBy . '\','; |
|
| 31 | + $lines[ ] = 'PLURAL_RULES = {'; |
|
| 32 | + foreach ( $languages as $lc ) { |
|
| 33 | + $lines[ ] = ' \'' . $lc->id . '\' => {'; |
|
| 34 | + $lines[ ] = ' \'name\' => \'' . addslashes( $lc->name ) . '\','; |
|
| 35 | + if ( isset( $lc->supersededBy ) ) { |
|
| 36 | + $lines[ ] = ' \'supersededBy\' => \'' . $lc->supersededBy . '\','; |
|
| 37 | 37 | } |
| 38 | - if (isset($lc->script)) { |
|
| 39 | - $lines[] = ' \'script\' => \'' . addslashes($lc->script) . '\','; |
|
| 38 | + if ( isset( $lc->script ) ) { |
|
| 39 | + $lines[ ] = ' \'script\' => \'' . addslashes( $lc->script ) . '\','; |
|
| 40 | 40 | } |
| 41 | - if (isset($lc->territory)) { |
|
| 42 | - $lines[] = ' \'territory\' => \'' . addslashes($lc->territory) . '\','; |
|
| 41 | + if ( isset( $lc->territory ) ) { |
|
| 42 | + $lines[ ] = ' \'territory\' => \'' . addslashes( $lc->territory ) . '\','; |
|
| 43 | 43 | } |
| 44 | - if (isset($lc->baseLanguage)) { |
|
| 45 | - $lines[] = ' \'baseLanguage\' => \'' . addslashes($lc->baseLanguage) . '\','; |
|
| 44 | + if ( isset( $lc->baseLanguage ) ) { |
|
| 45 | + $lines[ ] = ' \'baseLanguage\' => \'' . addslashes( $lc->baseLanguage ) . '\','; |
|
| 46 | 46 | } |
| 47 | - $lines[] = ' \'formula\' => \'' . $lc->formula . '\','; |
|
| 48 | - $lines[] = ' \'plurals\' => ' . count($lc->categories) . ','; |
|
| 47 | + $lines[ ] = ' \'formula\' => \'' . $lc->formula . '\','; |
|
| 48 | + $lines[ ] = ' \'plurals\' => ' . count( $lc->categories ) . ','; |
|
| 49 | 49 | $catNames = array(); |
| 50 | - foreach ($lc->categories as $c) { |
|
| 51 | - $catNames[] = "'{$c->id}'"; |
|
| 50 | + foreach ( $lc->categories as $c ) { |
|
| 51 | + $catNames[ ] = "'{$c->id}'"; |
|
| 52 | 52 | } |
| 53 | - $lines[] = ' \'cases\' => [' . implode(', ', $catNames) . '],'; |
|
| 54 | - $lines[] = ' \'examples\' => {'; |
|
| 55 | - foreach ($lc->categories as $c) { |
|
| 56 | - $lines[] = ' \'' . $c->id . '\' => \'' . $c->examples . '\','; |
|
| 53 | + $lines[ ] = ' \'cases\' => [' . implode( ', ', $catNames ) . '],'; |
|
| 54 | + $lines[ ] = ' \'examples\' => {'; |
|
| 55 | + foreach ( $lc->categories as $c ) { |
|
| 56 | + $lines[ ] = ' \'' . $c->id . '\' => \'' . $c->examples . '\','; |
|
| 57 | 57 | } |
| 58 | - $lines[] = ' },'; |
|
| 59 | - $lines[] = ' },'; |
|
| 58 | + $lines[ ] = ' },'; |
|
| 59 | + $lines[ ] = ' },'; |
|
| 60 | 60 | } |
| 61 | - $lines[] = '}'; |
|
| 62 | - $lines[] = ''; |
|
| 61 | + $lines[ ] = '}'; |
|
| 62 | + $lines[ ] = ''; |
|
| 63 | 63 | |
| 64 | - return implode("\n", $lines); |
|
| 64 | + return implode( "\n", $lines ); |
|
| 65 | 65 | } |
| 66 | 66 | } |
@@ -8,15 +8,13 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | namespace GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter; |
| 10 | 10 | |
| 11 | -class Ruby extends Exporter |
|
| 12 | -{ |
|
| 11 | +class Ruby extends Exporter { |
|
| 13 | 12 | /** |
| 14 | 13 | * {@inheritdoc} |
| 15 | 14 | * |
| 16 | 15 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
| 17 | 16 | */ |
| 18 | - public static function getDescription() |
|
| 19 | - { |
|
| 17 | + public static function getDescription() { |
|
| 20 | 18 | return 'Build a Ruby hash'; |
| 21 | 19 | } |
| 22 | 20 | |
@@ -25,8 +23,7 @@ discard block |
||
| 25 | 23 | * |
| 26 | 24 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
| 27 | 25 | */ |
| 28 | - protected static function toStringDo($languages) |
|
| 29 | - { |
|
| 26 | + protected static function toStringDo($languages) { |
|
| 30 | 27 | $lines = array(); |
| 31 | 28 | $lines[] = 'PLURAL_RULES = {'; |
| 32 | 29 | foreach ($languages as $lc) { |
@@ -10,68 +10,68 @@ |
||
| 10 | 10 | |
| 11 | 11 | class Json extends Exporter |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * {@inheritdoc} |
|
| 15 | - * |
|
| 16 | - * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
|
| 17 | - */ |
|
| 18 | - public static function getDescription() |
|
| 19 | - { |
|
| 20 | - return 'Build a compressed JSON-encoded file'; |
|
| 21 | - } |
|
| 13 | + /** |
|
| 14 | + * {@inheritdoc} |
|
| 15 | + * |
|
| 16 | + * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
|
| 17 | + */ |
|
| 18 | + public static function getDescription() |
|
| 19 | + { |
|
| 20 | + return 'Build a compressed JSON-encoded file'; |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Return the options for json_encode. |
|
| 25 | - * |
|
| 26 | - * @return int |
|
| 27 | - */ |
|
| 28 | - protected static function getEncodeOptions() |
|
| 29 | - { |
|
| 30 | - $result = 0; |
|
| 31 | - if (defined('\JSON_UNESCAPED_SLASHES')) { |
|
| 32 | - $result |= \JSON_UNESCAPED_SLASHES; |
|
| 33 | - } |
|
| 34 | - if (defined('\JSON_UNESCAPED_UNICODE')) { |
|
| 35 | - $result |= \JSON_UNESCAPED_UNICODE; |
|
| 36 | - } |
|
| 23 | + /** |
|
| 24 | + * Return the options for json_encode. |
|
| 25 | + * |
|
| 26 | + * @return int |
|
| 27 | + */ |
|
| 28 | + protected static function getEncodeOptions() |
|
| 29 | + { |
|
| 30 | + $result = 0; |
|
| 31 | + if (defined('\JSON_UNESCAPED_SLASHES')) { |
|
| 32 | + $result |= \JSON_UNESCAPED_SLASHES; |
|
| 33 | + } |
|
| 34 | + if (defined('\JSON_UNESCAPED_UNICODE')) { |
|
| 35 | + $result |= \JSON_UNESCAPED_UNICODE; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - return $result; |
|
| 39 | - } |
|
| 38 | + return $result; |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * {@inheritdoc} |
|
| 43 | - * |
|
| 44 | - * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
|
| 45 | - */ |
|
| 46 | - protected static function toStringDo($languages) |
|
| 47 | - { |
|
| 48 | - $list = array(); |
|
| 49 | - foreach ($languages as $language) { |
|
| 50 | - $item = array(); |
|
| 51 | - $item['name'] = $language->name; |
|
| 52 | - if (isset($language->supersededBy)) { |
|
| 53 | - $item['supersededBy'] = $language->supersededBy; |
|
| 54 | - } |
|
| 55 | - if (isset($language->script)) { |
|
| 56 | - $item['script'] = $language->script; |
|
| 57 | - } |
|
| 58 | - if (isset($language->territory)) { |
|
| 59 | - $item['territory'] = $language->territory; |
|
| 60 | - } |
|
| 61 | - if (isset($language->baseLanguage)) { |
|
| 62 | - $item['baseLanguage'] = $language->baseLanguage; |
|
| 63 | - } |
|
| 64 | - $item['formula'] = $language->formula; |
|
| 65 | - $item['plurals'] = count($language->categories); |
|
| 66 | - $item['cases'] = array(); |
|
| 67 | - $item['examples'] = array(); |
|
| 68 | - foreach ($language->categories as $category) { |
|
| 69 | - $item['cases'][] = $category->id; |
|
| 70 | - $item['examples'][$category->id] = $category->examples; |
|
| 71 | - } |
|
| 72 | - $list[$language->id] = $item; |
|
| 73 | - } |
|
| 41 | + /** |
|
| 42 | + * {@inheritdoc} |
|
| 43 | + * |
|
| 44 | + * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
|
| 45 | + */ |
|
| 46 | + protected static function toStringDo($languages) |
|
| 47 | + { |
|
| 48 | + $list = array(); |
|
| 49 | + foreach ($languages as $language) { |
|
| 50 | + $item = array(); |
|
| 51 | + $item['name'] = $language->name; |
|
| 52 | + if (isset($language->supersededBy)) { |
|
| 53 | + $item['supersededBy'] = $language->supersededBy; |
|
| 54 | + } |
|
| 55 | + if (isset($language->script)) { |
|
| 56 | + $item['script'] = $language->script; |
|
| 57 | + } |
|
| 58 | + if (isset($language->territory)) { |
|
| 59 | + $item['territory'] = $language->territory; |
|
| 60 | + } |
|
| 61 | + if (isset($language->baseLanguage)) { |
|
| 62 | + $item['baseLanguage'] = $language->baseLanguage; |
|
| 63 | + } |
|
| 64 | + $item['formula'] = $language->formula; |
|
| 65 | + $item['plurals'] = count($language->categories); |
|
| 66 | + $item['cases'] = array(); |
|
| 67 | + $item['examples'] = array(); |
|
| 68 | + foreach ($language->categories as $category) { |
|
| 69 | + $item['cases'][] = $category->id; |
|
| 70 | + $item['examples'][$category->id] = $category->examples; |
|
| 71 | + } |
|
| 72 | + $list[$language->id] = $item; |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - return json_encode($list, static::getEncodeOptions()); |
|
| 76 | - } |
|
| 75 | + return json_encode($list, static::getEncodeOptions()); |
|
| 76 | + } |
|
| 77 | 77 | } |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | protected static function getEncodeOptions() |
| 29 | 29 | { |
| 30 | 30 | $result = 0; |
| 31 | - if (defined('\JSON_UNESCAPED_SLASHES')) { |
|
| 31 | + if ( defined( '\JSON_UNESCAPED_SLASHES' ) ) { |
|
| 32 | 32 | $result |= \JSON_UNESCAPED_SLASHES; |
| 33 | 33 | } |
| 34 | - if (defined('\JSON_UNESCAPED_UNICODE')) { |
|
| 34 | + if ( defined( '\JSON_UNESCAPED_UNICODE' ) ) { |
|
| 35 | 35 | $result |= \JSON_UNESCAPED_UNICODE; |
| 36 | 36 | } |
| 37 | 37 | |
@@ -43,35 +43,35 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
| 45 | 45 | */ |
| 46 | - protected static function toStringDo($languages) |
|
| 46 | + protected static function toStringDo( $languages ) |
|
| 47 | 47 | { |
| 48 | 48 | $list = array(); |
| 49 | - foreach ($languages as $language) { |
|
| 49 | + foreach ( $languages as $language ) { |
|
| 50 | 50 | $item = array(); |
| 51 | - $item['name'] = $language->name; |
|
| 52 | - if (isset($language->supersededBy)) { |
|
| 53 | - $item['supersededBy'] = $language->supersededBy; |
|
| 51 | + $item[ 'name' ] = $language->name; |
|
| 52 | + if ( isset( $language->supersededBy ) ) { |
|
| 53 | + $item[ 'supersededBy' ] = $language->supersededBy; |
|
| 54 | 54 | } |
| 55 | - if (isset($language->script)) { |
|
| 56 | - $item['script'] = $language->script; |
|
| 55 | + if ( isset( $language->script ) ) { |
|
| 56 | + $item[ 'script' ] = $language->script; |
|
| 57 | 57 | } |
| 58 | - if (isset($language->territory)) { |
|
| 59 | - $item['territory'] = $language->territory; |
|
| 58 | + if ( isset( $language->territory ) ) { |
|
| 59 | + $item[ 'territory' ] = $language->territory; |
|
| 60 | 60 | } |
| 61 | - if (isset($language->baseLanguage)) { |
|
| 62 | - $item['baseLanguage'] = $language->baseLanguage; |
|
| 61 | + if ( isset( $language->baseLanguage ) ) { |
|
| 62 | + $item[ 'baseLanguage' ] = $language->baseLanguage; |
|
| 63 | 63 | } |
| 64 | - $item['formula'] = $language->formula; |
|
| 65 | - $item['plurals'] = count($language->categories); |
|
| 66 | - $item['cases'] = array(); |
|
| 67 | - $item['examples'] = array(); |
|
| 68 | - foreach ($language->categories as $category) { |
|
| 69 | - $item['cases'][] = $category->id; |
|
| 70 | - $item['examples'][$category->id] = $category->examples; |
|
| 64 | + $item[ 'formula' ] = $language->formula; |
|
| 65 | + $item[ 'plurals' ] = count( $language->categories ); |
|
| 66 | + $item[ 'cases' ] = array(); |
|
| 67 | + $item[ 'examples' ] = array(); |
|
| 68 | + foreach ( $language->categories as $category ) { |
|
| 69 | + $item[ 'cases' ][ ] = $category->id; |
|
| 70 | + $item[ 'examples' ][ $category->id ] = $category->examples; |
|
| 71 | 71 | } |
| 72 | - $list[$language->id] = $item; |
|
| 72 | + $list[ $language->id ] = $item; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - return json_encode($list, static::getEncodeOptions()); |
|
| 75 | + return json_encode( $list, static::getEncodeOptions() ); |
|
| 76 | 76 | } |
| 77 | 77 | } |
@@ -8,15 +8,13 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | namespace GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter; |
| 10 | 10 | |
| 11 | -class Json extends Exporter |
|
| 12 | -{ |
|
| 11 | +class Json extends Exporter { |
|
| 13 | 12 | /** |
| 14 | 13 | * {@inheritdoc} |
| 15 | 14 | * |
| 16 | 15 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::getDescription() |
| 17 | 16 | */ |
| 18 | - public static function getDescription() |
|
| 19 | - { |
|
| 17 | + public static function getDescription() { |
|
| 20 | 18 | return 'Build a compressed JSON-encoded file'; |
| 21 | 19 | } |
| 22 | 20 | |
@@ -25,8 +23,7 @@ discard block |
||
| 25 | 23 | * |
| 26 | 24 | * @return int |
| 27 | 25 | */ |
| 28 | - protected static function getEncodeOptions() |
|
| 29 | - { |
|
| 26 | + protected static function getEncodeOptions() { |
|
| 30 | 27 | $result = 0; |
| 31 | 28 | if (defined('\JSON_UNESCAPED_SLASHES')) { |
| 32 | 29 | $result |= \JSON_UNESCAPED_SLASHES; |
@@ -43,8 +40,7 @@ discard block |
||
| 43 | 40 | * |
| 44 | 41 | * @see \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Exporter\Exporter::toStringDo() |
| 45 | 42 | */ |
| 46 | - protected static function toStringDo($languages) |
|
| 47 | - { |
|
| 43 | + protected static function toStringDo($languages) { |
|
| 48 | 44 | $list = array(); |
| 49 | 45 | foreach ($languages as $language) { |
| 50 | 46 | $item = array(); |
@@ -15,145 +15,145 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | abstract class Exporter |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * @var array |
|
| 20 | - */ |
|
| 21 | - private static $exporters; |
|
| 18 | + /** |
|
| 19 | + * @var array |
|
| 20 | + */ |
|
| 21 | + private static $exporters; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Return the list of all the available exporters. Keys are the exporter handles, values are the exporter class names. |
|
| 25 | - * |
|
| 26 | - * @param bool $onlyForPublicUse if true, internal exporters will be omitted |
|
| 27 | - * |
|
| 28 | - * @return string[] |
|
| 29 | - */ |
|
| 30 | - final public static function getExporters($onlyForPublicUse = false) |
|
| 31 | - { |
|
| 32 | - if (!isset(self::$exporters)) { |
|
| 33 | - $exporters = array(); |
|
| 34 | - $m = null; |
|
| 35 | - foreach (scandir(__DIR__) as $f) { |
|
| 36 | - if (preg_match('/^(\w+)\.php$/', $f, $m)) { |
|
| 37 | - if ($f !== basename(__FILE__)) { |
|
| 38 | - $exporters[strtolower($m[1])] = $m[1]; |
|
| 39 | - } |
|
| 40 | - } |
|
| 41 | - } |
|
| 42 | - self::$exporters = $exporters; |
|
| 43 | - } |
|
| 44 | - if ($onlyForPublicUse) { |
|
| 45 | - $result = array(); |
|
| 46 | - foreach (self::$exporters as $handle => $class) { |
|
| 47 | - if (call_user_func(self::getExporterClassName($handle) . '::isForPublicUse') === true) { |
|
| 48 | - $result[$handle] = $class; |
|
| 49 | - } |
|
| 50 | - } |
|
| 51 | - } else { |
|
| 52 | - $result = self::$exporters; |
|
| 53 | - } |
|
| 23 | + /** |
|
| 24 | + * Return the list of all the available exporters. Keys are the exporter handles, values are the exporter class names. |
|
| 25 | + * |
|
| 26 | + * @param bool $onlyForPublicUse if true, internal exporters will be omitted |
|
| 27 | + * |
|
| 28 | + * @return string[] |
|
| 29 | + */ |
|
| 30 | + final public static function getExporters($onlyForPublicUse = false) |
|
| 31 | + { |
|
| 32 | + if (!isset(self::$exporters)) { |
|
| 33 | + $exporters = array(); |
|
| 34 | + $m = null; |
|
| 35 | + foreach (scandir(__DIR__) as $f) { |
|
| 36 | + if (preg_match('/^(\w+)\.php$/', $f, $m)) { |
|
| 37 | + if ($f !== basename(__FILE__)) { |
|
| 38 | + $exporters[strtolower($m[1])] = $m[1]; |
|
| 39 | + } |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | + self::$exporters = $exporters; |
|
| 43 | + } |
|
| 44 | + if ($onlyForPublicUse) { |
|
| 45 | + $result = array(); |
|
| 46 | + foreach (self::$exporters as $handle => $class) { |
|
| 47 | + if (call_user_func(self::getExporterClassName($handle) . '::isForPublicUse') === true) { |
|
| 48 | + $result[$handle] = $class; |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | + } else { |
|
| 52 | + $result = self::$exporters; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - return $result; |
|
| 56 | - } |
|
| 55 | + return $result; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * Return the description of a specific exporter. |
|
| 60 | - * |
|
| 61 | - * @param string $exporterHandle the handle of the exporter |
|
| 62 | - * |
|
| 63 | - * @throws \Exception throws an Exception if $exporterHandle is not valid |
|
| 64 | - * |
|
| 65 | - * @return string |
|
| 66 | - */ |
|
| 67 | - final public static function getExporterDescription($exporterHandle) |
|
| 68 | - { |
|
| 69 | - $exporters = self::getExporters(); |
|
| 70 | - if (!isset($exporters[$exporterHandle])) { |
|
| 71 | - throw new Exception("Invalid exporter handle: '{$exporterHandle}'"); |
|
| 72 | - } |
|
| 58 | + /** |
|
| 59 | + * Return the description of a specific exporter. |
|
| 60 | + * |
|
| 61 | + * @param string $exporterHandle the handle of the exporter |
|
| 62 | + * |
|
| 63 | + * @throws \Exception throws an Exception if $exporterHandle is not valid |
|
| 64 | + * |
|
| 65 | + * @return string |
|
| 66 | + */ |
|
| 67 | + final public static function getExporterDescription($exporterHandle) |
|
| 68 | + { |
|
| 69 | + $exporters = self::getExporters(); |
|
| 70 | + if (!isset($exporters[$exporterHandle])) { |
|
| 71 | + throw new Exception("Invalid exporter handle: '{$exporterHandle}'"); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - return call_user_func(self::getExporterClassName($exporterHandle) . '::getDescription'); |
|
| 75 | - } |
|
| 74 | + return call_user_func(self::getExporterClassName($exporterHandle) . '::getDescription'); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * Returns the fully qualified class name of a exporter given its handle. |
|
| 79 | - * |
|
| 80 | - * @param string $exporterHandle the exporter class handle |
|
| 81 | - * |
|
| 82 | - * @return string |
|
| 83 | - */ |
|
| 84 | - final public static function getExporterClassName($exporterHandle) |
|
| 85 | - { |
|
| 86 | - return __NAMESPACE__ . '\\' . ucfirst(strtolower($exporterHandle)); |
|
| 87 | - } |
|
| 77 | + /** |
|
| 78 | + * Returns the fully qualified class name of a exporter given its handle. |
|
| 79 | + * |
|
| 80 | + * @param string $exporterHandle the exporter class handle |
|
| 81 | + * |
|
| 82 | + * @return string |
|
| 83 | + */ |
|
| 84 | + final public static function getExporterClassName($exporterHandle) |
|
| 85 | + { |
|
| 86 | + return __NAMESPACE__ . '\\' . ucfirst(strtolower($exporterHandle)); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * Convert a list of Language instances to string. |
|
| 91 | - * |
|
| 92 | - * @param \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Language[] $languages the Language instances to convert |
|
| 93 | - * @param array|null $options |
|
| 94 | - * |
|
| 95 | - * @return string |
|
| 96 | - */ |
|
| 97 | - final public static function toString($languages, $options = null) |
|
| 98 | - { |
|
| 99 | - if (isset($options) && is_array($options)) { |
|
| 100 | - if (isset($options['us-ascii']) && $options['us-ascii']) { |
|
| 101 | - $asciiList = array(); |
|
| 102 | - foreach ($languages as $language) { |
|
| 103 | - $asciiList[] = $language->getUSAsciiClone(); |
|
| 104 | - } |
|
| 105 | - $languages = $asciiList; |
|
| 106 | - } |
|
| 107 | - } |
|
| 89 | + /** |
|
| 90 | + * Convert a list of Language instances to string. |
|
| 91 | + * |
|
| 92 | + * @param \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Language[] $languages the Language instances to convert |
|
| 93 | + * @param array|null $options |
|
| 94 | + * |
|
| 95 | + * @return string |
|
| 96 | + */ |
|
| 97 | + final public static function toString($languages, $options = null) |
|
| 98 | + { |
|
| 99 | + if (isset($options) && is_array($options)) { |
|
| 100 | + if (isset($options['us-ascii']) && $options['us-ascii']) { |
|
| 101 | + $asciiList = array(); |
|
| 102 | + foreach ($languages as $language) { |
|
| 103 | + $asciiList[] = $language->getUSAsciiClone(); |
|
| 104 | + } |
|
| 105 | + $languages = $asciiList; |
|
| 106 | + } |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - return static::toStringDo($languages); |
|
| 110 | - } |
|
| 109 | + return static::toStringDo($languages); |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * Save the Language instances to a file. |
|
| 114 | - * |
|
| 115 | - * @param \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Language[] $languages the Language instances to convert |
|
| 116 | - * @param array|null $options |
|
| 117 | - * |
|
| 118 | - * @throws \Exception |
|
| 119 | - */ |
|
| 120 | - final public static function toFile($languages, $filename, $options = null) |
|
| 121 | - { |
|
| 122 | - $data = self::toString($languages, $options); |
|
| 123 | - if (@file_put_contents($filename, $data) === false) { |
|
| 124 | - throw new Exception("Error writing data to '{$filename}'"); |
|
| 125 | - } |
|
| 126 | - } |
|
| 112 | + /** |
|
| 113 | + * Save the Language instances to a file. |
|
| 114 | + * |
|
| 115 | + * @param \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Language[] $languages the Language instances to convert |
|
| 116 | + * @param array|null $options |
|
| 117 | + * |
|
| 118 | + * @throws \Exception |
|
| 119 | + */ |
|
| 120 | + final public static function toFile($languages, $filename, $options = null) |
|
| 121 | + { |
|
| 122 | + $data = self::toString($languages, $options); |
|
| 123 | + if (@file_put_contents($filename, $data) === false) { |
|
| 124 | + throw new Exception("Error writing data to '{$filename}'"); |
|
| 125 | + } |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - /** |
|
| 129 | - * Is this exporter for public use? |
|
| 130 | - * |
|
| 131 | - * @return bool |
|
| 132 | - */ |
|
| 133 | - public static function isForPublicUse() |
|
| 134 | - { |
|
| 135 | - return true; |
|
| 136 | - } |
|
| 128 | + /** |
|
| 129 | + * Is this exporter for public use? |
|
| 130 | + * |
|
| 131 | + * @return bool |
|
| 132 | + */ |
|
| 133 | + public static function isForPublicUse() |
|
| 134 | + { |
|
| 135 | + return true; |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - /** |
|
| 139 | - * Return a short description of the exporter. |
|
| 140 | - * |
|
| 141 | - * @return string |
|
| 142 | - */ |
|
| 143 | - public static function getDescription() |
|
| 144 | - { |
|
| 145 | - throw new Exception(get_called_class() . ' does not implement the method ' . __FUNCTION__); |
|
| 146 | - } |
|
| 138 | + /** |
|
| 139 | + * Return a short description of the exporter. |
|
| 140 | + * |
|
| 141 | + * @return string |
|
| 142 | + */ |
|
| 143 | + public static function getDescription() |
|
| 144 | + { |
|
| 145 | + throw new Exception(get_called_class() . ' does not implement the method ' . __FUNCTION__); |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - /** |
|
| 149 | - * Convert a list of Language instances to string. |
|
| 150 | - * |
|
| 151 | - * @param \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Language[] $languages the Language instances to convert |
|
| 152 | - * |
|
| 153 | - * @return string |
|
| 154 | - */ |
|
| 155 | - protected static function toStringDo($languages) |
|
| 156 | - { |
|
| 157 | - throw new Exception(get_called_class() . ' does not implement the method ' . __FUNCTION__); |
|
| 158 | - } |
|
| 148 | + /** |
|
| 149 | + * Convert a list of Language instances to string. |
|
| 150 | + * |
|
| 151 | + * @param \GravityKit\GravityView\Foundation\ThirdParty\Gettext\Languages\Language[] $languages the Language instances to convert |
|
| 152 | + * |
|
| 153 | + * @return string |
|
| 154 | + */ |
|
| 155 | + protected static function toStringDo($languages) |
|
| 156 | + { |
|
| 157 | + throw new Exception(get_called_class() . ' does not implement the method ' . __FUNCTION__); |
|
| 158 | + } |
|
| 159 | 159 | } |