mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-03-22 13:10:41 +08:00
phpdoc improvements, fixes #1036
This commit is contained in:
parent
53d2d3334d
commit
5f00587d71
|
@ -55,7 +55,6 @@ class Database extends AbstractData
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $options
|
* @param array $options
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public function __construct(array $options)
|
public function __construct(array $options)
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,7 +66,6 @@ class Filesystem extends AbstractData
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $options
|
* @param array $options
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public function __construct(array $options)
|
public function __construct(array $options)
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,6 @@ class GoogleCloudStorage extends AbstractData
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $options
|
* @param array $options
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public function __construct(array $options)
|
public function __construct(array $options)
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,7 +78,6 @@ class S3Storage extends AbstractData
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $options
|
* @param array $options
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public function __construct(array $options)
|
public function __construct(array $options)
|
||||||
{
|
{
|
||||||
|
|
14
lib/I18n.php
14
lib/I18n.php
|
@ -85,7 +85,7 @@ class I18n
|
||||||
* @param mixed $args one or multiple parameters injected into placeholders
|
* @param mixed $args one or multiple parameters injected into placeholders
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function _($messageId)
|
public static function _($messageId, ...$args)
|
||||||
{
|
{
|
||||||
return forward_static_call_array('PrivateBin\I18n::translate', func_get_args());
|
return forward_static_call_array('PrivateBin\I18n::translate', func_get_args());
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ class I18n
|
||||||
* @param mixed $args one or multiple parameters injected into placeholders
|
* @param mixed $args one or multiple parameters injected into placeholders
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function translate($messageId)
|
public static function translate($messageId, ...$args)
|
||||||
{
|
{
|
||||||
if (empty($messageId)) {
|
if (empty($messageId)) {
|
||||||
return $messageId;
|
return $messageId;
|
||||||
|
@ -114,7 +114,7 @@ class I18n
|
||||||
if (!array_key_exists($messageId, self::$_translations)) {
|
if (!array_key_exists($messageId, self::$_translations)) {
|
||||||
self::$_translations[$messageId] = $messages;
|
self::$_translations[$messageId] = $messages;
|
||||||
}
|
}
|
||||||
$args = func_get_args();
|
array_unshift($args, $messageId);
|
||||||
if (is_array(self::$_translations[$messageId])) {
|
if (is_array(self::$_translations[$messageId])) {
|
||||||
$number = (int) $args[1];
|
$number = (int) $args[1];
|
||||||
$key = self::_getPluralForm($number);
|
$key = self::_getPluralForm($number);
|
||||||
|
@ -130,11 +130,9 @@ class I18n
|
||||||
}
|
}
|
||||||
// encode any non-integer arguments and the message ID, if it doesn't contain a link
|
// encode any non-integer arguments and the message ID, if it doesn't contain a link
|
||||||
$argsCount = count($args);
|
$argsCount = count($args);
|
||||||
if ($argsCount > 1) {
|
for ($i = 0; $i < $argsCount; ++$i) {
|
||||||
for ($i = 0; $i < $argsCount; ++$i) {
|
if ($i > 0 ? !is_int($args[$i]) : strpos($args[0], '<a') === false) {
|
||||||
if (($i > 0 && !is_int($args[$i])) || strpos($args[0], '<a') === false) {
|
$args[$i] = self::encode($args[$i]);
|
||||||
$args[$i] = self::encode($args[$i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return call_user_func_array('sprintf', $args);
|
return call_user_func_array('sprintf', $args);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user