80    private function load($set)
 
   82        assert(is_string($set));
 
   86        if (!in_array($set, $this->supportedSets, 
true)) {
 
   90        $stmt = $this->db->read(
"SELECT entity_id, entity_data FROM $tableName");
 
   91        if (
$stmt->execute()) {
 
   95                $data = json_decode(
$d[
'entity_data'], 
true);
 
   99                if (!array_key_exists(
'entityid', 
$data)) {
 
  100                    $data[
'entityid'] = 
$d[
'entity_id'];
 
  107            throw new Exception(
'PDO metadata handler: Database error: '.var_export($this->db->getLastError(), 
true));
 
  121        assert(is_string($set));
 
  123        if (array_key_exists($set, $this->cachedMetadata)) {
 
  124            return $this->cachedMetadata[$set];
 
  127        $metadataSet = $this->
load($set);
 
  128        if ($metadataSet === 
null) {
 
  129            $metadataSet = array();
 
  132        foreach ($metadataSet as 
$entityId => &$entry) {
 
  133            if (preg_match(
'/__DYNAMIC(:[0-9]+)?__/', 
$entityId)) {
 
  140        $this->cachedMetadata[$set] = $metadataSet;
 
  156        assert(is_string($set));
 
  160        if (!in_array($set, $this->supportedSets, 
true)) {
 
  164        $stmt = $this->db->read(
"SELECT entity_id, entity_data FROM $tableName WHERE entity_id=:entityId", array(
'entityId' => 
$entityId));
 
  165        if (
$stmt->execute()) {
 
  170                if (++$rowCount > 1) {
 
  174                $data = json_decode(
$d[
'entity_data'], 
true);
 
  175                if (
$data === 
null) {
 
  178                if (!array_key_exists(
'entityid', 
$data)) {
 
  179                    $data[
'entityid'] = 
$d[
'entity_id'];
 
  184            throw new Exception(
'PDO metadata handler: Database error: '.var_export($this->db->getLastError(), 
true));
 
  190        assert(is_string($set));
 
  195        if ($set === 
'saml20-idp-hosted') {
 
  196            return $baseurl.
'saml2/idp/metadata.php';
 
  197        } elseif ($set === 
'saml20-sp-hosted') {
 
  198            return $baseurl.
'saml2/sp/metadata.php';
 
  199        } elseif ($set === 
'shib13-idp-hosted') {
 
  200            return $baseurl.
'shib13/idp/metadata.php';
 
  201        } elseif ($set === 
'shib13-sp-hosted') {
 
  202            return $baseurl.
'shib13/sp/metadata.php';
 
  203        } elseif ($set === 
'wsfed-sp-hosted') {
 
  204            return 'urn:federation:'.\SimpleSAML\Utils\HTTP::getSelfHost();
 
  205        } elseif ($set === 
'adfs-idp-hosted') {
 
  206            return 'urn:federation:'.\SimpleSAML\Utils\HTTP::getSelfHost().
':idp';
 
  208            throw new Exception(
'Can not generate dynamic EntityID for metadata of this type: ['.$set.
']');
 
  224        assert(is_string(
$index));
 
  225        assert(is_string($set));
 
  226        assert(is_array($entityData));
 
  228        if (!in_array($set, $this->supportedSets, 
true)) {
 
  235            "SELECT entity_id, entity_data FROM $tableName WHERE entity_id = :entity_id",
 
  245            'entity_data' => json_encode($entityData),
 
  248        if ($retrivedEntityIDs !== 
false && count($retrivedEntityIDs) > 0) {
 
  249            $rows = $this->db->write(
 
  250                "UPDATE $tableName SET entity_data = :entity_data WHERE entity_id = :entity_id",
 
  254            $rows = $this->db->write(
 
  255                "INSERT INTO $tableName (entity_id, entity_data) VALUES (:entity_id, :entity_data)",
 
  274        assert(is_string(
$table));
 
  276        return $this->db->applyPrefix(str_replace(
"-", 
"_", $this->tablePrefix.$table));
 
  289        foreach ($this->supportedSets as $set) {
 
  291            $rows = $this->db->write(
 
  292                "CREATE TABLE IF NOT EXISTS $tableName (entity_id VARCHAR(255) PRIMARY KEY NOT NULL, entity_data ".
 
$metadata['__DYNAMIC:1__']
An exception for terminatinating execution or to throw for unit testing.
static getInstance($altConfig=null)
Retrieves the current database instance.
static getBaseURL()
Retrieve the base URL of the SimpleSAMLphp installation.
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
if(empty($password)) $table