From 8007d53473a3e32489c167a6771710c7b287399d Mon Sep 17 00:00:00 2001 From: Roy Williams Date: Wed, 10 Oct 2012 16:54:08 -0700 Subject: [PATCH] Added a method on FieldSpec to get all diff properties Summary: We need to be able to query for all properties matching a given pattern, as mentioned in D3676 Test Plan: Loaded Phabricator, ensured diff loaded, ensured field using all properties was able to enumerate them. Reviewers: vrana, epriestley Reviewed By: vrana CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3679 --- .../DifferentialFieldSpecification.php | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/applications/differential/field/specification/DifferentialFieldSpecification.php b/src/applications/differential/field/specification/DifferentialFieldSpecification.php index db26844b08..414e1e9169 100644 --- a/src/applications/differential/field/specification/DifferentialFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialFieldSpecification.php @@ -893,6 +893,22 @@ abstract class DifferentialFieldSpecification { return $this->handles[$phid]; } + /** + * Get the list of properties for a diff set by @{method:setManualDiff}. + * + * @return array Array of all Diff properties. + * @task context + */ + final public function getDiffProperties() { + if ($this->diffProperties === null) { + // This will be set to some (possibly empty) array if we've loaded + // properties, so null means diff properties aren't available in this + // context. + throw new DifferentialFieldDataNotAvailableException($this); + } + return $this->diffProperties; + } + /** * Get a property of a diff set by @{method:setManualDiff}. * @@ -902,13 +918,7 @@ abstract class DifferentialFieldSpecification { * @task context */ final public function getDiffProperty($key) { - if ($this->diffProperties === null) { - // This will be set to some (possibly empty) array if we've loaded - // properties, so null means diff properties aren't available in this - // context. - throw new DifferentialFieldDataNotAvailableException($this); - } - return idx($this->diffProperties, $key); + return idx($this->getDiffProperties(), $key); } }