<commit_before><?php

/**
 * @package gypcms
 */

namespace gypcms\page;

/**
 * Inteface for all pages
 *
 * @package gypcms
 * @author <NAME> <<EMAIL>>
 * @license http://www.opensource.org/licenses/mit-license.php MIT License
 */
interface Page
{
  /**
   * All pages must have a render function to display itself
   */
  public function render();
}<commit_msg>Changed the interface to an abstract base class<commit_after><?php

/**
 * @package gypcms
 */

namespace gypcms\page;

/**
 * Baseclass for all pages
 *
 * @package gypcms
 * @author <NAME> <<EMAIL>>
 * @license http://www.opensource.org/licenses/mit-license.php MIT License
 */
abstract class Page
{
  /**
   *
   * @var string The name of the template the page uses
   */
  protected $templateName;

  /**
   *
   * @var \Twig_Template
   */
  protected $template;

  /**
   *
   * @var array An array with settings for the page
   */
  protected $settings;

  /**
   *
   * @var array An array containing the data for the template
   */
  protected $data;

  /**
   *
   * Loads the template from the environment
   * Loads all settings and data
   *
   * @param string $templateName
   */
  public function __construct($templateName)
  {
    $this->templateName = $templateName;

    $twig = \gypcms\Site::getTwigEnvironment();

    $this->template = $twig->loadTemplate($this->templateName);

    $this->data = array();
    $this->settings = array();

    $this->loadSettings();
    $this->loadData();
  }

  /**
   * Loads all the data for the page view
   */
  public abstract function loadData();

  /**
   * Loads all the settings for the page view
   */
  public abstract function loadSettings();

  /**
   * Render the page
   */
  public function render()
  {
    $this->template->display($this->data);
  }
}
{'fraction_non_alphanumeric': 0.13893557422969188, 'fraction_numerical': 0.0, 'mean_word_length': 2.7838983050847457, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2834818', 'n_tokens_mistral': 581, 'n_tokens_neox': 563, 'n_words': 160}