Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 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 = [
11
        'neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota',
12
    ];
13
    protected static $months = [
14
        'leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec',
15
        'srpen', 'září', 'říjen', 'listopad', 'prosinec',
16
    ];
17
    protected static $monthsGenitive = [
18
        'ledna', 'února', 'března', 'dubna', 'května', 'června', 'července',
19
        'srpna', 'září', 'října', 'listopadu', 'prosince',
20
    ];
21
    protected static $formattedDateFormat = [
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
     *
43
     * @return string
44
     *
45
     * @example '2'
46
     */
47
    public static function dayOfMonth($max = 'now')
48
    {
49
        return static::dateTime($max)->format('j');
50
    }
51
 
52
    /**
53
     * Full date with inflected month
54
     *
55
     * @return string
56
     *
57
     * @example '16. listopadu 2003'
58
     */
59
    public function formattedDate()
60
    {
61
        $format = static::randomElement(static::$formattedDateFormat);
62
 
63
        return $this->generator->parse($format);
64
    }
65
}