<commit_before><?php
/**
 * radium: lithium application framework
 *
 * @copyright     Copyright 2013, brünsicke.com GmbH (http://bruensicke.com)
 * @license       http://opensource.org/licenses/BSD-3-Clause The BSD License
 */

namespace radium\extensions\helper;

class Page extends \lithium\template\Helper {

	/**
	 * holds instance of current page entity
	 *
	 * @var object
	 */
	protected $_page = null;

	/**
	 * Imports page from request object, if available
	 *
	 * @return void
	 */
	protected function _init() {
		parent::_init();
		$this->_page = ($this->_context->request()->page) ? : null;
	}

	/**
	 * returns widgets from current page
	 *
	 * @see radium\models\Pages::widgets()
	 * @return array array structure from widgets as from page->widgets()
	 */
	public function widgets() {
		return $this->_page->widgets();
	}

	/**
	 * returns current page entity
	 *
	 * @return object instance of current page entity
	 */
	public function get() {
		return $this->_page;
	}

	/**
	 * magic method to access page properties in view<commit_msg>add attribute fetch to Page Helper<commit_after><?php
/**
 * radium: lithium application framework
 *
 * @copyright     Copyright 2013, brünsicke.com GmbH (http://bruensicke.com)
 * @license       http://opensource.org/licenses/BSD-3-Clause The BSD License
 */

namespace radium\extensions\helper;

class Page extends \lithium\template\Helper {

	/**
	 * holds instance of current page entity
	 *
	 * @var object
	 */
	protected $_page = null;

	/**
	 * Imports page from request object, if available
	 *
	 * @return void
	 */
	protected function _init() {
		parent::_init();
		$this->_page = ($this->_context->request()->page) ? : null;
	}

	/**
	 * returns widgets from current page
	 *
	 * @see radium\models\Pages::widgets()
	 * @return array array structure from widgets as from page->widgets()
	 */
	public function widgets() {
		return $this->_page->widgets();
	}

	/**
	 * returns current page entity
	 *
	 * @param string $name Name of attribute to return from page
	 * @return object instance of current page entity
	 */
	public function get($name = null) {
		if (!is_null($name)) {
			return $this->_page->$name ? : null;
		}
		return $this->_page;
	}

	/**
	 * magic method to access page properties in view
{'fraction_non_alphanumeric': 0.13544415127528583, 'fraction_numerical': 0.0043975373790677225, 'mean_word_length': 3.2523364485981308, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5971465', 'n_tokens_mistral': 740, 'n_tokens_neox': 660, 'n_words': 208}