<commit_before><?php

/**
 * @package Able Core
 * @author  <NAME> <<EMAIL>>
 */

namespace AbleCore;

class Node extends EntityExtension {

	/**
	 * Gets the entity type of the current class.
	 *
	 * @return string The entity type.
	 */
	static function getEntityType()
	{
		return 'node';
	}

	/**
	 * Load
	 *
	 * Loads an existing node with the specified identifier.
	 *
	 * @param  mixed $identifier  This can be a number or a string. If it's a number,
	 *                            it is sent through node_load as a NID. If it is a
	 *                            string, it is sent through defaultcontent to try and
	 *                            grab a node with a matching machine name.
	 *
	 * @return Node
	 */
	public static function load($identifier)
	{
		$result = null;
		if (is_numeric($identifier)) {
			$result = parent::load($identifier);
		} else {
			// Try getting the UUID first, then the machine name.
			if (module_exists('uuid')) {
				$result = static::loadByUUID($identifier);
			}
			if (!$result && module_exists('defaultcontent') && function_exists('defaultcontent_get_default')) {
				$nid = defaultcontent_get_default($identifier);
				$result = static::load('node', $nid);
			}
			if (!$result) {
				trigger_error("When loading the node: '{$identifier}', a non-number was given, " .
					"but only a number is supported.",
					E_USER_WARNING);
			}
		}

		if (!$result) {
			trigger_error("The node: '{$identifier}' does not exist.", E_USER_WARNING);
			return false;
		} else {
			return $result;
		}
	}

	/**
	 * Get
	 *
	 * A shorthand for the rest of this class. Loads a node and renders it
	 * with or without the wrapper.
	 *
	 * @param  mixed  $identifier The identifier for the node.
	 *<commit_msg>Fix calling the load function.<commit_after><?php

/**
 * @package Able Core
 * @author  <NAME> <<EMAIL>>
 */

namespace AbleCore;

class Node extends EntityExtension {

	/**
	 * Gets the entity type of the current class.
	 *
	 * @return string The entity type.
	 */
	static function getEntityType()
	{
		return 'node';
	}

	/**
	 * Load
	 *
	 * Loads an existing node with the specified identifier.
	 *
	 * @param  mixed $identifier  This can be a number or a string. If it's a number,
	 *                            it is sent through node_load as a NID. If it is a
	 *                            string, it is sent through defaultcontent to try and
	 *                            grab a node with a matching machine name.
	 *
	 * @return Node
	 */
	public static function load($identifier)
	{
		$result = null;
		if (is_numeric($identifier)) {
			$result = parent::load($identifier);
		} else {
			// Try getting the UUID first, then the machine name.
			if (module_exists('uuid')) {
				$result = static::loadByUUID($identifier);
			}
			if (!$result && module_exists('defaultcontent') && function_exists('defaultcontent_get_default')) {
				$nid = defaultcontent_get_default($identifier);
				$result = static::load($nid);
			}
			if (!$result) {
				trigger_error("When loading the node: '{$identifier}', a non-number was given, " .
					"but only a number is supported.",
					E_USER_WARNING);
			}
		}

		if (!$result) {
			trigger_error("The node: '{$identifier}' does not exist.", E_USER_WARNING);
			return false;
		} else {
			return $result;
		}
	}

	/**
	 * Get
	 *
	 * A shorthand for the rest of this class. Loads a node and renders it
	 * with or without the wrapper.
	 *
	 * @param  mixed  $identifier The identifier for the node.
	 *
{'fraction_non_alphanumeric': 0.1190271816881259, 'fraction_numerical': 0.0, 'mean_word_length': 2.600411946446962, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '6679500', 'n_tokens_mistral': 1172, 'n_tokens_neox': 1027, 'n_words': 361}