Address.php
5 years ago
Company.php
5 years ago
DateTime.php
5 years ago
Internet.php
5 years ago
Payment.php
5 years ago
Person.php
5 years ago
PhoneNumber.php
5 years ago
Text.php
5 years ago
DateTime.php
62 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Faker\Provider\cs_CZ; |
| 4 | |
| 5 | /** |
| 6 | * Czech months and days without setting locale |
| 7 | */ |
| 8 | class DateTime extends \Faker\Provider\DateTime |
| 9 | { |
| 10 | protected static $days = array( |
| 11 | 'neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota' |
| 12 | ); |
| 13 | protected static $months = array( |
| 14 | 'leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', |
| 15 | 'srpen', 'září', 'říjen', 'listopad', 'prosinec' |
| 16 | ); |
| 17 | protected static $monthsGenitive = array( |
| 18 | 'ledna', 'února', 'března', 'dubna', 'května', 'června', 'července', |
| 19 | 'srpna', 'září', 'října', 'listopadu', 'prosince' |
| 20 | ); |
| 21 | protected static $formattedDateFormat = array( |
| 22 | '{{dayOfMonth}}. {{monthNameGenitive}} {{year}}', |
| 23 | ); |
| 24 | |
| 25 | public static function monthName($max = 'now') |
| 26 | { |
| 27 | return static::$months[parent::month($max) - 1]; |
| 28 | } |
| 29 | |
| 30 | public static function monthNameGenitive($max = 'now') |
| 31 | { |
| 32 | return static::$monthsGenitive[parent::month($max) - 1]; |
| 33 | } |
| 34 | |
| 35 | public static function dayOfWeek($max = 'now') |
| 36 | { |
| 37 | return static::$days[static::dateTime($max)->format('w')]; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" |
| 42 | * @return string |
| 43 | * @example '2' |
| 44 | */ |
| 45 | public static function dayOfMonth($max = 'now') |
| 46 | { |
| 47 | return static::dateTime($max)->format('j'); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Full date with inflected month |
| 52 | * @return string |
| 53 | * @example '16. listopadu 2003' |
| 54 | */ |
| 55 | public function formattedDate() |
| 56 | { |
| 57 | $format = static::randomElement(static::$formattedDateFormat); |
| 58 | |
| 59 | return $this->generator->parse($format); |
| 60 | } |
| 61 | } |
| 62 |