public function normalize($customer, $format = null, array $context = [])
    {
        if ($format === 'csv' && $this->contextHasGroup('TableExport', $context)) {
            return (string)$customer;
        }

        $data = parent::normalize($customer, $format, $context);

        $parent = $customer->getParent();

        if ($this->contextHasGroup(['Default', 'Customer', 'Search', 'Summary'], $context)) {
            $data = array_replace($data, [
                'number'     => $customer->getNumber(),
                'company'    => $customer->getCompany(),
                'email'      => $customer->getEmail(),
                'first_name' => $customer->getFirstName(),
                'last_name'  => $customer->getLastName(),
                'phone'      => $this->normalizeObject($customer->getPhone(), $format, $context),
                'mobile'     => $this->normalizeObject($customer->getMobile(), $format, $context),
                'parent'     => $parent ? $parent->getId() : null,
                'currency'   => $customer->getCurrency()->getCode(),
                'locale'     => $customer->getLocale(),
            ]);
        }

        if ($this->contextHasGroup('Summary', $context)) {
            $payment = $parent ? $parent : $customer;

            $data = array_replace($data, [
                'group'               => (string)$customer->getCustomerGroup(),
                'parent'              => (string)$parent,
                'vat_number'          => $payment->getVatNumber(),
                'vat_valid'           => $payment->isVatValid(),
                'payment_term'        => (string)$payment->getPaymentTerm(),
                'outstanding_limit'   => $payment->getOutstandingLimit(),
                'outstanding_balance' => $payment->getOutstandingBalance(),
                'credit_balance'      => $payment->getCreditBalance(),
                'description'         => $payment->getDescription(),
            ]);
        }

        return $data;
    }
public function normalize($customer, $format = null, array $context = [])
    {
        if ($format === 'csv' && $this->contextHasGroup('TableExport', $context)) {
            return (string)$customer;
        }

        $data = parent::normalize($customer, $format, $context);

        $parent = $customer->getParent();

        if ($this->contextHasGroup(['Default', 'Customer', 'Search', 'Summary'], $context)) {
            $data = array_replace($data, [
                'number'     => $customer->getNumber(),
                'company'    => $customer->getCompany(),
                'email'      => $customer->getEmail(),
                'first_name' => $customer->getFirstName(),
                'last_name'  => $customer->getLastName(),
                'phone'      => $this->normalizeObject($customer->getPhone(), $format, $context),
                'mobile'     => $this->normalizeObject($customer->getMobile(), $format, $context),
                'parent'     => $parent ? $parent->getId() : null,
                'currency'   => $customer->getCurrency()->getCode(),
                'locale'     => $customer->getLocale(),
            ]);
        }

        if ($this->contextHasGroup('Summary', $context)) {
            $payment = $parent ? $parent : $customer;

            $data = array_replace($data, [
                'group'               => (string)$customer->getCustomerGroup(),
                'parent'              => (string)$parent,
                'vat_number'          => $payment->getVatNumber(),
                'vat_valid'           => $payment->isVatValid(),
                'payment_term'        => (string)$payment->getPaymentTerm(),
                'outstanding_limit'   => $payment->getOutstandingLimit(),
                'outstanding_balance' => $payment->getOutstandingBalance(),
                'credit_balance'      => $payment->getCreditBalance(),
                'description'         => $payment->getDescription(),
            ]);
        }

        return $data;
    }
@inheritdoc

@param CustomerInterface $customer