<commit_before><?php

namespace App\Model;

use \App\Libs\Model;

class Settings extends Model{
  
  	protected $table = 'settings';
  	public $timestamps = false;
  	public $settings;

	public static function get($setting){

		$result = self::where('setting',$setting)->first();

		return $result->value;
	}

	public static function getAll(){


		foreach(self::All() as $each){
			$array[$each->setting] = $each->value;
		}


		return $array;
	}


	public function assignAll(){
		$settings = self::All();

		$this->settings = new \stdClass();

		foreach($settings as $each){

			if(!empty($each->setting)){
				$this->settings->{$each->setting} = $each->value;
			}
		
		}<commit_msg>Ability to pass default value to Settings::get method<commit_after><?php

namespace App\Model;

use \App\Libs\Model;

class Settings extends Model{
  
  	protected $table = 'settings';
  	public $timestamps = false;
  	public $settings;

	public static function get($setting,$default = null){

		$result = self::where('setting',$setting)->first();

		return $result==null? $default : $result->value;
	}

	public static function getAll(){

		foreach(self::all() as $each){
			$array[$each->setting] = $each->value;
		}


		return $array;
	}


	public function assignAll(){
		$settings = self::all();

		$this->settings = new \stdClass();

		foreach($settings as $each){

			if(!empty($each->setting)){
				$this->settings->{$each->setting} = $each->value;
			}
		
		}
{'fraction_non_alphanumeric': 0.17436250861474845, 'fraction_numerical': 0.0, 'mean_word_length': 3.87248322147651, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '3269118', 'n_tokens_mistral': 526, 'n_tokens_neox': 462, 'n_words': 110}