Stud.IP  5.4
Config Class Reference
Inheritance diagram for Config:
RangeConfig CourseConfig InstituteConfig UserConfig

Public Member Functions

 __construct ($data=null)
 
 getFields ($range=null, $section=null, $name=null)
 
 getMetadata ($field)
 
 getValue ($field)
 
 setValue ($field, $value)
 
 getIterator ()
 
 __get ($field)
 
 __set ($field, $value)
 
 __isset ($field)
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 count ()
 
 store ($field, $data)
 
 create ($field, $data=[])
 
 delete ($field)
 
 convertFromDatabase ($type, $value, $field)
 
 convertForDatabase ($type, $value, $field)
 

Static Public Member Functions

static get ()
 
static getInstance ()
 
static set ()
 

Protected Member Functions

 fetchData ($data=null)
 
 getI18NIdentifier ($field)
 

Protected Attributes

 $data = []
 
 $metadata = []
 

Constructor & Destructor Documentation

◆ __construct()

__construct (   $data = null)

pass array of config entries in field => value pairs to circumvent fetching from database

Parameters
array$data

Member Function Documentation

◆ __get()

__get (   $field)

magic method for dynamic properties

◆ __isset()

__isset (   $field)

magic method for dynamic properties

◆ __set()

__set (   $field,
  $value 
)

magic method for dynamic properties

◆ convertForDatabase()

convertForDatabase (   $type,
  $value,
  $field 
)

Transforms the given value to be stored in the database.

Parameters
string$type
mixed$value
string$field
Returns
mixed

◆ convertFromDatabase()

convertFromDatabase (   $type,
  $value,
  $field 
)

Transforms the data from the database for use.

Parameters
string$type
mixed$value
string$field
Returns
mixed

◆ count()

count ( )

Countable

◆ create()

create (   $field,
  $data = [] 
)

creates a new config entry in database

Parameters
stringname of entry
arraydata to insert as assoc array
Exceptions
InvalidArgumentException
Returns
null|ConfigEntry

◆ delete()

delete (   $field)

delete config entry from database

Parameters
stringname of entry
Exceptions
InvalidArgumentException
Returns
integer number of deleted rows

◆ fetchData()

fetchData (   $data = null)
protected

fetch config data from table config pass array to override database access

Parameters
array$data

◆ get()

static get ( )
static

returns singleton instance

Returns
Config

◆ getFields()

getFields (   $range = null,
  $section = null,
  $name = null 
)

returns a list of config entry names, filtered by given params

Parameters
stringfilter by range: global, range, user, course or institute
stringfilter by section
stringfilter by part of name
Returns
array

◆ getI18NIdentifier()

getI18NIdentifier (   $field)
protected

Returns the identifier for the i18n field.

Parameters
string$field
Returns
string

◆ getInstance()

static getInstance ( )
static

alias of Config::get() for compatibility

Returns
Config

◆ getIterator()

getIterator ( )

IteratorAggregate

◆ getMetadata()

getMetadata (   $field)

returns metadata for config entry

Parameters
string$field
Returns
array

◆ getValue()

getValue (   $field)

returns value of config entry for compatibility reasons an existing variable in global namespace with the same name is also returned

Parameters
string$field
Returns
mixed

◆ offsetExists()

offsetExists (   $offset)

ArrayAccess: Check whether the given offset exists.

◆ offsetGet()

offsetGet (   $offset)

ArrayAccess: Get the value at the given offset.

◆ offsetSet()

offsetSet (   $offset,
  $value 
)

ArrayAccess: Set the value at the given offset.

◆ offsetUnset()

offsetUnset (   $offset)

ArrayAccess: unset the value at the given offset (not applicable)

◆ set()

static set ( )
static

use to set singleton instance for testing or to unset by passing null

Parameters
Config$my_instance

◆ setValue()

setValue (   $field,
  $value 
)

set config entry to given value, but don't store it in database

Parameters
string$field
mixed$value
Returns

◆ store()

store (   $field,
  $data 
)

store new value for existing config entry in database posts notification ConfigValueChanged if entry is changed

Parameters
string$field
string$data
Exceptions
InvalidArgumentException
Returns
boolean

Field Documentation

◆ $data

$data = []
protected

◆ $metadata

$metadata = []
protected

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