1<?php
2
3namespace Drupal\locale;
4
5/**
6 * An interface for a service providing plural formulae.
7 */
8interface PluralFormulaInterface {
9
10  /**
11   * @param string $langcode
12   *   The language code to get the formula for.
13   * @param int $plural_count
14   *   The number of plural forms.
15   * @param array $formula
16   *   An array of formulae.
17   *
18   * @return self
19   *   The PluralFormula object.
20   */
21  public function setPluralFormula($langcode, $plural_count, array $formula);
22
23  /**
24   * Returns the number of plurals supported by a given language.
25   *
26   * @param null|string $langcode
27   *   (optional) The language code. If not provided, the current language
28   *   will be used.
29   *
30   * @return int
31   *   Number of plural variants supported by the given language.
32   */
33  public function getNumberOfPlurals($langcode = NULL);
34
35  /**
36   * Gets the plural formula for a langcode.
37   *
38   * @param string $langcode
39   *   The language code to get the formula for.
40   *
41   * @return array
42   *   An array of formulae.
43   */
44  public function getFormula($langcode);
45
46  /**
47   * Resets the static formulae cache.
48   *
49   * @return self
50   *   The PluralFormula object.
51   */
52  public function reset();
53
54}
55