Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getArrayDiffParted example
$from
=
$this
->
splitStringByLines
(
$from
)
;
}
elseif
(
!
is_array
(
$from
)
)
{
throw
new
InvalidArgumentException
(
'"from" must be an array or string.'
)
;
}
if
(
is_string
(
$to
)
)
{
$to
=
$this
->
splitStringByLines
(
$to
)
;
}
elseif
(
!
is_array
(
$to
)
)
{
throw
new
InvalidArgumentException
(
'"to" must be an array or string.'
)
;
}
[
$from
,
$to
,
$start
,
$end
]
= self::
getArrayDiffParted
(
$from
,
$to
)
;
if
(
$lcs
=== null
)
{
$lcs
=
$this
->
selectLcsImplementation
(
$from
,
$to
)
;
}
$common
=
$lcs
->
calculate
(
array_values
(
$from
)
,
array_values
(
$to
)
)
;
$diff
=
[
]
;
foreach
(
$start
as
$token
)
{
$diff
[
]
=
[
$token
, self::OLD
]
;
}