*/ private $preferences; /** * @var array */ private $options; /** * @param array $preferences Per-user preferences. * @param array $options Site options. */ public function __construct( array $preferences = array(), array $options = array() ) { $this->preferences = $preferences; $this->options = $options; } /** {@inheritDoc} */ public function user_preference( $key, $fallback = null ) { return array_key_exists( $key, $this->preferences ) ? $this->preferences[ $key ] : $fallback; } /** {@inheritDoc} */ public function site_option( $key, $fallback = null ) { return array_key_exists( $key, $this->options ) ? $this->options[ $key ] : $fallback; } }