repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
phingofficial/phing | classes/phing/tasks/ext/HttpRequestTask.php | HttpRequestTask.setObserverEvents | public function setObserverEvents($observerEvents)
{
$this->observerEvents = [];
$token = ' ,;';
$ext = strtok($observerEvents, $token);
while ($ext !== false) {
$this->observerEvents[] = $ext;
$ext = strtok($token);
}
} | php | public function setObserverEvents($observerEvents)
{
$this->observerEvents = [];
$token = ' ,;';
$ext = strtok($observerEvents, $token);
while ($ext !== false) {
$this->observerEvents[] = $ext;
$ext = strtok($token);
}
} | [
"public",
"function",
"setObserverEvents",
"(",
"$",
"observerEvents",
")",
"{",
"$",
"this",
"->",
"observerEvents",
"=",
"[",
"]",
";",
"$",
"token",
"=",
"' ,;'",
";",
"$",
"ext",
"=",
"strtok",
"(",
"$",
"observerEvents",
",",
"$",
"token",
")",
";... | Sets a list of observer events that will be logged if verbose output is enabled.
@param string $observerEvents List of observer events | [
"Sets",
"a",
"list",
"of",
"observer",
"events",
"that",
"will",
"be",
"logged",
"if",
"verbose",
"output",
"is",
"enabled",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/HttpRequestTask.php#L120-L131 | train |
phingofficial/phing | classes/phing/tasks/ext/HttpRequestTask.php | HttpRequestTask.init | public function init()
{
parent::init();
$this->regexp = new Regexp();
$this->authScheme = HTTP_Request2::AUTH_BASIC;
// Other dependencies that should only be loaded when class is actually used
include_once 'HTTP/Request2/Observer/Log.php';
} | php | public function init()
{
parent::init();
$this->regexp = new Regexp();
$this->authScheme = HTTP_Request2::AUTH_BASIC;
// Other dependencies that should only be loaded when class is actually used
include_once 'HTTP/Request2/Observer/Log.php';
} | [
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"$",
"this",
"->",
"regexp",
"=",
"new",
"Regexp",
"(",
")",
";",
"$",
"this",
"->",
"authScheme",
"=",
"HTTP_Request2",
"::",
"AUTH_BASIC",
";",
"// Other dependencies t... | Load the necessary environment for running this task.
@throws BuildException | [
"Load",
"the",
"necessary",
"environment",
"for",
"running",
"this",
"task",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/HttpRequestTask.php#L160-L170 | train |
phingofficial/phing | classes/phing/tasks/ext/HttpRequestTask.php | HttpRequestTask.processResponse | protected function processResponse(HTTP_Request2_Response $response)
{
if ($this->responseRegex !== '') {
$this->regexp->setPattern($this->responseRegex);
if (!$this->regexp->matches($response->getBody())) {
throw new BuildException('The received response body did not match the given regular expression');
} else {
$this->log('The response body matched the provided regex.');
}
}
if ($this->responseCodeRegex !== '') {
$this->regexp->setPattern($this->responseCodeRegex);
if (!$this->regexp->matches($response->getStatus())) {
throw new BuildException('The received response status-code did not match the given regular expression');
} else {
$this->log('The response status-code matched the provided regex.');
}
}
} | php | protected function processResponse(HTTP_Request2_Response $response)
{
if ($this->responseRegex !== '') {
$this->regexp->setPattern($this->responseRegex);
if (!$this->regexp->matches($response->getBody())) {
throw new BuildException('The received response body did not match the given regular expression');
} else {
$this->log('The response body matched the provided regex.');
}
}
if ($this->responseCodeRegex !== '') {
$this->regexp->setPattern($this->responseCodeRegex);
if (!$this->regexp->matches($response->getStatus())) {
throw new BuildException('The received response status-code did not match the given regular expression');
} else {
$this->log('The response status-code matched the provided regex.');
}
}
} | [
"protected",
"function",
"processResponse",
"(",
"HTTP_Request2_Response",
"$",
"response",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"responseRegex",
"!==",
"''",
")",
"{",
"$",
"this",
"->",
"regexp",
"->",
"setPattern",
"(",
"$",
"this",
"->",
"responseRege... | Checks whether response body or status-code matches the given regexp
@param HTTP_Request2_Response $response
@return void
@throws BuildException
@throws HTTP_Request2_Exception
@throws RegexpException | [
"Checks",
"whether",
"response",
"body",
"or",
"status",
"-",
"code",
"matches",
"the",
"given",
"regexp"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/HttpRequestTask.php#L238-L259 | train |
phingofficial/phing | classes/phing/tasks/ext/NotifySendTask.php | NotifySendTask.setIcon | public function setIcon($icon)
{
switch ($icon) {
case 'info':
case 'error':
case 'warning':
$this->icon = $icon;
break;
default:
if (file_exists($icon) && is_file($icon)) {
$this->icon = $icon;
} else {
if (isset($this->log)) {
$this->log(
sprintf(
"%s is not a file. Using default icon instead.",
$icon
),
Project::MSG_WARN
);
}
}
}
} | php | public function setIcon($icon)
{
switch ($icon) {
case 'info':
case 'error':
case 'warning':
$this->icon = $icon;
break;
default:
if (file_exists($icon) && is_file($icon)) {
$this->icon = $icon;
} else {
if (isset($this->log)) {
$this->log(
sprintf(
"%s is not a file. Using default icon instead.",
$icon
),
Project::MSG_WARN
);
}
}
}
} | [
"public",
"function",
"setIcon",
"(",
"$",
"icon",
")",
"{",
"switch",
"(",
"$",
"icon",
")",
"{",
"case",
"'info'",
":",
"case",
"'error'",
":",
"case",
"'warning'",
":",
"$",
"this",
"->",
"icon",
"=",
"$",
"icon",
";",
"break",
";",
"default",
"... | Set icon attribute
@param string $icon name/location of icon
@return void | [
"Set",
"icon",
"attribute"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/NotifySendTask.php#L38-L61 | train |
phingofficial/phing | classes/phing/tasks/ext/inifile/IniFileConfig.php | IniFileConfig.read | public function read($file)
{
$this->lines = [];
$section = '';
foreach (file($file) as $line) {
if (preg_match('/^\s*(;.*)?$/', $line)) {
// comment or whitespace
$this->lines[] = [
'type' => 'comment',
'data' => $line,
'section' => $section
];
} elseif (preg_match('/^\s?\[(.*)\]/', $line, $match)) {
// section
$section = $match[1];
$this->lines[] = [
'type' => 'section',
'data' => $line,
'section' => $section
];
} elseif (preg_match('/^\s*(.*?)\s*=\s*(.*?)\s*$/', $line, $match)) {
// entry
$this->lines[] = [
'type' => 'entry',
'data' => $line,
'section' => $section,
'key' => $match[1],
'value' => $match[2]
];
}
}
} | php | public function read($file)
{
$this->lines = [];
$section = '';
foreach (file($file) as $line) {
if (preg_match('/^\s*(;.*)?$/', $line)) {
// comment or whitespace
$this->lines[] = [
'type' => 'comment',
'data' => $line,
'section' => $section
];
} elseif (preg_match('/^\s?\[(.*)\]/', $line, $match)) {
// section
$section = $match[1];
$this->lines[] = [
'type' => 'section',
'data' => $line,
'section' => $section
];
} elseif (preg_match('/^\s*(.*?)\s*=\s*(.*?)\s*$/', $line, $match)) {
// entry
$this->lines[] = [
'type' => 'entry',
'data' => $line,
'section' => $section,
'key' => $match[1],
'value' => $match[2]
];
}
}
} | [
"public",
"function",
"read",
"(",
"$",
"file",
")",
"{",
"$",
"this",
"->",
"lines",
"=",
"[",
"]",
";",
"$",
"section",
"=",
"''",
";",
"foreach",
"(",
"file",
"(",
"$",
"file",
")",
"as",
"$",
"line",
")",
"{",
"if",
"(",
"preg_match",
"(",
... | Read ini file
@param string $file filename
@return void | [
"Read",
"ini",
"file"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/inifile/IniFileConfig.php#L45-L78 | train |
phingofficial/phing | classes/phing/tasks/ext/inifile/IniFileConfig.php | IniFileConfig.get | public function get($section, $key)
{
foreach ($this->lines as $line) {
if ($line['type'] != 'entry') {
continue;
}
if ($line['section'] != $section) {
continue;
}
if ($line['key'] != $key) {
continue;
}
return $line['value'];
}
throw new RuntimeException('Missing Section or Key');
} | php | public function get($section, $key)
{
foreach ($this->lines as $line) {
if ($line['type'] != 'entry') {
continue;
}
if ($line['section'] != $section) {
continue;
}
if ($line['key'] != $key) {
continue;
}
return $line['value'];
}
throw new RuntimeException('Missing Section or Key');
} | [
"public",
"function",
"get",
"(",
"$",
"section",
",",
"$",
"key",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"lines",
"as",
"$",
"line",
")",
"{",
"if",
"(",
"$",
"line",
"[",
"'type'",
"]",
"!=",
"'entry'",
")",
"{",
"continue",
";",
"}",
"... | Get value of given key in specified section
@param string $section Section
@param string $key Key
@return void | [
"Get",
"value",
"of",
"given",
"key",
"in",
"specified",
"section"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/inifile/IniFileConfig.php#L88-L104 | train |
phingofficial/phing | classes/phing/tasks/ext/inifile/IniFileConfig.php | IniFileConfig.set | public function set($section, $key, $value)
{
foreach ($this->lines as &$line) {
if ($line['type'] != 'entry') {
continue;
}
if ($line['section'] != $section) {
continue;
}
if ($line['key'] != $key) {
continue;
}
$line['value'] = $value;
$line['data'] = $key . " = " . $value . PHP_EOL;
return;
}
throw new RuntimeException('Missing Section or Key');
} | php | public function set($section, $key, $value)
{
foreach ($this->lines as &$line) {
if ($line['type'] != 'entry') {
continue;
}
if ($line['section'] != $section) {
continue;
}
if ($line['key'] != $key) {
continue;
}
$line['value'] = $value;
$line['data'] = $key . " = " . $value . PHP_EOL;
return;
}
throw new RuntimeException('Missing Section or Key');
} | [
"public",
"function",
"set",
"(",
"$",
"section",
",",
"$",
"key",
",",
"$",
"value",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"lines",
"as",
"&",
"$",
"line",
")",
"{",
"if",
"(",
"$",
"line",
"[",
"'type'",
"]",
"!=",
"'entry'",
")",
"{",... | Set key to value in specified section
@param string $section Section
@param string $key Key
@param string $value Value
@return void | [
"Set",
"key",
"to",
"value",
"in",
"specified",
"section"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/inifile/IniFileConfig.php#L115-L133 | train |
phingofficial/phing | classes/phing/filters/ConcatFilter.php | ConcatFilter.initialize | private function initialize()
{
// get parameters
$params = $this->getParameters();
if ($params !== null) {
/**
* @var Parameter $param
*/
foreach ($params as $param) {
if ('prepend' === $param->getName()) {
$this->setPrepend(new PhingFile($param->getValue()));
continue;
}
if ('append' === $param->getName()) {
$this->setAppend(new PhingFile($param->getValue()));
continue;
}
}
}
if ($this->prepend !== null) {
if (!$this->prepend->isAbsolute()) {
$this->prepend = new PhingFile($this->getProject()->getBasedir(), $this->prepend->getPath());
}
$this->prependReader = new BufferedReader(new FileReader($this->prepend));
}
if ($this->append !== null) {
if (!$this->append->isAbsolute()) {
$this->append = new PhingFile($this->getProject()->getBasedir(), $this->append->getPath());
}
$this->appendReader = new BufferedReader(new FileReader($this->append));
}
} | php | private function initialize()
{
// get parameters
$params = $this->getParameters();
if ($params !== null) {
/**
* @var Parameter $param
*/
foreach ($params as $param) {
if ('prepend' === $param->getName()) {
$this->setPrepend(new PhingFile($param->getValue()));
continue;
}
if ('append' === $param->getName()) {
$this->setAppend(new PhingFile($param->getValue()));
continue;
}
}
}
if ($this->prepend !== null) {
if (!$this->prepend->isAbsolute()) {
$this->prepend = new PhingFile($this->getProject()->getBasedir(), $this->prepend->getPath());
}
$this->prependReader = new BufferedReader(new FileReader($this->prepend));
}
if ($this->append !== null) {
if (!$this->append->isAbsolute()) {
$this->append = new PhingFile($this->getProject()->getBasedir(), $this->append->getPath());
}
$this->appendReader = new BufferedReader(new FileReader($this->append));
}
} | [
"private",
"function",
"initialize",
"(",
")",
"{",
"// get parameters",
"$",
"params",
"=",
"$",
"this",
"->",
"getParameters",
"(",
")",
";",
"if",
"(",
"$",
"params",
"!==",
"null",
")",
"{",
"/**\n * @var Parameter $param\n */",
"foreac... | Scans the parameters list for the "lines" parameter and uses
it to set the number of lines to be returned in the filtered stream.
also scan for skip parameter.
@throws BuildException | [
"Scans",
"the",
"parameters",
"list",
"for",
"the",
"lines",
"parameter",
"and",
"uses",
"it",
"to",
"set",
"the",
"number",
"of",
"lines",
"to",
"be",
"returned",
"in",
"the",
"filtered",
"stream",
".",
"also",
"scan",
"for",
"skip",
"parameter",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/ConcatFilter.php#L134-L165 | train |
phingofficial/phing | classes/phing/filters/ConcatFilter.php | ConcatFilter.chain | public function chain(Reader $rdr)
{
$newFilter = new ConcatFilter($rdr);
$newFilter->setProject($this->getProject());
$newFilter->setPrepend($this->getPrepend());
$newFilter->setAppend($this->getAppend());
return $newFilter;
} | php | public function chain(Reader $rdr)
{
$newFilter = new ConcatFilter($rdr);
$newFilter->setProject($this->getProject());
$newFilter->setPrepend($this->getPrepend());
$newFilter->setAppend($this->getAppend());
return $newFilter;
} | [
"public",
"function",
"chain",
"(",
"Reader",
"$",
"rdr",
")",
"{",
"$",
"newFilter",
"=",
"new",
"ConcatFilter",
"(",
"$",
"rdr",
")",
";",
"$",
"newFilter",
"->",
"setProject",
"(",
"$",
"this",
"->",
"getProject",
"(",
")",
")",
";",
"$",
"newFilt... | Creates a new ConcatReader using the passed in
Reader for instantiation.
@param Reader $rdr A Reader object providing the underlying stream.
Must not be <code>null</code>.
@return ConcatFilter a new filter based on this configuration, but filtering
the specified reader | [
"Creates",
"a",
"new",
"ConcatReader",
"using",
"the",
"passed",
"in",
"Reader",
"for",
"instantiation",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/ConcatFilter.php#L177-L185 | train |
phingofficial/phing | classes/phing/filters/ConcatFilter.php | ConcatFilter.setPrepend | public function setPrepend($prepend)
{
if ($prepend instanceof PhingFile) {
$this->prepend = $prepend;
} else {
$this->prepend = new PhingFile($prepend);
}
} | php | public function setPrepend($prepend)
{
if ($prepend instanceof PhingFile) {
$this->prepend = $prepend;
} else {
$this->prepend = new PhingFile($prepend);
}
} | [
"public",
"function",
"setPrepend",
"(",
"$",
"prepend",
")",
"{",
"if",
"(",
"$",
"prepend",
"instanceof",
"PhingFile",
")",
"{",
"$",
"this",
"->",
"prepend",
"=",
"$",
"prepend",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"prepend",
"=",
"new",
"Ph... | Sets `prepend` attribute.
@param PhingFile|string prepend new value | [
"Sets",
"prepend",
"attribute",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/ConcatFilter.php#L202-L209 | train |
phingofficial/phing | classes/phing/tasks/system/ConditionTask.php | ConditionTask.main | public function main()
{
if ($this->countConditions() > 1) {
throw new BuildException(
"You must not nest more than one condition into <condition>"
);
}
if ($this->countConditions() < 1) {
throw new BuildException(
"You must nest a condition into <condition>"
);
}
if ($this->property === null) {
throw new BuildException('The property attribute is required.');
}
$cs = $this->getIterator();
if ($cs->current()->evaluate()) {
$this->log("Condition true; setting " . $this->property . " to " . $this->value, Project::MSG_DEBUG);
$this->project->setNewProperty($this->property, $this->value);
} elseif ($this->alternative !== null) {
$this->log("Condition false; setting " . $this->property . " to " . $this->alternative, Project::MSG_DEBUG);
$this->project->setNewProperty($this->property, $this->alternative);
} else {
$this->log('Condition false; not setting ' . $this->property, Project::MSG_DEBUG);
}
} | php | public function main()
{
if ($this->countConditions() > 1) {
throw new BuildException(
"You must not nest more than one condition into <condition>"
);
}
if ($this->countConditions() < 1) {
throw new BuildException(
"You must nest a condition into <condition>"
);
}
if ($this->property === null) {
throw new BuildException('The property attribute is required.');
}
$cs = $this->getIterator();
if ($cs->current()->evaluate()) {
$this->log("Condition true; setting " . $this->property . " to " . $this->value, Project::MSG_DEBUG);
$this->project->setNewProperty($this->property, $this->value);
} elseif ($this->alternative !== null) {
$this->log("Condition false; setting " . $this->property . " to " . $this->alternative, Project::MSG_DEBUG);
$this->project->setNewProperty($this->property, $this->alternative);
} else {
$this->log('Condition false; not setting ' . $this->property, Project::MSG_DEBUG);
}
} | [
"public",
"function",
"main",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"countConditions",
"(",
")",
">",
"1",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"You must not nest more than one condition into <condition>\"",
")",
";",
"}",
"if",
"(",
"$",
... | See whether our nested condition holds and set the property.
@throws BuildException
@return void | [
"See",
"whether",
"our",
"nested",
"condition",
"holds",
"and",
"set",
"the",
"property",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/ConditionTask.php#L99-L124 | train |
phingofficial/phing | classes/phing/tasks/ext/phpcpd/formatter/DefaultPHPCPDResultFormatter.php | DefaultPHPCPDResultFormatter.processClonesNew | private function processClonesNew($clones, $useFile = false, $outFile = null)
{
if ($useFile) {
$resource = fopen($outFile->getPath(), "w");
} else {
$resource = fopen("php://output", "w");
}
$output = new \Symfony\Component\Console\Output\StreamOutput($resource);
$logger = new \SebastianBergmann\PHPCPD\Log\Text();
$logger->printResult($output, $clones);
} | php | private function processClonesNew($clones, $useFile = false, $outFile = null)
{
if ($useFile) {
$resource = fopen($outFile->getPath(), "w");
} else {
$resource = fopen("php://output", "w");
}
$output = new \Symfony\Component\Console\Output\StreamOutput($resource);
$logger = new \SebastianBergmann\PHPCPD\Log\Text();
$logger->printResult($output, $clones);
} | [
"private",
"function",
"processClonesNew",
"(",
"$",
"clones",
",",
"$",
"useFile",
"=",
"false",
",",
"$",
"outFile",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"useFile",
")",
"{",
"$",
"resource",
"=",
"fopen",
"(",
"$",
"outFile",
"->",
"getPath",
"(... | Wrapper for PHPCPD 2.0
@param CodeCloneMap $clones
@param boolean $useFile
@param PhingFile|null $outFile | [
"Wrapper",
"for",
"PHPCPD",
"2",
".",
"0"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/phpcpd/formatter/DefaultPHPCPDResultFormatter.php#L72-L83 | train |
phingofficial/phing | classes/phing/tasks/system/TstampCustomFormat.php | TstampCustomFormat.execute | public function execute(TstampTask $tstamp, $d, $location)
{
if (empty($this->propertyName)) {
throw new BuildException("property attribute must be provided", $location);
}
if (empty($this->pattern)) {
throw new BuildException("pattern attribute must be provided", $location);
}
$oldlocale = "";
if (!empty($this->locale)) {
$oldlocale = setlocale(LC_ALL, 0);
setlocale(LC_ALL, $this->locale);
}
$savedTimezone = date_default_timezone_get();
if (!empty($this->timezone)) {
date_default_timezone_set($this->timezone);
}
$value = strftime($this->pattern, $d);
$tstamp->prefixProperty($this->propertyName, $value);
if (!empty($this->locale)) {
// reset locale
setlocale(LC_ALL, $oldlocale);
}
if (!empty($this->timezone)) {
date_default_timezone_set($savedTimezone);
}
} | php | public function execute(TstampTask $tstamp, $d, $location)
{
if (empty($this->propertyName)) {
throw new BuildException("property attribute must be provided", $location);
}
if (empty($this->pattern)) {
throw new BuildException("pattern attribute must be provided", $location);
}
$oldlocale = "";
if (!empty($this->locale)) {
$oldlocale = setlocale(LC_ALL, 0);
setlocale(LC_ALL, $this->locale);
}
$savedTimezone = date_default_timezone_get();
if (!empty($this->timezone)) {
date_default_timezone_set($this->timezone);
}
$value = strftime($this->pattern, $d);
$tstamp->prefixProperty($this->propertyName, $value);
if (!empty($this->locale)) {
// reset locale
setlocale(LC_ALL, $oldlocale);
}
if (!empty($this->timezone)) {
date_default_timezone_set($savedTimezone);
}
} | [
"public",
"function",
"execute",
"(",
"TstampTask",
"$",
"tstamp",
",",
"$",
"d",
",",
"$",
"location",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"propertyName",
")",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"property attribute must b... | validate parameter and execute the format.
@param TstampTask $tstamp reference to task
@throws BuildException | [
"validate",
"parameter",
"and",
"execute",
"the",
"format",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/TstampCustomFormat.php#L58-L90 | train |
phingofficial/phing | classes/phing/tasks/system/EchoProperties.php | EchoProperties.setDestfile | public function setDestfile($destfile)
{
if (is_string($destfile)) {
$this->destfile = new PhingFile($destfile);
} else {
$this->destfile = $destfile;
}
} | php | public function setDestfile($destfile)
{
if (is_string($destfile)) {
$this->destfile = new PhingFile($destfile);
} else {
$this->destfile = $destfile;
}
} | [
"public",
"function",
"setDestfile",
"(",
"$",
"destfile",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"destfile",
")",
")",
"{",
"$",
"this",
"->",
"destfile",
"=",
"new",
"PhingFile",
"(",
"$",
"destfile",
")",
";",
"}",
"else",
"{",
"$",
"this",
... | Set a file to store the property output. If this is never specified,
then the output will be sent to the Phing log.
@param string|PhingFile $destfile file to store the property output | [
"Set",
"a",
"file",
"to",
"store",
"the",
"property",
"output",
".",
"If",
"this",
"is",
"never",
"specified",
"then",
"the",
"output",
"will",
"be",
"sent",
"to",
"the",
"Phing",
"log",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/EchoProperties.php#L134-L141 | train |
phingofficial/phing | classes/phing/tasks/system/EchoProperties.php | EchoProperties.xmlSaveProperties | protected function xmlSaveProperties(Properties $props, OutputStream $os)
{
$doc = new DOMDocument('1.0', 'UTF-8');
$doc->formatOutput = true;
$rootElement = $doc->createElement(self::$PROPERTIES);
$properties = $props->getProperties();
ksort($properties);
foreach ($properties as $key => $value) {
$propElement = $doc->createElement(self::$PROPERTY);
$propElement->setAttribute(self::$ATTR_NAME, $key);
$propElement->setAttribute(self::$ATTR_VALUE, $value);
$rootElement->appendChild($propElement);
}
try {
$doc->appendChild($rootElement);
$os->write($doc->saveXML());
} catch (IOException $ioe) {
throw new BuildException("Unable to write XML file", $ioe);
}
} | php | protected function xmlSaveProperties(Properties $props, OutputStream $os)
{
$doc = new DOMDocument('1.0', 'UTF-8');
$doc->formatOutput = true;
$rootElement = $doc->createElement(self::$PROPERTIES);
$properties = $props->getProperties();
ksort($properties);
foreach ($properties as $key => $value) {
$propElement = $doc->createElement(self::$PROPERTY);
$propElement->setAttribute(self::$ATTR_NAME, $key);
$propElement->setAttribute(self::$ATTR_VALUE, $value);
$rootElement->appendChild($propElement);
}
try {
$doc->appendChild($rootElement);
$os->write($doc->saveXML());
} catch (IOException $ioe) {
throw new BuildException("Unable to write XML file", $ioe);
}
} | [
"protected",
"function",
"xmlSaveProperties",
"(",
"Properties",
"$",
"props",
",",
"OutputStream",
"$",
"os",
")",
"{",
"$",
"doc",
"=",
"new",
"DOMDocument",
"(",
"'1.0'",
",",
"'UTF-8'",
")",
";",
"$",
"doc",
"->",
"formatOutput",
"=",
"true",
";",
"$... | Output the properties as xml output.
@param Properties $props the properties to save
@param OutputStream $os the output stream to write to (Note this gets closed)
@throws BuildException | [
"Output",
"the",
"properties",
"as",
"xml",
"output",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/EchoProperties.php#L348-L369 | train |
phingofficial/phing | classes/phing/tasks/ext/GrowlNotifyTask.php | GrowlNotifyTask.setName | public function setName($name = '')
{
if ('' == $name) {
$name = 'Growl for Phing';
}
if (!is_string($name)) {
throw new BuildException(
'"name" attribute is invalid.' .
' Expect to be a string, actual is ' . gettype($name)
);
}
$this->name = $name;
} | php | public function setName($name = '')
{
if ('' == $name) {
$name = 'Growl for Phing';
}
if (!is_string($name)) {
throw new BuildException(
'"name" attribute is invalid.' .
' Expect to be a string, actual is ' . gettype($name)
);
}
$this->name = $name;
} | [
"public",
"function",
"setName",
"(",
"$",
"name",
"=",
"''",
")",
"{",
"if",
"(",
"''",
"==",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"'Growl for Phing'",
";",
"}",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
... | Defines the name of the application sending the notification
@param string $name (optional) Name of the application
that appears in your Growl preferences
Default: "Growl for Phing"
@return void
@throws BuildException | [
"Defines",
"the",
"name",
"of",
"the",
"application",
"sending",
"the",
"notification"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/GrowlNotifyTask.php#L124-L138 | train |
phingofficial/phing | classes/phing/tasks/ext/GrowlNotifyTask.php | GrowlNotifyTask.setMessage | public function setMessage($message = '')
{
if (!is_string($message)) {
throw new BuildException(
'"message" attribute is invalid.' .
' Expect to be a string, actual is ' . gettype($message)
);
}
$this->message = $message;
} | php | public function setMessage($message = '')
{
if (!is_string($message)) {
throw new BuildException(
'"message" attribute is invalid.' .
' Expect to be a string, actual is ' . gettype($message)
);
}
$this->message = $message;
} | [
"public",
"function",
"setMessage",
"(",
"$",
"message",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"message",
")",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"'\"message\" attribute is invalid.'",
".",
"' Expect to be a string, actual is '"... | The notification's text is required.
Use \n to specify a line break.
@param string $message Notification's text
@return void
@throws BuildException | [
"The",
"notification",
"s",
"text",
"is",
"required",
".",
"Use",
"\\",
"n",
"to",
"specify",
"a",
"line",
"break",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/GrowlNotifyTask.php#L161-L171 | train |
phingofficial/phing | classes/phing/tasks/ext/GrowlNotifyTask.php | GrowlNotifyTask.setTitle | public function setTitle($title = '')
{
if ('' == $title) {
$title = 'GrowlNotify';
}
if (!is_string($title)) {
throw new BuildException(
'"title" attribute is invalid.' .
' Expect to be a string, actual is ' . gettype($title)
);
}
$this->title = $title;
} | php | public function setTitle($title = '')
{
if ('' == $title) {
$title = 'GrowlNotify';
}
if (!is_string($title)) {
throw new BuildException(
'"title" attribute is invalid.' .
' Expect to be a string, actual is ' . gettype($title)
);
}
$this->title = $title;
} | [
"public",
"function",
"setTitle",
"(",
"$",
"title",
"=",
"''",
")",
"{",
"if",
"(",
"''",
"==",
"$",
"title",
")",
"{",
"$",
"title",
"=",
"'GrowlNotify'",
";",
"}",
"if",
"(",
"!",
"is_string",
"(",
"$",
"title",
")",
")",
"{",
"throw",
"new",
... | The notification's title.
Use \n to specify a line break.
@param string $title (optional) Notification's title
Default: GrowlNotify
@return void
@throws BuildException | [
"The",
"notification",
"s",
"title",
".",
"Use",
"\\",
"n",
"to",
"specify",
"a",
"line",
"break",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/GrowlNotifyTask.php#L183-L197 | train |
phingofficial/phing | classes/phing/tasks/ext/GrowlNotifyTask.php | GrowlNotifyTask.setAppicon | public function setAppicon($icon = '')
{
if (!is_string($icon)) {
throw new BuildException(
'"appicon" attribute is invalid.' .
' Expect to be a string, actual is ' . gettype($icon)
);
}
// relative location
if (strpos($icon, '..') === 0) {
$icon = realpath(__DIR__ . DIRECTORY_SEPARATOR . $icon);
} elseif (strpos($icon, '.') === 0) {
$icon = __DIR__ . substr($icon, 1);
}
$this->appicon = $icon;
} | php | public function setAppicon($icon = '')
{
if (!is_string($icon)) {
throw new BuildException(
'"appicon" attribute is invalid.' .
' Expect to be a string, actual is ' . gettype($icon)
);
}
// relative location
if (strpos($icon, '..') === 0) {
$icon = realpath(__DIR__ . DIRECTORY_SEPARATOR . $icon);
} elseif (strpos($icon, '.') === 0) {
$icon = __DIR__ . substr($icon, 1);
}
$this->appicon = $icon;
} | [
"public",
"function",
"setAppicon",
"(",
"$",
"icon",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"icon",
")",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"'\"appicon\" attribute is invalid.'",
".",
"' Expect to be a string, actual is '",
".... | The icon of the application being registered.
Must be a valid file type (png, jpg, gif, ico).
Can be any of the following:
- absolute url (http://domain/image.png)
- absolute file path (c:\temp\image.png)
- relative file path (.\folder\image.png) (relative file paths must start
with a dot and are relative to GrowlNotify's phing task location
@param string $icon Icon of the application
@return void
@throws BuildException | [
"The",
"icon",
"of",
"the",
"application",
"being",
"registered",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/GrowlNotifyTask.php#L239-L256 | train |
phingofficial/phing | classes/phing/tasks/ext/GrowlNotifyTask.php | GrowlNotifyTask.setHost | public function setHost($host = '127.0.0.1')
{
if (!is_string($host)) {
throw new BuildException(
'"host" attribute is invalid.' .
' Expect to be a string, actual is ' . gettype($host)
);
}
$this->host = $host;
} | php | public function setHost($host = '127.0.0.1')
{
if (!is_string($host)) {
throw new BuildException(
'"host" attribute is invalid.' .
' Expect to be a string, actual is ' . gettype($host)
);
}
$this->host = $host;
} | [
"public",
"function",
"setHost",
"(",
"$",
"host",
"=",
"'127.0.0.1'",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"host",
")",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"'\"host\" attribute is invalid.'",
".",
"' Expect to be a string, actual is '",
... | The host address to send the notification to.
If any value other than 'localhost' or '127.0.0.1' is provided, the host
is considered a remote host and the "pass" attribute must also be provided.
Default: 127.0.0.1
@param string $host Remote host name/ip
Default: 127.0.0.1
@return void
@throws BuildException | [
"The",
"host",
"address",
"to",
"send",
"the",
"notification",
"to",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/GrowlNotifyTask.php#L271-L281 | train |
phingofficial/phing | classes/phing/tasks/ext/GrowlNotifyTask.php | GrowlNotifyTask.setPassword | public function setPassword($password = '')
{
if (!is_string($password)) {
throw new BuildException(
'"password" attribute is invalid.' .
' Expect to be a string, actual is ' . gettype($password)
);
}
$this->password = $password;
} | php | public function setPassword($password = '')
{
if (!is_string($password)) {
throw new BuildException(
'"password" attribute is invalid.' .
' Expect to be a string, actual is ' . gettype($password)
);
}
$this->password = $password;
} | [
"public",
"function",
"setPassword",
"(",
"$",
"password",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"password",
")",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"'\"password\" attribute is invalid.'",
".",
"' Expect to be a string, actual i... | The password required to send notifications.
A password is required to send a request to a remote host. If host attribute
is specified and is any value other than 'localhost' or '127.0.0.1',
then "pass" attribute is also required.
Default: no password
@param string $password Password to send request to a remote host
@return void
@throws BuildException | [
"The",
"password",
"required",
"to",
"send",
"notifications",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/GrowlNotifyTask.php#L296-L306 | train |
phingofficial/phing | classes/phing/tasks/ext/GrowlNotifyTask.php | GrowlNotifyTask.setPriority | public function setPriority($priority = '')
{
if ('' == $priority) {
$priority = 'normal';
}
switch ($priority) {
case 'low':
$priority = Net_Growl::PRIORITY_LOW;
break;
case 'moderate':
$priority = Net_Growl::PRIORITY_MODERATE;
break;
case 'normal':
$priority = Net_Growl::PRIORITY_NORMAL;
break;
case 'high':
$priority = Net_Growl::PRIORITY_HIGH;
break;
case 'emergency':
$priority = Net_Growl::PRIORITY_EMERGENCY;
break;
default:
throw new BuildException(
'"priority" attribute is invalid.'
);
}
$this->priority = $priority;
} | php | public function setPriority($priority = '')
{
if ('' == $priority) {
$priority = 'normal';
}
switch ($priority) {
case 'low':
$priority = Net_Growl::PRIORITY_LOW;
break;
case 'moderate':
$priority = Net_Growl::PRIORITY_MODERATE;
break;
case 'normal':
$priority = Net_Growl::PRIORITY_NORMAL;
break;
case 'high':
$priority = Net_Growl::PRIORITY_HIGH;
break;
case 'emergency':
$priority = Net_Growl::PRIORITY_EMERGENCY;
break;
default:
throw new BuildException(
'"priority" attribute is invalid.'
);
}
$this->priority = $priority;
} | [
"public",
"function",
"setPriority",
"(",
"$",
"priority",
"=",
"''",
")",
"{",
"if",
"(",
"''",
"==",
"$",
"priority",
")",
"{",
"$",
"priority",
"=",
"'normal'",
";",
"}",
"switch",
"(",
"$",
"priority",
")",
"{",
"case",
"'low'",
":",
"$",
"prio... | The notification priority.
Valid values are : low, moderate, normal, high, emergency
Default: normal
@param string $priority Notification priority
Default: normal
@return void
@throws BuildException | [
"The",
"notification",
"priority",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/GrowlNotifyTask.php#L320-L349 | train |
phingofficial/phing | classes/phing/tasks/ext/GrowlNotifyTask.php | GrowlNotifyTask.setIcon | public function setIcon($icon = '')
{
if (!is_string($icon)) {
throw new BuildException(
'"icon" attribute is invalid.' .
' Expect to be a string, actual is ' . gettype($icon)
);
}
// relative location
if (strpos($icon, '..') === 0) {
$icon = realpath(__DIR__ . DIRECTORY_SEPARATOR . $icon);
} elseif (strpos($icon, '.') === 0) {
$icon = __DIR__ . substr($icon, 1);
}
$this->icon = $icon;
} | php | public function setIcon($icon = '')
{
if (!is_string($icon)) {
throw new BuildException(
'"icon" attribute is invalid.' .
' Expect to be a string, actual is ' . gettype($icon)
);
}
// relative location
if (strpos($icon, '..') === 0) {
$icon = realpath(__DIR__ . DIRECTORY_SEPARATOR . $icon);
} elseif (strpos($icon, '.') === 0) {
$icon = __DIR__ . substr($icon, 1);
}
$this->icon = $icon;
} | [
"public",
"function",
"setIcon",
"(",
"$",
"icon",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"icon",
")",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"'\"icon\" attribute is invalid.'",
".",
"' Expect to be a string, actual is '",
".",
"... | The icon to show for the notification.
Must be a valid file type (png, jpg, gif, ico).
Can be any of the following:
- absolute url (http://domain/image.png)
- absolute file path (c:\temp\image.png)
- relative file path (.\folder\image.png) (relative file paths must start
with a dot and are relative to GrowlNotify's phing task location
@param string $icon Icon of the message
@return void
@throws BuildException | [
"The",
"icon",
"to",
"show",
"for",
"the",
"notification",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/GrowlNotifyTask.php#L399-L416 | train |
phingofficial/phing | classes/phing/tasks/ext/GrowlNotifyTask.php | GrowlNotifyTask.main | public function main()
{
if (empty($this->message)) {
throw new BuildException(
'"message" attribute cannot be empty'
);
}
$notifications = [
$this->notification
];
$options = [
'host' => $this->host,
'protocol' => $this->protocol,
];
if (!empty($this->appicon)) {
$options['AppIcon'] = $this->appicon;
}
try {
if ($this->growl instanceof Net_Growl) {
$growl = $this->growl;
} else {
$growl = Net_Growl::singleton(
$this->name,
$notifications,
$this->password,
$options
);
}
$response = $growl->register();
if ($this->protocol == 'gntp') {
if ($response->getStatus() != 'OK') {
throw new BuildException(
'Growl Error ' . $response->getErrorCode() .
' - ' . $response->getErrorDescription()
);
}
}
$this->log(
'Application ' . $this->name . ' registered',
Project::MSG_VERBOSE
);
$logRequest = [
'Application-Name' => $this->name,
'Application-Icon' => $this->appicon,
'Notification-Name' => $this->notification,
'Notification-Title' => $this->title,
'Notification-Text' => $this->message,
'Notification-Priority' => $this->priority,
'Notification-Icon' => $this->icon,
'Notification-Sticky' => $this->sticky,
];
foreach ($logRequest as $key => $value) {
$this->log($key . ': ' . $value, Project::MSG_DEBUG);
}
$options = [
'sticky' => $this->sticky,
'priority' => $this->priority,
'icon' => $this->icon,
];
$response = $growl->publish(
$this->notification,
$this->title,
$this->message,
$options
);
if ($this->protocol == 'gntp') {
if ($response->getStatus() != 'OK') {
throw new BuildException(
'Growl Error ' . $response->getErrorCode() .
' - ' . $response->getErrorDescription()
);
}
}
$this->log('Notification was sent to remote host ' . $this->host);
} catch (Net_Growl_Exception $e) {
throw new BuildException(
'Growl Exception : ' . $e->getMessage()
);
}
} | php | public function main()
{
if (empty($this->message)) {
throw new BuildException(
'"message" attribute cannot be empty'
);
}
$notifications = [
$this->notification
];
$options = [
'host' => $this->host,
'protocol' => $this->protocol,
];
if (!empty($this->appicon)) {
$options['AppIcon'] = $this->appicon;
}
try {
if ($this->growl instanceof Net_Growl) {
$growl = $this->growl;
} else {
$growl = Net_Growl::singleton(
$this->name,
$notifications,
$this->password,
$options
);
}
$response = $growl->register();
if ($this->protocol == 'gntp') {
if ($response->getStatus() != 'OK') {
throw new BuildException(
'Growl Error ' . $response->getErrorCode() .
' - ' . $response->getErrorDescription()
);
}
}
$this->log(
'Application ' . $this->name . ' registered',
Project::MSG_VERBOSE
);
$logRequest = [
'Application-Name' => $this->name,
'Application-Icon' => $this->appicon,
'Notification-Name' => $this->notification,
'Notification-Title' => $this->title,
'Notification-Text' => $this->message,
'Notification-Priority' => $this->priority,
'Notification-Icon' => $this->icon,
'Notification-Sticky' => $this->sticky,
];
foreach ($logRequest as $key => $value) {
$this->log($key . ': ' . $value, Project::MSG_DEBUG);
}
$options = [
'sticky' => $this->sticky,
'priority' => $this->priority,
'icon' => $this->icon,
];
$response = $growl->publish(
$this->notification,
$this->title,
$this->message,
$options
);
if ($this->protocol == 'gntp') {
if ($response->getStatus() != 'OK') {
throw new BuildException(
'Growl Error ' . $response->getErrorCode() .
' - ' . $response->getErrorDescription()
);
}
}
$this->log('Notification was sent to remote host ' . $this->host);
} catch (Net_Growl_Exception $e) {
throw new BuildException(
'Growl Exception : ' . $e->getMessage()
);
}
} | [
"public",
"function",
"main",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"message",
")",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"'\"message\" attribute cannot be empty'",
")",
";",
"}",
"$",
"notifications",
"=",
"[",
"$",
"this",... | The main entry point method
@return void
@throws BuildException | [
"The",
"main",
"entry",
"point",
"method"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/GrowlNotifyTask.php#L424-L509 | train |
phingofficial/phing | classes/phing/listener/XmlLogger.php | XmlLogger.buildStarted | public function buildStarted(BuildEvent $event)
{
$this->buildTimerStart = Phing::currentTimeMillis();
$this->buildElement = $this->doc->createElement(XmlLogger::BUILD_TAG);
$this->elementStack[] = $this->buildElement;
$this->timesStack[] = $this->buildTimerStart;
} | php | public function buildStarted(BuildEvent $event)
{
$this->buildTimerStart = Phing::currentTimeMillis();
$this->buildElement = $this->doc->createElement(XmlLogger::BUILD_TAG);
$this->elementStack[] = $this->buildElement;
$this->timesStack[] = $this->buildTimerStart;
} | [
"public",
"function",
"buildStarted",
"(",
"BuildEvent",
"$",
"event",
")",
"{",
"$",
"this",
"->",
"buildTimerStart",
"=",
"Phing",
"::",
"currentTimeMillis",
"(",
")",
";",
"$",
"this",
"->",
"buildElement",
"=",
"$",
"this",
"->",
"doc",
"->",
"createEl... | Fired when the build starts, this builds the top-level element for the
document and remembers the time of the start of the build.
@param BuildEvent Ignored. | [
"Fired",
"when",
"the",
"build",
"starts",
"this",
"builds",
"the",
"top",
"-",
"level",
"element",
"for",
"the",
"document",
"and",
"remembers",
"the",
"time",
"of",
"the",
"start",
"of",
"the",
"build",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/XmlLogger.php#L142-L148 | train |
phingofficial/phing | classes/phing/listener/XmlLogger.php | XmlLogger.targetStarted | public function targetStarted(BuildEvent $event)
{
$target = $event->getTarget();
$targetElement = $this->doc->createElement(XmlLogger::TARGET_TAG);
$targetElement->setAttribute(XmlLogger::NAME_ATTR, $target->getName());
$this->timesStack[] = Phing::currentTimeMillis();
$this->elementStack[] = $targetElement;
} | php | public function targetStarted(BuildEvent $event)
{
$target = $event->getTarget();
$targetElement = $this->doc->createElement(XmlLogger::TARGET_TAG);
$targetElement->setAttribute(XmlLogger::NAME_ATTR, $target->getName());
$this->timesStack[] = Phing::currentTimeMillis();
$this->elementStack[] = $targetElement;
} | [
"public",
"function",
"targetStarted",
"(",
"BuildEvent",
"$",
"event",
")",
"{",
"$",
"target",
"=",
"$",
"event",
"->",
"getTarget",
"(",
")",
";",
"$",
"targetElement",
"=",
"$",
"this",
"->",
"doc",
"->",
"createElement",
"(",
"XmlLogger",
"::",
"TAR... | Fired when a target starts building, remembers the current time and the name of the target.
@param BuildEvent $event An event with any relevant extra information.
Will not be <code>null</code>. | [
"Fired",
"when",
"a",
"target",
"starts",
"building",
"remembers",
"the",
"current",
"time",
"and",
"the",
"name",
"of",
"the",
"target",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/XmlLogger.php#L221-L230 | train |
phingofficial/phing | classes/phing/listener/XmlLogger.php | XmlLogger.targetFinished | public function targetFinished(BuildEvent $event)
{
$targetTimerStart = array_pop($this->timesStack);
$targetElement = array_pop($this->elementStack);
$elapsedTime = Phing::currentTimeMillis() - $targetTimerStart;
$targetElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime));
$parentElement = $this->elementStack[count($this->elementStack) - 1];
$parentElement->appendChild($targetElement);
} | php | public function targetFinished(BuildEvent $event)
{
$targetTimerStart = array_pop($this->timesStack);
$targetElement = array_pop($this->elementStack);
$elapsedTime = Phing::currentTimeMillis() - $targetTimerStart;
$targetElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime));
$parentElement = $this->elementStack[count($this->elementStack) - 1];
$parentElement->appendChild($targetElement);
} | [
"public",
"function",
"targetFinished",
"(",
"BuildEvent",
"$",
"event",
")",
"{",
"$",
"targetTimerStart",
"=",
"array_pop",
"(",
"$",
"this",
"->",
"timesStack",
")",
";",
"$",
"targetElement",
"=",
"array_pop",
"(",
"$",
"this",
"->",
"elementStack",
")",... | Fired when a target finishes building, this adds the time taken
to the appropriate target element in the log.
@param BuildEvent $event An event with any relevant extra information.
Will not be <code>null</code>. | [
"Fired",
"when",
"a",
"target",
"finishes",
"building",
"this",
"adds",
"the",
"time",
"taken",
"to",
"the",
"appropriate",
"target",
"element",
"in",
"the",
"log",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/XmlLogger.php#L239-L249 | train |
phingofficial/phing | classes/phing/listener/XmlLogger.php | XmlLogger.taskStarted | public function taskStarted(BuildEvent $event)
{
$task = $event->getTask();
$taskElement = $this->doc->createElement(XmlLogger::TASK_TAG);
$taskElement->setAttribute(XmlLogger::NAME_ATTR, $task->getTaskName());
$taskElement->setAttribute(XmlLogger::LOCATION_ATTR, (string) $task->getLocation());
$this->timesStack[] = Phing::currentTimeMillis();
$this->elementStack[] = $taskElement;
} | php | public function taskStarted(BuildEvent $event)
{
$task = $event->getTask();
$taskElement = $this->doc->createElement(XmlLogger::TASK_TAG);
$taskElement->setAttribute(XmlLogger::NAME_ATTR, $task->getTaskName());
$taskElement->setAttribute(XmlLogger::LOCATION_ATTR, (string) $task->getLocation());
$this->timesStack[] = Phing::currentTimeMillis();
$this->elementStack[] = $taskElement;
} | [
"public",
"function",
"taskStarted",
"(",
"BuildEvent",
"$",
"event",
")",
"{",
"$",
"task",
"=",
"$",
"event",
"->",
"getTask",
"(",
")",
";",
"$",
"taskElement",
"=",
"$",
"this",
"->",
"doc",
"->",
"createElement",
"(",
"XmlLogger",
"::",
"TASK_TAG",
... | Fired when a task starts building, remembers the current time and the name of the task.
@param BuildEvent $event An event with any relevant extra information.
Will not be <code>null</code>. | [
"Fired",
"when",
"a",
"task",
"starts",
"building",
"remembers",
"the",
"current",
"time",
"and",
"the",
"name",
"of",
"the",
"task",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/XmlLogger.php#L257-L267 | train |
phingofficial/phing | classes/phing/listener/XmlLogger.php | XmlLogger.taskFinished | public function taskFinished(BuildEvent $event)
{
$taskTimerStart = array_pop($this->timesStack);
$taskElement = array_pop($this->elementStack);
$elapsedTime = Phing::currentTimeMillis() - $taskTimerStart;
$taskElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime));
$parentElement = $this->elementStack[count($this->elementStack) - 1];
$parentElement->appendChild($taskElement);
} | php | public function taskFinished(BuildEvent $event)
{
$taskTimerStart = array_pop($this->timesStack);
$taskElement = array_pop($this->elementStack);
$elapsedTime = Phing::currentTimeMillis() - $taskTimerStart;
$taskElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime));
$parentElement = $this->elementStack[count($this->elementStack) - 1];
$parentElement->appendChild($taskElement);
} | [
"public",
"function",
"taskFinished",
"(",
"BuildEvent",
"$",
"event",
")",
"{",
"$",
"taskTimerStart",
"=",
"array_pop",
"(",
"$",
"this",
"->",
"timesStack",
")",
";",
"$",
"taskElement",
"=",
"array_pop",
"(",
"$",
"this",
"->",
"elementStack",
")",
";"... | Fired when a task finishes building, this adds the time taken
to the appropriate task element in the log.
@param BuildEvent $event An event with any relevant extra information.
Will not be <code>null</code>. | [
"Fired",
"when",
"a",
"task",
"finishes",
"building",
"this",
"adds",
"the",
"time",
"taken",
"to",
"the",
"appropriate",
"task",
"element",
"in",
"the",
"log",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/XmlLogger.php#L276-L286 | train |
phingofficial/phing | classes/phing/tasks/system/PhingCallTask.php | PhingCallTask.addReference | public function addReference(PhingReference $r)
{
if ($this->callee === null) {
$this->init();
}
$this->callee->addReference($r);
} | php | public function addReference(PhingReference $r)
{
if ($this->callee === null) {
$this->init();
}
$this->callee->addReference($r);
} | [
"public",
"function",
"addReference",
"(",
"PhingReference",
"$",
"r",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"callee",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"init",
"(",
")",
";",
"}",
"$",
"this",
"->",
"callee",
"->",
"addReference",
"(",
... | Reference element identifying a data type to carry
over to the invoked target.
@param PhingReference $r the specified `PhingReference`. | [
"Reference",
"element",
"identifying",
"a",
"data",
"type",
"to",
"carry",
"over",
"to",
"the",
"invoked",
"target",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PhingCallTask.php#L138-L144 | train |
phingofficial/phing | classes/phing/tasks/system/PhingCallTask.php | PhingCallTask.init | public function init()
{
$this->callee = $this->project->createTask("phing");
$this->callee->setOwningTarget($this->getOwningTarget());
$this->callee->setTaskName($this->getTaskName());
$this->callee->setHaltOnFailure(true);
$this->callee->setLocation($this->getLocation());
$this->callee->init();
} | php | public function init()
{
$this->callee = $this->project->createTask("phing");
$this->callee->setOwningTarget($this->getOwningTarget());
$this->callee->setTaskName($this->getTaskName());
$this->callee->setHaltOnFailure(true);
$this->callee->setLocation($this->getLocation());
$this->callee->init();
} | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"callee",
"=",
"$",
"this",
"->",
"project",
"->",
"createTask",
"(",
"\"phing\"",
")",
";",
"$",
"this",
"->",
"callee",
"->",
"setOwningTarget",
"(",
"$",
"this",
"->",
"getOwningTarget",
... | init this task by creating new instance of the phing task and
configuring it's by calling its own init method. | [
"init",
"this",
"task",
"by",
"creating",
"new",
"instance",
"of",
"the",
"phing",
"task",
"and",
"configuring",
"it",
"s",
"by",
"calling",
"its",
"own",
"init",
"method",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PhingCallTask.php#L150-L158 | train |
phingofficial/phing | classes/phing/tasks/system/PhingCallTask.php | PhingCallTask.main | public function main()
{
if ($this->getOwningTarget()->getName() === "") {
$this->log("Cowardly refusing to call target '{$this->subTarget}' from the root", Project::MSG_WARN);
return;
}
$this->log("Running PhingCallTask for target '" . $this->subTarget . "'", Project::MSG_DEBUG);
if ($this->callee === null) {
$this->init();
}
if ($this->subTarget === null) {
throw new BuildException("Attribute target is required.", $this->getLocation());
}
$this->callee->setPhingFile($this->project->getProperty("phing.file"));
$this->callee->setTarget($this->subTarget);
$this->callee->setInheritAll($this->inheritAll);
$this->callee->setInheritRefs($this->inheritRefs);
$this->callee->main();
} | php | public function main()
{
if ($this->getOwningTarget()->getName() === "") {
$this->log("Cowardly refusing to call target '{$this->subTarget}' from the root", Project::MSG_WARN);
return;
}
$this->log("Running PhingCallTask for target '" . $this->subTarget . "'", Project::MSG_DEBUG);
if ($this->callee === null) {
$this->init();
}
if ($this->subTarget === null) {
throw new BuildException("Attribute target is required.", $this->getLocation());
}
$this->callee->setPhingFile($this->project->getProperty("phing.file"));
$this->callee->setTarget($this->subTarget);
$this->callee->setInheritAll($this->inheritAll);
$this->callee->setInheritRefs($this->inheritRefs);
$this->callee->main();
} | [
"public",
"function",
"main",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getOwningTarget",
"(",
")",
"->",
"getName",
"(",
")",
"===",
"\"\"",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"\"Cowardly refusing to call target '{$this->subTarget}' from the root\"",
... | hand off the work to the phing task of ours, after setting it up
@throws BuildException on validation failure or if the target didn't
execute | [
"hand",
"off",
"the",
"work",
"to",
"the",
"phing",
"task",
"of",
"ours",
"after",
"setting",
"it",
"up"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PhingCallTask.php#L166-L187 | train |
phingofficial/phing | classes/phing/util/PearPackageScanner.php | PearPackageScanner.setDescFile | public function setDescFile($descfile)
{
if ($descfile != '' && !file_exists($descfile)) {
throw new BuildException(
'PEAR package xml file "' . $descfile . '" does not exist'
);
}
$this->packageFile = $descfile;
} | php | public function setDescFile($descfile)
{
if ($descfile != '' && !file_exists($descfile)) {
throw new BuildException(
'PEAR package xml file "' . $descfile . '" does not exist'
);
}
$this->packageFile = $descfile;
} | [
"public",
"function",
"setDescFile",
"(",
"$",
"descfile",
")",
"{",
"if",
"(",
"$",
"descfile",
"!=",
"''",
"&&",
"!",
"file_exists",
"(",
"$",
"descfile",
")",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"'PEAR package xml file \"'",
".",
"$",
"desc... | Sets the package.xml file to read, instead of using the
local pear installation.
@param string $descfile Name of package xml file
@throws BuildException
@return void | [
"Sets",
"the",
"package",
".",
"xml",
"file",
"to",
"read",
"instead",
"of",
"using",
"the",
"local",
"pear",
"installation",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/PearPackageScanner.php#L56-L65 | train |
phingofficial/phing | classes/phing/util/PearPackageScanner.php | PearPackageScanner.setConfig | public function setConfig($config)
{
if ($config != '') {
if (!file_exists($config)) {
throw new BuildException(
'PEAR configuration file "' . $config . '" does not exist'
);
}
} else {
// try to auto-detect a pear local installation
if (DIRECTORY_SEPARATOR == '/') {
$config = '.pearrc';
} else {
$config = 'pear.ini';
}
$config = PEAR_CONFIG_DEFAULT_BIN_DIR . DIRECTORY_SEPARATOR . $config;
if (!file_exists($config)) {
// cannot find a pear local installation
$config = '';
}
}
$this->config = $config;
} | php | public function setConfig($config)
{
if ($config != '') {
if (!file_exists($config)) {
throw new BuildException(
'PEAR configuration file "' . $config . '" does not exist'
);
}
} else {
// try to auto-detect a pear local installation
if (DIRECTORY_SEPARATOR == '/') {
$config = '.pearrc';
} else {
$config = 'pear.ini';
}
$config = PEAR_CONFIG_DEFAULT_BIN_DIR . DIRECTORY_SEPARATOR . $config;
if (!file_exists($config)) {
// cannot find a pear local installation
$config = '';
}
}
$this->config = $config;
} | [
"public",
"function",
"setConfig",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"$",
"config",
"!=",
"''",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"config",
")",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"'PEAR configuration file \"'",
".",... | Sets the full path to the PEAR configuration file
@param string $config Configuration file
@throws BuildException
@return void | [
"Sets",
"the",
"full",
"path",
"to",
"the",
"PEAR",
"configuration",
"file"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/PearPackageScanner.php#L99-L122 | train |
phingofficial/phing | classes/phing/util/PearPackageScanner.php | PearPackageScanner.loadPackageInfo | protected function loadPackageInfo()
{
$config = PEAR_Config::singleton($this->config);
if (empty($this->packageFile)) {
// loads informations from PEAR package installed
$reg = $config->getRegistry();
if (!$reg->packageExists($this->package, $this->channel)) {
throw new BuildException(
sprintf(
'PEAR package %s/%s does not exist',
$this->channel,
$this->package
)
);
}
$packageInfo = $reg->getPackage($this->package, $this->channel);
} else {
// loads informations from PEAR package XML description file
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
$pkg = new PEAR_PackageFile($config);
$packageInfo = $pkg->fromPackageFile($this->packageFile, PEAR_VALIDATE_NORMAL);
PEAR::staticPopErrorHandling();
if (@PEAR::isError($packageInfo)) {
throw new BuildException("Errors in package file: " . $packageInfo->getMessage());
}
}
return $packageInfo;
} | php | protected function loadPackageInfo()
{
$config = PEAR_Config::singleton($this->config);
if (empty($this->packageFile)) {
// loads informations from PEAR package installed
$reg = $config->getRegistry();
if (!$reg->packageExists($this->package, $this->channel)) {
throw new BuildException(
sprintf(
'PEAR package %s/%s does not exist',
$this->channel,
$this->package
)
);
}
$packageInfo = $reg->getPackage($this->package, $this->channel);
} else {
// loads informations from PEAR package XML description file
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
$pkg = new PEAR_PackageFile($config);
$packageInfo = $pkg->fromPackageFile($this->packageFile, PEAR_VALIDATE_NORMAL);
PEAR::staticPopErrorHandling();
if (@PEAR::isError($packageInfo)) {
throw new BuildException("Errors in package file: " . $packageInfo->getMessage());
}
}
return $packageInfo;
} | [
"protected",
"function",
"loadPackageInfo",
"(",
")",
"{",
"$",
"config",
"=",
"PEAR_Config",
"::",
"singleton",
"(",
"$",
"this",
"->",
"config",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"packageFile",
")",
")",
"{",
"// loads informations fr... | Loads and returns the PEAR package information.
@return PEAR_PackageFile_v2 Package information object
@throws BuildException When the package does not exist | [
"Loads",
"and",
"returns",
"the",
"PEAR",
"package",
"information",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/PearPackageScanner.php#L167-L196 | train |
phingofficial/phing | classes/phing/util/PearPackageScanner.php | PearPackageScanner.scan | public function scan()
{
$this->init();
$list = $this->packageInfo->getFilelist();
if ($this->includes === null) {
// No includes supplied, so set it to 'matches all'
$this->includes = ["**"];
}
if ($this->excludes === null) {
$this->excludes = [];
}
$this->filesIncluded = [];
$this->filesNotIncluded = [];
$this->filesExcluded = [];
$this->filesDeselected = [];
$this->dirsIncluded = [];
$this->dirsNotIncluded = [];
$this->dirsExcluded = [];
$this->dirsDeselected = [];
$origFirstFile = null;
foreach ($list as $file => $att) {
if ($att['role'] != $this->role && $this->role != '') {
continue;
}
$origFile = $file;
if (isset($att['install-as'])) {
$file = $att['install-as'];
} else {
if (isset($att['baseinstalldir'])) {
$file = ltrim($att['baseinstalldir'] . '/' . $file, '/');
}
}
$file = str_replace('/', DIRECTORY_SEPARATOR, $file);
if ($this->isIncluded($file)) {
if ($this->isExcluded($file)) {
$this->everythingIncluded = false;
if (@is_dir($file)) {
$this->dirsExcluded[] = $file;
} else {
$this->filesExcluded[] = $file;
}
} else {
if (@is_dir($file)) {
$this->dirsIncluded[] = $file;
} else {
$this->filesIncluded[] = $file;
if ($origFirstFile === null) {
$origFirstFile = $origFile;
}
}
}
} else {
$this->everythingIncluded = false;
if (@is_dir($file)) {
$this->dirsNotIncluded[] = $file;
} else {
$this->filesNotIncluded[] = $file;
}
}
}
if (count($this->filesIncluded) > 0) {
if (empty($this->packageFile)) {
$att = $list[$origFirstFile];
$base_dir = substr(
$att['installed_as'],
0,
-strlen($this->filesIncluded[0])
);
} else {
$base_dir = dirname($this->packageFile);
}
$this->setBasedir($base_dir);
}
return true;
} | php | public function scan()
{
$this->init();
$list = $this->packageInfo->getFilelist();
if ($this->includes === null) {
// No includes supplied, so set it to 'matches all'
$this->includes = ["**"];
}
if ($this->excludes === null) {
$this->excludes = [];
}
$this->filesIncluded = [];
$this->filesNotIncluded = [];
$this->filesExcluded = [];
$this->filesDeselected = [];
$this->dirsIncluded = [];
$this->dirsNotIncluded = [];
$this->dirsExcluded = [];
$this->dirsDeselected = [];
$origFirstFile = null;
foreach ($list as $file => $att) {
if ($att['role'] != $this->role && $this->role != '') {
continue;
}
$origFile = $file;
if (isset($att['install-as'])) {
$file = $att['install-as'];
} else {
if (isset($att['baseinstalldir'])) {
$file = ltrim($att['baseinstalldir'] . '/' . $file, '/');
}
}
$file = str_replace('/', DIRECTORY_SEPARATOR, $file);
if ($this->isIncluded($file)) {
if ($this->isExcluded($file)) {
$this->everythingIncluded = false;
if (@is_dir($file)) {
$this->dirsExcluded[] = $file;
} else {
$this->filesExcluded[] = $file;
}
} else {
if (@is_dir($file)) {
$this->dirsIncluded[] = $file;
} else {
$this->filesIncluded[] = $file;
if ($origFirstFile === null) {
$origFirstFile = $origFile;
}
}
}
} else {
$this->everythingIncluded = false;
if (@is_dir($file)) {
$this->dirsNotIncluded[] = $file;
} else {
$this->filesNotIncluded[] = $file;
}
}
}
if (count($this->filesIncluded) > 0) {
if (empty($this->packageFile)) {
$att = $list[$origFirstFile];
$base_dir = substr(
$att['installed_as'],
0,
-strlen($this->filesIncluded[0])
);
} else {
$base_dir = dirname($this->packageFile);
}
$this->setBasedir($base_dir);
}
return true;
} | [
"public",
"function",
"scan",
"(",
")",
"{",
"$",
"this",
"->",
"init",
"(",
")",
";",
"$",
"list",
"=",
"$",
"this",
"->",
"packageInfo",
"->",
"getFilelist",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"includes",
"===",
"null",
")",
"{",
"// ... | Generates the list of included files and directories
@return boolean True if all went well, false if something was wrong
@uses $filesIncluded
@uses $filesDeselected
@uses $filesNotIncluded
@uses $filesExcluded
@uses $everythingIncluded
@uses $dirsIncluded
@uses $dirsDeselected
@uses $dirsNotIncluded
@uses $dirsExcluded | [
"Generates",
"the",
"list",
"of",
"included",
"files",
"and",
"directories"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/PearPackageScanner.php#L213-L294 | train |
phingofficial/phing | classes/phing/tasks/system/condition/HttpCondition.php | HttpCondition.setRequestMethod | public function setRequestMethod($method)
{
$this->requestMethod = $method === null ? self::DEFAULT_REQUEST_METHOD : strtoupper($method);
} | php | public function setRequestMethod($method)
{
$this->requestMethod = $method === null ? self::DEFAULT_REQUEST_METHOD : strtoupper($method);
} | [
"public",
"function",
"setRequestMethod",
"(",
"$",
"method",
")",
"{",
"$",
"this",
"->",
"requestMethod",
"=",
"$",
"method",
"===",
"null",
"?",
"self",
"::",
"DEFAULT_REQUEST_METHOD",
":",
"strtoupper",
"(",
"$",
"method",
")",
";",
"}"
] | Sets the method to be used when issuing the HTTP request.
@param string $method The HTTP request method to use. Valid values are
"GET", "HEAD", "TRACE", etc. The default
if not specified is "GET". | [
"Sets",
"the",
"method",
"to",
"be",
"used",
"when",
"issuing",
"the",
"HTTP",
"request",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/condition/HttpCondition.php#L71-L74 | train |
phingofficial/phing | classes/phing/filters/StripPhpComments.php | StripPhpComments.read | public function read($len = null)
{
$buffer = $this->in->read($len);
if ($buffer === -1) {
return -1;
}
$newStr = '';
$tokens = token_get_all($buffer);
foreach ($tokens as $token) {
if (is_array($token)) {
list($id, $text) = $token;
switch ($id) {
case T_COMMENT:
case T_DOC_COMMENT:
// no action on comments
continue 2;
default:
$newStr .= $text;
continue 2;
}
}
$newStr .= $token;
}
return $newStr;
} | php | public function read($len = null)
{
$buffer = $this->in->read($len);
if ($buffer === -1) {
return -1;
}
$newStr = '';
$tokens = token_get_all($buffer);
foreach ($tokens as $token) {
if (is_array($token)) {
list($id, $text) = $token;
switch ($id) {
case T_COMMENT:
case T_DOC_COMMENT:
// no action on comments
continue 2;
default:
$newStr .= $text;
continue 2;
}
}
$newStr .= $token;
}
return $newStr;
} | [
"public",
"function",
"read",
"(",
"$",
"len",
"=",
"null",
")",
"{",
"$",
"buffer",
"=",
"$",
"this",
"->",
"in",
"->",
"read",
"(",
"$",
"len",
")",
";",
"if",
"(",
"$",
"buffer",
"===",
"-",
"1",
")",
"{",
"return",
"-",
"1",
";",
"}",
"... | Returns the stream without Php comments.
@param null $len
@return string the resulting stream, or -1
if the end of the resulting stream has been reached | [
"Returns",
"the",
"stream",
"without",
"Php",
"comments",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/StripPhpComments.php#L55-L83 | train |
phingofficial/phing | classes/phing/filters/StripPhpComments.php | StripPhpComments.chain | public function chain(Reader $reader)
{
$newFilter = new StripPhpComments($reader);
$newFilter->setProject($this->getProject());
return $newFilter;
} | php | public function chain(Reader $reader)
{
$newFilter = new StripPhpComments($reader);
$newFilter->setProject($this->getProject());
return $newFilter;
} | [
"public",
"function",
"chain",
"(",
"Reader",
"$",
"reader",
")",
"{",
"$",
"newFilter",
"=",
"new",
"StripPhpComments",
"(",
"$",
"reader",
")",
";",
"$",
"newFilter",
"->",
"setProject",
"(",
"$",
"this",
"->",
"getProject",
"(",
")",
")",
";",
"retu... | Creates a new StripPhpComments using the passed in
Reader for instantiation.
@param A|Reader $reader
@internal param A $reader Reader object providing the underlying stream.
Must not be <code>null</code>.
@return $this a new filter based on this configuration, but filtering
the specified reader | [
"Creates",
"a",
"new",
"StripPhpComments",
"using",
"the",
"passed",
"in",
"Reader",
"for",
"instantiation",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/StripPhpComments.php#L96-L102 | train |
phingofficial/phing | classes/phing/tasks/ext/pdo/DummyPDOQuerySplitter.php | DummyPDOQuerySplitter.nextQuery | public function nextQuery()
{
$sql = null;
while (($line = $this->sqlReader->readLine()) !== null) {
$delimiter = $this->parent->getDelimiter();
$project = $this->parent->getOwningTarget()->getProject();
$line = $project->replaceProperties(trim($line));
if (($line != $delimiter) && (StringHelper::startsWith("//", $line)
|| StringHelper::startsWith("--", $line)
|| StringHelper::startsWith("#", $line))
) {
continue;
}
$sql .= " " . $line . "\n";
/**
* fix issue with PDO and wrong formated multistatements
*
* @issue 1108
*/
if (StringHelper::endsWith($delimiter, $line)) {
break;
}
}
return $sql;
} | php | public function nextQuery()
{
$sql = null;
while (($line = $this->sqlReader->readLine()) !== null) {
$delimiter = $this->parent->getDelimiter();
$project = $this->parent->getOwningTarget()->getProject();
$line = $project->replaceProperties(trim($line));
if (($line != $delimiter) && (StringHelper::startsWith("//", $line)
|| StringHelper::startsWith("--", $line)
|| StringHelper::startsWith("#", $line))
) {
continue;
}
$sql .= " " . $line . "\n";
/**
* fix issue with PDO and wrong formated multistatements
*
* @issue 1108
*/
if (StringHelper::endsWith($delimiter, $line)) {
break;
}
}
return $sql;
} | [
"public",
"function",
"nextQuery",
"(",
")",
"{",
"$",
"sql",
"=",
"null",
";",
"while",
"(",
"(",
"$",
"line",
"=",
"$",
"this",
"->",
"sqlReader",
"->",
"readLine",
"(",
")",
")",
"!==",
"null",
")",
"{",
"$",
"delimiter",
"=",
"$",
"this",
"->... | Returns entire SQL source
@return string|null | [
"Returns",
"entire",
"SQL",
"source"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdo/DummyPDOQuerySplitter.php#L39-L68 | train |
phingofficial/phing | classes/phing/tasks/ext/pdepend/PhpDependAnalyzerElement.php | PhpDependAnalyzerElement.setValue | public function setValue($value)
{
$this->value = [];
$token = ' ,;';
$values = strtok($value, $token);
while ($values !== false) {
$this->value[] = $values;
$values = strtok($token);
}
} | php | public function setValue($value)
{
$this->value = [];
$token = ' ,;';
$values = strtok($value, $token);
while ($values !== false) {
$this->value[] = $values;
$values = strtok($token);
}
} | [
"public",
"function",
"setValue",
"(",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"[",
"]",
";",
"$",
"token",
"=",
"' ,;'",
";",
"$",
"values",
"=",
"strtok",
"(",
"$",
"value",
",",
"$",
"token",
")",
";",
"while",
"(",
"$",
"va... | Sets the value for the analyzer
@param string $value Value for the analyzer | [
"Sets",
"the",
"value",
"for",
"the",
"analyzer"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdepend/PhpDependAnalyzerElement.php#L80-L91 | train |
phingofficial/phing | classes/phing/tasks/ext/pdepend/PhpDependTask.php | PhpDependTask.requireDependencies | protected function requireDependencies()
{
if (!empty($this->pharLocation)) {
include_once 'phar://' . $this->pharLocation . '/vendor/autoload.php';
}
// check 2.x version (composer/phar)
if (class_exists('PDepend\\TextUI\\Runner')) {
return;
}
$this->oldVersion = true;
// check 1.x version (composer)
if (class_exists('PHP_Depend_TextUI_Runner')) {
// include_path hack for PHP_Depend 1.1.3
$rc = new ReflectionClass('PHP_Depend');
set_include_path(get_include_path() . ":" . realpath(dirname($rc->getFileName()) . "/../"));
return;
}
@include_once 'PHP/Depend/Autoload.php';
if (!class_exists('PHP_Depend_Autoload')) {
throw new BuildException(
'PhpDependTask depends on PHP_Depend being installed and on include_path',
$this->getLocation()
);
}
// register PHP_Depend autoloader
$autoload = new PHP_Depend_Autoload();
$autoload->register();
} | php | protected function requireDependencies()
{
if (!empty($this->pharLocation)) {
include_once 'phar://' . $this->pharLocation . '/vendor/autoload.php';
}
// check 2.x version (composer/phar)
if (class_exists('PDepend\\TextUI\\Runner')) {
return;
}
$this->oldVersion = true;
// check 1.x version (composer)
if (class_exists('PHP_Depend_TextUI_Runner')) {
// include_path hack for PHP_Depend 1.1.3
$rc = new ReflectionClass('PHP_Depend');
set_include_path(get_include_path() . ":" . realpath(dirname($rc->getFileName()) . "/../"));
return;
}
@include_once 'PHP/Depend/Autoload.php';
if (!class_exists('PHP_Depend_Autoload')) {
throw new BuildException(
'PhpDependTask depends on PHP_Depend being installed and on include_path',
$this->getLocation()
);
}
// register PHP_Depend autoloader
$autoload = new PHP_Depend_Autoload();
$autoload->register();
} | [
"protected",
"function",
"requireDependencies",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"pharLocation",
")",
")",
"{",
"include_once",
"'phar://'",
".",
"$",
"this",
"->",
"pharLocation",
".",
"'/vendor/autoload.php'",
";",
"}",
"// c... | Load the necessary environment for running PHP_Depend
@throws BuildException | [
"Load",
"the",
"necessary",
"environment",
"for",
"running",
"PHP_Depend"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdepend/PhpDependTask.php#L133-L167 | train |
phingofficial/phing | classes/phing/tasks/ext/pdepend/PhpDependTask.php | PhpDependTask.setAllowedFileExtensions | public function setAllowedFileExtensions($fileExtensions)
{
$this->allowedFileExtensions = [];
$token = ' ,;';
$ext = strtok($fileExtensions, $token);
while ($ext !== false) {
$this->allowedFileExtensions[] = $ext;
$ext = strtok($token);
}
} | php | public function setAllowedFileExtensions($fileExtensions)
{
$this->allowedFileExtensions = [];
$token = ' ,;';
$ext = strtok($fileExtensions, $token);
while ($ext !== false) {
$this->allowedFileExtensions[] = $ext;
$ext = strtok($token);
}
} | [
"public",
"function",
"setAllowedFileExtensions",
"(",
"$",
"fileExtensions",
")",
"{",
"$",
"this",
"->",
"allowedFileExtensions",
"=",
"[",
"]",
";",
"$",
"token",
"=",
"' ,;'",
";",
"$",
"ext",
"=",
"strtok",
"(",
"$",
"fileExtensions",
",",
"$",
"token... | Sets a list of filename extensions for valid php source code files
@param string $fileExtensions List of valid file extensions | [
"Sets",
"a",
"list",
"of",
"filename",
"extensions",
"for",
"valid",
"php",
"source",
"code",
"files"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdepend/PhpDependTask.php#L184-L195 | train |
phingofficial/phing | classes/phing/tasks/ext/pdepend/PhpDependTask.php | PhpDependTask.setExcludeDirectories | public function setExcludeDirectories($excludeDirectories)
{
$this->excludeDirectories = [];
$token = ' ,;';
$pattern = strtok($excludeDirectories, $token);
while ($pattern !== false) {
$this->excludeDirectories[] = $pattern;
$pattern = strtok($token);
}
} | php | public function setExcludeDirectories($excludeDirectories)
{
$this->excludeDirectories = [];
$token = ' ,;';
$pattern = strtok($excludeDirectories, $token);
while ($pattern !== false) {
$this->excludeDirectories[] = $pattern;
$pattern = strtok($token);
}
} | [
"public",
"function",
"setExcludeDirectories",
"(",
"$",
"excludeDirectories",
")",
"{",
"$",
"this",
"->",
"excludeDirectories",
"=",
"[",
"]",
";",
"$",
"token",
"=",
"' ,;'",
";",
"$",
"pattern",
"=",
"strtok",
"(",
"$",
"excludeDirectories",
",",
"$",
... | Sets a list of exclude directories
@param string $excludeDirectories List of exclude directories | [
"Sets",
"a",
"list",
"of",
"exclude",
"directories"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdepend/PhpDependTask.php#L202-L213 | train |
phingofficial/phing | classes/phing/tasks/ext/pdepend/PhpDependTask.php | PhpDependTask.setExcludePackages | public function setExcludePackages($excludePackages)
{
$this->excludePackages = [];
$token = ' ,;';
$pattern = strtok($excludePackages, $token);
while ($pattern !== false) {
$this->excludePackages[] = $pattern;
$pattern = strtok($token);
}
} | php | public function setExcludePackages($excludePackages)
{
$this->excludePackages = [];
$token = ' ,;';
$pattern = strtok($excludePackages, $token);
while ($pattern !== false) {
$this->excludePackages[] = $pattern;
$pattern = strtok($token);
}
} | [
"public",
"function",
"setExcludePackages",
"(",
"$",
"excludePackages",
")",
"{",
"$",
"this",
"->",
"excludePackages",
"=",
"[",
"]",
";",
"$",
"token",
"=",
"' ,;'",
";",
"$",
"pattern",
"=",
"strtok",
"(",
"$",
"excludePackages",
",",
"$",
"token",
"... | Sets a list of exclude packages
@param string $excludePackages Exclude packages | [
"Sets",
"a",
"list",
"of",
"exclude",
"packages"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdepend/PhpDependTask.php#L220-L231 | train |
phingofficial/phing | classes/phing/tasks/ext/pdepend/PhpDependTask.php | PhpDependTask.main | public function main()
{
$this->requireDependencies();
if (!isset($this->file) and count($this->filesets) == 0) {
throw new BuildException('Missing either a nested fileset or attribute "file" set');
}
if (count($this->loggers) == 0) {
throw new BuildException('Missing nested "logger" element');
}
$this->validateLoggers();
$this->validateAnalyzers();
$filesToParse = $this->getFilesToParse();
$runner = $this->createRunner();
$runner->setSourceArguments($filesToParse);
foreach ($this->loggers as $logger) {
// Register logger
if ($this->oldVersion) {
$runner->addLogger(
$logger->getType(),
$logger->getOutfile()->__toString()
);
} else {
$runner->addReportGenerator(
$logger->getType(),
$logger->getOutfile()->__toString()
);
}
}
foreach ($this->analyzers as $analyzer) {
// Register additional analyzer
$runner->addOption(
$analyzer->getType(),
$analyzer->getValue()
);
}
// Disable annotation parsing
if ($this->withoutAnnotations) {
$runner->setWithoutAnnotations();
}
// Enable bad documentation support
if ($this->supportBadDocumentation) {
$runner->setSupportBadDocumentation();
}
// Check for suffix
if (count($this->allowedFileExtensions) > 0) {
$runner->setFileExtensions($this->allowedFileExtensions);
}
// Check for ignore directories
if (count($this->excludeDirectories) > 0) {
$runner->setExcludeDirectories($this->excludeDirectories);
}
// Check for exclude packages
if (count($this->excludePackages) > 0) {
$runner->setExcludePackages($this->excludePackages);
}
$runner->run();
if ($runner->hasParseErrors() === true) {
$this->log('Following errors occurred:');
foreach ($runner->getParseErrors() as $error) {
$this->log($error);
}
if ($this->haltonerror === true) {
throw new BuildException('Errors occurred during parse process');
}
}
} | php | public function main()
{
$this->requireDependencies();
if (!isset($this->file) and count($this->filesets) == 0) {
throw new BuildException('Missing either a nested fileset or attribute "file" set');
}
if (count($this->loggers) == 0) {
throw new BuildException('Missing nested "logger" element');
}
$this->validateLoggers();
$this->validateAnalyzers();
$filesToParse = $this->getFilesToParse();
$runner = $this->createRunner();
$runner->setSourceArguments($filesToParse);
foreach ($this->loggers as $logger) {
// Register logger
if ($this->oldVersion) {
$runner->addLogger(
$logger->getType(),
$logger->getOutfile()->__toString()
);
} else {
$runner->addReportGenerator(
$logger->getType(),
$logger->getOutfile()->__toString()
);
}
}
foreach ($this->analyzers as $analyzer) {
// Register additional analyzer
$runner->addOption(
$analyzer->getType(),
$analyzer->getValue()
);
}
// Disable annotation parsing
if ($this->withoutAnnotations) {
$runner->setWithoutAnnotations();
}
// Enable bad documentation support
if ($this->supportBadDocumentation) {
$runner->setSupportBadDocumentation();
}
// Check for suffix
if (count($this->allowedFileExtensions) > 0) {
$runner->setFileExtensions($this->allowedFileExtensions);
}
// Check for ignore directories
if (count($this->excludeDirectories) > 0) {
$runner->setExcludeDirectories($this->excludeDirectories);
}
// Check for exclude packages
if (count($this->excludePackages) > 0) {
$runner->setExcludePackages($this->excludePackages);
}
$runner->run();
if ($runner->hasParseErrors() === true) {
$this->log('Following errors occurred:');
foreach ($runner->getParseErrors() as $error) {
$this->log($error);
}
if ($this->haltonerror === true) {
throw new BuildException('Errors occurred during parse process');
}
}
} | [
"public",
"function",
"main",
"(",
")",
"{",
"$",
"this",
"->",
"requireDependencies",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"file",
")",
"and",
"count",
"(",
"$",
"this",
"->",
"filesets",
")",
"==",
"0",
")",
"{",
"thr... | Executes PHP_Depend_TextUI_Runner against PhingFile or a FileSet
@throws BuildException | [
"Executes",
"PHP_Depend_TextUI_Runner",
"against",
"PhingFile",
"or",
"a",
"FileSet"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdepend/PhpDependTask.php#L322-L403 | train |
phingofficial/phing | classes/phing/tasks/ext/pdepend/PhpDependTask.php | PhpDependTask.validateLoggers | protected function validateLoggers()
{
foreach ($this->loggers as $logger) {
if ($logger->getType() === '') {
throw new BuildException('Logger missing required "type" attribute');
}
if ($logger->getOutfile() === null) {
throw new BuildException('Logger requires "outfile" attribute');
}
}
} | php | protected function validateLoggers()
{
foreach ($this->loggers as $logger) {
if ($logger->getType() === '') {
throw new BuildException('Logger missing required "type" attribute');
}
if ($logger->getOutfile() === null) {
throw new BuildException('Logger requires "outfile" attribute');
}
}
} | [
"protected",
"function",
"validateLoggers",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"loggers",
"as",
"$",
"logger",
")",
"{",
"if",
"(",
"$",
"logger",
"->",
"getType",
"(",
")",
"===",
"''",
")",
"{",
"throw",
"new",
"BuildException",
"(",
... | Validates the available loggers
@throws BuildException | [
"Validates",
"the",
"available",
"loggers"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdepend/PhpDependTask.php#L410-L421 | train |
phingofficial/phing | classes/phing/tasks/ext/pdepend/PhpDependTask.php | PhpDependTask.validateAnalyzers | protected function validateAnalyzers()
{
foreach ($this->analyzers as $analyzer) {
if ($analyzer->getType() === '') {
throw new BuildException('Analyzer missing required "type" attribute');
}
if (count($analyzer->getValue()) === 0) {
throw new BuildException('Analyzer missing required "value" attribute');
}
}
} | php | protected function validateAnalyzers()
{
foreach ($this->analyzers as $analyzer) {
if ($analyzer->getType() === '') {
throw new BuildException('Analyzer missing required "type" attribute');
}
if (count($analyzer->getValue()) === 0) {
throw new BuildException('Analyzer missing required "value" attribute');
}
}
} | [
"protected",
"function",
"validateAnalyzers",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"analyzers",
"as",
"$",
"analyzer",
")",
"{",
"if",
"(",
"$",
"analyzer",
"->",
"getType",
"(",
")",
"===",
"''",
")",
"{",
"throw",
"new",
"BuildException",
... | Validates the available analyzers
@throws BuildException | [
"Validates",
"the",
"available",
"analyzers"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdepend/PhpDependTask.php#L428-L439 | train |
phingofficial/phing | classes/phing/tasks/ext/pdepend/PhpDependTask.php | PhpDependTask.getConfiguration | private function getConfiguration()
{
// Check for configuration option
if ($this->configFile == null || !($this->configFile instanceof PhingFile)) {
return null;
}
if (file_exists($this->configFile->__toString()) === false) {
throw new BuildException(
'The configuration file "' . $this->configFile->__toString() . '" doesn\'t exist.'
);
}
if ($this->oldVersion) {
$configurationClassName = 'PHP_Depend_Util_Configuration';
} else {
$configurationClassName = 'PDepend\\Util\\Configuration';
}
return new $configurationClassName(
$this->configFile->__toString(),
null,
true
);
} | php | private function getConfiguration()
{
// Check for configuration option
if ($this->configFile == null || !($this->configFile instanceof PhingFile)) {
return null;
}
if (file_exists($this->configFile->__toString()) === false) {
throw new BuildException(
'The configuration file "' . $this->configFile->__toString() . '" doesn\'t exist.'
);
}
if ($this->oldVersion) {
$configurationClassName = 'PHP_Depend_Util_Configuration';
} else {
$configurationClassName = 'PDepend\\Util\\Configuration';
}
return new $configurationClassName(
$this->configFile->__toString(),
null,
true
);
} | [
"private",
"function",
"getConfiguration",
"(",
")",
"{",
"// Check for configuration option",
"if",
"(",
"$",
"this",
"->",
"configFile",
"==",
"null",
"||",
"!",
"(",
"$",
"this",
"->",
"configFile",
"instanceof",
"PhingFile",
")",
")",
"{",
"return",
"null"... | Loads configuration file
@return null|PHP_Depend_Util_Configuration
@throws BuildException | [
"Loads",
"configuration",
"file"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdepend/PhpDependTask.php#L528-L552 | train |
phingofficial/phing | classes/phing/util/regexp/PregEngine.php | PregEngine.getModifiers | public function getModifiers()
{
$mods = $this->modifiers;
if ($this->getIgnoreCase()) {
$mods .= 'i';
} elseif ($this->getIgnoreCase() === false) {
$mods = str_replace('i', '', $mods);
}
if ($this->getMultiline()) {
$mods .= 's';
} elseif ($this->getMultiline() === false) {
$mods = str_replace('s', '', $mods);
}
// filter out duplicates
$mods = preg_split('//', $mods, -1, PREG_SPLIT_NO_EMPTY);
$mods = implode('', array_unique($mods));
return $mods;
} | php | public function getModifiers()
{
$mods = $this->modifiers;
if ($this->getIgnoreCase()) {
$mods .= 'i';
} elseif ($this->getIgnoreCase() === false) {
$mods = str_replace('i', '', $mods);
}
if ($this->getMultiline()) {
$mods .= 's';
} elseif ($this->getMultiline() === false) {
$mods = str_replace('s', '', $mods);
}
// filter out duplicates
$mods = preg_split('//', $mods, -1, PREG_SPLIT_NO_EMPTY);
$mods = implode('', array_unique($mods));
return $mods;
} | [
"public",
"function",
"getModifiers",
"(",
")",
"{",
"$",
"mods",
"=",
"$",
"this",
"->",
"modifiers",
";",
"if",
"(",
"$",
"this",
"->",
"getIgnoreCase",
"(",
")",
")",
"{",
"$",
"mods",
".=",
"'i'",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"... | Gets pattern modifiers.
@return string | [
"Gets",
"pattern",
"modifiers",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/regexp/PregEngine.php#L79-L97 | train |
phingofficial/phing | classes/phing/util/regexp/PregEngine.php | PregEngine.match | public function match($pattern, $source, &$matches)
{
return preg_match($this->preparePattern($pattern), $source, $matches) > 0;
} | php | public function match($pattern, $source, &$matches)
{
return preg_match($this->preparePattern($pattern), $source, $matches) > 0;
} | [
"public",
"function",
"match",
"(",
"$",
"pattern",
",",
"$",
"source",
",",
"&",
"$",
"matches",
")",
"{",
"return",
"preg_match",
"(",
"$",
"this",
"->",
"preparePattern",
"(",
"$",
"pattern",
")",
",",
"$",
"source",
",",
"$",
"matches",
")",
">",... | Matches pattern against source string and sets the matches array.
@param string $pattern The regex pattern to match.
@param string $source The source string.
@param array $matches The array in which to store matches.
@return boolean Success of matching operation. | [
"Matches",
"pattern",
"against",
"source",
"string",
"and",
"sets",
"the",
"matches",
"array",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/regexp/PregEngine.php#L197-L200 | train |
phingofficial/phing | classes/phing/util/regexp/PregEngine.php | PregEngine.matchAll | public function matchAll($pattern, $source, &$matches)
{
return preg_match_all($this->preparePattern($pattern), $source, $matches) > 0;
} | php | public function matchAll($pattern, $source, &$matches)
{
return preg_match_all($this->preparePattern($pattern), $source, $matches) > 0;
} | [
"public",
"function",
"matchAll",
"(",
"$",
"pattern",
",",
"$",
"source",
",",
"&",
"$",
"matches",
")",
"{",
"return",
"preg_match_all",
"(",
"$",
"this",
"->",
"preparePattern",
"(",
"$",
"pattern",
")",
",",
"$",
"source",
",",
"$",
"matches",
")",... | Matches all patterns in source string and sets the matches array.
@param string $pattern The regex pattern to match.
@param string $source The source string.
@param array $matches The array in which to store matches.
@return boolean Success of matching operation. | [
"Matches",
"all",
"patterns",
"in",
"source",
"string",
"and",
"sets",
"the",
"matches",
"array",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/regexp/PregEngine.php#L210-L213 | train |
phingofficial/phing | classes/phing/tasks/ext/hg/HgAddTask.php | HgAddTask.loadIgnoreFile | public function loadIgnoreFile()
{
$ignores = [];
$lines = file('.hgignore');
foreach ($lines as $line) {
$nline = trim($line);
$nline = preg_replace('/\/\*$/', '/', $nline);
$ignores[] = $nline;
}
$this->ignoreFile = $ignores;
} | php | public function loadIgnoreFile()
{
$ignores = [];
$lines = file('.hgignore');
foreach ($lines as $line) {
$nline = trim($line);
$nline = preg_replace('/\/\*$/', '/', $nline);
$ignores[] = $nline;
}
$this->ignoreFile = $ignores;
} | [
"public",
"function",
"loadIgnoreFile",
"(",
")",
"{",
"$",
"ignores",
"=",
"[",
"]",
";",
"$",
"lines",
"=",
"file",
"(",
"'.hgignore'",
")",
";",
"foreach",
"(",
"$",
"lines",
"as",
"$",
"line",
")",
"{",
"$",
"nline",
"=",
"trim",
"(",
"$",
"l... | Load .hgignore file.
@return void | [
"Load",
".",
"hgignore",
"file",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/hg/HgAddTask.php#L120-L130 | train |
phingofficial/phing | classes/phing/tasks/ext/hg/HgAddTask.php | HgAddTask.fileIsIgnored | public function fileIsIgnored($file)
{
$line = $this->ignoreFile[0];
$mode = 'regexp';
$ignored = false;
if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)
|| $matches[1] === 'glob'
) {
$mode = 'glob';
}
if ($mode === 'glob') {
$ignored = $this->ignoredByGlob($file);
} elseif ($mode === 'regexp') {
$ignored = $this->ignoredByRegex($file);
}
return $ignored;
} | php | public function fileIsIgnored($file)
{
$line = $this->ignoreFile[0];
$mode = 'regexp';
$ignored = false;
if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)
|| $matches[1] === 'glob'
) {
$mode = 'glob';
}
if ($mode === 'glob') {
$ignored = $this->ignoredByGlob($file);
} elseif ($mode === 'regexp') {
$ignored = $this->ignoredByRegex($file);
}
return $ignored;
} | [
"public",
"function",
"fileIsIgnored",
"(",
"$",
"file",
")",
"{",
"$",
"line",
"=",
"$",
"this",
"->",
"ignoreFile",
"[",
"0",
"]",
";",
"$",
"mode",
"=",
"'regexp'",
";",
"$",
"ignored",
"=",
"false",
";",
"if",
"(",
"preg_match",
"(",
"'#^syntax\\... | Determine if a file is to be ignored.
@param string $file filename
@return bool | [
"Determine",
"if",
"a",
"file",
"is",
"to",
"be",
"ignored",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/hg/HgAddTask.php#L139-L155 | train |
phingofficial/phing | classes/phing/tasks/ext/hg/HgAddTask.php | HgAddTask.ignoredByGlob | public function ignoredByGlob($file)
{
$lfile = $file;
if (strpos($lfile, './') === 0) {
$lfile = substr($lfile, 2);
}
foreach ($this->ignoreFile as $line) {
if (strpos($lfile, $line) === 0) {
return true;
}
}
return false;
} | php | public function ignoredByGlob($file)
{
$lfile = $file;
if (strpos($lfile, './') === 0) {
$lfile = substr($lfile, 2);
}
foreach ($this->ignoreFile as $line) {
if (strpos($lfile, $line) === 0) {
return true;
}
}
return false;
} | [
"public",
"function",
"ignoredByGlob",
"(",
"$",
"file",
")",
"{",
"$",
"lfile",
"=",
"$",
"file",
";",
"if",
"(",
"strpos",
"(",
"$",
"lfile",
",",
"'./'",
")",
"===",
"0",
")",
"{",
"$",
"lfile",
"=",
"substr",
"(",
"$",
"lfile",
",",
"2",
")... | Determine if file is ignored by glob pattern.
@param string $file filename
@return bool | [
"Determine",
"if",
"file",
"is",
"ignored",
"by",
"glob",
"pattern",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/hg/HgAddTask.php#L164-L176 | train |
phingofficial/phing | classes/phing/tasks/ext/RSTTask.php | RSTTask.render | protected function render($tool, $source, $targetFile)
{
if (count($this->filterChains) == 0) {
$this->renderFile($tool, $source, $targetFile);
return;
}
$tmpTarget = tempnam(sys_get_temp_dir(), 'rST-');
$this->renderFile($tool, $source, $tmpTarget);
$this->fileUtils->copyFile(
new PhingFile($tmpTarget),
new PhingFile($targetFile),
$this->getProject(),
true,
false,
$this->filterChains,
$this->mode
);
unlink($tmpTarget);
} | php | protected function render($tool, $source, $targetFile)
{
if (count($this->filterChains) == 0) {
$this->renderFile($tool, $source, $targetFile);
return;
}
$tmpTarget = tempnam(sys_get_temp_dir(), 'rST-');
$this->renderFile($tool, $source, $tmpTarget);
$this->fileUtils->copyFile(
new PhingFile($tmpTarget),
new PhingFile($targetFile),
$this->getProject(),
true,
false,
$this->filterChains,
$this->mode
);
unlink($tmpTarget);
} | [
"protected",
"function",
"render",
"(",
"$",
"tool",
",",
"$",
"source",
",",
"$",
"targetFile",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"filterChains",
")",
"==",
"0",
")",
"{",
"$",
"this",
"->",
"renderFile",
"(",
"$",
"tool",
",",... | Renders a single file and applies filters on it
@param string $tool conversion tool to use
@param string $source rST source file
@param string $targetFile target file name
@return void | [
"Renders",
"a",
"single",
"file",
"and",
"applies",
"filters",
"on",
"it"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/RSTTask.php#L204-L224 | train |
phingofficial/phing | classes/phing/tasks/ext/RSTTask.php | RSTTask.renderFile | protected function renderFile($tool, $source, $targetFile)
{
if ($this->uptodate && file_exists($targetFile)
&& filemtime($source) <= filemtime($targetFile)
) {
//target is up to date
return;
}
//work around a bug in php by replacing /./ with /
$targetDir = str_replace('/./', '/', dirname($targetFile));
if (!is_dir($targetDir)) {
$this->log("Creating directory '$targetDir'", Project::MSG_VERBOSE);
mkdir($targetDir, $this->mode, true);
}
$cmd = $tool
. ' --exit-status=2'
. ' ' . $this->toolParam
. ' ' . escapeshellarg($source)
. ' ' . escapeshellarg($targetFile)
. ' 2>&1';
$this->log('command: ' . $cmd, Project::MSG_VERBOSE);
exec($cmd, $arOutput, $retval);
if ($retval != 0) {
$this->log(implode("\n", $arOutput), Project::MSG_INFO);
throw new BuildException('Rendering rST failed');
}
$this->log(implode("\n", $arOutput), Project::MSG_DEBUG);
} | php | protected function renderFile($tool, $source, $targetFile)
{
if ($this->uptodate && file_exists($targetFile)
&& filemtime($source) <= filemtime($targetFile)
) {
//target is up to date
return;
}
//work around a bug in php by replacing /./ with /
$targetDir = str_replace('/./', '/', dirname($targetFile));
if (!is_dir($targetDir)) {
$this->log("Creating directory '$targetDir'", Project::MSG_VERBOSE);
mkdir($targetDir, $this->mode, true);
}
$cmd = $tool
. ' --exit-status=2'
. ' ' . $this->toolParam
. ' ' . escapeshellarg($source)
. ' ' . escapeshellarg($targetFile)
. ' 2>&1';
$this->log('command: ' . $cmd, Project::MSG_VERBOSE);
exec($cmd, $arOutput, $retval);
if ($retval != 0) {
$this->log(implode("\n", $arOutput), Project::MSG_INFO);
throw new BuildException('Rendering rST failed');
}
$this->log(implode("\n", $arOutput), Project::MSG_DEBUG);
} | [
"protected",
"function",
"renderFile",
"(",
"$",
"tool",
",",
"$",
"source",
",",
"$",
"targetFile",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"uptodate",
"&&",
"file_exists",
"(",
"$",
"targetFile",
")",
"&&",
"filemtime",
"(",
"$",
"source",
")",
"<=",... | Renders a single file with the rST tool.
@param string $tool conversion tool to use
@param string $source rST source file
@param string $targetFile target file name
@return void
@throws BuildException When the conversion fails | [
"Renders",
"a",
"single",
"file",
"with",
"the",
"rST",
"tool",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/RSTTask.php#L237-L266 | train |
phingofficial/phing | classes/phing/tasks/ext/RSTTask.php | RSTTask.getTargetFile | public function getTargetFile($file, $destination = null)
{
if ($destination != ''
&& substr($destination, -1) !== '/'
&& substr($destination, -1) !== '\\'
) {
return $destination;
}
if (strtolower(substr($file, -4)) == '.rst') {
$file = substr($file, 0, -4);
}
return $destination . $file . '.' . self::$targetExt[$this->format];
} | php | public function getTargetFile($file, $destination = null)
{
if ($destination != ''
&& substr($destination, -1) !== '/'
&& substr($destination, -1) !== '\\'
) {
return $destination;
}
if (strtolower(substr($file, -4)) == '.rst') {
$file = substr($file, 0, -4);
}
return $destination . $file . '.' . self::$targetExt[$this->format];
} | [
"public",
"function",
"getTargetFile",
"(",
"$",
"file",
",",
"$",
"destination",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"destination",
"!=",
"''",
"&&",
"substr",
"(",
"$",
"destination",
",",
"-",
"1",
")",
"!==",
"'/'",
"&&",
"substr",
"(",
"$",
... | Determines and returns the target file name from the
input file and the configured destination name.
@param string $file Input file
@param string $destination Destination file or directory name,
may be null
@return string Target file name
@uses $format
@uses $targetExt | [
"Determines",
"and",
"returns",
"the",
"target",
"file",
"name",
"from",
"the",
"input",
"file",
"and",
"the",
"configured",
"destination",
"name",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/RSTTask.php#L308-L322 | train |
phingofficial/phing | classes/phing/tasks/ext/RSTTask.php | RSTTask.setFormat | public function setFormat($format)
{
if (!in_array($format, self::$supportedFormats)) {
throw new BuildException(
sprintf(
'Invalid output format "%s", allowed are: %s',
$format,
implode(', ', self::$supportedFormats)
)
);
}
$this->format = $format;
} | php | public function setFormat($format)
{
if (!in_array($format, self::$supportedFormats)) {
throw new BuildException(
sprintf(
'Invalid output format "%s", allowed are: %s',
$format,
implode(', ', self::$supportedFormats)
)
);
}
$this->format = $format;
} | [
"public",
"function",
"setFormat",
"(",
"$",
"format",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"format",
",",
"self",
"::",
"$",
"supportedFormats",
")",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"sprintf",
"(",
"'Invalid output format \"%s\",... | The setter for the attribute "format"
@param string $format Output format
@return void
@throws BuildException When the format is not supported | [
"The",
"setter",
"for",
"the",
"attribute",
"format"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/RSTTask.php#L345-L357 | train |
phingofficial/phing | classes/phing/tasks/ext/RSTTask.php | RSTTask.setToolpath | public function setToolpath($path)
{
if (!file_exists($path)) {
$fs = FileSystem::getFileSystem();
$fullpath = $fs->which($path);
if ($fullpath === false) {
throw new BuildException(
'Tool does not exist. Path: ' . $path
);
}
$path = $fullpath;
}
if (!is_executable($path)) {
throw new BuildException(
'Tool not executable. Path: ' . $path
);
}
$this->toolPath = $path;
} | php | public function setToolpath($path)
{
if (!file_exists($path)) {
$fs = FileSystem::getFileSystem();
$fullpath = $fs->which($path);
if ($fullpath === false) {
throw new BuildException(
'Tool does not exist. Path: ' . $path
);
}
$path = $fullpath;
}
if (!is_executable($path)) {
throw new BuildException(
'Tool not executable. Path: ' . $path
);
}
$this->toolPath = $path;
} | [
"public",
"function",
"setToolpath",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"$",
"fs",
"=",
"FileSystem",
"::",
"getFileSystem",
"(",
")",
";",
"$",
"fullpath",
"=",
"$",
"fs",
"->",
"which",
"("... | The setter for the attribute "toolpath"
@param $path
@throws BuildException
@internal param string $param Full path to tool path, i.e. /usr/local/bin/rst2html
@return void | [
"The",
"setter",
"for",
"the",
"attribute",
"toolpath"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/RSTTask.php#L393-L411 | train |
phingofficial/phing | classes/phing/tasks/ext/RSTTask.php | RSTTask.createMapper | public function createMapper()
{
if ($this->mapperElement !== null) {
throw new BuildException(
'Cannot define more than one mapper',
$this->getLocation()
);
}
$this->mapperElement = new Mapper($this->project);
return $this->mapperElement;
} | php | public function createMapper()
{
if ($this->mapperElement !== null) {
throw new BuildException(
'Cannot define more than one mapper',
$this->getLocation()
);
}
$this->mapperElement = new Mapper($this->project);
return $this->mapperElement;
} | [
"public",
"function",
"createMapper",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"mapperElement",
"!==",
"null",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"'Cannot define more than one mapper'",
",",
"$",
"this",
"->",
"getLocation",
"(",
")",
")",
... | Nested creator, creates one Mapper for this task
@return Mapper The created Mapper type object
@throws BuildException | [
"Nested",
"creator",
"creates",
"one",
"Mapper",
"for",
"this",
"task"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/RSTTask.php#L432-L443 | train |
phingofficial/phing | classes/phing/tasks/ext/HttpTask.php | HttpTask.main | public function main()
{
if (!isset($this->url)) {
throw new BuildException("Required attribute 'url' is missing");
}
try {
$this->processResponse($this->createRequest()->send());
} catch (HTTP_Request2_MessageException $e) {
throw new BuildException($e);
}
} | php | public function main()
{
if (!isset($this->url)) {
throw new BuildException("Required attribute 'url' is missing");
}
try {
$this->processResponse($this->createRequest()->send());
} catch (HTTP_Request2_MessageException $e) {
throw new BuildException($e);
}
} | [
"public",
"function",
"main",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"url",
")",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"Required attribute 'url' is missing\"",
")",
";",
"}",
"try",
"{",
"$",
"this",
"->",
"processRe... | Makes a HTTP request and processes its response
@throws BuildException | [
"Makes",
"a",
"HTTP",
"request",
"and",
"processes",
"its",
"response"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/HttpTask.php#L175-L186 | train |
phingofficial/phing | classes/phing/tasks/ext/zendguard/ZendGuardLicenseTask.php | ZendGuardLicenseTask.cleanupTmpFiles | private function cleanupTmpFiles()
{
if (!empty($this->tmpLicensePath) && file_exists($this->tmpLicensePath)) {
$this->log("Deleting temporary license template " . $this->tmpLicensePath, Project::MSG_VERBOSE);
unlink($this->tmpLicensePath);
}
} | php | private function cleanupTmpFiles()
{
if (!empty($this->tmpLicensePath) && file_exists($this->tmpLicensePath)) {
$this->log("Deleting temporary license template " . $this->tmpLicensePath, Project::MSG_VERBOSE);
unlink($this->tmpLicensePath);
}
} | [
"private",
"function",
"cleanupTmpFiles",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"tmpLicensePath",
")",
"&&",
"file_exists",
"(",
"$",
"this",
"->",
"tmpLicensePath",
")",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"\"Deleting temp... | If temporary license file was created during the process
this will remove it
@return void | [
"If",
"temporary",
"license",
"file",
"was",
"created",
"during",
"the",
"process",
"this",
"will",
"remove",
"it"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/zendguard/ZendGuardLicenseTask.php#L380-L387 | train |
phingofficial/phing | classes/phing/tasks/ext/zendguard/ZendGuardLicenseTask.php | ZendGuardLicenseTask.prepareSignCommand | protected function prepareSignCommand()
{
$command = $this->zendsignPath;
// add license path
$command .= ' ' . $this->getLicenseTemplatePath();
// add result file path
$command .= ' ' . $this->outputFile;
// add key path
$command .= ' ' . $this->privateKeyPath;
$this->zendsignCommand = $command;
return $command;
} | php | protected function prepareSignCommand()
{
$command = $this->zendsignPath;
// add license path
$command .= ' ' . $this->getLicenseTemplatePath();
// add result file path
$command .= ' ' . $this->outputFile;
// add key path
$command .= ' ' . $this->privateKeyPath;
$this->zendsignCommand = $command;
return $command;
} | [
"protected",
"function",
"prepareSignCommand",
"(",
")",
"{",
"$",
"command",
"=",
"$",
"this",
"->",
"zendsignPath",
";",
"// add license path",
"$",
"command",
".=",
"' '",
".",
"$",
"this",
"->",
"getLicenseTemplatePath",
"(",
")",
";",
"// add result file pa... | Prepares and returns the command that will be
used to create the license.
@return string | [
"Prepares",
"and",
"returns",
"the",
"command",
"that",
"will",
"be",
"used",
"to",
"create",
"the",
"license",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/zendguard/ZendGuardLicenseTask.php#L395-L411 | train |
phingofficial/phing | classes/phing/tasks/ext/zendguard/ZendGuardLicenseTask.php | ZendGuardLicenseTask.generateLicense | protected function generateLicense()
{
$command = $this->prepareSignCommand() . ' 2>&1';
$this->log('Creating license at ' . $this->outputFile);
$this->log('Running: ' . $command, Project::MSG_VERBOSE);
$tmp = exec($command, $output, $return_var);
// Check for exit value 1. Zendenc_sign command for some reason
// returns 0 in case of failure and 1 in case of success...
if ($return_var !== 1) {
throw new BuildException("Creating license failed. \n\nZendenc_sign msg:\n" . implode(
"\n",
$output
) . "\n\n");
}
} | php | protected function generateLicense()
{
$command = $this->prepareSignCommand() . ' 2>&1';
$this->log('Creating license at ' . $this->outputFile);
$this->log('Running: ' . $command, Project::MSG_VERBOSE);
$tmp = exec($command, $output, $return_var);
// Check for exit value 1. Zendenc_sign command for some reason
// returns 0 in case of failure and 1 in case of success...
if ($return_var !== 1) {
throw new BuildException("Creating license failed. \n\nZendenc_sign msg:\n" . implode(
"\n",
$output
) . "\n\n");
}
} | [
"protected",
"function",
"generateLicense",
"(",
")",
"{",
"$",
"command",
"=",
"$",
"this",
"->",
"prepareSignCommand",
"(",
")",
".",
"' 2>&1'",
";",
"$",
"this",
"->",
"log",
"(",
"'Creating license at '",
".",
"$",
"this",
"->",
"outputFile",
")",
";",... | Creates the signed license at the defined output path
@throws BuildException
@return void | [
"Creates",
"the",
"signed",
"license",
"at",
"the",
"defined",
"output",
"path"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/zendguard/ZendGuardLicenseTask.php#L437-L454 | train |
phingofficial/phing | classes/phing/tasks/ext/zendguard/ZendGuardLicenseTask.php | ZendGuardLicenseTask.generateLicenseTemplate | protected function generateLicenseTemplate()
{
$this->tmpLicensePath = tempnam(sys_get_temp_dir(), 'zendlicense');
$this->log("Creating temporary license template " . $this->tmpLicensePath, Project::MSG_VERBOSE);
if (file_put_contents($this->tmpLicensePath, $this->generateLicenseTemplateContent()) === false) {
throw new BuildException("Unable to create temporary template license file: " . $this->tmpLicensePath);
}
return $this->tmpLicensePath;
} | php | protected function generateLicenseTemplate()
{
$this->tmpLicensePath = tempnam(sys_get_temp_dir(), 'zendlicense');
$this->log("Creating temporary license template " . $this->tmpLicensePath, Project::MSG_VERBOSE);
if (file_put_contents($this->tmpLicensePath, $this->generateLicenseTemplateContent()) === false) {
throw new BuildException("Unable to create temporary template license file: " . $this->tmpLicensePath);
}
return $this->tmpLicensePath;
} | [
"protected",
"function",
"generateLicenseTemplate",
"(",
")",
"{",
"$",
"this",
"->",
"tmpLicensePath",
"=",
"tempnam",
"(",
"sys_get_temp_dir",
"(",
")",
",",
"'zendlicense'",
")",
";",
"$",
"this",
"->",
"log",
"(",
"\"Creating temporary license template \"",
".... | It will generate a temporary license template
based on the properties defined.
@throws BuildException
@return string Path of the temporary license template file | [
"It",
"will",
"generate",
"a",
"temporary",
"license",
"template",
"based",
"on",
"the",
"properties",
"defined",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/zendguard/ZendGuardLicenseTask.php#L463-L473 | train |
phingofficial/phing | classes/phing/tasks/ext/zendguard/ZendGuardLicenseTask.php | ZendGuardLicenseTask.generateLicenseTemplateContent | protected function generateLicenseTemplateContent()
{
$contentArr = [];
// Product Name
$contentArr[] = ['Product-Name', $this->productName];
// Registered to
$contentArr[] = ['Registered-To', $this->registeredTo];
// Hardware locked
$contentArr[] = ['Hardware-Locked', ($this->hardwareLocked ? 'Yes' : 'No')];
// Expires
$contentArr[] = ['Expires', $this->expires];
// IP-Range
if (!empty($this->ipRange)) {
$contentArr[] = ['IP-Range', $this->ipRange];
}
// Host-ID
if (!empty($this->hostID)) {
foreach (explode(';', $this->hostID) as $hostID) {
$contentArr[] = ['Host-ID', $hostID];
}
} else {
$contentArr[] = ['Host-ID', 'Not-Locked'];
}
// parse user defined fields
if (!empty($this->userDefinedValues)) {
$this->parseAndAddUserDefinedValues($this->userDefinedValues, $contentArr);
}
// parse user defined x-fields
if (!empty($this->xUserDefinedValues)) {
$this->parseAndAddUserDefinedValues($this->xUserDefinedValues, $contentArr, 'X-');
}
// merge all the values
$content = '';
foreach ($contentArr as $valuePair) {
list($key, $value) = $valuePair;
$content .= $key . " = " . $value . "\n";
}
return $content;
} | php | protected function generateLicenseTemplateContent()
{
$contentArr = [];
// Product Name
$contentArr[] = ['Product-Name', $this->productName];
// Registered to
$contentArr[] = ['Registered-To', $this->registeredTo];
// Hardware locked
$contentArr[] = ['Hardware-Locked', ($this->hardwareLocked ? 'Yes' : 'No')];
// Expires
$contentArr[] = ['Expires', $this->expires];
// IP-Range
if (!empty($this->ipRange)) {
$contentArr[] = ['IP-Range', $this->ipRange];
}
// Host-ID
if (!empty($this->hostID)) {
foreach (explode(';', $this->hostID) as $hostID) {
$contentArr[] = ['Host-ID', $hostID];
}
} else {
$contentArr[] = ['Host-ID', 'Not-Locked'];
}
// parse user defined fields
if (!empty($this->userDefinedValues)) {
$this->parseAndAddUserDefinedValues($this->userDefinedValues, $contentArr);
}
// parse user defined x-fields
if (!empty($this->xUserDefinedValues)) {
$this->parseAndAddUserDefinedValues($this->xUserDefinedValues, $contentArr, 'X-');
}
// merge all the values
$content = '';
foreach ($contentArr as $valuePair) {
list($key, $value) = $valuePair;
$content .= $key . " = " . $value . "\n";
}
return $content;
} | [
"protected",
"function",
"generateLicenseTemplateContent",
"(",
")",
"{",
"$",
"contentArr",
"=",
"[",
"]",
";",
"// Product Name",
"$",
"contentArr",
"[",
"]",
"=",
"[",
"'Product-Name'",
",",
"$",
"this",
"->",
"productName",
"]",
";",
"// Registered to",
"$... | Generates license template content based
on the defined parameters
@return string | [
"Generates",
"license",
"template",
"content",
"based",
"on",
"the",
"defined",
"parameters"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/zendguard/ZendGuardLicenseTask.php#L481-L526 | train |
phingofficial/phing | classes/phing/util/DataStore.php | DataStore.put | public function put($key, $value, $autocommit = false)
{
$this->data[$key] = $value;
if ($autocommit) {
$this->commit();
}
} | php | public function put($key, $value, $autocommit = false)
{
$this->data[$key] = $value;
if ($autocommit) {
$this->commit();
}
} | [
"public",
"function",
"put",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"autocommit",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"if",
"(",
"$",
"autocommit",
")",
"{",
"$",
"this",
"->",... | Adds a value to the data store
@param string $key the key
@param mixed $value the value
@param boolean $autocommit whether to auto-commit (write)
the data store to disk
@return void | [
"Adds",
"a",
"value",
"to",
"the",
"data",
"store"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/DataStore.php#L79-L86 | train |
phingofficial/phing | classes/phing/util/DataStore.php | DataStore.remove | public function remove($key, $autocommit = false)
{
unset($this->data[$key]);
if ($autocommit) {
$this->commit();
}
} | php | public function remove($key, $autocommit = false)
{
unset($this->data[$key]);
if ($autocommit) {
$this->commit();
}
} | [
"public",
"function",
"remove",
"(",
"$",
"key",
",",
"$",
"autocommit",
"=",
"false",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"key",
"]",
")",
";",
"if",
"(",
"$",
"autocommit",
")",
"{",
"$",
"this",
"->",
"commit",
"(",
... | Remove a value from the data store
@param string $key the key
@param boolean $autocommit whether to auto-commit (write)
the data store to disk | [
"Remove",
"a",
"value",
"from",
"the",
"data",
"store"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/DataStore.php#L95-L102 | train |
phingofficial/phing | classes/phing/util/DataStore.php | DataStore.read | private function read()
{
if (!$this->file->canRead()) {
throw new BuildException(
"Can't read data store from '" .
$this->file->getPath() . "'"
);
} else {
$serializedData = $this->file->contents();
$this->data = unserialize($serializedData);
}
} | php | private function read()
{
if (!$this->file->canRead()) {
throw new BuildException(
"Can't read data store from '" .
$this->file->getPath() . "'"
);
} else {
$serializedData = $this->file->contents();
$this->data = unserialize($serializedData);
}
} | [
"private",
"function",
"read",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"file",
"->",
"canRead",
"(",
")",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"Can't read data store from '\"",
".",
"$",
"this",
"->",
"file",
"->",
"getPath",
"(",... | Internal function to read data store from file
@throws BuildException
@return void | [
"Internal",
"function",
"to",
"read",
"data",
"store",
"from",
"file"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/DataStore.php#L120-L132 | train |
phingofficial/phing | classes/phing/util/DataStore.php | DataStore.write | private function write()
{
if (!$this->file->canWrite()) {
throw new BuildException(
"Can't write data store to '" .
$this->file->getPath() . "'"
);
} else {
$serializedData = serialize($this->data);
$writer = new FileWriter($this->file);
$writer->write($serializedData);
$writer->close();
}
} | php | private function write()
{
if (!$this->file->canWrite()) {
throw new BuildException(
"Can't write data store to '" .
$this->file->getPath() . "'"
);
} else {
$serializedData = serialize($this->data);
$writer = new FileWriter($this->file);
$writer->write($serializedData);
$writer->close();
}
} | [
"private",
"function",
"write",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"file",
"->",
"canWrite",
"(",
")",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"Can't write data store to '\"",
".",
"$",
"this",
"->",
"file",
"->",
"getPath",
"("... | Internal function to write data store to file
@throws BuildException
@return void | [
"Internal",
"function",
"to",
"write",
"data",
"store",
"to",
"file"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/DataStore.php#L140-L154 | train |
phingofficial/phing | classes/phing/filters/XsltFilter.php | XsltFilter.process | protected function process($xml, $xsl)
{
$processor = new XSLTProcessor();
// Create and setup document.
$xmlDom = new DOMDocument();
$xmlDom->resolveExternals = $this->resolveDocumentExternals;
// Create and setup stylesheet.
$xslDom = new DOMDocument();
$xslDom->resolveExternals = $this->resolveStylesheetExternals;
if ($this->html) {
$result = @$xmlDom->loadHTML($xml);
} else {
$result = @$xmlDom->loadXML($xml);
}
if ($result === false) {
throw new BuildException('Invalid syntax detected.');
}
$xslDom->loadXML($xsl);
if (defined('XSL_SECPREF_WRITE_FILE')) {
$processor->setSecurityPrefs(XSL_SECPREF_WRITE_FILE | XSL_SECPREF_CREATE_DIRECTORY);
}
$processor->importStylesheet($xslDom);
// ignoring param "type" attrib, because
// we're only supporting direct XSL params right now
foreach ($this->xsltParams as $param) {
$this->log("Setting XSLT param: " . $param->getName() . "=>" . $param->getExpression(), Project::MSG_DEBUG);
$processor->setParameter(null, $param->getName(), $param->getExpression());
}
$errorlevel = error_reporting();
error_reporting($errorlevel & ~E_WARNING);
@$result = $processor->transformToXml($xmlDom);
error_reporting($errorlevel);
if (false === $result) {
//$errno = xslt_errno($processor);
//$err = xslt_error($processor);
throw new BuildException("XSLT Error");
} else {
return $result;
}
} | php | protected function process($xml, $xsl)
{
$processor = new XSLTProcessor();
// Create and setup document.
$xmlDom = new DOMDocument();
$xmlDom->resolveExternals = $this->resolveDocumentExternals;
// Create and setup stylesheet.
$xslDom = new DOMDocument();
$xslDom->resolveExternals = $this->resolveStylesheetExternals;
if ($this->html) {
$result = @$xmlDom->loadHTML($xml);
} else {
$result = @$xmlDom->loadXML($xml);
}
if ($result === false) {
throw new BuildException('Invalid syntax detected.');
}
$xslDom->loadXML($xsl);
if (defined('XSL_SECPREF_WRITE_FILE')) {
$processor->setSecurityPrefs(XSL_SECPREF_WRITE_FILE | XSL_SECPREF_CREATE_DIRECTORY);
}
$processor->importStylesheet($xslDom);
// ignoring param "type" attrib, because
// we're only supporting direct XSL params right now
foreach ($this->xsltParams as $param) {
$this->log("Setting XSLT param: " . $param->getName() . "=>" . $param->getExpression(), Project::MSG_DEBUG);
$processor->setParameter(null, $param->getName(), $param->getExpression());
}
$errorlevel = error_reporting();
error_reporting($errorlevel & ~E_WARNING);
@$result = $processor->transformToXml($xmlDom);
error_reporting($errorlevel);
if (false === $result) {
//$errno = xslt_errno($processor);
//$err = xslt_error($processor);
throw new BuildException("XSLT Error");
} else {
return $result;
}
} | [
"protected",
"function",
"process",
"(",
"$",
"xml",
",",
"$",
"xsl",
")",
"{",
"$",
"processor",
"=",
"new",
"XSLTProcessor",
"(",
")",
";",
"// Create and setup document.",
"$",
"xmlDom",
"=",
"new",
"DOMDocument",
"(",
")",
";",
"$",
"xmlDom",
"->",
"... | Try to process the XSLT transformation
@param string $xml XML to process.
@param string $xsl XSLT sheet to use for the processing.
@return string
@throws BuildException On XSLT errors | [
"Try",
"to",
"process",
"the",
"XSLT",
"transformation"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/XsltFilter.php#L272-L320 | train |
phingofficial/phing | classes/phing/filters/XsltFilter.php | XsltFilter.chain | public function chain(Reader $reader)
{
$newFilter = new XsltFilter($reader);
$newFilter->setProject($this->getProject());
$newFilter->setStyle($this->getStyle());
$newFilter->setInitialized(true);
$newFilter->setParams($this->getParams());
$newFilter->setHtml($this->getHtml());
return $newFilter;
} | php | public function chain(Reader $reader)
{
$newFilter = new XsltFilter($reader);
$newFilter->setProject($this->getProject());
$newFilter->setStyle($this->getStyle());
$newFilter->setInitialized(true);
$newFilter->setParams($this->getParams());
$newFilter->setHtml($this->getHtml());
return $newFilter;
} | [
"public",
"function",
"chain",
"(",
"Reader",
"$",
"reader",
")",
"{",
"$",
"newFilter",
"=",
"new",
"XsltFilter",
"(",
"$",
"reader",
")",
";",
"$",
"newFilter",
"->",
"setProject",
"(",
"$",
"this",
"->",
"getProject",
"(",
")",
")",
";",
"$",
"new... | Creates a new XsltFilter using the passed in
Reader for instantiation.
@param Reader A Reader object providing the underlying stream.
Must not be <code>null</code>.
@return XsltFilter A new filter based on this configuration, but filtering
the specified reader | [
"Creates",
"a",
"new",
"XsltFilter",
"using",
"the",
"passed",
"in",
"Reader",
"for",
"instantiation",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/XsltFilter.php#L332-L342 | train |
phingofficial/phing | classes/phing/filters/XsltFilter.php | XsltFilter._initialize | private function _initialize()
{
$params = $this->getParameters();
if ($params !== null) {
for ($i = 0, $_i = count($params); $i < $_i; $i++) {
if ($params[$i]->getType() === null) {
if ($params[$i]->getName() === "style") {
$this->setStyle($params[$i]->getValue());
}
} elseif ($params[$i]->getType() == "param") {
$xp = new XsltParam();
$xp->setName($params[$i]->getName());
$xp->setExpression($params[$i]->getValue());
$this->xsltParams[] = $xp;
}
}
}
} | php | private function _initialize()
{
$params = $this->getParameters();
if ($params !== null) {
for ($i = 0, $_i = count($params); $i < $_i; $i++) {
if ($params[$i]->getType() === null) {
if ($params[$i]->getName() === "style") {
$this->setStyle($params[$i]->getValue());
}
} elseif ($params[$i]->getType() == "param") {
$xp = new XsltParam();
$xp->setName($params[$i]->getName());
$xp->setExpression($params[$i]->getValue());
$this->xsltParams[] = $xp;
}
}
}
} | [
"private",
"function",
"_initialize",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getParameters",
"(",
")",
";",
"if",
"(",
"$",
"params",
"!==",
"null",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
",",
"$",
"_i",
"=",
"count",
"(",
"$... | Parses the parameters to get stylesheet path. | [
"Parses",
"the",
"parameters",
"to",
"get",
"stylesheet",
"path",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/XsltFilter.php#L347-L364 | train |
phingofficial/phing | classes/phing/types/CommandlineMarker.php | CommandlineMarker.getPosition | public function getPosition()
{
if ($this->realPos === -1) {
$this->realPos = ($this->outer->executable === null ? 0 : 1);
for ($i = 0; $i < $this->position; $i++) {
$arg = $this->outer->arguments[$i];
$this->realPos += count($arg->getParts());
}
}
return $this->realPos;
} | php | public function getPosition()
{
if ($this->realPos === -1) {
$this->realPos = ($this->outer->executable === null ? 0 : 1);
for ($i = 0; $i < $this->position; $i++) {
$arg = $this->outer->arguments[$i];
$this->realPos += count($arg->getParts());
}
}
return $this->realPos;
} | [
"public",
"function",
"getPosition",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"realPos",
"===",
"-",
"1",
")",
"{",
"$",
"this",
"->",
"realPos",
"=",
"(",
"$",
"this",
"->",
"outer",
"->",
"executable",
"===",
"null",
"?",
"0",
":",
"1",
")"... | Return the number of arguments that preceded this marker.
<p>The name of the executable - if set - is counted as the
very first argument.</p> | [
"Return",
"the",
"number",
"of",
"arguments",
"that",
"preceded",
"this",
"marker",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/CommandlineMarker.php#L36-L47 | train |
phingofficial/phing | classes/phing/system/util/Timer.php | Timer.getElapsedTime | public function getElapsedTime($places = 5)
{
$etime = $this->etime - $this->stime;
$format = "%0." . $places . "f";
return (sprintf($format, $etime));
} | php | public function getElapsedTime($places = 5)
{
$etime = $this->etime - $this->stime;
$format = "%0." . $places . "f";
return (sprintf($format, $etime));
} | [
"public",
"function",
"getElapsedTime",
"(",
"$",
"places",
"=",
"5",
")",
"{",
"$",
"etime",
"=",
"$",
"this",
"->",
"etime",
"-",
"$",
"this",
"->",
"stime",
";",
"$",
"format",
"=",
"\"%0.\"",
".",
"$",
"places",
".",
"\"f\"",
";",
"return",
"("... | This function returns the elapsed time in seconds.
Call start_time() at the beginning of script execution and end_time() at
the end of script execution. Then, call elapsed_time() to obtain the
difference between start_time() and end_time().
@param int $places decimal place precision of elapsed time (default is 5)
@return string Properly formatted time. | [
"This",
"function",
"returns",
"the",
"elapsed",
"time",
"in",
"seconds",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/util/Timer.php#L89-L95 | train |
phingofficial/phing | classes/phing/types/Mapper.php | Mapper.setClasspath | public function setClasspath(Path $classpath)
{
if ($this->isReference()) {
throw $this->tooManyAttributes();
}
if ($this->classpath === null) {
$this->classpath = $classpath;
} else {
$this->classpath->append($classpath);
}
} | php | public function setClasspath(Path $classpath)
{
if ($this->isReference()) {
throw $this->tooManyAttributes();
}
if ($this->classpath === null) {
$this->classpath = $classpath;
} else {
$this->classpath->append($classpath);
}
} | [
"public",
"function",
"setClasspath",
"(",
"Path",
"$",
"classpath",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isReference",
"(",
")",
")",
"{",
"throw",
"$",
"this",
"->",
"tooManyAttributes",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"classp... | Set the classpath to be used when searching for component being defined
@param Path $classpath An Path object containing the classpath.
@throws BuildException | [
"Set",
"the",
"classpath",
"to",
"be",
"used",
"when",
"searching",
"for",
"component",
"being",
"defined"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Mapper.php#L70-L80 | train |
phingofficial/phing | classes/phing/types/Mapper.php | Mapper.createClasspath | public function createClasspath()
{
if ($this->isReference()) {
throw $this->tooManyAttributes();
}
if ($this->classpath === null) {
$this->classpath = new Path($this->project);
}
return $this->classpath->createPath();
} | php | public function createClasspath()
{
if ($this->isReference()) {
throw $this->tooManyAttributes();
}
if ($this->classpath === null) {
$this->classpath = new Path($this->project);
}
return $this->classpath->createPath();
} | [
"public",
"function",
"createClasspath",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isReference",
"(",
")",
")",
"{",
"throw",
"$",
"this",
"->",
"tooManyAttributes",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"classpath",
"===",
"null",
")... | Create the classpath to be used when searching for component being defined | [
"Create",
"the",
"classpath",
"to",
"be",
"used",
"when",
"searching",
"for",
"component",
"being",
"defined"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Mapper.php#L85-L95 | train |
phingofficial/phing | classes/phing/types/Mapper.php | Mapper.setRefid | public function setRefid(Reference $r)
{
if ($this->type !== null || $this->from !== null || $this->to !== null) {
throw DataType::tooManyAttributes();
}
parent::setRefid($r);
} | php | public function setRefid(Reference $r)
{
if ($this->type !== null || $this->from !== null || $this->to !== null) {
throw DataType::tooManyAttributes();
}
parent::setRefid($r);
} | [
"public",
"function",
"setRefid",
"(",
"Reference",
"$",
"r",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"type",
"!==",
"null",
"||",
"$",
"this",
"->",
"from",
"!==",
"null",
"||",
"$",
"this",
"->",
"to",
"!==",
"null",
")",
"{",
"throw",
"DataType"... | Make this Mapper instance a reference to another Mapper.
You must not set any other attribute if you make it a reference.
@param Reference $r
@throws BuildException | [
"Make",
"this",
"Mapper",
"instance",
"a",
"reference",
"to",
"another",
"Mapper",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Mapper.php#L213-L219 | train |
phingofficial/phing | classes/phing/types/Mapper.php | Mapper.getImplementation | public function getImplementation()
{
if ($this->isReference()) {
$o = $this->getRef();
if ($o instanceof FileNameMapper) {
return $o;
}
if ($o instanceof Mapper) {
return $o->getImplementation();
}
$od = $o == null ? "null" : get_class($o);
throw new BuildException($od . " at reference '" . $r->getRefId() . "' is not a valid mapper reference.");
}
if ($this->type === null && $this->classname === null && $this->container == null) {
throw new BuildException("either type or classname attribute must be set for <mapper>");
}
if ($this->container != null) {
return $this->container;
}
if ($this->type !== null) {
switch ($this->type) {
case 'chained':
$this->classname = 'phing.mappers.ChainedMapper';
break;
case 'composite':
$this->classname = 'phing.mappers.CompositeMapper';
break;
case 'cutdirs':
$this->classname = 'phing.mappers.CutDirsMapper';
break;
case 'identity':
$this->classname = 'phing.mappers.IdentityMapper';
break;
case 'firstmatch':
$this->classname = 'phing.mappers.FirstMatchMapper';
break;
case 'flatten':
$this->classname = 'phing.mappers.FlattenMapper';
break;
case 'glob':
$this->classname = 'phing.mappers.GlobMapper';
break;
case 'regexp':
case 'regex':
$this->classname = 'phing.mappers.RegexpMapper';
break;
case 'merge':
$this->classname = 'phing.mappers.MergeMapper';
break;
default:
throw new BuildException("Mapper type {$this->type} not known");
break;
}
}
// get the implementing class
$cls = Phing::import($this->classname, $this->classpath);
$m = new $cls();
$m->setFrom($this->from);
$m->setTo($this->to);
return $m;
} | php | public function getImplementation()
{
if ($this->isReference()) {
$o = $this->getRef();
if ($o instanceof FileNameMapper) {
return $o;
}
if ($o instanceof Mapper) {
return $o->getImplementation();
}
$od = $o == null ? "null" : get_class($o);
throw new BuildException($od . " at reference '" . $r->getRefId() . "' is not a valid mapper reference.");
}
if ($this->type === null && $this->classname === null && $this->container == null) {
throw new BuildException("either type or classname attribute must be set for <mapper>");
}
if ($this->container != null) {
return $this->container;
}
if ($this->type !== null) {
switch ($this->type) {
case 'chained':
$this->classname = 'phing.mappers.ChainedMapper';
break;
case 'composite':
$this->classname = 'phing.mappers.CompositeMapper';
break;
case 'cutdirs':
$this->classname = 'phing.mappers.CutDirsMapper';
break;
case 'identity':
$this->classname = 'phing.mappers.IdentityMapper';
break;
case 'firstmatch':
$this->classname = 'phing.mappers.FirstMatchMapper';
break;
case 'flatten':
$this->classname = 'phing.mappers.FlattenMapper';
break;
case 'glob':
$this->classname = 'phing.mappers.GlobMapper';
break;
case 'regexp':
case 'regex':
$this->classname = 'phing.mappers.RegexpMapper';
break;
case 'merge':
$this->classname = 'phing.mappers.MergeMapper';
break;
default:
throw new BuildException("Mapper type {$this->type} not known");
break;
}
}
// get the implementing class
$cls = Phing::import($this->classname, $this->classpath);
$m = new $cls();
$m->setFrom($this->from);
$m->setTo($this->to);
return $m;
} | [
"public",
"function",
"getImplementation",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isReference",
"(",
")",
")",
"{",
"$",
"o",
"=",
"$",
"this",
"->",
"getRef",
"(",
")",
";",
"if",
"(",
"$",
"o",
"instanceof",
"FileNameMapper",
")",
"{",
"re... | Factory, returns inmplementation of file name mapper as new instance | [
"Factory",
"returns",
"inmplementation",
"of",
"file",
"name",
"mapper",
"as",
"new",
"instance"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Mapper.php#L224-L291 | train |
phingofficial/phing | classes/phing/types/Mapper.php | Mapper.getRef | private function getRef()
{
$dataTypeName = StringHelper::substring(__CLASS__, strrpos(__CLASS__, '\\') + 1);
return $this->getCheckedRef(__CLASS__, $dataTypeName);
} | php | private function getRef()
{
$dataTypeName = StringHelper::substring(__CLASS__, strrpos(__CLASS__, '\\') + 1);
return $this->getCheckedRef(__CLASS__, $dataTypeName);
} | [
"private",
"function",
"getRef",
"(",
")",
"{",
"$",
"dataTypeName",
"=",
"StringHelper",
"::",
"substring",
"(",
"__CLASS__",
",",
"strrpos",
"(",
"__CLASS__",
",",
"'\\\\'",
")",
"+",
"1",
")",
";",
"return",
"$",
"this",
"->",
"getCheckedRef",
"(",
"_... | Performs the check for circular references and returns the referenced Mapper. | [
"Performs",
"the",
"check",
"for",
"circular",
"references",
"and",
"returns",
"the",
"referenced",
"Mapper",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Mapper.php#L296-L300 | train |
phingofficial/phing | classes/phing/types/Excludes.php | Excludes.getExcludedFiles | public function getExcludedFiles()
{
$includes = [];
foreach ($this->files as $file) {
$includes[] = $file->getName();
}
$this->directoryScanner->setIncludes($includes);
$this->directoryScanner->scan();
$files = $this->directoryScanner->getIncludedFiles();
$dir = $this->directoryScanner->getBasedir();
$fileList = [];
foreach ($files as $file) {
$fileList[] = $dir . DIRECTORY_SEPARATOR . $file;
}
return $fileList;
} | php | public function getExcludedFiles()
{
$includes = [];
foreach ($this->files as $file) {
$includes[] = $file->getName();
}
$this->directoryScanner->setIncludes($includes);
$this->directoryScanner->scan();
$files = $this->directoryScanner->getIncludedFiles();
$dir = $this->directoryScanner->getBasedir();
$fileList = [];
foreach ($files as $file) {
$fileList[] = $dir . DIRECTORY_SEPARATOR . $file;
}
return $fileList;
} | [
"public",
"function",
"getExcludedFiles",
"(",
")",
"{",
"$",
"includes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"files",
"as",
"$",
"file",
")",
"{",
"$",
"includes",
"[",
"]",
"=",
"$",
"file",
"->",
"getName",
"(",
")",
";",
"}... | Returns the excluded files
@return array | [
"Returns",
"the",
"excluded",
"files"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Excludes.php#L117-L137 | train |
phingofficial/phing | classes/phing/types/Excludes.php | Excludes.getExcludedClasses | public function getExcludedClasses()
{
$excludedClasses = [];
foreach ($this->classes as $excludedClass) {
$excludedClasses[] = $excludedClass->getName();
}
return $excludedClasses;
} | php | public function getExcludedClasses()
{
$excludedClasses = [];
foreach ($this->classes as $excludedClass) {
$excludedClasses[] = $excludedClass->getName();
}
return $excludedClasses;
} | [
"public",
"function",
"getExcludedClasses",
"(",
")",
"{",
"$",
"excludedClasses",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"classes",
"as",
"$",
"excludedClass",
")",
"{",
"$",
"excludedClasses",
"[",
"]",
"=",
"$",
"excludedClass",
"->",
... | Returns the excluded class names
@return array | [
"Returns",
"the",
"excluded",
"class",
"names"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Excludes.php#L144-L153 | train |
phingofficial/phing | classes/phing/types/Excludes.php | Excludes.getExcludedMethods | public function getExcludedMethods()
{
$excludedMethods = [];
foreach ($this->methods as $excludedMethod) {
$classAndMethod = explode('::', $excludedMethod->getName());
$className = $classAndMethod[0];
$methodName = $classAndMethod[1];
$excludedMethods[$className][] = $methodName;
}
return $excludedMethods;
} | php | public function getExcludedMethods()
{
$excludedMethods = [];
foreach ($this->methods as $excludedMethod) {
$classAndMethod = explode('::', $excludedMethod->getName());
$className = $classAndMethod[0];
$methodName = $classAndMethod[1];
$excludedMethods[$className][] = $methodName;
}
return $excludedMethods;
} | [
"public",
"function",
"getExcludedMethods",
"(",
")",
"{",
"$",
"excludedMethods",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"methods",
"as",
"$",
"excludedMethod",
")",
"{",
"$",
"classAndMethod",
"=",
"explode",
"(",
"'::'",
",",
"$",
"exc... | Returns the excluded method names
@return array | [
"Returns",
"the",
"excluded",
"method",
"names"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Excludes.php#L160-L173 | train |
phingofficial/phing | classes/phing/tasks/system/InputTask.php | InputTask.main | public function main()
{
if ($this->propertyName === null) {
throw new BuildException("You must specify a value for propertyName attribute.");
}
if ($this->message === "") {
throw new BuildException("You must specify a message for input task.");
}
if ($this->validargs !== null) {
$accept = preg_split('/[\s,]+/', $this->validargs);
// is it a boolean (yes/no) inputrequest?
$yesno = false;
if (count($accept) == 2) {
$yesno = true;
foreach ($accept as $ans) {
if (!StringHelper::isBoolean($ans)) {
$yesno = false;
break;
}
}
}
if ($yesno) {
$request = new YesNoInputRequest($this->message, $accept);
} else {
$request = new MultipleChoiceInputRequest($this->message, $accept);
}
} else {
$request = new InputRequest($this->message);
}
// default default is curr prop value
$request->setDefaultValue($this->project->getProperty($this->propertyName));
$request->setPromptChar($this->promptChar);
$request->setHidden($this->hidden);
// unless overridden...
if ($this->defaultValue !== null) {
$request->setDefaultValue($this->defaultValue);
}
$this->project->getInputHandler()->handleInput($request);
$value = $request->getInput();
if ($value !== null) {
$this->project->setUserProperty($this->propertyName, $value);
}
} | php | public function main()
{
if ($this->propertyName === null) {
throw new BuildException("You must specify a value for propertyName attribute.");
}
if ($this->message === "") {
throw new BuildException("You must specify a message for input task.");
}
if ($this->validargs !== null) {
$accept = preg_split('/[\s,]+/', $this->validargs);
// is it a boolean (yes/no) inputrequest?
$yesno = false;
if (count($accept) == 2) {
$yesno = true;
foreach ($accept as $ans) {
if (!StringHelper::isBoolean($ans)) {
$yesno = false;
break;
}
}
}
if ($yesno) {
$request = new YesNoInputRequest($this->message, $accept);
} else {
$request = new MultipleChoiceInputRequest($this->message, $accept);
}
} else {
$request = new InputRequest($this->message);
}
// default default is curr prop value
$request->setDefaultValue($this->project->getProperty($this->propertyName));
$request->setPromptChar($this->promptChar);
$request->setHidden($this->hidden);
// unless overridden...
if ($this->defaultValue !== null) {
$request->setDefaultValue($this->defaultValue);
}
$this->project->getInputHandler()->handleInput($request);
$value = $request->getInput();
if ($value !== null) {
$this->project->setUserProperty($this->propertyName, $value);
}
} | [
"public",
"function",
"main",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"propertyName",
"===",
"null",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"You must specify a value for propertyName attribute.\"",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
... | Actual method executed by phing.
@throws BuildException | [
"Actual",
"method",
"executed",
"by",
"phing",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/InputTask.php#L137-L187 | train |
phingofficial/phing | classes/phing/listener/DefaultLogger.php | DefaultLogger.buildStarted | public function buildStarted(BuildEvent $event)
{
$this->startTime = Phing::currentTimeMillis();
if ($this->msgOutputLevel >= Project::MSG_INFO) {
$this->printMessage(
"Buildfile: " . $event->getProject()->getProperty("phing.file"),
$this->out,
Project::MSG_INFO
);
}
} | php | public function buildStarted(BuildEvent $event)
{
$this->startTime = Phing::currentTimeMillis();
if ($this->msgOutputLevel >= Project::MSG_INFO) {
$this->printMessage(
"Buildfile: " . $event->getProject()->getProperty("phing.file"),
$this->out,
Project::MSG_INFO
);
}
} | [
"public",
"function",
"buildStarted",
"(",
"BuildEvent",
"$",
"event",
")",
"{",
"$",
"this",
"->",
"startTime",
"=",
"Phing",
"::",
"currentTimeMillis",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"msgOutputLevel",
">=",
"Project",
"::",
"MSG_INFO",
")",... | Sets the start-time when the build started. Used for calculating
the build-time.
@param BuildEvent $event | [
"Sets",
"the",
"start",
"-",
"time",
"when",
"the",
"build",
"started",
".",
"Used",
"for",
"calculating",
"the",
"build",
"-",
"time",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/DefaultLogger.php#L141-L151 | train |
phingofficial/phing | classes/phing/listener/DefaultLogger.php | DefaultLogger.buildFinished | public function buildFinished(BuildEvent $event)
{
$error = $event->getException();
if ($error === null) {
$msg = PHP_EOL . $this->getBuildSuccessfulMessage() . PHP_EOL;
} else {
$msg = PHP_EOL . $this->getBuildFailedMessage() . PHP_EOL;
self::throwableMessage($msg, $error, Project::MSG_VERBOSE <= $this->msgOutputLevel);
}
$msg .= PHP_EOL . "Total time: " . self::formatTime(Phing::currentTimeMillis() - $this->startTime) . PHP_EOL;
if ($error === null) {
$this->printMessage($msg, $this->out, Project::MSG_VERBOSE);
} else {
$this->printMessage($msg, $this->err, Project::MSG_ERR);
}
} | php | public function buildFinished(BuildEvent $event)
{
$error = $event->getException();
if ($error === null) {
$msg = PHP_EOL . $this->getBuildSuccessfulMessage() . PHP_EOL;
} else {
$msg = PHP_EOL . $this->getBuildFailedMessage() . PHP_EOL;
self::throwableMessage($msg, $error, Project::MSG_VERBOSE <= $this->msgOutputLevel);
}
$msg .= PHP_EOL . "Total time: " . self::formatTime(Phing::currentTimeMillis() - $this->startTime) . PHP_EOL;
if ($error === null) {
$this->printMessage($msg, $this->out, Project::MSG_VERBOSE);
} else {
$this->printMessage($msg, $this->err, Project::MSG_ERR);
}
} | [
"public",
"function",
"buildFinished",
"(",
"BuildEvent",
"$",
"event",
")",
"{",
"$",
"error",
"=",
"$",
"event",
"->",
"getException",
"(",
")",
";",
"if",
"(",
"$",
"error",
"===",
"null",
")",
"{",
"$",
"msg",
"=",
"PHP_EOL",
".",
"$",
"this",
... | Prints whether the build succeeded or failed, and any errors that
occurred during the build. Also outputs the total build-time.
@param BuildEvent $event
@see BuildEvent::getException() | [
"Prints",
"whether",
"the",
"build",
"succeeded",
"or",
"failed",
"and",
"any",
"errors",
"that",
"occurred",
"during",
"the",
"build",
".",
"Also",
"outputs",
"the",
"total",
"build",
"-",
"time",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/DefaultLogger.php#L160-L176 | train |
phingofficial/phing | classes/phing/listener/DefaultLogger.php | DefaultLogger.targetStarted | public function targetStarted(BuildEvent $event)
{
if (Project::MSG_INFO <= $this->msgOutputLevel
&& $event->getTarget()->getName() != ''
) {
$showLongTargets = $event->getProject()->getProperty("phing.showlongtargets");
$msg = PHP_EOL . $event->getProject()->getName() . ' > ' . $event->getTarget()->getName() . ($showLongTargets ? ' [' . $event->getTarget()->getDescription() . ']' : '') . ':' . PHP_EOL;
$this->printMessage($msg, $this->out, $event->getPriority());
}
} | php | public function targetStarted(BuildEvent $event)
{
if (Project::MSG_INFO <= $this->msgOutputLevel
&& $event->getTarget()->getName() != ''
) {
$showLongTargets = $event->getProject()->getProperty("phing.showlongtargets");
$msg = PHP_EOL . $event->getProject()->getName() . ' > ' . $event->getTarget()->getName() . ($showLongTargets ? ' [' . $event->getTarget()->getDescription() . ']' : '') . ':' . PHP_EOL;
$this->printMessage($msg, $this->out, $event->getPriority());
}
} | [
"public",
"function",
"targetStarted",
"(",
"BuildEvent",
"$",
"event",
")",
"{",
"if",
"(",
"Project",
"::",
"MSG_INFO",
"<=",
"$",
"this",
"->",
"msgOutputLevel",
"&&",
"$",
"event",
"->",
"getTarget",
"(",
")",
"->",
"getName",
"(",
")",
"!=",
"''",
... | Prints the current target name
@param BuildEvent $event
@see BuildEvent::getTarget() | [
"Prints",
"the",
"current",
"target",
"name"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/DefaultLogger.php#L225-L234 | train |
phingofficial/phing | classes/phing/listener/DefaultLogger.php | DefaultLogger.messageLogged | public function messageLogged(BuildEvent $event)
{
$priority = $event->getPriority();
if ($priority <= $this->msgOutputLevel) {
$msg = "";
if ($event->getTask() !== null && !$this->emacsMode) {
$name = $event->getTask();
$name = $name->getTaskName();
$msg = str_pad("[$name] ", self::LEFT_COLUMN_SIZE, " ", STR_PAD_LEFT);
}
$msg .= $event->getMessage();
if ($priority != Project::MSG_ERR) {
$this->printMessage($msg, $this->out, $priority);
} else {
$this->printMessage($msg, $this->err, $priority);
}
}
} | php | public function messageLogged(BuildEvent $event)
{
$priority = $event->getPriority();
if ($priority <= $this->msgOutputLevel) {
$msg = "";
if ($event->getTask() !== null && !$this->emacsMode) {
$name = $event->getTask();
$name = $name->getTaskName();
$msg = str_pad("[$name] ", self::LEFT_COLUMN_SIZE, " ", STR_PAD_LEFT);
}
$msg .= $event->getMessage();
if ($priority != Project::MSG_ERR) {
$this->printMessage($msg, $this->out, $priority);
} else {
$this->printMessage($msg, $this->err, $priority);
}
}
} | [
"public",
"function",
"messageLogged",
"(",
"BuildEvent",
"$",
"event",
")",
"{",
"$",
"priority",
"=",
"$",
"event",
"->",
"getPriority",
"(",
")",
";",
"if",
"(",
"$",
"priority",
"<=",
"$",
"this",
"->",
"msgOutputLevel",
")",
"{",
"$",
"msg",
"=",
... | Print a message to the stdout.
@param BuildEvent $event
@see BuildEvent::getMessage() | [
"Print",
"a",
"message",
"to",
"the",
"stdout",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/DefaultLogger.php#L275-L294 | train |
phingofficial/phing | classes/phing/listener/DefaultLogger.php | DefaultLogger.formatTime | public static function formatTime($micros)
{
$seconds = $micros;
$minutes = (int) floor($seconds / 60);
if ($minutes >= 1) {
return sprintf(
"%1.0f minute%s %0.2f second%s",
$minutes,
($minutes === 1 ? " " : "s "),
$seconds - floor($seconds / 60) * 60,
($seconds % 60 === 1 ? "" : "s")
);
} else {
return sprintf("%0.4f second%s", $seconds, ($seconds % 60 === 1 ? "" : "s"));
}
} | php | public static function formatTime($micros)
{
$seconds = $micros;
$minutes = (int) floor($seconds / 60);
if ($minutes >= 1) {
return sprintf(
"%1.0f minute%s %0.2f second%s",
$minutes,
($minutes === 1 ? " " : "s "),
$seconds - floor($seconds / 60) * 60,
($seconds % 60 === 1 ? "" : "s")
);
} else {
return sprintf("%0.4f second%s", $seconds, ($seconds % 60 === 1 ? "" : "s"));
}
} | [
"public",
"static",
"function",
"formatTime",
"(",
"$",
"micros",
")",
"{",
"$",
"seconds",
"=",
"$",
"micros",
";",
"$",
"minutes",
"=",
"(",
"int",
")",
"floor",
"(",
"$",
"seconds",
"/",
"60",
")",
";",
"if",
"(",
"$",
"minutes",
">=",
"1",
")... | Formats a time micro integer to human readable format.
@param integer The time stamp
@return string | [
"Formats",
"a",
"time",
"micro",
"integer",
"to",
"human",
"readable",
"format",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/DefaultLogger.php#L302-L317 | train |
phingofficial/phing | classes/phing/system/io/WindowsFileSystem.php | WindowsFileSystem.normalizer | protected function normalizer($strPath, $len, $offset)
{
if ($len == 0) {
return $strPath;
}
if ($offset < 3) {
$offset = 0; //Avoid fencepost cases with UNC pathnames
}
$src = 0;
$slash = $this->slash;
$sb = "";
if ($offset == 0) {
// Complete normalization, including prefix
$src = $this->normalizePrefix($strPath, $len, $sb);
} else {
// Partial normalization
$src = $offset;
$sb .= substr($strPath, 0, $offset);
}
// Remove redundant slashes from the remainder of the path, forcing all
// slashes into the preferred slash
while ($src < $len) {
$c = $strPath{$src++};
if ($this->isSlash($c)) {
while (($src < $len) && $this->isSlash($strPath{$src})) {
$src++;
}
if ($src === $len) {
/* Check for trailing separator */
$sn = (int) strlen($sb);
if (($sn == 2) && ($sb{1} === ':')) {
// "z:\\"
$sb .= $slash;
break;
}
if ($sn === 0) {
// "\\"
$sb .= $slash;
break;
}
if (($sn === 1) && ($this->isSlash($sb{0}))) {
/* "\\\\" is not collapsed to "\\" because "\\\\" marks
the beginning of a UNC pathname. Even though it is
not, by itself, a valid UNC pathname, we leave it as
is in order to be consistent with the win32 APIs,
which treat this case as an invalid UNC pathname
rather than as an alias for the root directory of
the current drive. */
$sb .= $slash;
break;
}
// Path does not denote a root directory, so do not append
// trailing slash
break;
} else {
$sb .= $slash;
}
} else {
$sb .= $c;
}
}
$rv = (string) $sb;
return $rv;
} | php | protected function normalizer($strPath, $len, $offset)
{
if ($len == 0) {
return $strPath;
}
if ($offset < 3) {
$offset = 0; //Avoid fencepost cases with UNC pathnames
}
$src = 0;
$slash = $this->slash;
$sb = "";
if ($offset == 0) {
// Complete normalization, including prefix
$src = $this->normalizePrefix($strPath, $len, $sb);
} else {
// Partial normalization
$src = $offset;
$sb .= substr($strPath, 0, $offset);
}
// Remove redundant slashes from the remainder of the path, forcing all
// slashes into the preferred slash
while ($src < $len) {
$c = $strPath{$src++};
if ($this->isSlash($c)) {
while (($src < $len) && $this->isSlash($strPath{$src})) {
$src++;
}
if ($src === $len) {
/* Check for trailing separator */
$sn = (int) strlen($sb);
if (($sn == 2) && ($sb{1} === ':')) {
// "z:\\"
$sb .= $slash;
break;
}
if ($sn === 0) {
// "\\"
$sb .= $slash;
break;
}
if (($sn === 1) && ($this->isSlash($sb{0}))) {
/* "\\\\" is not collapsed to "\\" because "\\\\" marks
the beginning of a UNC pathname. Even though it is
not, by itself, a valid UNC pathname, we leave it as
is in order to be consistent with the win32 APIs,
which treat this case as an invalid UNC pathname
rather than as an alias for the root directory of
the current drive. */
$sb .= $slash;
break;
}
// Path does not denote a root directory, so do not append
// trailing slash
break;
} else {
$sb .= $slash;
}
} else {
$sb .= $c;
}
}
$rv = (string) $sb;
return $rv;
} | [
"protected",
"function",
"normalizer",
"(",
"$",
"strPath",
",",
"$",
"len",
",",
"$",
"offset",
")",
"{",
"if",
"(",
"$",
"len",
"==",
"0",
")",
"{",
"return",
"$",
"strPath",
";",
"}",
"if",
"(",
"$",
"offset",
"<",
"3",
")",
"{",
"$",
"offse... | Normalize the given pathname, whose length is len, starting at the given
offset; everything before this offset is already normal.
@param $strPath
@param $len
@param $offset
@return string | [
"Normalize",
"the",
"given",
"pathname",
"whose",
"length",
"is",
"len",
"starting",
"at",
"the",
"given",
"offset",
";",
"everything",
"before",
"this",
"offset",
"is",
"already",
"normal",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/WindowsFileSystem.php#L155-L221 | train |
phingofficial/phing | classes/phing/system/io/WindowsFileSystem.php | WindowsFileSystem.normalize | public function normalize($strPath)
{
$strPath = $this->fixEncoding($strPath);
if ($this->_isPharArchive($strPath)) {
return str_replace('\\', '/', $strPath);
}
$n = strlen($strPath);
$slash = $this->slash;
$altSlash = $this->altSlash;
$prev = 0;
for ($i = 0; $i < $n; $i++) {
$c = $strPath{$i};
if ($c === $altSlash) {
return $this->normalizer($strPath, $n, ($prev === $slash) ? $i - 1 : $i);
}
if (($c === $slash) && ($prev === $slash) && ($i > 1)) {
return $this->normalizer($strPath, $n, $i - 1);
}
if (($c === ':') && ($i > 1)) {
return $this->normalizer($strPath, $n, 0);
}
$prev = $c;
}
if ($prev === $slash) {
return $this->normalizer($strPath, $n, $n - 1);
}
return $strPath;
} | php | public function normalize($strPath)
{
$strPath = $this->fixEncoding($strPath);
if ($this->_isPharArchive($strPath)) {
return str_replace('\\', '/', $strPath);
}
$n = strlen($strPath);
$slash = $this->slash;
$altSlash = $this->altSlash;
$prev = 0;
for ($i = 0; $i < $n; $i++) {
$c = $strPath{$i};
if ($c === $altSlash) {
return $this->normalizer($strPath, $n, ($prev === $slash) ? $i - 1 : $i);
}
if (($c === $slash) && ($prev === $slash) && ($i > 1)) {
return $this->normalizer($strPath, $n, $i - 1);
}
if (($c === ':') && ($i > 1)) {
return $this->normalizer($strPath, $n, 0);
}
$prev = $c;
}
if ($prev === $slash) {
return $this->normalizer($strPath, $n, $n - 1);
}
return $strPath;
} | [
"public",
"function",
"normalize",
"(",
"$",
"strPath",
")",
"{",
"$",
"strPath",
"=",
"$",
"this",
"->",
"fixEncoding",
"(",
"$",
"strPath",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_isPharArchive",
"(",
"$",
"strPath",
")",
")",
"{",
"return",
"str... | Check that the given pathname is normal. If not, invoke the real
normalizer on the part of the pathname that requires normalization.
This way we iterate through the whole pathname string only once.
@param string $strPath
@return string | [
"Check",
"that",
"the",
"given",
"pathname",
"is",
"normal",
".",
"If",
"not",
"invoke",
"the",
"real",
"normalizer",
"on",
"the",
"part",
"of",
"the",
"pathname",
"that",
"requires",
"normalization",
".",
"This",
"way",
"we",
"iterate",
"through",
"the",
... | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/WindowsFileSystem.php#L231-L261 | train |
phingofficial/phing | classes/phing/system/io/WindowsFileSystem.php | WindowsFileSystem.compare | public function compare(PhingFile $f1, PhingFile $f2)
{
$f1Path = $f1->getPath();
$f2Path = $f2->getPath();
return strcasecmp((string) $f1Path, (string) $f2Path);
} | php | public function compare(PhingFile $f1, PhingFile $f2)
{
$f1Path = $f1->getPath();
$f2Path = $f2->getPath();
return strcasecmp((string) $f1Path, (string) $f2Path);
} | [
"public",
"function",
"compare",
"(",
"PhingFile",
"$",
"f1",
",",
"PhingFile",
"$",
"f2",
")",
"{",
"$",
"f1Path",
"=",
"$",
"f1",
"->",
"getPath",
"(",
")",
";",
"$",
"f2Path",
"=",
"$",
"f2",
"->",
"getPath",
"(",
")",
";",
"return",
"strcasecmp... | compares file paths lexicographically
@param PhingFile $f1
@param PhingFile $f2
@return int | [
"compares",
"file",
"paths",
"lexicographically"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/WindowsFileSystem.php#L594-L600 | train |
phingofficial/phing | classes/phing/input/ConsoleInputHandler.php | ConsoleInputHandler.handleInput | public function handleInput(InputRequest $request)
{
$questionHelper = new QuestionHelper();
if (method_exists($questionHelper, 'setInputStream')) {
$questionHelper->setInputStream($this->inputStream);
}
$question = $this->getQuestion($request);
if ($request->isHidden()) {
$question->setHidden(true);
}
$input = new StringInput('');
if (method_exists($input, 'setStream')) {
$input->setStream($this->inputStream);
}
$result = $questionHelper->ask($input, $this->output, $question);
$request->setInput($result);
} | php | public function handleInput(InputRequest $request)
{
$questionHelper = new QuestionHelper();
if (method_exists($questionHelper, 'setInputStream')) {
$questionHelper->setInputStream($this->inputStream);
}
$question = $this->getQuestion($request);
if ($request->isHidden()) {
$question->setHidden(true);
}
$input = new StringInput('');
if (method_exists($input, 'setStream')) {
$input->setStream($this->inputStream);
}
$result = $questionHelper->ask($input, $this->output, $question);
$request->setInput($result);
} | [
"public",
"function",
"handleInput",
"(",
"InputRequest",
"$",
"request",
")",
"{",
"$",
"questionHelper",
"=",
"new",
"QuestionHelper",
"(",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"questionHelper",
",",
"'setInputStream'",
")",
")",
"{",
"$",
"ques... | Handle the request encapsulated in the argument.
<p>Precondition: the request.getPrompt will return a non-null
value.</p>
<p>Postcondition: request.getInput will return a non-null
value, request.isInputValid will return true.</p>
@param InputRequest $request
@return void | [
"Handle",
"the",
"request",
"encapsulated",
"in",
"the",
"argument",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/input/ConsoleInputHandler.php#L52-L73 | train |
phingofficial/phing | classes/phing/filters/TailFilter.php | TailFilter.read | public function read($len = null)
{
if (!$this->getInitialized()) {
$this->initialize();
$this->setInitialized(true);
}
while (($buffer = $this->in->read($len)) !== -1) {
// Remove the last "\n" from buffer for
// prevent explode to add an empty cell at
// the end of array
$buffer = trim($buffer, "\n");
$lines = explode("\n", $buffer);
$skip = $this->skip > 0 ? $this->skip : 0;
if (count($lines) >= $this->lines) {
// Buffer have more (or same) number of lines than needed.
// Fill lineBuffer with the last "$this->_lines" lasts ones.
$off = count($lines) - $this->lines;
if ($skip > 0) {
$this->lineBuffer = array_slice($lines, $off - $skip, -$skip);
} else {
$this->lineBuffer = array_slice($lines, $off);
}
} else {
// Some new lines ...
// Prepare space for insert these new ones
$this->lineBuffer = array_slice($this->lineBuffer, count($lines) - 1);
$this->lineBuffer = array_merge($this->lineBuffer, $lines);
}
}
if (empty($this->lineBuffer)) {
$ret = -1;
} else {
$ret = implode("\n", $this->lineBuffer);
$this->lineBuffer = [];
}
return $ret;
} | php | public function read($len = null)
{
if (!$this->getInitialized()) {
$this->initialize();
$this->setInitialized(true);
}
while (($buffer = $this->in->read($len)) !== -1) {
// Remove the last "\n" from buffer for
// prevent explode to add an empty cell at
// the end of array
$buffer = trim($buffer, "\n");
$lines = explode("\n", $buffer);
$skip = $this->skip > 0 ? $this->skip : 0;
if (count($lines) >= $this->lines) {
// Buffer have more (or same) number of lines than needed.
// Fill lineBuffer with the last "$this->_lines" lasts ones.
$off = count($lines) - $this->lines;
if ($skip > 0) {
$this->lineBuffer = array_slice($lines, $off - $skip, -$skip);
} else {
$this->lineBuffer = array_slice($lines, $off);
}
} else {
// Some new lines ...
// Prepare space for insert these new ones
$this->lineBuffer = array_slice($this->lineBuffer, count($lines) - 1);
$this->lineBuffer = array_merge($this->lineBuffer, $lines);
}
}
if (empty($this->lineBuffer)) {
$ret = -1;
} else {
$ret = implode("\n", $this->lineBuffer);
$this->lineBuffer = [];
}
return $ret;
} | [
"public",
"function",
"read",
"(",
"$",
"len",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getInitialized",
"(",
")",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"$",
"this",
"->",
"setInitialized",
"(",
"true",
")",
... | Returns the last n lines of a file.
@param int $len Num chars to read.
@return mixed The filtered buffer or -1 if EOF. | [
"Returns",
"the",
"last",
"n",
"lines",
"of",
"a",
"file",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/TailFilter.php#L80-L121 | train |
phingofficial/phing | classes/phing/filters/TailFilter.php | TailFilter.chain | public function chain(Reader $reader)
{
$newFilter = new TailFilter($reader);
$newFilter->setLines($this->getLines());
$newFilter->setSkip($this->getSkip());
$newFilter->setInitialized(true);
$newFilter->setProject($this->getProject());
return $newFilter;
} | php | public function chain(Reader $reader)
{
$newFilter = new TailFilter($reader);
$newFilter->setLines($this->getLines());
$newFilter->setSkip($this->getSkip());
$newFilter->setInitialized(true);
$newFilter->setProject($this->getProject());
return $newFilter;
} | [
"public",
"function",
"chain",
"(",
"Reader",
"$",
"reader",
")",
"{",
"$",
"newFilter",
"=",
"new",
"TailFilter",
"(",
"$",
"reader",
")",
";",
"$",
"newFilter",
"->",
"setLines",
"(",
"$",
"this",
"->",
"getLines",
"(",
")",
")",
";",
"$",
"newFilt... | Creates a new TailFilter using the passed in
Reader for instantiation.
@param Reader $reader A Reader object providing the underlying stream.
Must not be <code>null</code>.
@return TailFilter A new filter based on this configuration, but filtering
the specified reader. | [
"Creates",
"a",
"new",
"TailFilter",
"using",
"the",
"passed",
"in",
"Reader",
"for",
"instantiation",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/TailFilter.php#L173-L182 | train |
phingofficial/phing | classes/phing/tasks/ext/liquibase/AbstractLiquibaseTask.php | AbstractLiquibaseTask.execute | protected function execute($lbcommand, $lbparams = '')
{
$nestedparams = "";
foreach ($this->parameters as $p) {
$nestedparams .= $p->getCommandline($this->project) . ' ';
}
$nestedprops = "";
foreach ($this->properties as $p) {
$nestedprops .= $p->getCommandline($this->project) . ' ';
}
$command = sprintf(
'java -jar %s --changeLogFile=%s --url=%s --username=%s --password=%s --classpath=%s %s %s %s %s 2>&1',
escapeshellarg($this->jar),
escapeshellarg($this->changeLogFile),
escapeshellarg($this->url),
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->classpathref),
$nestedparams,
escapeshellarg($lbcommand),
$lbparams,
$nestedprops
);
if ($this->passthru) {
passthru($command);
} else {
$output = [];
$return = null;
exec($command, $output, $return);
$output = implode(PHP_EOL, $output);
if ($this->display) {
print $output;
}
if (!empty($this->outputProperty)) {
$this->project->setProperty($this->outputProperty, $output);
}
if ($this->checkreturn && $return != 0) {
throw new BuildException("Liquibase exited with code $return");
}
}
return;
} | php | protected function execute($lbcommand, $lbparams = '')
{
$nestedparams = "";
foreach ($this->parameters as $p) {
$nestedparams .= $p->getCommandline($this->project) . ' ';
}
$nestedprops = "";
foreach ($this->properties as $p) {
$nestedprops .= $p->getCommandline($this->project) . ' ';
}
$command = sprintf(
'java -jar %s --changeLogFile=%s --url=%s --username=%s --password=%s --classpath=%s %s %s %s %s 2>&1',
escapeshellarg($this->jar),
escapeshellarg($this->changeLogFile),
escapeshellarg($this->url),
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->classpathref),
$nestedparams,
escapeshellarg($lbcommand),
$lbparams,
$nestedprops
);
if ($this->passthru) {
passthru($command);
} else {
$output = [];
$return = null;
exec($command, $output, $return);
$output = implode(PHP_EOL, $output);
if ($this->display) {
print $output;
}
if (!empty($this->outputProperty)) {
$this->project->setProperty($this->outputProperty, $output);
}
if ($this->checkreturn && $return != 0) {
throw new BuildException("Liquibase exited with code $return");
}
}
return;
} | [
"protected",
"function",
"execute",
"(",
"$",
"lbcommand",
",",
"$",
"lbparams",
"=",
"''",
")",
"{",
"$",
"nestedparams",
"=",
"\"\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"parameters",
"as",
"$",
"p",
")",
"{",
"$",
"nestedparams",
".=",
"$",
"p... | Executes the given command and returns the output.
@param $lbcommand
@param string $lbparams the command to execute
@throws BuildException
@return string the output of the executed command | [
"Executes",
"the",
"given",
"command",
"and",
"returns",
"the",
"output",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/liquibase/AbstractLiquibaseTask.php#L253-L300 | train |
phingofficial/phing | classes/phing/filters/StripWhitespace.php | StripWhitespace.read | public function read($len = null)
{
if ($this->processed === true) {
return -1; // EOF
}
// Read XML
$php = null;
while (($buffer = $this->in->read($len)) !== -1) {
$php .= $buffer;
}
if ($php === null) { // EOF?
return -1;
}
if (empty($php)) {
$this->log("PHP file is empty!", Project::MSG_WARN);
return ''; // return empty string, don't attempt to strip whitespace
}
// write buffer to a temporary file, since php_strip_whitespace() needs a filename
$file = new PhingFile(tempnam(PhingFile::getTempDir(), 'stripwhitespace'));
file_put_contents($file->getAbsolutePath(), $php);
$output = php_strip_whitespace($file->getAbsolutePath());
unlink($file->getAbsolutePath());
$this->processed = true;
return $output;
} | php | public function read($len = null)
{
if ($this->processed === true) {
return -1; // EOF
}
// Read XML
$php = null;
while (($buffer = $this->in->read($len)) !== -1) {
$php .= $buffer;
}
if ($php === null) { // EOF?
return -1;
}
if (empty($php)) {
$this->log("PHP file is empty!", Project::MSG_WARN);
return ''; // return empty string, don't attempt to strip whitespace
}
// write buffer to a temporary file, since php_strip_whitespace() needs a filename
$file = new PhingFile(tempnam(PhingFile::getTempDir(), 'stripwhitespace'));
file_put_contents($file->getAbsolutePath(), $php);
$output = php_strip_whitespace($file->getAbsolutePath());
unlink($file->getAbsolutePath());
$this->processed = true;
return $output;
} | [
"public",
"function",
"read",
"(",
"$",
"len",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"processed",
"===",
"true",
")",
"{",
"return",
"-",
"1",
";",
"// EOF",
"}",
"// Read XML",
"$",
"php",
"=",
"null",
";",
"while",
"(",
"(",
"$",... | Returns the stream without Php comments and whitespace.
@param null $len
@return int the resulting stream, or -1
if the end of the resulting stream has been reached | [
"Returns",
"the",
"stream",
"without",
"Php",
"comments",
"and",
"whitespace",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/StripWhitespace.php#L38-L70 | train |
phingofficial/phing | classes/phing/filters/StripWhitespace.php | StripWhitespace.chain | public function chain(Reader $reader)
{
$newFilter = new StripWhitespace($reader);
$newFilter->setProject($this->getProject());
return $newFilter;
} | php | public function chain(Reader $reader)
{
$newFilter = new StripWhitespace($reader);
$newFilter->setProject($this->getProject());
return $newFilter;
} | [
"public",
"function",
"chain",
"(",
"Reader",
"$",
"reader",
")",
"{",
"$",
"newFilter",
"=",
"new",
"StripWhitespace",
"(",
"$",
"reader",
")",
";",
"$",
"newFilter",
"->",
"setProject",
"(",
"$",
"this",
"->",
"getProject",
"(",
")",
")",
";",
"retur... | Creates a new StripWhitespace using the passed in
Reader for instantiation.
@param A|Reader $reader
@internal param A $reader Reader object providing the underlying stream.
Must not be <code>null</code>.
@return StripWhitespace a new filter based on this configuration, but filtering
the specified reader | [
"Creates",
"a",
"new",
"StripWhitespace",
"using",
"the",
"passed",
"in",
"Reader",
"for",
"instantiation",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/StripWhitespace.php#L83-L89 | train |
phingofficial/phing | classes/phing/parser/RootHandler.php | RootHandler.startElement | public function startElement($tag, $attrs)
{
if ($tag === "project") {
$ph = new ProjectHandler($this->parser, $this, $this->configurator, $this->context);
$ph->init($tag, $attrs);
} else {
throw new ExpatParseException(
"Unexpected tag <$tag> in top-level of build file.",
$this->parser->getLocation()
);
}
} | php | public function startElement($tag, $attrs)
{
if ($tag === "project") {
$ph = new ProjectHandler($this->parser, $this, $this->configurator, $this->context);
$ph->init($tag, $attrs);
} else {
throw new ExpatParseException(
"Unexpected tag <$tag> in top-level of build file.",
$this->parser->getLocation()
);
}
} | [
"public",
"function",
"startElement",
"(",
"$",
"tag",
",",
"$",
"attrs",
")",
"{",
"if",
"(",
"$",
"tag",
"===",
"\"project\"",
")",
"{",
"$",
"ph",
"=",
"new",
"ProjectHandler",
"(",
"$",
"this",
"->",
"parser",
",",
"$",
"this",
",",
"$",
"this"... | Kick off a custom action for a start element tag.
The root element of our buildfile is the <project> element. The
root filter handles this element if it occurs, creates ProjectHandler
to handle any nested tags & attributes of the <project> tag,
and calls init.
@param string $tag The xml tagname
@param array $attrs The attributes of the tag
@throws ExpatParseException if the first element within our build file
is not the >project< element | [
"Kick",
"off",
"a",
"custom",
"action",
"for",
"a",
"start",
"element",
"tag",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/parser/RootHandler.php#L77-L88 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.