get cell phone Number for Customer with primary contact prefered

@return string cell phone number of primary contact or address cell number or null
321921
public function getCellPhoneNumber()
    {
        $mobil     = null;
        $mobilsRaw = $this->getFlexiData($this->getApiURL(),
            ['detail' => 'custom:id,mobil,kontakty(primarni,mobil)', 'relations' => 'kontakty']);
        if (is_array($mobilsRaw)) {
            $mobils = $mobilsRaw[0];
            if (array_key_exists('mobil', $mobils) && strlen(trim($mobils['mobil']))) {
                $mobil = $mobils['mobil'];
            }
            if (array_key_exists('kontakty', $mobils) && !empty($mobils['kontakty'])) {
                foreach ($mobils['kontakty'] as $kontakt) {
                    if (($kontakt['primarni'] == 'true') && strlen(trim($kontakt['mobil']))) {
                        $mobil = $kontakt['mobil'];
                        break;
                    }
                }
            }
        }
        return $mobil;
    }
651982
protected function getDependentPhoneNumbers() {
        if (!$this->_dependentPhoneNumbers) {
            $this->_dependentPhoneNumbers = new DependentPhoneNumberList(
                $this->version,
                $this->solution['accountSid'],
                $this->solution['sid']
            );
        }

        return $this->_dependentPhoneNumbers;
    }
1097684
protected function parseMainContact(ContactInterface $contact)
    {
        if ($contact) {
            $data = [];
            $data['id'] = $contact->getId();
            $data['fullName'] = $contact->getFullName();
            $data['phone'] = $contact->getMainPhone();
            $data['email'] = $contact->getMainEmail();

            return $data;
        } else {
            return null;
        }
    }
383013
public function GetCustomerNumber()
    {
        $sCustNr = parent::GetCustomerNumber();
        if (empty($sCustNr)) {
            $oShop = TdbShop::GetInstance();
            $sCustNr = $oShop->GetNextFreeCustomerNumber();
            $aData = $this->sqlData;
            $aData['customer_number'] = $sCustNr;
            $this->LoadFromRow($aData);
        }

        return $this->fieldCustomerNumber;
    }
647458
protected function getCustomerData()
    {
        $card = $this->getCard();
        $data = array();

        $data['customer']['name'] = $card->getName();
        $data['customer']['email'] = $card->getEmail();
        $data['customer']['sex'] = $card->getGender();
        $data['customer']['born_at'] = $card->getBirthday('m-d-Y');
        $data['customer']['document_number'] = $card->getHolderDocumentNumber();

        $arrayAddress = $this->extractAddress($card->getAddress1());
        if ( ! empty($arrayAddress['street']) ) {
            $data['customer']['address'] = $arrayAddress;
            $data['customer']['address']['zipcode'] = $card->getPostcode();
            if ( $card->getAddress2() ) {
                $data['customer']['address']['neighborhood'] = $card->getAddress2();
            }

            $data['customer']['address']['city']    = $card->getCity();
            $data['customer']['address']['state']   = $card->getState();
            $data['customer']['address']['country'] = $card->getCountry();
        }

        $arrayPhone = $this->extractDddPhone($card->getPhone());
        if ( ! empty($arrayPhone['ddd']) ) {
            $data['customer']['phone'] = $arrayPhone;
        }

        return $data;
    }
813500
public function getPhone(): string
    {
        $string = '';
        if ($this->userMeta->notification_phone !== null) {
            $phone = new UserMetaPhone($this->userMeta->notification_phone);
            $string = $phone->country . $phone->number;
        }
        return $string;
    }
1044307
public function getContactMessage()
    {
        if ($this->_sContactMessage === null) {
            $this->_sContactMessage = Registry::getConfig()->getRequestParameter('c_message');
        }

        return $this->_sContactMessage;
    }
422241
private function customerNameA() {return dfc($this, function() {
		/** @var O $o */ $o = $this->o();
		/** @var OA $ba */ $ba = $this->addressB();
		/** @var C|DFCustomer $c */
		/** @var string|null $f */
		return ($f = $o->getCustomerFirstname()) ? [$f, $o->getCustomerLastname()] : (
			($c = $o->getCustomer()) && ($f = $c->getFirstname()) ? [$f, $c->getLastname()] : (
				$f = $ba->getFirstname() ? [$f, $ba->getLastname()] : (
					($sa = $this->addressS()) && ($f = $sa->getFirstname()) ? [$f, $sa->getLastname()] :
						[null, null]
				)
			)
		);
	});}
531838
public function getUserId()
    {
        /* @var $session \Mage_Customer_Model_Session */
        $session = Mage::getSingleton('customer/session');
        $customer = $session->getCustomer();
        if ($customer !== null) {
            return $session->getCustomer()->getId();
        } else {
            return null;
        }
    }
54330
protected function getPrimaryName() {
		if ($this->primary === null) {
			$tableModel    = $this->getTableModel();
			$this->primary = $tableModel->getModelsMetaData()->getPrimaryKeyAttributes($tableModel);
			
			if (empty($this->primary)) {
				$this->primary = false;
			}
			
			if (count($this->primary) === 1) {
				$this->primary = current($this->primary);
			}
		}
		
		if ($this->primary === false) {
			return;
		}
		
		return $this->primary;
	}
1001825
public function getMobilePhoneNumberFromUser($user = null)
    {
        if (!$user)
            $user = $this->getLoggedInUser();
        // It may just be an ID.
        if (is_numeric($user)) {
            $userManager = $this->container->get('fos_user.user_manager');
            $user = $userManager->findUserBy(array('id' => $user));
        }
        // Or string?
        if (is_string($user)) {
            $userManager = $this->container->get('fos_user.user_manager');
            $user = $userManager->findUserBy(array('username' => $user));
        }

        if (is_object($user) && method_exists($user, 'getMobilePhoneNumber'))
            return $user->getMobilePhoneNumber();
        if (is_object($user) && method_exists($user, 'getPhoneNumber'))
            return $user->getPhoneNumber();
        return null;
    }
1251852
public function PhoneFriendly()
    {
        $ReplacementMap = array(
            'a'=>'2', 'b'=>'2', 'c'=>'2',
            'd'=>'3', 'e'=>'3', 'f'=>'3',
            'g'=>'4', 'h'=>'4', 'i'=>'4',
            'j'=>'5', 'k'=>'5', 'l'=>'5',
            'm'=>'6', 'n'=>'6', 'o'=>'6',
            'p'=>'7', 'q'=>'7', 'r'=>'7', 's'=>'7',
            't'=>'8', 'u'=>'8', 'v'=>'8',
            'w'=>'9', 'x'=>'9', 'y'=>'9', 'z'=>'9',
            '+'=>'00',
            ' '=>''
        );
        $value = str_ireplace(
            array_keys($ReplacementMap),
            array_values($ReplacementMap),
            $this->owner->value
        );

        // Strip out everything else
        $value = preg_replace('/[^0-9\,]+/', '', $value);

        return $value;
    }
327787
private function getCountryCode()
    {
        $posted = $this->appRequest->getPostValue();
        if (isset($posted['customer'][ABlock::TMPL_FLDGRP][ABlock::TMPL_FIELD_COUNTRY_CODE])) {
            $result = $posted['customer'][ABlock::TMPL_FLDGRP][ABlock::TMPL_FIELD_COUNTRY_CODE];
        } else {
            $result = $this->hlpRegistry->getCustomerCountry();
        }
        return $result;
    }
317451
public function getPhonebook()
    {
        $entries = Connection::sendCurlRequest(Connection::URL_PHONEBOOK . '_' . $this->iden, 'GET', null, false,
            $this->apiKey)->phonebook;

        $objEntries = [];
        foreach ($entries as $e) {
            $objEntries[] = new PhonebookEntry($e, $this);
        }

        return $objEntries;
    }
1166871
public function get_data() {
		$data = parent::get_data();

		$data['logo'] = Acf::get_option_field( 'contact_details_logo' );
		$data['address'] = Acf::get_option_field( 'contact_details_address' );
		$data['phone'] = Acf::get_option_field( 'contact_details_phone' );
		$data['email'] = Acf::get_option_field( 'contact_details_email' );

		return $data;
	}
1279647
protected function getCustomerId() {
    $customer_id = NULL;
    $current_user = $this->getCurrentUser();

    if ($current_user->isAnonymous()) {
      return $customer_id;
    }

    $use_ecomm_sessions = \Drupal::config('acm.commerce_users')
      ->get('use_ecomm_sessions');

    if ($use_ecomm_sessions) {
      $customer_id = $current_user->getAccount()->id();
    }
    else {
      $customer_id = $current_user->getAccount()->acm_customer_id;
    }

    return $customer_id;
  }
317168
public function getFromId( $ContactNumberId){
        $rest = $this->getService( self::API_NUMBER . $ContactNumberId);
        $rest->GET();

        return $rest->getResult( models\Call\ContactNumber::class);
    }