<commit_before><?php
 /**
  * @author <NAME> <<EMAIL>>
  * @version 0.0.1
  */
class DayOneEntry {
   /**
     * @var string $_uuid           Saves the UUID of the entry
     * @var string $_creationDate   Saves the creation data of the entry
     * @var string $_activity       Saves the activity type
     * @var string $_creator        Saves the creator
     * @var string $_entryText      Saves the Text of the entry
     * @var string $_timeZone       Saves the TimeZone where entry was created
     * @var mixed $_music           Saves information about music
     * @var mixed $_location        Saves information about location
     * @var bool $_debug            Saves if Debug-mode is used
     */
    protected $_uuid, $_creationDate, $_activity, $_creator, $_entryText, $_timeZone, $_music, $_location, $_debug;

    const VERSION = '0.0.1';

    /**
     * If UUID is submitted then use that one, otherwise generate uuid
     *
     * @param bool $debug (optional) Use debug-mode
     * @param string $uuid (optional) Use specific 32character UUID for new entry
     */
    public function __construct($debug = false, $uuid = null) {
        if ($uuid === null) {
            $this->_uuid = $this->generateUuid();
        } else {
            if (strlen($uuid) !== 32) {
                throw new Exception("UUID has to be 32 characters long", 1);
            }
            $this->_uuid = $uuid;
        }

        // Set general stuff
        $this->setTime(time());
        $this->_activity = 'Stationary';
        $this->_timeZone = date_default_timezone_get();
        $this->_creator = array(
            'Device Agent' => 'DayOne PHP',
            'Generation Date' => strval(date('Y-m-d\TG:i:s\Z')),
            'Host Name' => 'DayOne PHP',
            'OS Agent' => 'DayOne PHP',
            'Software Agent' => 'DayOne PHP' . ' ' . self::VERSION
        );
        $this->entryText = '';
        $this->debug = $debug;

        if ($this->debug) {
            echo 'Entry created successfully';
        }

    }
    /**
     * Sets the text for the DayOne-Entry
     *
     * @param string $text Text that should be added to entry
     */
    public function setEntryText($text) {
        // replace newline with PHP_EOL
        $text = str_replace(
            array('\r\n', '\r', '\n', '<br>'),      // search for these
            PHP_EOL,                                // replace with real EOL
            $text);

        // replace characters that could lead to problems
        $text = htmlspecialchars($text);

        $this->entryText = $text;

        if ($this->debug) {
            echo 'EntryText addedd successfully';
        }
    }

    /**
     * Sets time of entry
     *
     * @param int $time Timestampt
     */
    public function setTime($time) {
        $this->_creationDate = strval(date('Y-m-d\TG:i:s\Z', $time));
    }

    /**
     * Sets location for DayOne-Entry
     *
     * @param string $city City's name
     * @param string $country Country
     * @param string $locality Locality (e.g. district)
     * @param float $latitude Latitude
     * @param float $longitude Longitude
     * @param string $name Name of Location
     */
    public function setLocation($city, $country, $locality, $latitude, $longitude, $name) {
        if (empty($city) || empty($country) || empty($locality) || empty($latitude) || empty($longitude) || empty($name)) {
            die('setLocation(): all fields must be set');
        }
        $this->_location = array(
            'city' => strval($city),
            'country' => strval($country),
            'locality' => strval($locality),
            'latitude' => floatval($latitude),
            'longitude' => floatval($longitude),
            'name' => strval($name),
        );<commit_msg>Fixed a date with date generation<commit_after><?php
 /**
  * @author <NAME> <<EMAIL>>
  * @version 0.0.2
  */
class DayOneEntry {
   /**
     * @var string $_uuid           Saves the UUID of the entry
     * @var string $_creationDate   Saves the creation data of the entry
     * @var string $_activity       Saves the activity type
     * @var string $_creator        Saves the creator
     * @var string $_entryText      Saves the Text of the entry
     * @var string $_timeZone       Saves the TimeZone where entry was created
     * @var mixed $_music           Saves information about music
     * @var mixed $_location        Saves information about location
     * @var bool $_debug            Saves if Debug-mode is used
     */
    protected $_uuid, $_creationDate, $_activity, $_creator, $_entryText, $_timeZone, $_music, $_location, $_debug;

    const VERSION = '0.0.2';

    /**
     * If UUID is submitted then use that one, otherwise generate uuid
     *
     * @param bool $debug (optional) Use debug-mode
     * @param string $uuid (optional) Use specific 32character UUID for new entry
     */
    public function __construct($debug = false, $uuid = null) {
        if ($uuid === null) {
            $this->_uuid = $this->generateUuid();
        } else {
            if (strlen($uuid) !== 32) {
                throw new Exception("UUID has to be 32 characters long", 1);
            }
            $this->_uuid = $uuid;
        }

        // Set general stuff
        $this->setTime(time());
        $this->_activity = 'Stationary';
        $this->_timeZone = date_default_timezone_get();
        $this->_creator = array(
            'Device Agent' => 'DayOne PHP',
            'Generation Date' => strval(date('Y-m-d\TH:i:s\Z')),
            'Host Name' => 'DayOne PHP',
            'OS Agent' => 'DayOne PHP',
            'Software Agent' => 'DayOne PHP' . ' ' . self::VERSION
        );
        $this->entryText = '';
        $this->debug = $debug;

        if ($this->debug) {
            echo 'Entry created successfully';
        }

    }
    /**
     * Sets the text for the DayOne-Entry
     *
     * @param string $text Text that should be added to entry
     */
    public function setEntryText($text) {
        // replace newline with PHP_EOL
        $text = str_replace(
            array('\r\n', '\r', '\n', '<br>'),      // search for these
            PHP_EOL,                                // replace with real EOL
            $text);

        // replace characters that could lead to problems
        $text = htmlspecialchars($text);

        $this->entryText = $text;

        if ($this->debug) {
            echo 'EntryText addedd successfully';
        }
    }

    /**
     * Sets time of entry
     *
     * @param int $time Timestampt
     */
    public function setTime($time) {
        $this->_creationDate = strval(date('Y-m-d\TH:i:s\Z', $time));
    }

    /**
     * Sets location for DayOne-Entry
     *
     * @param string $city City's name
     * @param string $country Country
     * @param string $locality Locality (e.g. district)
     * @param float $latitude Latitude
     * @param float $longitude Longitude
     * @param string $name Name of Location
     */
    public function setLocation($city, $country, $locality, $latitude, $longitude, $name) {
        if (empty($city) || empty($country) || empty($locality) || empty($latitude) || empty($longitude) || empty($name)) {
            die('setLocation(): all fields must be set');
        }
        $this->_location = array(
            'city' => strval($city),
            'country' => strval($country),
            'locality' => strval($locality),
            'latitude' => floatval($latitude),
            'longitude' => floatval($longitude),
            'name' => strval($name),
        );
{'fraction_non_alphanumeric': 0.13201581027667983, 'fraction_numerical': 0.0034255599472990776, 'mean_word_length': 1.9354215003866977, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7434339', 'n_tokens_mistral': 2186, 'n_tokens_neox': 2141, 'n_words': 655}