Integration/PhoneToPartsIntegration.php
public function doEnhancement(Lead $lead)
    {
        $phone = preg_replace('/\D+/', '', $lead->getPhone());
        if (empty($phone)) {
            $phone = preg_replace('/\D+/', '', $lead->getMobile());
        }
        $phone = substr($phone, -10);

        if (10 === strlen($phone)) {
            $lead->addUpdatedField('ptp_area_code', substr($phone, -10, 3));
            $lead->addUpdatedField('ptp_prefix', substr($phone, -7, 3));
            $lead->addUpdatedField('ptp_line_number', substr($phone, -4, 4));

            return true;
        }

        return false;
    }
public function doEnhancement(Lead $lead)
    {
        $phone = preg_replace('/\D+/', '', $lead->getPhone());
        if (empty($phone)) {
            $phone = preg_replace('/\D+/', '', $lead->getMobile());
        }
        $phone = substr($phone, -10);

        if (10 === strlen($phone)) {
            $lead->addUpdatedField('ptp_area_code', substr($phone, -10, 3));
            $lead->addUpdatedField('ptp_prefix', substr($phone, -7, 3));
            $lead->addUpdatedField('ptp_line_number', substr($phone, -4, 4));

            return true;
        }

        return false;
    }
public function doEnhancement ( Lead $ lead ) { $ phone = preg_replace ( '/\D+/' , '' , $ lead -> getPhone ( ) ) ; if ( empty ( $ phone ) ) { $ phone = preg_replace ( '/\D+/' , '' , $ lead -> getMobile ( ) ) ; } $ phone = substr ( $ phone , - 10 ) ; if ( 10 === strlen ( $ phone ) ) { $ lead -> addUpdatedField ( 'ptp_area_code' , substr ( $ phone , - 10 , 3 ) ) ; $ lead -> addUpdatedField ( 'ptp_prefix' , substr ( $ phone , - 7 , 3 ) ) ; $ lead -> addUpdatedField ( 'ptp_line_number' , substr ( $ phone , - 4 , 4 ) ) ; return true ; } return false ; }
@param Lead $lead

@return bool
@param Lead $lead