<commit_before><?php

namespace UoBParser\Entities;

use \Exception;

class Course
{
    function __construct($id, $name, $level, $deptId)
    {
        $this->id = $id;
        $this->name = $name;
        $this->level = $level;
        $this->deptId = $deptId;
        $this->department = false;
    }

    /**
     * Get the url to access the sessions for this course
     * @return string
     */
    public function sessionUrl()
    {
        $args['dept'] = $this->deptId;
        $args['course'] = $this->id;
        $args['level'] = $this->level;

        $url =  'http://'.$_SERVER['SERVER_NAME'];
        $url .= $_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : '';
        $url .= dirname($_SERVER['PHP_SELF']);
        $url .= '/sessions?'.http_build_query($args);
        return $url;
    }

    /**
     * Split name in to chunks
     * Parse the string so that it isn't split by '-' between brackets
     * @return array
     */
    public function nameChunks()
    {
        $name = $this->name;

        $chunks = [];<commit_msg>Added HTTPS support to Course->sessionUrl()<commit_after><?php

namespace UoBParser\Entities;

use \Exception;

class Course
{
    function __construct($id, $name, $level, $deptId)
    {
        $this->id = $id;
        $this->name = $name;
        $this->level = $level;
        $this->deptId = $deptId;
        $this->department = false;
    }

    /**
     * Get the url to access the sessions for this course
     * @return string
     */
    public function sessionUrl()
    {
        $args['dept'] = $this->deptId;
        $args['course'] = $this->id;
        $args['level'] = $this->level;

        $isHttps = empty($_SERVER['HTTPS']) == false && $_SERVER['HTTPS'] != 'off';

        $url = $isHttps ? 'https://' : 'http://';
        $url .= $_SERVER['SERVER_NAME'];
        $url .= $_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : '';
        $url .= dirname($_SERVER['PHP_SELF']);
        $url .= '/sessions?'.http_build_query($args);

        return $url;
    }

    /**
     * Split name in to chunks
     * Parse the string so that it isn't split by '-' between brackets
     * @return array
     */
    public function nameChunks()
    {
        $name = $this->name;

        $chunks = [];
{'fraction_non_alphanumeric': 0.17791411042944785, 'fraction_numerical': 0.0017528483786152498, 'mean_word_length': 2.140302613480055, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, 'https://': 1, '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': '3931971', 'n_tokens_mistral': 755, 'n_tokens_neox': 736, 'n_words': 171}