<commit_before><?php

/**
 * Copyright 2014 SURFnet bv
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

namespace Surfnet\StepupMiddlewareClient\Identity\Dto;

use Assert;
use Surfnet\StepupMiddlewareClient\Dto\HttpQuery;

class VerifiedSecondFactorSearchQuery implements HttpQuery
{
    /**
     * @var string
     */
    private $identityId;

    /**
     * @var string
     */
    private $secondFactorId;

    /**
     * @var string
     */
    private $registrationCode;

    /**
     * @param string $identityId
     * @return self
     */
    public function setIdentityId($identityId)
    {
        $this->assertNonEmptyString($identityId, 'identityId');

        $this->identityId = $identityId;

        return $this;
    }

    /**
     * @param string $secondFactorId
     * @return self
     */
    public function setSecondFactorId($secondFactorId)
    {
        $this->assertNonEmptyString($secondFactorId, 'secondFactorId');

        $this->secondFactorId = $secondFactorId;

        return $this;
    }

    /**
     * @param string $registrationCode
     * @return self
     */
    public function setRegistrationCode($registrationCode)
    {
        $this->assertNonEmptyString($registrationCode, 'registrationCode');

        $this->registrationCode = $registrationCode;

        return $this;
    }

    private function assertNonEmptyString($value, $name)
    {
        $message = sprintf(
            '"%s" must be a non-empty string, "%s" given',
            $name,
            (is_object($value) ? get_class($value) : gettype($value))
        );

        Assert\that($value)->string($message)->notEmpty($message);
    }

    public function toHttpQuery()
    {
        $fields = [];

        if ($this->identityId) {
            $fields['identityId'] = $this->identityId;
        }

        if ($this->secondFactorId) {
            $fields['secondFactorId'] = $this->secondFactorId;
        }

        if ($this->registrationCode) {
            $fields['registrationCode'] = $this->registrationCode;
        }

        return '?' . http_build_query($fields);
    }
}<commit_msg>Add fga for vetting procedure<commit_after><?php

/**
 * Copyright 2014 SURFnet bv
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

namespace Surfnet\StepupMiddlewareClient\Identity\Dto;

use Assert;
use Surfnet\StepupMiddlewareClient\Dto\HttpQuery;

class VerifiedSecondFactorSearchQuery implements HttpQuery
{
    /**
     * @var string
     */
    private $identityId;

    /**
     * @var string
     */
    private $secondFactorId;

    /**
     * @var string
     */
    private $registrationCode;

    /**
     * @var string
     */
    private $institution;

    /**
     * @param string $identityId
     * @return self
     */
    public function setIdentityId($identityId)
    {
        $this->assertNonEmptyString($identityId, 'identityId');

        $this->identityId = $identityId;

        return $this;
    }

    /**
     * @param string $secondFactorId
     * @return self
     */
    public function setSecondFactorId($secondFactorId)
    {
        $this->assertNonEmptyString($secondFactorId, 'secondFactorId');

        $this->secondFactorId = $secondFactorId;

        return $this;
    }

    /**
     * @param string $registrationCode
     * @return self
     */
    public function setRegistrationCode($registrationCode)
    {
        $this->assertNonEmptyString($registrationCode, 'registrationCode');

        $this->registrationCode = $registrationCode;

        return $this;
    }

    /**
     * @param string $institution
     */
    public function setInstitution($institution)
    {
        $this->assertNonEmptyString($institution, 'institution');

        $this->institution = $institution;

        return $this;
    }

    private function assertNonEmptyString($value, $name)
    {
        $message = sprintf(
            '"%s" must be a non-empty string, "%s" given',
            $name,
            (is_object($value) ? get_class($value) : gettype($value))
        );

        Assert\that($value)->string($message)->notEmpty($message);
    }

    public function toHttpQuery()
    {
        $fields = [];

        $fields['institution'] = $this->institution;

        if ($this->identityId) {
            $fields['identityId'] = $this->identityId;
        }

        if ($this->secondFactorId) {
            $fields['secondFactorId'] = $this->secondFactorId;
        }

        if ($this->registrationCode) {
            $fields['registrationCode'] = $this->registrationCode;
        }

        return '?' . http_build_query($fields);
    }
}
{'fraction_non_alphanumeric': 0.11762609160577438, 'fraction_numerical': 0.0028515416146854392, 'mean_word_length': 2.492221530802738, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1120068', 'n_tokens_mistral': 1591, 'n_tokens_neox': 1528, 'n_words': 390}