<commit_before><?php

namespace TicketCo\Resources;

class Events extends API
{

    /**
     * @var string
     */
    protected $resource = 'events';

    /**
     * Get all events
     *
     * @param array $filters Filter by providing one or more of these params;
     *                          tags            - Filter by tags. E.g ['tags' => 'teater,standup']
     *                          title           - Filter by title. E.g ['title' => 'red']
     *                          street_address  - ['street_address' => 'Oslo']
     *                          location        - Location name: ['location' => 'Concert']
     *                          start_at        - Exact start date: ['start_at' => '2017-1-1']
     * @return mixed
     * @throws \Exception
     */
    public function all($filters = [])
    {
        return $this->request($filters);
    }

    /**
     * Retrieve a single event
     *
     * @param int $id
     * @return mixed
     * @throws \Exception
     */
    public function get($id)
    {
        return $this->request([], $id);
    }

    /**
     * Returns status of event
     *
     * @param int $id
     * @return mixed
     * @throws \Exception
     */
    public function status($id)
    {<commit_msg>Patch added for upcoming events. TicketCo is working on a fix for the API<commit_after><?php

namespace TicketCo\Resources;

use DateTime;

class Events extends API
{

    /**
     * @var string
     */
    protected $resource = 'events';

    /**
     * Get all events
     *
     * @param array $filters Filter by providing one or more of these params;
     *                          tags            - Filter by tags. E.g ['tags' => 'teater,standup']
     *                          title           - Filter by title. E.g ['title' => 'red']
     *                          street_address  - ['street_address' => 'Oslo']
     *                          location        - Location name: ['location' => 'Concert']
     *                          start_at        - Exact start date: ['start_at' => '2017-1-1']
     * @return mixed
     * @throws \Exception
     */
    public function all($filters = [])
    {
        return $this->request($filters);
    }

    /**
     * Patch for upcoming events after API changes
     * @throws \Exception
     */
    public function upcoming()
    {
        date_default_timezone_set('Europe/Oslo');

        $events = $this->request();

        $now = new DateTime();
        return $events->filter(function($event) use ($now) {
            $dt = new DateTime($event->start_at);
            return $dt >= $now;
        });
    }

    /**
     * Retrieve a single event
     *
     * @param int $id
     * @return mixed
     * @throws \Exception
     */
    public function get($id)
    {
        return $this->request([], $id);
    }

    /**
     * Returns status of event
     *
     * @param int $id
     * @return mixed
     * @throws \Exception
     */
    public function status($id)
    {
{'fraction_non_alphanumeric': 0.12718120805369126, 'fraction_numerical': 0.004026845637583893, 'mean_word_length': 1.4494658997534922, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '3274416', 'n_tokens_mistral': 846, 'n_tokens_neox': 827, 'n_words': 233}