You are a developer and looking for Shopware projects?
Apply Now!
parseShortOption example
protected
function
parseToken
(
string
$token
, bool
$parseOptions
)
: bool
{
if
(
$parseOptions
&& '' ==
$token
)
{
$this
->
parseArgument
(
$token
)
;
}
elseif
(
$parseOptions
&& '--' ==
$token
)
{
return
false;
}
elseif
(
$parseOptions
&&
str_starts_with
(
$token
, '--'
)
)
{
$this
->
parseLongOption
(
$token
)
;
}
elseif
(
$parseOptions
&& '-' ===
$token
[
0
]
&& '-' !==
$token
)
{
$this
->
parseShortOption
(
$token
)
;
}
else
{
$this
->
parseArgument
(
$token
)
;
}
return
$parseOptions
;
}
/** * Parses a short option. */
private
function
parseShortOption
(
string
$token
)
: void
{
protected
function
parseToken
(
string
$token
, bool
$parseOptions
)
: bool
{
if
(
$parseOptions
&& '' ==
$token
)
{
$this
->
parseArgument
(
$token
)
;
}
elseif
(
$parseOptions
&& '--' ==
$token
)
{
return
false;
}
elseif
(
$parseOptions
&&
str_starts_with
(
$token
, '--'
)
)
{
$this
->
parseLongOption
(
$token
)
;
}
elseif
(
$parseOptions
&& '-' ===
$token
[
0
]
&& '-' !==
$token
)
{
$this
->
parseShortOption
(
$token
)
;
}
else
{
$this
->
parseArgument
(
$token
)
;
}
return
$parseOptions
;
}
/** * Parses a short option. */
private
function
parseShortOption
(
string
$token
)
: void
{