Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
3c7e8467
Commit
3c7e8467
authored
9 years ago
by
Jaime Perez Crespo
Browse files
Options
Downloads
Patches
Plain Diff
Reformat SimpleSAML_Store.
parent
bfc70e12
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/SimpleSAML/Store.php
+82
-78
82 additions, 78 deletions
lib/SimpleSAML/Store.php
with
82 additions
and
78 deletions
lib/SimpleSAML/Store.php
+
82
−
78
View file @
3c7e8467
<?php
<?php
/**
/**
* Base class for data stores.
* Base class for data stores.
*
*
* @package SimpleSAMLphp
* @package SimpleSAMLphp
*/
*/
abstract
class
SimpleSAML_Store
{
abstract
class
SimpleSAML_Store
{
/**
* Our singleton instance.
/**
*
* Our singleton instance.
* This is false if the data store isn't enabled, and null if we haven't attempted to initialize it.
*
*
* This is false if the data store isn't enabled, and null if we haven't attempted to initialize it.
* @var SimpleSAML_Store|boolean|null
*
*/
* @var SimpleSAML_Store|boolean|null
private
static
$instance
;
*/
private
static
$instance
;
/**
* Retrieve our singleton instance.
/**
*
* Retrieve our singleton instance.
* @return SimpleSAML_Store|boolean The data store, or false if it isn't enabled.
*
*/
* @return SimpleSAML_Store|boolean The data store, or false if it isn't enabled.
public
static
function
getInstance
()
{
*/
public
static
function
getInstance
()
if
(
self
::
$instance
!==
NULL
)
{
{
return
self
::
$instance
;
}
if
(
self
::
$instance
!==
null
)
{
return
self
::
$instance
;
$config
=
SimpleSAML_Configuration
::
getInstance
();
}
$storeType
=
$config
->
getString
(
'store.type'
,
NULL
);
if
(
$storeType
===
NULL
)
{
$config
=
SimpleSAML_Configuration
::
getInstance
();
$storeType
=
$config
->
getString
(
'session.handler'
,
'phpsession'
);
$storeType
=
$config
->
getString
(
'store.type'
,
null
);
}
if
(
$storeType
===
null
)
{
$storeType
=
$config
->
getString
(
'session.handler'
,
'phpsession'
);
switch
(
$storeType
)
{
}
case
'phpsession'
:
/* We cannot support advanced features with the PHP session store. */
switch
(
$storeType
)
{
self
::
$instance
=
FALSE
;
case
'phpsession'
:
break
;
// we cannot support advanced features with the PHP session store
case
'memcache'
:
self
::
$instance
=
false
;
self
::
$instance
=
new
SimpleSAML_Store_Memcache
();
break
;
break
;
case
'memcache'
:
case
'sql'
:
self
::
$instance
=
new
SimpleSAML_Store_Memcache
();
self
::
$instance
=
new
SimpleSAML_Store_SQL
();
break
;
break
;
case
'sql'
:
default
:
self
::
$instance
=
new
SimpleSAML_Store_SQL
();
/* Datastore from module. */
break
;
$className
=
SimpleSAML_Module
::
resolveClass
(
$storeType
,
'Store'
,
'SimpleSAML_Store'
);
default
:
self
::
$instance
=
new
$className
();
// datastore from module
}
$className
=
SimpleSAML_Module
::
resolveClass
(
$storeType
,
'Store'
,
'SimpleSAML_Store'
);
self
::
$instance
=
new
$className
();
return
self
::
$instance
;
}
}
return
self
::
$instance
;
}
/**
* Retrieve a value from the data store.
*
/**
* @param string $type The data type.
* Retrieve a value from the data store.
* @param string $key The key.
*
* @return mixed|null The value.
* @param string $type The data type.
*/
* @param string $key The key.
abstract
public
function
get
(
$type
,
$key
);
*
* @return mixed|null The value.
*/
/**
abstract
public
function
get
(
$type
,
$key
);
* Save a value to the data store.
*
* @param string $type The data type.
/**
* @param string $key The key.
* Save a value to the data store.
* @param mixed $value The value.
*
* @param int|null $expire The expiration time (unix timestamp), or null if it never expires.
* @param string $type The data type.
*/
* @param string $key The key.
abstract
public
function
set
(
$type
,
$key
,
$value
,
$expire
=
NULL
);
* @param mixed $value The value.
* @param int|null $expire The expiration time (unix timestamp), or null if it never expires.
*/
/**
abstract
public
function
set
(
$type
,
$key
,
$value
,
$expire
=
null
);
* Delete a value from the data store.
*
* @param string $type The data type.
/**
* @param string $key The key.
* Delete a value from the data store.
*/
*
abstract
public
function
delete
(
$type
,
$key
);
* @param string $type The data type.
* @param string $key The key.
*/
abstract
public
function
delete
(
$type
,
$key
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment