xref: /dokuwiki/vendor/php81_bc/strftime/src/AbstractLocaleFormatter.php (revision db9267247e06d4aae1a33463c71b2c22d7f7a2a7)
1*db926724SAndreas Gohr<?php
2*db926724SAndreas Gohr
3*db926724SAndreas Gohrnamespace PHP81_BC\strftime;
4*db926724SAndreas Gohr
5*db926724SAndreas Gohruse DateTimeInterface;
6*db926724SAndreas Gohr
7*db926724SAndreas Gohrabstract class AbstractLocaleFormatter {
8*db926724SAndreas Gohr
9*db926724SAndreas Gohr  protected $locale;
10*db926724SAndreas Gohr
11*db926724SAndreas Gohr  /**
12*db926724SAndreas Gohr   * Constructor
13*db926724SAndreas Gohr   *
14*db926724SAndreas Gohr   * @param string $locale The locale to use when formatting
15*db926724SAndreas Gohr   */
16*db926724SAndreas Gohr  public function __construct($locale)
17*db926724SAndreas Gohr  {
18*db926724SAndreas Gohr    $this->locale = $locale;
19*db926724SAndreas Gohr  }
20*db926724SAndreas Gohr
21*db926724SAndreas Gohr  /**
22*db926724SAndreas Gohr   * Format the given local dependent placeholder
23*db926724SAndreas Gohr   *
24*db926724SAndreas Gohr   * @param DateTimeInterface $timestamp
25*db926724SAndreas Gohr   * @param string $format The strftime compatible, locale dependend placeholder
26*db926724SAndreas Gohr   * @throws \RuntimeException when the given place holder is unknown
27*db926724SAndreas Gohr   * @return false|string
28*db926724SAndreas Gohr   */
29*db926724SAndreas Gohr  abstract public function __invoke(DateTimeInterface $timestamp, string $format);
30*db926724SAndreas Gohr
31*db926724SAndreas Gohr}
32