46 throw new UnexpectedValueException(
"Missing ID in URL component." );
54 foreach (
$urls as $url ) {
56 if (
$blob !==
false ) {
68 return "memory://$location/$index";
75 foreach ( self::$data as &$dataForLocation ) {
76 unset( $dataForLocation[$this->dbDomain] );
78 unset( $dataForLocation );
79 self::$data = array_filter( self::$data,
'count' );
88 list( $proto,
$path ) = explode(
'://', $url, 2 ) + [
null, null ];
89 if ( $proto !==
'memory' ) {
90 throw new UnexpectedValueException(
"Got URL of protocol '$proto', not 'memory'." );
91 } elseif (
$path ===
null ) {
92 throw new UnexpectedValueException(
"URL is missing path component." );
95 $parts = explode(
'/',
$path );
96 if ( count( $parts ) > 2 ) {
97 throw new UnexpectedValueException(
"Too components in URL '$path'." );
100 return [ $parts[0], $parts[1] ?? null ];
Key/value blob storage for a particular storage medium type (e.g.
array $params
Usage context options for this instance.
string $dbDomain
Default database domain to store content under.
Process memory based external objects for testing.
clear()
Remove all data from memory for this domain.
static array[] $data
Map of (location => DB domain => id => value)
fetchFromURL( $url)
Fetch data from given external store URL.
batchFetchFromURLs(array $urls)
Fetch data from given external store URLs.
__construct(array $params)
store( $location, $data)
Insert a data item into a given location.