<commit_before><?php

namespace OpenConext\EngineBlock\ApiBundle\Dto;

use DateTime;
use OpenConext\Component\EngineBlockMetadata\ContactPerson;
use OpenConext\Component\EngineBlockMetadata\Entity\ServiceProvider;
use OpenConext\EngineBlock\Authentication\Entity\Consent as ConsentEntity;

final class Consent
{
    const CONTACT_TYPE_SUPPORT = 'support';

    /**
     * @var ConsentEntity
     */
    private $consent;

    /**
     * @var ServiceProvider
     */
    private $serviceProvider;

    /**
     * @param ConsentEntity   $consent
     * @param ServiceProvider $serviceProvider
     */
    public function __construct(ConsentEntity $consent, ServiceProvider $serviceProvider)
    {
        $this->consent         = $consent;
        $this->serviceProvider = $serviceProvider;
    }

    /**
     * @return array
     */
    public function jsonSerialize()
    {
        $supportContacts = array_values(
            array_filter(
                $this->serviceProvider->contactPersons,
                function (ContactPerson $contact) {
                    return $contact->contactType === Consent::CONTACT_TYPE_SUPPORT;
                }
            )
        );

        $supportEmail = null;
        if (count($supportContacts) > 0) {
            $supportEmail = $supportContacts[0]->emailAddress;
        }

        $serviceProvider = array(
            'entity_id'    => $this->serviceProvider->entityId,
            'display_name' => array(
                'en' => $this->serviceProvider->displayNameEn,
                'nl' => $this->serviceProvider->displayNameNl,
            ),
            'eula_url' => $this->serviceProvider->termsOfServiceUrl,
            'support_url' => null,
            'support_email' => $supportEmail,
        );

        return array(
            'service_provider' => $serviceProvider,
            'consent_given_on' => $this->consent->getDateConsentWasGivenOn()->format(DateTime::ATOM),
            'last_used_on'     => $this->consent->getDateLastUsedOn()->format(DateTime::ATOM),
        );
    }
}<commit_msg>Remove support URL from consent server provider for now<commit_after><?php

namespace OpenConext\EngineBlock\ApiBundle\Dto;

use DateTime;
use OpenConext\Component\EngineBlockMetadata\ContactPerson;
use OpenConext\Component\EngineBlockMetadata\Entity\ServiceProvider;
use OpenConext\EngineBlock\Authentication\Entity\Consent as ConsentEntity;

final class Consent
{
    const CONTACT_TYPE_SUPPORT = 'support';

    /**
     * @var ConsentEntity
     */
    private $consent;

    /**
     * @var ServiceProvider
     */
    private $serviceProvider;

    /**
     * @param ConsentEntity   $consent
     * @param ServiceProvider $serviceProvider
     */
    public function __construct(ConsentEntity $consent, ServiceProvider $serviceProvider)
    {
        $this->consent         = $consent;
        $this->serviceProvider = $serviceProvider;
    }

    /**
     * @return array
     */
    public function jsonSerialize()
    {
        $supportContacts = array_values(
            array_filter(
                $this->serviceProvider->contactPersons,
                function (ContactPerson $contact) {
                    return $contact->contactType === Consent::CONTACT_TYPE_SUPPORT;
                }
            )
        );

        $supportEmail = null;
        if (count($supportContacts) > 0) {
            $supportEmail = $supportContacts[0]->emailAddress;
        }

        $serviceProvider = array(
            'entity_id'    => $this->serviceProvider->entityId,
            'display_name' => array(
                'en' => $this->serviceProvider->displayNameEn,
                'nl' => $this->serviceProvider->displayNameNl,
            ),
            'eula_url' => $this->serviceProvider->termsOfServiceUrl,
            'support_email' => $supportEmail,
        );

        return array(
            'service_provider' => $serviceProvider,
            'consent_given_on' => $this->consent->getDateConsentWasGivenOn()->format(DateTime::ATOM),
            'last_used_on'     => $this->consent->getDateLastUsedOn()->format(DateTime::ATOM),
        );
    }
}
{'fraction_non_alphanumeric': 0.11632406287787182, 'fraction_numerical': 0.0009673518742442564, 'mean_word_length': 2.2825396825396824, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 64, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2008605', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1132, 'n_words': 184}