1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-04 20:52:43 +01:00
phorge-phorge/src/applications/fact/chart/PhabricatorSinChartFunction.php
epriestley 769e745a3f In charts, make "min" and "max" into pure functions and formally mark pure functions as pure
Summary:
Depends on D20814. Currently, "min()" and "max()" are still "min(f, n)". This is no longer consistent with the construction of functions a function-generators that are composed at top level.

Turn them into "min(n)" and "max(n)" (i.e., not higher-order functions).

Then, mark all the functions which are pure mathematical functions and not higher-order as "pure". These functions have no function parameters and do not reference external data. For now, this distinction has no immediate implications, but it will simplify the next change (which tracks where data came from when it originated from an external source -- these pure functions never have any source information, since they only apply pure mathematical transformations to data).

Test Plan: Loaded a burnup chart, nothing seemed obviously broken.

Subscribers: yelirekim

Differential Revision: https://secure.phabricator.com/D20815
2019-09-17 09:28:23 -07:00

22 lines
338 B
PHP

<?php
final class PhabricatorSinChartFunction
extends PhabricatorPureChartFunction {
const FUNCTIONKEY = 'sin';
protected function newArguments() {
return array();
}
public function evaluateFunction(array $xv) {
$yv = array();
foreach ($xv as $x) {
$yv[] = sin(deg2rad($x));
}
return $yv;
}
}