<commit_before><?php

class Brera_MagentoConnector_Model_XmlUploader
{
    const PROTOCOL_DELIMITER = '://';

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

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

    function __construct($xmlString, $target)
    {
        $this->checkTarget($target);
        $this->target = $target;
        $this->xmlString = $xmlString;
    }


    public function uploadXmlTo()
    {
        file_put_contents($this->target, $this->xmlString);
    }

    private function checkTarget($target)
    {
        $protocol = strtok($target, self::PROTOCOL_DELIMITER) . self::PROTOCOL_DELIMITER;
        if (!in_array($protocol, $this->getAllowedProtocols())) {
            $message = sprintf('"%s" is not one of the allowed protocols: "%s"', $protocol,
                implode(', ', $this->getAllowedProtocols()));
            Mage::throwException($message);
        }
    }

    /**
     * @return string[]
     */
    private function getAllowedProtocols()
    {
        return array(
            'ssh2.scp://',
            'ssh2.sftp://',
            'file://',
        );
    }
}
<commit_msg>Issue #2: Rename method, add docs<commit_after><?php

class Brera_MagentoConnector_Model_XmlUploader
{
    const PROTOCOL_DELIMITER = '://';

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

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

    /**
     * @param string $xmlString
     * @param string $target
     */
    function __construct($xmlString, $target)
    {
        $this->checkTarget($target);
        $this->target = $target;
        $this->xmlString = $xmlString;
    }

    public function upload()
    {
        file_put_contents($this->target, $this->xmlString);
    }

    /**
     * @param string $target
     * @throws Mage_Core_Exception
     */
    private function checkTarget($target)
    {
        $protocol = strtok($target, self::PROTOCOL_DELIMITER) . self::PROTOCOL_DELIMITER;
        if (!in_array($protocol, $this->getAllowedProtocols())) {
            $message = sprintf('"%s" is not one of the allowed protocols: "%s"', $protocol,
                implode(', ', $this->getAllowedProtocols()));
            Mage::throwException($message);
        }
    }

    /**
     * @return string[]
     */
    private function getAllowedProtocols()
    {
        return array(
            'ssh2.scp://',
            'ssh2.sftp://',
            'file://',
        );
    }
}

{'fraction_non_alphanumeric': 0.15071283095723015, 'fraction_numerical': 0.002036659877800407, 'mean_word_length': 2.0320987654320986, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 11}, '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': '5834590', 'n_tokens_mistral': 761, 'n_tokens_neox': 756, 'n_words': 136}