4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Intl\DateFormatter\DateFormat
;
15 * Parser and formatter for the second format
17 * @author Igor Wiedler <igor@wiedler.ch>
19 class SecondTransformer
extends Transformer
24 public function format(\DateTime
$dateTime, $length)
26 $secondOfMinute = (int) $dateTime->format('s');
28 return $this->padLeft($secondOfMinute, $length);
34 public function getReverseMatchingRegExp($length)
36 return 1 === $length ? '\d{1,2}' : '\d{'.$length.'}';
42 public function extractDateOptions($matched, $length)
45 'second' => (int) $matched,