Transformer.php 754 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Locale\Stub\DateFormat;
  11. /**
  12. * Parser and formatter for date formats
  13. *
  14. * @author Igor Wiedler <igor@wiedler.ch>
  15. */
  16. abstract class Transformer
  17. {
  18. abstract public function format(\DateTime $dateTime, $length);
  19. abstract public function getReverseMatchingRegExp($length);
  20. abstract public function extractDateOptions($matched, $length);
  21. protected function padLeft($value, $length)
  22. {
  23. return str_pad($value, $length, '0', STR_PAD_LEFT);
  24. }
  25. }