Skip to content

Commit

Permalink
[REF] Minor code simplification
Browse files Browse the repository at this point in the history
Move the return earlier, simplify the IF
  • Loading branch information
eileenmcnaughton committed Mar 10, 2020
1 parent 895b386 commit 0e044d8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CRM/Core/PseudoConstant.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,15 @@ public static function get($daoName, $fieldName, $params = [], $context = NULL)
$dao = new $daoName();
$fieldSpec = $dao->getFieldSpec($fieldName);

// Ensure we have the canonical name for this field
$fieldName = CRM_Utils_Array::value('name', $fieldSpec, $fieldName);

// Return false if field doesn't exist.
if (empty($fieldSpec)) {
return FALSE;
}

elseif (!empty($fieldSpec['pseudoconstant'])) {
// Ensure we have the canonical name for this field
$fieldName = $fieldSpec['name'] ?? $fieldName;

if (!empty($fieldSpec['pseudoconstant'])) {
$pseudoconstant = $fieldSpec['pseudoconstant'];

// if callback is specified..
Expand Down

0 comments on commit 0e044d8

Please sign in to comment.