xref: /webtrees/app/Census/AbstractCensusColumn.php (revision ef21b467575956631eb5374fe4f2bfb94e69aaa9)
1<?php
2/**
3 * webtrees: online genealogy
4 * Copyright (C) 2015 webtrees development team
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16namespace Fisharebest\Webtrees\Census;
17
18use Fisharebest\Webtrees\Date;
19
20/**
21 * Definitions for a census column
22 */
23class AbstractCensusColumn {
24	/** @var CensusInterface */
25	private $census;
26
27	/** @var string */
28	private $abbr;
29
30	/** @var string */
31	private $title;
32
33	/**
34	 * Create a column for a census
35	 *
36	 * @param CensusInterface $census - The census to which this column forms part.
37	 * @param string          $abbr   - The abbrievated on-screen name "BiC"
38	 * @param string          $title  - The full column heading "Born in the county"
39	 */
40	public function __construct(CensusInterface $census, $abbr, $title) {
41		$this->census = $census;
42		$this->abbr   = $abbr;
43		$this->title  = $title;
44	}
45
46	/**
47	 * A short version of the column's name.
48	 *
49	 * @return string
50	 */
51	public function abbreviation() {
52		return $this->abbr;
53	}
54
55	/**
56	 * When did this census occur
57	 *
58	 * @return Date
59	 */
60	public function date() {
61		return new Date($this->census->censusDate());
62	}
63
64	/**
65	 * Where did this census occur
66	 *
67	 * @return string
68	 */
69	public function place() {
70		return $this->census->censusPlace();
71	}
72
73	/**
74	 * The full version of the column's name.
75	 *
76	 * @return string
77	 */
78	public function title() {
79		return $this->title;
80	}
81}
82