Semantic MediaWiki and related extensions
Public Member Functions | Static Public Member Functions | List of all members
SMW\Settings Class Reference
Inheritance diagram for SMW\Settings:
Inheritance graph
[legend]
Collaboration diagram for SMW\Settings:
Collaboration graph
[legend]

Public Member Functions

 get ( $key)
 
 safeGet ( $key, $default=false)
 
- Public Member Functions inherited from SMW\Options
 __construct (array $options=[])
 
 set ( $key, $value)
 
 delete ( $key)
 
 has ( $key)
 
 is ( $key, $value)
 
 get ( $key)
 
 safeGet ( $key, $default=false)
 
 dotGet ( $key, $default=false)
 
 isFlagSet ( $key, $flag)
 
 toArray ()
 
 getOptions ()
 
 filter (array $keys)
 

Static Public Member Functions

static newFromGlobals ()
 
static newFromArray (array $settings)
 
static clear ()
 

Additional Inherited Members

- Protected Attributes inherited from SMW\Options
 $options = []
 

Detailed Description

Encapsulate Semantic MediaWiki settings to access values through a specified interface

GNU GPL v2+

Since
1.9
Author
mwjames

Member Function Documentation

◆ clear()

static SMW\Settings::clear ( )
static
Since
1.9

◆ get()

SMW\Settings::get (   $key)

Returns settings for a given key (nested settings are supported)

Example:
$settings = Settings::newFromArray( array(
'Foo' => 'Bar'
'Parent' => array(
'Child' => array( 'Lisa', 'Lula', array( 'Lila' ) )
)
);
$settings->get( 'Child' ) will return array( 'Lisa', 'Lula', array( 'Lila' ) )
Since
1.9
Parameters
string$key
Returns
mixed
Exceptions
SettingNotFoundException

◆ newFromArray()

static SMW\Settings::newFromArray ( array  $settings)
static

Factory method for immediate instantiation of a settings object for a given array

Example:
$settings = Settings::newFromArray( array( 'Foo' => 'Bar' ) );
$settings->get( 'Foo' );
Since
1.9
Returns
Settings

◆ newFromGlobals()

static SMW\Settings::newFromGlobals ( )
static

Assemble individual SMW related settings into one accessible array for easy instantiation since we don't have unique way of accessing only SMW related settings ( e.g. $smwgSettings['...']) we need this method as short cut to invoke only smwg* related settings

Example:
$settings->get( 'smwgDefaultStore' );
Since
1.9
Returns
Settings

◆ safeGet()

SMW\Settings::safeGet (   $key,
  $default = false 
)
Since
3.0
Parameters
string$key
mixed$default
Returns
mixed

The documentation for this class was generated from the following file:

About | General disclaimer | Privacy policy