X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Ftranslation%2FMessageSelector.php;h=5de171c5f4a408c84d7b85453be7c271d69980ea;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=c6134191bce084acaea696f2037a6018bd0e0c72;hpb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;p=yaffs-website diff --git a/vendor/symfony/translation/MessageSelector.php b/vendor/symfony/translation/MessageSelector.php index c6134191b..5de171c5f 100644 --- a/vendor/symfony/translation/MessageSelector.php +++ b/vendor/symfony/translation/MessageSelector.php @@ -49,10 +49,16 @@ class MessageSelector */ public function choose($message, $number, $locale) { - preg_match_all('/(?:\|\||[^\|])++/', $message, $parts); + $parts = array(); + if (preg_match('/^\|++$/', $message)) { + $parts = explode('|', $message); + } elseif (preg_match_all('/(?:\|\||[^\|])++/', $message, $matches)) { + $parts = $matches[0]; + } + $explicitRules = array(); $standardRules = array(); - foreach ($parts[0] as $part) { + foreach ($parts as $part) { $part = trim(str_replace('||', '|', $part)); if (preg_match('/^(?P'.Interval::getIntervalRegexp().')\s*(?P.*?)$/xs', $part, $matches)) { @@ -76,7 +82,7 @@ class MessageSelector if (!isset($standardRules[$position])) { // when there's exactly one rule given, and that rule is a standard // rule, use this rule - if (1 === count($parts[0]) && isset($standardRules[0])) { + if (1 === \count($parts) && isset($standardRules[0])) { return $standardRules[0]; }