<commit_before><?php

class Sabre_DAV_Property_Principal extends Sabre_DAV_Property {

    const UNAUTHENTICATED = 1;
    const AUTHENTICATED = 2;
    const HREF = 3;

    private $type;
    private $href;

    function __construct($type, $href = null) {

        $this->type = $type;
        $this->href = $href;

    }

    function getType() {

        return $this->type;

    }

    function getHref() {

        return $this->href;

    }

    function serialize(Sabre_DAV_Server $server, DOMElement $node) {

        switch($this->type) {

            case self::UNAUTHENTICATED :
                $node->appendChild(
                    $node->ownerDocument->createElementNS('DAV:','d:unauthenticated')
                );
                break;
            case self::AUTHENTICATED :
                $node->appendChild(
                    $node->ownerDocument->createElementNS('DAV:','d:authenticated')
                );
                break;
            case self::HREF :
                $href = $node->ownerDocument->createElementNS('DAV:','d:href');
                $href->nodeValue = $server->getBaseUri() . $this->href;
                $node->appendChild($href);
                break;

        }

    }

}
<commit_msg>Added php docblocks<commit_after><?php

/**
 * Principal property
 *
 * @package Sabre
 * @copyright Copyright (C) 2007-2010 Rooftop Solutions. All rights reserved.
 * @author <NAME> (http://www.rooftopsolutions.nl/) 
 * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
 */

/**
 * Principal property
 *
 * The principal property represents a principal from RFC3744 (ACL).
 * The property can be used to specify a principal or pseudo principals. 
 */
class Sabre_DAV_Property_Principal extends Sabre_DAV_Property {

    /**
     * To specify a not-logged-in user, use the UNAUTHENTICTED principal
     */
    const UNAUTHENTICATED = 1;

    /**
     * To specify any principal that is logged in, use AUTHENTICATED
     */
    const AUTHENTICATED = 2;

    /**
     * Specific princpals can be specified with the HREF
     */
    const HREF = 3;

    /**
     * Principal-type
     *
     * Must be one of the UNAUTHENTICATED, AUTHENTICATED or HREF constants.
     * 
     * @var int 
     */
    private $type;

    /**
     * Url to principal
     *
     * This value is only used for the HREF principal type.
     * 
     * @var string 
     */
    private $href;

    /**
     * Creates the property.
     *
     * The 'type' argument must be one of the type constants defined in this class.
     *
     * 'href' is only required for the HREF type.
     * 
     * @param int $type 
     * @param string $href 
     * @return void
     */
    public function __construct($type, $href = null) {

        $this->type = $type;

        if ($type===self::HREF && is_null($href)) {
            throw new Sabre_DAV_Exception('The href argument must be specified for the HREF principal type.');
        }
        $this->href = $href;

    }

    /**
     * Returns the principal type 
     * 
     * @return int 
     */
    public function getType() {

        return $this->type;

    }

    /**
     * Returns the principal uri. 
     * 
     * @return string
     */
    public function getHref() {

        return $this->href;

    }

    /**
     * Serializes the property into a DOMElement. 
     * 
     * @param Sabre_DAV_Server $server 
     * @param DOMElement $node 
     * @return void
     */
    public function serialize(Sabre_DAV_Server $server, DOMElement $node) {

        switch($this->type) {

            case self::UNAUTHENTICATED :
                $node->appendChild(
                    $node->ownerDocument->createElementNS('DAV:','d:unauthenticated')
                );
                break;
            case self::AUTHENTICATED :
                $node->appendChild(
                    $node->ownerDocument->createElementNS('DAV:','d:authenticated')
                );
                break;
            case self::HREF :
                $href = $node->ownerDocument->createElementNS('DAV:','d:href');
                $href->nodeValue = $server->getBaseUri() . $this->href;
                $node->appendChild($href);
                break;

        }

    }

}

{'fraction_non_alphanumeric': 0.11678832116788321, 'fraction_numerical': 0.004238285848834471, 'mean_word_length': 1.7892317793827972, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '1769347', 'n_tokens_mistral': 1310, 'n_tokens_neox': 1193, 'n_words': 298}