Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F2753766
SquareModule.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
SquareModule.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
BaconQrCode\Renderer\Module
;
use
BaconQrCode\Encoder\ByteMatrix
;
use
BaconQrCode\Renderer\Module\EdgeIterator\EdgeIterator
;
use
BaconQrCode\Renderer\Path\Path
;
/**
* Groups modules together to a single path.
*/
final
class
SquareModule
implements
ModuleInterface
{
/**
* @var self|null
*/
private
static
$instance
;
private
function
__construct
()
{
}
public
static
function
instance
()
:
self
{
return
self
::
$instance
?:
self
::
$instance
=
new
self
();
}
public
function
createPath
(
ByteMatrix
$matrix
)
:
Path
{
$path
=
new
Path
();
foreach
(
new
EdgeIterator
(
$matrix
)
as
$edge
)
{
$points
=
$edge
->
getSimplifiedPoints
();
$length
=
count
(
$points
);
$path
=
$path
->
move
(
$points
[
0
][
0
],
$points
[
0
][
1
]);
for
(
$i
=
1
;
$i
<
$length
;
++
$i
)
{
$path
=
$path
->
line
(
$points
[
$i
][
0
],
$points
[
$i
][
1
]);
}
$path
=
$path
->
close
();
}
return
$path
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Jul 3, 21:42 (18 h, 53 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
f4/3d/e8d0962045905709136e5a68dc51
Default Alt Text
SquareModule.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment