Repository navigation
Expand file tree
/
Copy pathRUtils.php
More file actions
75 lines (67 loc) · 1.59 KB
/
Copy pathRUtils.php
File metadata and controls
75 lines (67 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
namespace php_rutils;
class RUtils
{
const MALE = 1; //sex - male
const FEMALE = 2; //sex - female
const NEUTER = 3; //sex - neuter
/**
* Default encoding for multibyte strings
* @var string
*/
public static $encoding = 'UTF-8';
private static $_numeral;
private static $_dt;
private static $_translit;
private static $_typo;
/**
* Plural forms and in-word representation for numerals
* @return \php_rutils\Numeral
*/
public static function numeral()
{
if (self::$_numeral === null)
self::$_numeral = new Numeral();
return self::$_numeral;
}
/**
* Russian dates without locales
* @return \php_rutils\Dt
*/
public static function dt()
{
if (self::$_dt === null)
self::$_dt = new Dt();
return self::$_dt;
}
/**
* Simple transliteration
* @return \php_rutils\Translit
*/
public static function translit()
{
if (self::$_translit === null)
self::$_translit = new Translit();
return self::$_translit;
}
/**
* Russian typography
* @return \php_rutils\Typo
*/
public static function typo()
{
if (self::$_typo === null)
self::$_typo = new Typo();
return self::$_typo;
}
/**
* Format number with russian locale
* @param float $number
* @param int $decimals
* @return string
*/
public static function formatNumber($number, $decimals=0)
{
return number_format($number, $decimals, ',', ' ');
}
}