<commit_before><?php

class InstagramPhoto extends Eloquent {

	/*
	Relations
	 */

	public function user()
	{
		return $this->belongsTo('User');
	}

	public function setTagsAttribute(array $tags)
	{
		$this->attributes['tags'] = json_encode($tags);
	}

	public function getTagsAttribute()
	{
		return json_decode($this->attributes['tags']);
	}

	/*
	Scopes
	 */

	public function scopeLatest($query)
	{
		return $query->orderBy('captured_time', 'desc');
	}

	/**
	 * Refresh an Instagram photo's information
	 * @param  array $photo
	 */
	public static function refresh($data)
	{
		$photo = static::find($data['id']);
		if ( ! $photo) {
			$photo = new static;
			$photo->id = $data['id'];
		}

		$photo->tags                          = $data['tags'];
		$photo->latitude                      = array_get($data, 'location.latitude');
		$photo->longitude                     = array_get($data, 'location.longitude');
		$photo->captured_time                 = $data['created_time'];
		$photo->link                          = $data['link'];
		$photo->image_low_resolution_url      = array_get($data, 'images.low_resolution.url');
		$photo->image_thumbnail_url           = array_get($data, 'images.thumbnail.url');
		$photo->image_standard_resolution_url = array_get($data, 'images.standard_resolution.url');
		$photo->instagram_username            = array_get($data, 'user.username');
		$photo->instagram_user_id             = array_get($data, 'user.id');
		$photo->type                          = $data['type'];

		$photo->save();
	}

}<commit_msg>Force Instagram photo to server over HTTPS<commit_after><?php

class InstagramPhoto extends Eloquent {

	/*
	Relations
	 */

	public function user()
	{
		return $this->belongsTo('User');
	}

	public function setTagsAttribute(array $tags)
	{
		$this->attributes['tags'] = json_encode($tags);
	}

	public function getTagsAttribute()
	{
		return json_decode($this->attributes['tags']);
	}

	/*
	Scopes
	 */

	public function scopeLatest($query)
	{
		return $query->orderBy('captured_time', 'desc');
	}

	/**
	 * Refresh an Instagram photo's information
	 * @param  array $photo
	 */
	public static function refresh($data)
	{
		$photo = static::find($data['id']);
		if ( ! $photo) {
			$photo = new static;
			$photo->id = $data['id'];
		}

		$photo->tags                          = $data['tags'];
		$photo->latitude                      = array_get($data, 'location.latitude');
		$photo->longitude                     = array_get($data, 'location.longitude');
		$photo->captured_time                 = $data['created_time'];
		$photo->link                          = $data['link'];
		$photo->image_low_resolution_url      = str_replace('http://', 'https://', array_get($data, 'images.low_resolution.url'));
		$photo->image_thumbnail_url           = str_replace('http://', 'https://', array_get($data, 'images.thumbnail.url'));
		$photo->image_standard_resolution_url = str_replace('http://', 'https://', array_get($data, 'images.standard_resolution.url'));
		$photo->instagram_username            = array_get($data, 'user.username');
		$photo->instagram_user_id             = array_get($data, 'user.id');
		$photo->type                          = $data['type'];

		$photo->save();
	}

}
{'fraction_non_alphanumeric': 0.16971198513471664, 'fraction_numerical': 0.0, 'mean_word_length': 2.8498212157330154, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, 'https://': 3, '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': '5753479', 'n_tokens_mistral': 1093, 'n_tokens_neox': 997, 'n_words': 172}