Skip to content

Commit

Permalink
PHPdocs and code style for statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
fisharebest committed Jan 4, 2025
1 parent 1f50a43 commit 46492e3
Show file tree
Hide file tree
Showing 44 changed files with 71 additions and 3,385 deletions.
2 changes: 1 addition & 1 deletion app/Census/CensusColumnConditionCanada.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CensusColumnConditionCanada extends AbstractCensusColumnCondition
// Text to display for female children
protected const string GIRL = 'S';

// Text to display for divorced individuals
// Text to display for divorced males
protected const string DIVORCE = 'D';

// Text to display for divorced females
Expand Down
2 changes: 1 addition & 1 deletion app/Census/CensusColumnConditionCanadaMarriedSingle.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CensusColumnConditionCanadaMarriedSingle extends AbstractCensusColumnCondi
// Text to display for female children
protected const string GIRL = 'S';

// Text to display for divorced individuals
// Text to display for divorced males
protected const string DIVORCE = '';

// Text to display for divorced females
Expand Down
2 changes: 1 addition & 1 deletion app/Census/CensusColumnConditionCanadaMarriedWidowed.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CensusColumnConditionCanadaMarriedWidowed extends AbstractCensusColumnCond
// Text to display for female children
protected const string GIRL = '';

// Text to display for divorced individuals
// Text to display for divorced males
protected const string DIVORCE = '';

// Text to display for divorced females
Expand Down
2 changes: 1 addition & 1 deletion app/Census/CensusColumnConditionCanadaWidowed.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CensusColumnConditionCanadaWidowed extends AbstractCensusColumnCondition
// Text to display for female children
protected const string GIRL = '';

// Text to display for divorced individuals
// Text to display for divorced males
protected const string DIVORCE = '';

// Text to display for divorced females
Expand Down
2 changes: 1 addition & 1 deletion app/Census/CensusColumnConditionCanadaWidowedFemale.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CensusColumnConditionCanadaWidowedFemale extends AbstractCensusColumnCondi
// Text to display for female children
protected const string GIRL = '';

// Text to display for divorced individuals
// Text to display for divorced males
protected const string DIVORCE = '';

// Text to display for divorced females
Expand Down
2 changes: 1 addition & 1 deletion app/Census/CensusColumnConditionCanadaWidowedMale.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CensusColumnConditionCanadaWidowedMale extends AbstractCensusColumnConditi
// Text to display for female children
protected const string GIRL = '';

// Text to display for divorced individuals
// Text to display for divorced males
protected const string DIVORCE = '';

// Text to display for divorced females
Expand Down
2 changes: 1 addition & 1 deletion app/Census/CensusColumnConditionUs.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CensusColumnConditionUs extends CensusColumnConditionEnglish
// Text to display for female children
protected const string GIRL = 'S';

// Text to display for divorced individuals
// Text to display for divorced males
protected const string DIVORCE = 'D';

// Text to display for divorced females
Expand Down
19 changes: 6 additions & 13 deletions app/Module/StatisticsChartModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
use function count;
use function explode;
use function in_array;
use function intdiv;
use function is_numeric;
use function sprintf;

Expand Down Expand Up @@ -527,21 +526,17 @@ public function postCustomChartAction(ServerRequestInterface $request): Response
$z_axis = $this->axisAll();
$rows = $statistics->statsAgeQuery('DEAT');
foreach ($rows as $row) {
foreach ($row as $age) {
$years = (int) ($age / self::DAYS_IN_YEAR);
$this->fillYData($years, 0, 1, $x_axis, $z_axis, $ydata);
}
$years = (int) ($row->days / self::DAYS_IN_YEAR);
$this->fillYData($years, 0, 1, $x_axis, $z_axis, $ydata);
}
break;
case self::Z_AXIS_SEX:
$z_axis = $this->axisSexes();
foreach (array_keys($z_axis) as $sex) {
$rows = $statistics->statsAgeQuery('DEAT', $sex);
foreach ($rows as $row) {
foreach ($row as $age) {
$years = (int) ($age / self::DAYS_IN_YEAR);
$this->fillYData($years, $sex, 1, $x_axis, $z_axis, $ydata);
}
$years = (int) ($row->days / self::DAYS_IN_YEAR);
$this->fillYData($years, $sex, 1, $x_axis, $z_axis, $ydata);
}
}
break;
Expand All @@ -552,10 +547,8 @@ public function postCustomChartAction(ServerRequestInterface $request): Response
foreach (array_keys($z_axis) as $boundary) {
$rows = $statistics->statsAgeQuery('DEAT', 'BOTH', $prev_boundary, $boundary);
foreach ($rows as $row) {
foreach ($row as $age) {
$years = (int) ($age / self::DAYS_IN_YEAR);
$this->fillYData($years, $boundary, 1, $x_axis, $z_axis, $ydata);
}
$years = (int) ($row->days / self::DAYS_IN_YEAR);
$this->fillYData($years, $boundary, 1, $x_axis, $z_axis, $ydata);
}
$prev_boundary = $boundary + 1;
}
Expand Down
Loading

0 comments on commit 46492e3

Please sign in to comment.