<commit_before><?php namespace ProcessWire;

/**
 * ProcessWire Fields
 *
 * Manages collection of ALL Field instances, not specific to any particular Fieldgroup
 * 
 * ProcessWire 3.x, Copyright 2016 by <NAME>
 * https://processwire.com
 * 
 * #pw-summary Manages all custom fields in ProcessWire
 * 
 * @method Field|null get($key) Get a field by name or id
 * @method bool changeFieldtype(Field $field1, $keepSettings = false)
 * @method bool saveFieldgroupContext(Field $field, Fieldgroup $fieldgroup, $namespace = '') 
 * @method bool deleteFieldDataByTemplate(Field $field, Template $template) #pw-hooker
 * @method void changedType(Saveable $item, Fieldtype $fromType, Fieldtype $toType) #pw-hooker
 * @method void changeTypeReady(Saveable $item, Fieldtype $fromType, Fieldtype $toType) #pw-hooker
 *
 */

class Fields extends WireSaveableItems {

	/**
	 * Instance of FieldsArray
	 *
	 */
	protected $fieldsArray = null;

	/**
	 * Field names that are native/permanent to the system and thus treated differently in several instances. 
	 *
	 * For example, a Field can't be given one of these names. 
	 *
	 */
	static protected $nativeNamesSystem = array(
		'id', 
		'parent_id', 
		'parent', // alias
		'parents', 
		'templates_id', 
		'template', // alias
		'name', 
		'status',
		'created',
		'createdUser', 
		'createdUserID',
		'createdUsersID',
		'created_users_id', 
		'include',
		'modified', 
		'modifiedUser', 
		'modifiedUserID',
		'modifiedUsersID',
		'modified_users_id', 
		'published',
		'num_children',
		'numChildren', 
		'sort', 
		'sortfield', 
		'flags', 
		'find',
		'get',
		'child', 
		'children', 
		'siblings', 
		//'roles', 
		'url', 
		'path', 
		'templatePrevious', 
		'rootParent', 
		'fieldgroup',
		'fields', 
		'description',
		'data',
		'isNew',
		);

	/**
	 * Field names that are native/permanent to this instance of ProcessWire (configurable at runtime)
	 *
	 */
	protected $nativeNamesLocal = array();

	/**
	 * Construct
	 *
	 */
	public function __construct() {
		$this->fieldsArray = new FieldsArray();
	}

	/**
	 * Construct and load the Fields
	 * 
	 * #pw-internal<commit_msg>Fix issue processwire/processwire-issues#171 which updates our reserved field names list<commit_after><?php namespace ProcessWire;

/**
 * ProcessWire Fields
 *
 * Manages collection of ALL Field instances, not specific to any particular Fieldgroup
 * 
 * ProcessWire 3.x, Copyright 2016 by <NAME>
 * https://processwire.com
 * 
 * #pw-summary Manages all custom fields in ProcessWire
 * 
 * @method Field|null get($key) Get a field by name or id
 * @method bool changeFieldtype(Field $field1, $keepSettings = false)
 * @method bool saveFieldgroupContext(Field $field, Fieldgroup $fieldgroup, $namespace = '') 
 * @method bool deleteFieldDataByTemplate(Field $field, Template $template) #pw-hooker
 * @method void changedType(Saveable $item, Fieldtype $fromType, Fieldtype $toType) #pw-hooker
 * @method void changeTypeReady(Saveable $item, Fieldtype $fromType, Fieldtype $toType) #pw-hooker
 *
 */

class Fields extends WireSaveableItems {

	/**
	 * Instance of FieldsArray
	 *
	 */
	protected $fieldsArray = null;

	/**
	 * Field names that are native/permanent to the system and thus treated differently in several instances. 
	 *
	 * For example, a Field can't be given one of these names. 
	 *
	 */
	static protected $nativeNamesSystem = array(
		'child',
		'children',
		'created_users_id',
		'created',
		'createdUser',
		'createdUserID',
		'createdUsersID',
		'data',
		'description',
		'fieldgroup',
		'fields',
		'find',
		'flags',
		'get',
		'id',
		'include',
		'isNew',
		'limit',
		'modified_users_id',
		'modified',
		'modifiedUser',
		'modifiedUserID',
		'modifiedUsersID',
		'name',
		'num_children',
		'numChildren',
		'parent_id',
		'parent', 
		'parents',
		'path',
		'published',
		'rootParent',
		'siblings',
		'sort',
		'sortfield',
		'start',
		'status',
		'template',
		'templatePrevious',
		'templates_id',
		'url',
	);

	/**
	 * Field names that are native/permanent to this instance of ProcessWire (configurable at runtime)
	 *
	 */
	protected $nativeNamesLocal = array();

	/**
	 * Construct
	 *
	 */
	public function __construct() {
		$this->fieldsArray = new FieldsArray();
	}

	/**
	 * Construct and load the Fields
	 * 
	 * #pw-internal
{'fraction_non_alphanumeric': 0.1331781140861467, 'fraction_numerical': 0.0034924330616996507, 'mean_word_length': 3.8161434977578477, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '5963403', 'n_tokens_mistral': 1527, 'n_tokens_neox': 1349, 'n_words': 387}