Skip to content

Commit

Permalink
Added prefix/suffix support for CommandlineMarker. (phingofficial#938)
Browse files Browse the repository at this point in the history
  • Loading branch information
siad007 authored Jun 30, 2018
1 parent 48443db commit 046f1de
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion classes/phing/types/CommandlineMarker.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class CommandlineMarker
private $position;
private $realPos = -1;
private $outer;
private $prefix;
private $suffix;

/**
* @param Commandline $outer
Expand All @@ -33,7 +35,7 @@ public function __construct(Commandline $outer, $position)
*/
public function getPosition()
{
if ($this->realPos == -1) {
if ($this->realPos === -1) {
$this->realPos = ($this->outer->executable === null ? 0 : 1);
for ($i = 0; $i < $this->position; $i++) {
$arg = $this->outer->arguments[$i];
Expand All @@ -43,4 +45,40 @@ public function getPosition()

return $this->realPos;
}

/**
* Set the prefix to be placed in front of the inserted argument.
*
* @param string $prefix fixed prefix string.
*/
public function setPrefix($prefix)
{
$this->prefix = $prefix !== null ? $prefix : '';
}

/**
* Get the prefix to be placed in front of the inserted argument.
*/
public function getPrefix()
{
return $this->prefix;
}

/**
* Set the suffix to be placed at the end of the inserted argument.
*
* @param string $suffix fixed suffix string.
*/
public function setSuffix($suffix)
{
$this->suffix = $suffix !== null ? $suffix : '';
}

/**
* Get the suffix to be placed at the end of the inserted argument.
*/
public function getSuffix()
{
return $this->suffix;
}
}

0 comments on commit 046f1de

Please sign in to comment.