<commit_before><?php
/**
 * Grav Events Plugin Calendar Class
 *
 * The Events Calendar Class provides variables for Twig to create a dynamic
 * calendar with previous and next links that relate to month and year. This
 * is used for display a traditional calendar and forming the rows and columns
 * that make up the calendar.
 *
 * @package    Events
 * @author     <NAME> <<EMAIL>>
 * @copyright  2016 <NAME>
 * @license    https://opensource.org/licenses/MIT MIT
 * @version    1.0.14
 * @link       https://github.com/kalebheitzman/grav-plugin-events
 * @since      File available since Release 1.0.0
 */

namespace Events;
require_once __DIR__.'/../vendor/autoload.php';
use Carbon\Carbon;

/**
 * Events Plugin Calendar Class
 *
 * The Events Calendar Class provides variables for Twig to create a dynamic
 * calendar with previous and next links that relate to month and year. This
 * class is also used to display a traditional calendar and form the rows
 * and columns that make up the calendar. It does not calculate dates or
 * manipulate any information. It's simply for displaying a nice **calendar
 * page** on your Grav website. It is referenced under the
 * `onTwigSiteVariables` hook in the root events plugin file.
 *
 * @package    Events
 * @author     <NAME> <<EMAIL>>
 * @copyright  2016 <NAME>
 * @license    https://opensource.org/licenses/MIT MIT
 * @version    1.0.8
 * @link       https://github.com/kalebheitzman/grav-plugin-events
 * @since      1.0.0 Initial Release
 */
class Calendar
{
	/**
	 * Twig Calendar Vars
	 *
	 * Adds a url to the event header and stores each event in an associative
	 * array that can be accessed from twig calendar template via **year,
	 * month, and day** params. Here is an example of accessing a particular
	 * day on a calendar.
	 *
	 * ```twig
	 * {% for events in calendar.events[calendar.year][calendar.month][day] %}
	 *  	{% for event in events %}
   *          {% if event.title %}
   *              <div class="event"><a href="{{ event.url }}">{{ event.title }}</a></div>
   *          {% endif %}
   *      {% endfor %}
	 * {% endfor %}
	 * ```
	 *
	 * @param  object $collection Grav Collection
	 *
	 * @return array              Calendar variables for Twig
	 */
	public function calendarVars( $collection )
	{
		// build a calendar array to use in twig
		$calendar = array();
		foreach($collection as $event) {
			$header = $event->header();
			$start = $header->event['start'];

			// build dates to create an associate array
			$carbonStart = Carbon::parse($start);
			$year = $carbonStart->year;
 			$month = $carbonStart->month;<commit_msg>updated calendar order<commit_after><?php
/**
 * Grav Events Plugin Calendar Class
 *
 * The Events Calendar Class provides variables for Twig to create a dynamic
 * calendar with previous and next links that relate to month and year. This
 * is used for display a traditional calendar and forming the rows and columns
 * that make up the calendar.
 *
 * @package    Events
 * @author     <NAME> <<EMAIL>>
 * @copyright  2016 <NAME>
 * @license    https://opensource.org/licenses/MIT MIT
 * @version    1.0.14
 * @link       https://github.com/kalebheitzman/grav-plugin-events
 * @since      File available since Release 1.0.0
 */

namespace Events;
require_once __DIR__.'/../vendor/autoload.php';
use Carbon\Carbon;

/**
 * Events Plugin Calendar Class
 *
 * The Events Calendar Class provides variables for Twig to create a dynamic
 * calendar with previous and next links that relate to month and year. This
 * class is also used to display a traditional calendar and form the rows
 * and columns that make up the calendar. It does not calculate dates or
 * manipulate any information. It's simply for displaying a nice **calendar
 * page** on your Grav website. It is referenced under the
 * `onTwigSiteVariables` hook in the root events plugin file.
 *
 * @package    Events
 * @author     <NAME> <<EMAIL>>
 * @copyright  2016 <NAME>
 * @license    https://opensource.org/licenses/MIT MIT
 * @version    1.0.8
 * @link       https://github.com/kalebheitzman/grav-plugin-events
 * @since      1.0.0 Initial Release
 */
class Calendar
{
	/**
	 * Twig Calendar Vars
	 *
	 * Adds a url to the event header and stores each event in an associative
	 * array that can be accessed from twig calendar template via **year,
	 * month, and day** params. Here is an example of accessing a particular
	 * day on a calendar.
	 *
	 * ```twig
	 * {% for events in calendar.events[calendar.year][calendar.month][day] %}
	 *  	{% for event in events %}
   *          {% if event.title %}
   *              <div class="event"><a href="{{ event.url }}">{{ event.title }}</a></div>
   *          {% endif %}
   *      {% endfor %}
	 * {% endfor %}
	 * ```
	 *
	 * @param  object $collection Grav Collection
	 *
	 * @return array              Calendar variables for Twig
	 */
	public function calendarVars( $collection )
	{
		// build a calendar array to use in twig
		$calendar = array();

		$collection->order('date', 'asc');

		foreach($collection as $event) {
			$header = $event->header();
			$start = $header->event['start'];

			// build dates to create an associate array
			$carbonStart = Carbon::parse($start);
			$year = $carbonStart->year;
 			$month = $carbonStart->month;
{'fraction_non_alphanumeric': 0.11483163072266364, 'fraction_numerical': 0.007945516458569807, 'mean_word_length': 3.011380880121396, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 36, 'https://': 8, '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': '1416429', 'n_tokens_mistral': 1610, 'n_tokens_neox': 1455, 'n_words': 581}