<commit_before><?
/*
 * Class: File_Model
 * ORM Class implementing files table
 */
class Model_File extends ORM {

	/*
	 * Variable: $imageinfo
	 * Private array containing info pertaining to generated images
	 */
	private $imageinfo = array();

	/*
	 * Variable: object_fields
	 * Private array containing fields that should be passed through to parent object on __get and __set
	 */
	private $object_fields = array('loaded');

	/*
	 * Function: __construct($id) 
	 * Constructor, fills this->object fields with configured fields and current table columns
	 * Parameters:
	 * id  - the id of file
	 * Returns: 
	 */
	public function __construct($id){
		parent::__construct($id);
		$this->object_fields = array_merge($this->object_fields, array_keys($this->_table_columns) );
	}


	/*
	 * Function: __get($column) 
	 * Custom getter for this model. This model supports a notion of 'resize prefixes' for image files,
	 * so that width, height, filename, fullpath, and urlfilename can be accessed via $model->prefix->parameter
	 * Parameters:
	 * $column - the column to get
	 * Returns: the value of the column
	 */
	public function __get($column) {
		//if it's a column in the table just return it
		
		if(in_array($column, $this->object_fields )){
			return parent::__get($column);
		}

		if($column == 'urlfilename'){
			return rawurlencode(parent::__get('filename'));
		} else if ($column == 'fullpath'){
			return Graph::mediapath().parent::__get('filename');
		}

		//otherwise check if it's a valid resize prefix


		$prefix = $column; //for code clarity

		//create image info object
		if(!isset($this->imageinfo[$prefix])){<commit_msg>Added missing case for ext to file model getter<commit_after><?
/*
 * Class: File_Model
 * ORM Class implementing files table
 */
class Model_File extends ORM {

	/*
	 * Variable: $imageinfo
	 * Private array containing info pertaining to generated images
	 */
	private $imageinfo = array();

	/*
	 * Variable: object_fields
	 * Private array containing fields that should be passed through to parent object on __get and __set
	 */
	private $object_fields = array('loaded');

	/*
	 * Function: __construct($id) 
	 * Constructor, fills this->object fields with configured fields and current table columns
	 * Parameters:
	 * id  - the id of file
	 * Returns: 
	 */
	public function __construct($id){
		parent::__construct($id);
		$this->object_fields = array_merge($this->object_fields, array_keys($this->_table_columns) );
	}


	/*
	 * Function: __get($column) 
	 * Custom getter for this model. This model supports a notion of 'resize prefixes' for image files,
	 * so that width, height, filename, fullpath, and urlfilename can be accessed via $model->prefix->parameter
	 * Parameters:
	 * $column - the column to get
	 * Returns: the value of the column
	 */
	public function __get($column) {
		//if it's a column in the table just return it
		
		if(in_array($column, $this->object_fields )){
			return parent::__get($column);
		}

		if($column == 'urlfilename'){
			return rawurlencode(parent::__get('filename'));
		} else if ($column == 'fullpath'){
			return Graph::mediapath().parent::__get('filename');
		} else if($column == 'ext'){
         $chunks = explode('.', parent::__get('filename'));
         return $chunks[count($chunks)-1];
      }

		//otherwise check if it's a valid resize prefix


		$prefix = $column; //for code clarity

		//create image info object
		if(!isset($this->imageinfo[$prefix])){
{'fraction_non_alphanumeric': 0.12658959537572254, 'fraction_numerical': 0.00028901734104046245, 'mean_word_length': 3.860955056179775, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '7465017', 'n_tokens_mistral': 1080, 'n_tokens_neox': 961, 'n_words': 337}