Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5973251
BooleanGenerator.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
644 B
Referenced Files
None
Subscribers
None
BooleanGenerator.php
View Options
<?php
namespace
Eris\Generator
;
use
Eris\Generator
;
use
Eris\Generators
;
use
Eris\Random\RandomRange
;
function
bool
()
{
return
Generators
::
bool
();
}
/**
* @template-implements Generator<bool>
*/
class
BooleanGenerator
implements
Generator
{
public
function
__invoke
(
$_size
,
RandomRange
$rand
)
{
$booleanValues
=
[
true
,
false
];
$randomIndex
=
$rand
->
rand
(
0
,
count
(
$booleanValues
)
-
1
);
return
GeneratedValueSingle
::
fromJustValue
(
$booleanValues
[
$randomIndex
],
'boolean'
);
}
public
function
shrink
(
GeneratedValue
$element
)
{
return
GeneratedValueSingle
::
fromJustValue
(
false
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 16:29 (12 h, 3 m ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
63/95/2d7f178003e819d5ff295fb88386
Default Alt Text
BooleanGenerator.php (644 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment