rep__get_primary_agent_profile( $api_data )

Get the primary agent profile from malcolm api response data.

Namespace

REP_Malcolm

Parameters

$api_data

array

Malcolm API data

Return

array

An array containing primary agent profile.

Source

File: \includes\rep-helper-functions.php

function rep__get_primary_agent_profile( $api_data ){

    $rea_agent_profiles    = lp__array_key_value('rea_agent_profiles', $api_data, []);
    $rea_agent_profile     = [];

    if( ! empty( $rea_agent_profiles ) ){
        if( array_key_exists( 0, $rea_agent_profiles ) ){
            $rea_agent_profile = lp__array_key_value(0, $rea_agent_profiles, []);
        } elseif( array_key_exists( 'profile_id', $rea_agent_profiles ) ) {
            $rea_agent_profile = $rea_agent_profiles;
        }
    }

    return $rea_agent_profile;

}