1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Polyfill\Intl\Icu\DateFormat;
13
14/**
15 * Parser and formatter for day of year format.
16 *
17 * @author Igor Wiedler <igor@wiedler.ch>
18 *
19 * @internal
20 */
21class DayOfYearTransformer extends Transformer
22{
23    /**
24     * {@inheritdoc}
25     */
26    public function format(\DateTime $dateTime, int $length): string
27    {
28        $dayOfYear = (int) $dateTime->format('z') + 1;
29
30        return $this->padLeft($dayOfYear, $length);
31    }
32
33    /**
34     * {@inheritdoc}
35     */
36    public function getReverseMatchingRegExp(int $length): string
37    {
38        return '\d{'.$length.'}';
39    }
40
41    /**
42     * {@inheritdoc}
43     */
44    public function extractDateOptions(string $matched, int $length): array
45    {
46        return [];
47    }
48}
49