<commit_before><?php

namespace BBBLoadBalancer\AdminBundle\Document;

use Symfony\Component\Security\Core\User\AdvancedUserInterface;
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Doctrine\Bundle\MongoDBBundle\Validator\Constraints\Unique as MongoDBUnique;

/**
 * @MongoDB\Document(collection="Server")
 * @MongoDBUnique(fields="url", message = "The URL field is not unique")
 */
class Server
{
    /**
     * @MongoDB\Id
     */
    protected $id;

    /**
     * @MongoDB\String
     * @Assert\NotBlank(message = "No name given")
     */
    protected $name;

    /**
     * @MongoDB\String
     * @Assert\NotBlank(message = "No URL given")
     */
    protected $url;

    /**
     * @MongoDB\Boolean
     * @Assert\Type(type="boolean", message="The value for enabled is not valid")
     */
    protected $enabled;

    /**
     * Get id
     *
     * @return id $id
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return self
     */
    public function setName($name)
    {
        $this->name = $name;
        return $this;
    }<commit_msg>adding validation for server URL<commit_after><?php

namespace BBBLoadBalancer\AdminBundle\Document;

use Symfony\Component\Security\Core\User\AdvancedUserInterface;
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Doctrine\Bundle\MongoDBBundle\Validator\Constraints\Unique as MongoDBUnique;

/**
 * @MongoDB\Document(collection="Server")
 * @MongoDBUnique(fields="url", message = "The URL field is not unique")
 */
class Server
{
    /**
     * @MongoDB\Id
     */
    protected $id;

    /**
     * @MongoDB\String
     * @Assert\NotBlank(message = "No name given")
     */
    protected $name;

    /**
     * @MongoDB\String
     * @Assert\NotBlank(message = "No URL given")
     * @Assert\Regex(pattern="/^http:\/\//", message="URL must start with http://")
     */
    protected $url;

    /**
     * @MongoDB\Boolean
     * @Assert\Type(type="boolean", message="The value for enabled is not valid")
     */
    protected $enabled;

    /**
     * Get id
     *
     * @return id $id
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return self
     */
    public function setName($name)
    {
        $this->name = $name;
        return $this;
    }
{'fraction_non_alphanumeric': 0.1374764595103578, 'fraction_numerical': 0.0, 'mean_word_length': 2.4947368421052634, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5557949', 'n_tokens_mistral': 848, 'n_tokens_neox': 830, 'n_words': 174}