Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getAuthorGitHub example
foreach
(
$collection
as
$changelog
)
{
$log
=
sprintf
(
'* [%s - %s](./changelog/%s)',
$changelog
->
getDefinition
(
)
->
getIssue
(
)
,
$changelog
->
getDefinition
(
)
->
getTitle
(
)
,
$releaseDir
. '/' .
$changelog
->
getName
(
)
)
;
$author
=
$changelog
->
getDefinition
(
)
->
getAuthor
(
)
?? '';
$authorEmail
=
$changelog
->
getDefinition
(
)
->
getAuthorEmail
(
)
?? '';
$github
=
$changelog
->
getDefinition
(
)
->
getAuthorGitHub
(
)
?? '';
if
(
!
empty
(
$author
)
&& !
empty
(
$github
)
&& !
empty
(
$authorEmail
)
&& !
str_contains
(
$authorEmail
, '@shopware.com'
)
)
{
$log
.=
sprintf
(
' ([%s](https://github.com/%s))',
$author
,
str_replace
(
'@', '',
$github
)
)
;
}
$append
[
]
=
$log
;
}
if
(
!
$dryRun
)
{
$content
=
file_get_contents
(
$this
->
getChangelogGlobal
(
)
)
?: '';
$posLatestRelease
=
strpos
(
$content
, '## '
)
;
public
function
testData
(
string
$inFile
, array
$expectedData
, string
$outFile
, int
$expectedExceptions
)
: void
{
$parser
= self::
getContainer
(
)
->
get
(
ChangelogParser::
class
)
;
$logEntry
=
$parser
->
parse
(
(string)
file_get_contents
(
$inFile
)
)
;
static
::
assertSame
(
$expectedData
[
'title'
]
,
$logEntry
->
getTitle
(
)
)
;
static
::
assertSame
(
$expectedData
[
'issue'
]
,
$logEntry
->
getIssue
(
)
)
;
static
::
assertSame
(
$expectedData
[
'flag'
]
,
$logEntry
->
getFlag
(
)
)
;
static
::
assertSame
(
$expectedData
[
'author'
]
,
$logEntry
->
getAuthor
(
)
)
;
static
::
assertSame
(
$expectedData
[
'authorEmail'
]
,
$logEntry
->
getAuthorEmail
(
)
)
;
static
::
assertSame
(
$expectedData
[
'authorGithub'
]
,
$logEntry
->
getAuthorGitHub
(
)
)
;
static
::
assertSame
(
$expectedData
[
'core'
]
,
$logEntry
->
getCore
(
)
)
;
static
::
assertSame
(
$expectedData
[
'storefront'
]
,
$logEntry
->
getStorefront
(
)
)
;
static
::
assertSame
(
$expectedData
[
'admin'
]
,
$logEntry
->
getAdministration
(
)
)
;
static
::
assertSame
(
$expectedData
[
'api'
]
,
$logEntry
->
getApi
(
)
)
;
static
::
assertSame
(
$expectedData
[
'upgrade'
]
,
$logEntry
->
getUpgradeInformation
(
)
)
;
static
::
assertSame
(
$expectedData
[
'major'
]
,
$logEntry
->
getNextMajorVersionChanges
(
)
)
;
$lines
=
file
(
$outFile
)
;
static
::
assertIsArray
(
$lines
)
;
/** @var array<string> $templateLines */
$templateLines
=
explode
(
\PHP_EOL,
$logEntry
->
toTemplate
(
)
)
;