Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15431117
D20815.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
11 KB
Referenced Files
None
Subscribers
None
D20815.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -4422,6 +4422,7 @@
'PhabricatorProjectsWatchersSearchEngineAttachment' => 'applications/project/engineextension/PhabricatorProjectsWatchersSearchEngineAttachment.php',
'PhabricatorPronounSetting' => 'applications/settings/setting/PhabricatorPronounSetting.php',
'PhabricatorProtocolLog' => 'infrastructure/log/PhabricatorProtocolLog.php',
+ 'PhabricatorPureChartFunction' => 'applications/fact/chart/PhabricatorPureChartFunction.php',
'PhabricatorPygmentSetupCheck' => 'applications/config/check/PhabricatorPygmentSetupCheck.php',
'PhabricatorQuery' => 'infrastructure/query/PhabricatorQuery.php',
'PhabricatorQueryConstraint' => 'infrastructure/query/constraint/PhabricatorQueryConstraint.php',
@@ -9155,7 +9156,7 @@
'PhabricatorConpherenceWidgetVisibleSetting' => 'PhabricatorInternalSetting',
'PhabricatorConsoleApplication' => 'PhabricatorApplication',
'PhabricatorConsoleContentSource' => 'PhabricatorContentSource',
- 'PhabricatorConstantChartFunction' => 'PhabricatorChartFunction',
+ 'PhabricatorConstantChartFunction' => 'PhabricatorPureChartFunction',
'PhabricatorContactNumbersSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorContentSource' => 'Phobject',
'PhabricatorContentSourceModule' => 'PhabricatorConfigModule',
@@ -9167,7 +9168,7 @@
'PhabricatorCoreCreateTransaction' => 'PhabricatorCoreTransactionType',
'PhabricatorCoreTransactionType' => 'PhabricatorModularTransactionType',
'PhabricatorCoreVoidTransaction' => 'PhabricatorModularTransactionType',
- 'PhabricatorCosChartFunction' => 'PhabricatorChartFunction',
+ 'PhabricatorCosChartFunction' => 'PhabricatorPureChartFunction',
'PhabricatorCountFact' => 'PhabricatorFact',
'PhabricatorCountdown' => array(
'PhabricatorCountdownDAO',
@@ -10068,7 +10069,7 @@
'PhabricatorMarkupInterface',
),
'PhabricatorMarkupPreviewController' => 'PhabricatorController',
- 'PhabricatorMaxChartFunction' => 'PhabricatorChartFunction',
+ 'PhabricatorMaxChartFunction' => 'PhabricatorPureChartFunction',
'PhabricatorMemeEngine' => 'Phobject',
'PhabricatorMemeRemarkupRule' => 'PhutilRemarkupRule',
'PhabricatorMentionRemarkupRule' => 'PhutilRemarkupRule',
@@ -10135,7 +10136,7 @@
'PhabricatorMetronome' => 'Phobject',
'PhabricatorMetronomeTestCase' => 'PhabricatorTestCase',
'PhabricatorMetronomicTriggerClock' => 'PhabricatorTriggerClock',
- 'PhabricatorMinChartFunction' => 'PhabricatorChartFunction',
+ 'PhabricatorMinChartFunction' => 'PhabricatorPureChartFunction',
'PhabricatorModularTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorModularTransactionType' => 'Phobject',
'PhabricatorMonogramDatasourceEngineExtension' => 'PhabricatorDatasourceEngineExtension',
@@ -10950,6 +10951,7 @@
'PhabricatorProjectsWatchersSearchEngineAttachment' => 'PhabricatorSearchEngineAttachment',
'PhabricatorPronounSetting' => 'PhabricatorSelectSetting',
'PhabricatorProtocolLog' => 'Phobject',
+ 'PhabricatorPureChartFunction' => 'PhabricatorChartFunction',
'PhabricatorPygmentSetupCheck' => 'PhabricatorSetupCheck',
'PhabricatorQuery' => 'Phobject',
'PhabricatorQueryConstraint' => 'Phobject',
@@ -11208,7 +11210,7 @@
'PhabricatorPolicyInterface',
),
'PhabricatorSavedQueryQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
- 'PhabricatorScaleChartFunction' => 'PhabricatorChartFunction',
+ 'PhabricatorScaleChartFunction' => 'PhabricatorPureChartFunction',
'PhabricatorScheduleTaskTriggerAction' => 'PhabricatorTriggerAction',
'PhabricatorScopedEnv' => 'Phobject',
'PhabricatorSearchAbstractDocument' => 'Phobject',
@@ -11299,12 +11301,12 @@
'PhabricatorSetupIssue' => 'Phobject',
'PhabricatorSetupIssueUIExample' => 'PhabricatorUIExample',
'PhabricatorSetupIssueView' => 'AphrontView',
- 'PhabricatorShiftChartFunction' => 'PhabricatorChartFunction',
+ 'PhabricatorShiftChartFunction' => 'PhabricatorPureChartFunction',
'PhabricatorShortSite' => 'PhabricatorSite',
'PhabricatorShowFiletreeSetting' => 'PhabricatorSelectSetting',
'PhabricatorSignDocumentsUserLogType' => 'PhabricatorUserLogType',
'PhabricatorSimpleEditType' => 'PhabricatorEditType',
- 'PhabricatorSinChartFunction' => 'PhabricatorChartFunction',
+ 'PhabricatorSinChartFunction' => 'PhabricatorPureChartFunction',
'PhabricatorSite' => 'AphrontSite',
'PhabricatorSlackAuthProvider' => 'PhabricatorOAuth2AuthProvider',
'PhabricatorSlowvoteApplication' => 'PhabricatorApplication',
diff --git a/src/applications/fact/chart/PhabricatorConstantChartFunction.php b/src/applications/fact/chart/PhabricatorConstantChartFunction.php
--- a/src/applications/fact/chart/PhabricatorConstantChartFunction.php
+++ b/src/applications/fact/chart/PhabricatorConstantChartFunction.php
@@ -1,7 +1,7 @@
<?php
final class PhabricatorConstantChartFunction
- extends PhabricatorChartFunction {
+ extends PhabricatorPureChartFunction {
const FUNCTIONKEY = 'constant';
diff --git a/src/applications/fact/chart/PhabricatorCosChartFunction.php b/src/applications/fact/chart/PhabricatorCosChartFunction.php
--- a/src/applications/fact/chart/PhabricatorCosChartFunction.php
+++ b/src/applications/fact/chart/PhabricatorCosChartFunction.php
@@ -1,7 +1,7 @@
<?php
final class PhabricatorCosChartFunction
- extends PhabricatorChartFunction {
+ extends PhabricatorPureChartFunction {
const FUNCTIONKEY = 'cos';
diff --git a/src/applications/fact/chart/PhabricatorMaxChartFunction.php b/src/applications/fact/chart/PhabricatorMaxChartFunction.php
--- a/src/applications/fact/chart/PhabricatorMaxChartFunction.php
+++ b/src/applications/fact/chart/PhabricatorMaxChartFunction.php
@@ -1,36 +1,27 @@
<?php
final class PhabricatorMaxChartFunction
- extends PhabricatorChartFunction {
+ extends PhabricatorPureChartFunction {
const FUNCTIONKEY = 'max';
protected function newArguments() {
return array(
- $this->newArgument()
- ->setName('x')
- ->setType('function'),
$this->newArgument()
->setName('max')
->setType('number'),
);
}
- public function getDomain() {
- return $this->getArgument('x')->getDomain();
- }
-
- public function newInputValues(PhabricatorChartDataQuery $query) {
- return $this->getArgument('x')->newInputValues($query);
- }
-
public function evaluateFunction(array $xv) {
- $yv = $this->getArgument('x')->evaluateFunction($xv);
$max = $this->getArgument('max');
- foreach ($yv as $k => $y) {
- if ($y > $max) {
- $yv[$k] = null;
+ $yv = array();
+ foreach ($xv as $x) {
+ if ($x > $max) {
+ $yv[] = null;
+ } else {
+ $yv[] = $x;
}
}
diff --git a/src/applications/fact/chart/PhabricatorMinChartFunction.php b/src/applications/fact/chart/PhabricatorMinChartFunction.php
--- a/src/applications/fact/chart/PhabricatorMinChartFunction.php
+++ b/src/applications/fact/chart/PhabricatorMinChartFunction.php
@@ -1,36 +1,27 @@
<?php
final class PhabricatorMinChartFunction
- extends PhabricatorChartFunction {
+ extends PhabricatorPureChartFunction {
const FUNCTIONKEY = 'min';
protected function newArguments() {
return array(
- $this->newArgument()
- ->setName('x')
- ->setType('function'),
$this->newArgument()
->setName('min')
->setType('number'),
);
}
- public function getDomain() {
- return $this->getArgument('x')->getDomain();
- }
-
- public function newInputValues(PhabricatorChartDataQuery $query) {
- return $this->getArgument('x')->newInputValues($query);
- }
-
public function evaluateFunction(array $xv) {
- $yv = $this->getArgument('x')->evaluateFunction($xv);
$min = $this->getArgument('min');
- foreach ($yv as $k => $y) {
- if ($y < $min) {
- $yv[$k] = null;
+ $yv = array();
+ foreach ($xv as $x) {
+ if ($x < $min) {
+ $yv[] = null;
+ } else {
+ $yv[] = $x;
}
}
diff --git a/src/applications/fact/chart/PhabricatorPureChartFunction.php b/src/applications/fact/chart/PhabricatorPureChartFunction.php
new file mode 100644
--- /dev/null
+++ b/src/applications/fact/chart/PhabricatorPureChartFunction.php
@@ -0,0 +1,4 @@
+<?php
+
+abstract class PhabricatorPureChartFunction
+ extends PhabricatorChartFunction {}
diff --git a/src/applications/fact/chart/PhabricatorScaleChartFunction.php b/src/applications/fact/chart/PhabricatorScaleChartFunction.php
--- a/src/applications/fact/chart/PhabricatorScaleChartFunction.php
+++ b/src/applications/fact/chart/PhabricatorScaleChartFunction.php
@@ -1,7 +1,7 @@
<?php
final class PhabricatorScaleChartFunction
- extends PhabricatorChartFunction {
+ extends PhabricatorPureChartFunction {
const FUNCTIONKEY = 'scale';
diff --git a/src/applications/fact/chart/PhabricatorShiftChartFunction.php b/src/applications/fact/chart/PhabricatorShiftChartFunction.php
--- a/src/applications/fact/chart/PhabricatorShiftChartFunction.php
+++ b/src/applications/fact/chart/PhabricatorShiftChartFunction.php
@@ -1,7 +1,7 @@
<?php
final class PhabricatorShiftChartFunction
- extends PhabricatorChartFunction {
+ extends PhabricatorPureChartFunction {
const FUNCTIONKEY = 'shift';
diff --git a/src/applications/fact/chart/PhabricatorSinChartFunction.php b/src/applications/fact/chart/PhabricatorSinChartFunction.php
--- a/src/applications/fact/chart/PhabricatorSinChartFunction.php
+++ b/src/applications/fact/chart/PhabricatorSinChartFunction.php
@@ -1,7 +1,7 @@
<?php
final class PhabricatorSinChartFunction
- extends PhabricatorChartFunction {
+ extends PhabricatorPureChartFunction {
const FUNCTIONKEY = 'sin';
diff --git a/src/applications/project/chart/PhabricatorProjectBurndownChartEngine.php b/src/applications/project/chart/PhabricatorProjectBurndownChartEngine.php
--- a/src/applications/project/chart/PhabricatorProjectBurndownChartEngine.php
+++ b/src/applications/project/chart/PhabricatorProjectBurndownChartEngine.php
@@ -32,12 +32,14 @@
if ($project_phids) {
foreach ($project_phids as $project_phid) {
$function = $this->newFunction(
- 'min',
array(
'accumulate',
array('fact', 'tasks.open-count.assign.project', $project_phid),
),
- 0);
+ array(
+ 'min',
+ 0,
+ ));
$function->getFunctionLabel()
->setName(pht('Tasks Moved Into Project'))
@@ -47,12 +49,14 @@
$functions[] = $function;
$function = $this->newFunction(
- 'min',
array(
'accumulate',
array('fact', 'tasks.open-count.status.project', $project_phid),
),
- 0);
+ array(
+ 'min',
+ 0,
+ ));
$function->getFunctionLabel()
->setName(pht('Tasks Reopened'))
@@ -68,20 +72,24 @@
array('fact', 'tasks.open-count.create.project', $project_phid),
),
array(
- 'max',
array(
'accumulate',
array('fact', 'tasks.open-count.status.project', $project_phid),
),
- 0,
+ array(
+ 'max',
+ 0,
+ ),
),
array(
- 'max',
array(
'accumulate',
array('fact', 'tasks.open-count.assign.project', $project_phid),
),
- 0,
+ array(
+ 'max',
+ 0,
+ ),
));
$function->getFunctionLabel()
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 25, 10:36 AM (3 d, 9 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7383172
Default Alt Text
D20815.diff (11 KB)
Attached To
Mode
D20815: In charts, make "min" and "max" into pure functions and formally mark pure functions as pure
Attached
Detach File
Event Timeline
Log In to Comment