Created by
Dan Gifford
| /**
* Call the setter for each property in the given
* config array, if it exists. Calls Setters in
* camel case, e.g. setPropertyNameGoesHere()
*
* @param array $config
*/
public function setConfig( array $config = null ): void
{
if( is_null( $config ) )
{
return;
}
foreach( $config as $name => $value )
{
$method_a = array_merge(['set'], array_map( 'ucfirst', explode('_', $name) ));
$method = implode('', $method_a);
if( is_callable([$this, $method]) )
{
$this->$method( $value );
}
}
}
|