original_string: protected function sanitize($preferences = null) : Collection
  	{
  		if (is_null($preferences) && $this->auth->check()) {
  			return Collection::make($this->auth->user()->preferences);
  		}
  
  		if (is_null($preferences) && ! $this->auth->check()) {
  			return $this->allowed;
  		}
  
  		if (is_string($preferences)) {
  			$preferences = json_decode($preferences, true);
  		}
  
  		return Collection::make($preferences)->filter(function($item, $key) {
  			return $this->allowed->has($key);
  		});
  	}
code: protected function sanitize($preferences = null) : Collection
  	{
  		if (is_null($preferences) && $this->auth->check()) {
  			return Collection::make($this->auth->user()->preferences);
  		}
  
  		if (is_null($preferences) && ! $this->auth->check()) {
  			return $this->allowed;
  		}
  
  		if (is_string($preferences)) {
  			$preferences = json_decode($preferences, true);
  		}
  
  		return Collection::make($preferences)->filter(function($item, $key) {
  			return $this->allowed->has($key);
  		});
  	}
code_tokens: protected function sanitize ( $ preferences = null ) : Collection { if ( is_null ( $ preferences ) && $ this -> auth -> check ( ) ) { return Collection :: make ( $ this -> auth -> user ( ) -> preferences ) ; } if ( is_null ( $ preferences ) && ! $ this -> auth -> check ( ) ) { return $ this -> allowed ; } if ( is_string ( $ preferences ) ) { $ preferences = json_decode ( $ preferences , true ) ; } return Collection :: make ( $ preferences ) -> filter ( function ( $ item , $ key ) { return $ this -> allowed -> has ( $ key ) ; } ) ; }
docstring: Sanitizes the given preferences.
  
  @param  null|string $preferences
  
  @return Collection
docstring_tokens: Sanitizes the given preferences .