<commit_before><?php
/** @noinspection PhpUndefinedClassInspection */

namespace App\ModelFunctions;

use App\Album;
use App\Logs;
use App\Photo;
use App\Response;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;

class AlbumFunctions
{


	/**
	 * given an albumID return if the said album is "smart"
	 *
	 * @param $albumID
	 * @return bool
	 */
	public function is_smart_album($albumID)
	{
		if ($albumID === 'f' || $albumID === 's' || $albumID === 'r' || $albumID === 0) {
			return true;
		}
		return false;
	}



	/**
	 * Create a new album from a title and optional parent_id
	 *
	 * @param string $title
	 * @param int $parent_id
	 * @param int $user_id
	 * @return Album|string
	 */
	public function create(string $title, int $parent_id, int $user_id): Album
	{
		$parent = Album::find($parent_id);
		// we get the parent if it exists.

		$album = new Album();
		$album->id = Helpers::generateID();
		$album->title = $title;
		$album->description = '';<commit_msg>Fix top-level uploads for regular users (#253)<commit_after><?php
/** @noinspection PhpUndefinedClassInspection */

namespace App\ModelFunctions;

use App\Album;
use App\Logs;
use App\Photo;
use App\Response;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;

class AlbumFunctions
{


	/**
	 * given an albumID return if the said album is "smart"
	 *
	 * @param $albumID
	 * @return bool
	 */
	public function is_smart_album($albumID)
	{
		if ($albumID === 'f' || $albumID === 's' || $albumID === 'r' || $albumID === '0') {
			return true;
		}
		return false;
	}



	/**
	 * Create a new album from a title and optional parent_id
	 *
	 * @param string $title
	 * @param int $parent_id
	 * @param int $user_id
	 * @return Album|string
	 */
	public function create(string $title, int $parent_id, int $user_id): Album
	{
		$parent = Album::find($parent_id);
		// we get the parent if it exists.

		$album = new Album();
		$album->id = Helpers::generateID();
		$album->title = $title;
		$album->description = '';
{'fraction_non_alphanumeric': 0.14217182730047973, 'fraction_numerical': 0.002180549498473615, 'mean_word_length': 3.92274678111588, 'pattern_counts': {'":': 0, '<': 5, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5308553', 'n_tokens_mistral': 805, 'n_tokens_neox': 761, 'n_words': 210}