AbstractTranslator::get()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
ccs 0
cts 0
cp 0
c 0
b 0
f 0
nc 1
1
<?php
2
/**
3
 * Part of the Joomla Framework DateTime Package
4
 *
5
 * @copyright  Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
6
 * @license    GNU Lesser General Public License version 2.1 or later; see LICENSE
7
 */
8
9
namespace Joomla\DateTime\Translator;
10
11
/**
12
 * Base Translator class.
13
 *
14
 * @since  2.0.0
15
 */
16
abstract class AbstractTranslator
17
{
18
	/**
19
	 * The locale to use.
20
	 *
21
	 * @var    string
22
	 * @since  2.0.0
23
	 */
24
	protected $locale = 'en';
25
26
	/**
27
	 * Sets the locale.
28
	 *
29
	 * @param   string  $locale  The locale to set.
30
	 *
31
	 * @return  void
32
	 *
33
	 * @since   2.0.0
34
	 */
35 279
	public function setLocale($locale)
36
	{
37 279
		$this->locale = $locale;
38 279
	}
39
40
	/**
41
	 * Returns a translated item.
42
	 *
43
	 * @param   string  $item     The item to translate.
44
	 * @param   array   $replace  An replace array.
45
	 *
46
	 * @return  string
47
	 *
48
	 * @since   2.0.0
49
	 */
50
	abstract public function get($item, array $replace = array());
51
52
	/**
53
	 * Returns a translated item with a proper form for pluralization.
54
	 *
55
	 * @param   string   $item     The item to translate.
56
	 * @param   integer  $number   Number of items for pluralization.
57
	 * @param   array    $replace  An replace array.
58
	 *
59
	 * @return  string
60
	 *
61
	 * @since   2.0.0
62
	 */
63
	abstract public function choice($item, $number, array $replace = array());
64
}
65