34        parent::__construct(
$config, $reserved);
 
   36        assert(
'is_array($config)');
 
   39        foreach (
$config as $origName => $newName) {
 
   40            if (is_int($origName)) {
 
   41                if ($newName === 
'%duplicate') {
 
   42                    $this->duplicate = 
true;
 
   45                    $mapFiles[] = $newName;
 
   50            if (!is_string($origName)) {
 
   51                throw new Exception(
'Invalid attribute name: '.var_export($origName, 
true));
 
   54            if (!is_string($newName) && !is_array($newName)) {
 
   55                throw new Exception(
'Invalid attribute name: '.var_export($newName, 
true));
 
   58            $this->map[$origName] = $newName;
 
   62        foreach ($mapFiles as &
$file) {
 
   80        $m = explode(
':', $fileName);
 
   81        if (count(
$m) === 2) { 
 
   83                throw new Exception(
"Module '$m[0]' is not enabled.");
 
   87            $filePath = 
$config->getPathValue(
'attributenamemapdir', 
'attributemap/').$fileName.
'.php';
 
   90        if (!file_exists($filePath)) {
 
   91            throw new Exception(
'Could not find attribute map file: '.$filePath);
 
   97            throw new Exception(
'Attribute map file "'.$filePath.
'" didn\'t define an attribute map.');
 
  100        if ($this->duplicate) {
 
  101            $this->map = array_merge_recursive($this->map, 
$attributemap);
 
  115        assert(
'is_array($request)');
 
  116        assert(
'array_key_exists("Attributes", $request)');
 
  121            if (array_key_exists(
$name, $this->map)) {
 
  122                if (!is_array($this->map[
$name])) {
 
  123                    if (!$this->duplicate) {
 
  128                    foreach ($this->map[
$name] as $to_map) {
 
  131                    if (!$this->duplicate && !in_array(
$name, $this->map[
$name], 
true)) {
 
An exception for terminatinating execution or to throw for unit testing.
static getModuleDir($module)
Retrieve the base directory for a module.
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.
$duplicate
Should attributes be duplicated or renamed.
process(&$request)
Apply filter to rename attributes.
$map
Associative array with the mappings of attribute names.
__construct($config, $reserved)
Initialize this filter, parse configuration.
loadMapFile($fileName)
Loads and merges in a file with a attribute map.
Attribute-related utility methods.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file