ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SimpleSAML\Utils\Arrays Class Reference
+ Collaboration diagram for SimpleSAML\Utils\Arrays:

Static Public Member Functions

static arrayize ($data, $index=0)
 Put a non-array variable into an array. More...
 
static transpose ($array)
 This function transposes a two-dimensional array, so that $a['k1']['k2'] becomes $a['k2']['k1']. More...
 

Detailed Description

Definition at line 9 of file Arrays.php.

Member Function Documentation

◆ arrayize()

static SimpleSAML\Utils\Arrays::arrayize (   $data,
  $index = 0 
)
static

Put a non-array variable into an array.

Parameters
array$dataThe data to place into an array.
mixed$indexThe index or key of the array where to place the data. Defaults to 0.
Returns
array An array with one element containing $data, with key $index, or $data itself if it's already an array.
Author
Andreas Solberg, UNINETT AS andre.nosp@m.as.s.nosp@m.olber.nosp@m.g@un.nosp@m.inett.nosp@m..no
Jaime Perez, UNINETT AS jaime.nosp@m..per.nosp@m.ez@un.nosp@m.inet.nosp@m.t.no

Definition at line 24 of file Arrays.php.

25 {
26 return (is_array($data)) ? $data : array($index => $data);
27 }
$index
Definition: metadata.php:60

References $data, and $index.

Referenced by SimpleSAML_Metadata_SAMLBuilder\addOrganizationInfo(), SimpleSAML_Utilities\arrayize(), sspmod_statistics_StatDataset\loadData(), SimpleSAML\Utils\Attributes\normalizeAttributesArray(), SimpleSAML_Auth_LDAP\searchfordn(), and sspmod_saml_Auth_Source_SP\startSSO2().

+ Here is the caller graph for this function:

◆ transpose()

static SimpleSAML\Utils\Arrays::transpose (   $array)
static

This function transposes a two-dimensional array, so that $a['k1']['k2'] becomes $a['k2']['k1'].

Parameters
array$arrayThe two-dimensional array to transpose.
Returns
mixed The transposed array, or false if $array is not a valid two-dimensional array.
Author
Andreas Solberg, UNINETT AS andre.nosp@m.as.s.nosp@m.olber.nosp@m.g@un.nosp@m.inett.nosp@m..no

Definition at line 39 of file Arrays.php.

40 {
41 if (!is_array($array)) {
42 return false;
43 }
44
45 $ret = array();
46 foreach ($array as $k1 => $a2) {
47 if (!is_array($a2)) {
48 return false;
49 }
50
51 foreach ($a2 as $k2 => $v) {
52 if (!array_key_exists($k2, $ret)) {
53 $ret[$k2] = array();
54 }
55 $ret[$k2][$k1] = $v;
56 }
57 }
58 return $ret;
59 }
$ret
Definition: parser.php:6

References $ret.

Referenced by SimpleSAML_Memcache\getStats(), and SimpleSAML_Utilities\transposeArray().

+ Here is the caller graph for this function:

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