Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5961301
MapGenerator.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1013 B
Referenced Files
None
Subscribers
None
MapGenerator.php
View Options
<?php
namespace
Eris\Generator
;
use
Eris\Generator
;
use
Eris\Generators
;
use
Eris\Random\RandomRange
;
// TODO: support calls like ($function . $generator)
function
map
(
callable
$function
,
Generator
$generator
)
{
return
Generators
::
map
(
$function
,
$generator
);
}
/**
* @psalm-template T
* @template-implements Generator<T>
*/
class
MapGenerator
implements
Generator
{
private
$map
;
private
$generator
;
public
function
__construct
(
callable
$map
,
$generator
)
{
$this
->
map
=
$map
;
$this
->
generator
=
$generator
;
}
public
function
__invoke
(
$_size
,
RandomRange
$rand
)
{
$input
=
$this
->
generator
->
__invoke
(
$_size
,
$rand
);
return
$input
->
map
(
$this
->
map
,
'map'
);
}
public
function
shrink
(
GeneratedValue
$value
)
{
$input
=
$value
->
input
();
$shrunkInput
=
$this
->
generator
->
shrink
(
$input
);
return
$shrunkInput
->
map
(
$this
->
map
,
'map'
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 07:59 (1 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
bb/84/be98db63ef438347e3b82e937e00
Default Alt Text
MapGenerator.php (1013 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment