summaryrefslogtreecommitdiff
path: root/app/Controller/LifespanController.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2016-12-24 10:40:57 +0000
committerGreg Roach <fisharebest@gmail.com>2016-12-24 10:42:28 +0000
commit2118c0e3314864fd87a9f7e14cf8615480d51d10 (patch)
tree337e8a5a288af58199e9806880c08bba749e9db7 /app/Controller/LifespanController.php
parentc9aedfee207b0d58d8f5f9c94605a95e3542b9de (diff)
downloadwebtrees-2118c0e3314864fd87a9f7e14cf8615480d51d10.tar.gz
webtrees-2118c0e3314864fd87a9f7e14cf8615480d51d10.tar.bz2
webtrees-2118c0e3314864fd87a9f7e14cf8615480d51d10.zip
Remove PHP 5.3 workaround
Diffstat (limited to 'app/Controller/LifespanController.php')
-rw-r--r--app/Controller/LifespanController.php32
1 files changed, 11 insertions, 21 deletions
diff --git a/app/Controller/LifespanController.php b/app/Controller/LifespanController.php
index a145810a7b..aea01158ce 100644
--- a/app/Controller/LifespanController.php
+++ b/app/Controller/LifespanController.php
@@ -85,24 +85,20 @@ class LifespanController extends PageController {
/** @var string[] A list of colors to use. */
private $colors = [];
- /** @todo This attribute is public to support the PHP5.3 closure workaround. */
/** @var Place|null A place to serarh. */
- public $place_obj = null;
+ private $place_obj = null;
- /** @todo This attribute is public to support the PHP5.3 closure workaround. */
/** @var Date|null Start of the date range. */
- public $startDate = null;
+ private $startDate = null;
- /** @todo This attribute is public to support the PHP5.3 closure workaround. */
/** @var Date|null End of the date range. */
- public $endDate = null;
+ private $endDate = null;
/** @var bool Only match dates in the chosen calendar. */
private $strictDate;
- /** @todo This attribute is public to support the PHP5.3 closure workaround. */
/** @var string[] List of facts/events to include. */
- public $facts;
+ private $facts;
/** @var string[] Facts and events to exclude from the chart */
private $nonfacts = [
@@ -271,9 +267,8 @@ class LifespanController extends PageController {
$bdate = $this->getCalendarDate($this->people[0]->getEstimatedBirthDate()->minimumJulianDay());
$minyear = $bdate->y;
- $that = $this; // PHP5.3 cannot access $this inside a closure
- $maxyear = array_reduce($this->people, function ($carry, Individual $item) use ($that) {
- $date = $that->getCalendarDate($item->getEstimatedDeathDate()->maximumJulianDay());
+ $maxyear = array_reduce($this->people, function ($carry, Individual $item) {
+ $date = $this->getCalendarDate($item->getEstimatedDeathDate()->maximumJulianDay());
return max($carry, $date->y);
}, 0);
@@ -392,11 +387,10 @@ class LifespanController extends PageController {
}
Functions::sortFacts($facts);
- $that = $this; // PHP5.3 cannot access $this inside a closure
- $acceptedFacts = array_filter($facts, function (Fact $fact) use ($that) {
+ $acceptedFacts = array_filter($facts, function (Fact $fact) {
return
- (in_array($fact->getTag(), $that->facts) && $fact->getDate()->isOK()) ||
- (($that->place_obj || $that->startDate) && $that->checkFact($fact));
+ (in_array($fact->getTag(), $this->facts) && $fact->getDate()->isOK()) ||
+ (($this->place_obj || $this->startDate) && $this->checkFact($fact));
});
$eventList = [];
@@ -472,13 +466,11 @@ class LifespanController extends PageController {
*
* Does this fact meet the search criteria?
*
- * @todo This function is public to support the PHP5.3 closure workaround.
- *
* @param Fact $fact
*
* @return bool
*/
- public function checkFact(Fact $fact) {
+ private function checkFact(Fact $fact) {
$valid = !in_array($fact->getTag(), $this->nonfacts);
if ($valid && $this->place_obj) {
$valid = stripos($fact->getPlace()->getGedcomName(), $this->place_obj->getGedcomName()) !== false;
@@ -499,13 +491,11 @@ class LifespanController extends PageController {
/**
* Function getCalendarDate
*
- * @todo This function is public to support the PHP5.3 closure workaround.
- *
* @param int $date
*
* @return object
*/
- public function getCalendarDate($date) {
+ private function getCalendarDate($date) {
switch ($this->calendar) {
case 'julian':
$caldate = new JulianDate($date);