Integration/GenderFromNameIntegration.php
public function doEnhancement(Lead $lead)
    {
        $gender = $lead->getFieldValue('gender');
        if (!$gender or $this->isPush) {
            try {
                $oldGender = $gender;
                $gender    = $this->getIntegrationModel()->getGender($lead->getFirstname());
            } catch (\Exception $e) {
                return false;
            }

            if ($gender) {
                $lead->addUpdatedField('gender', $gender, $oldGender);

                return true;
            }
        }

        return false;
    }
public function doEnhancement(Lead $lead)
    {
        $gender = $lead->getFieldValue('gender');
        if (!$gender or $this->isPush) {
            try {
                $oldGender = $gender;
                $gender    = $this->getIntegrationModel()->getGender($lead->getFirstname());
            } catch (\Exception $e) {
                return false;
            }

            if ($gender) {
                $lead->addUpdatedField('gender', $gender, $oldGender);

                return true;
            }
        }

        return false;
    }
@param Lead $lead

@return bool