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/zendguard/ZendGuardEncodeTask.php | ZendGuardEncodeTask.encodeFile | protected function encodeFile($filePath)
{
$command = $this->encodeCommand . $filePath . ' 2>&1';
$this->log('Running: ' . $command, Project::MSG_VERBOSE);
$tmp = exec($command, $output, $return_var);
if ($return_var !== 0) {
throw new BuildException("Encoding failed. \n Msg: " . $tmp . " \n Encode command: " . $command);
}
return true;
} | php | protected function encodeFile($filePath)
{
$command = $this->encodeCommand . $filePath . ' 2>&1';
$this->log('Running: ' . $command, Project::MSG_VERBOSE);
$tmp = exec($command, $output, $return_var);
if ($return_var !== 0) {
throw new BuildException("Encoding failed. \n Msg: " . $tmp . " \n Encode command: " . $command);
}
return true;
} | [
"protected",
"function",
"encodeFile",
"(",
"$",
"filePath",
")",
"{",
"$",
"command",
"=",
"$",
"this",
"->",
"encodeCommand",
".",
"$",
"filePath",
".",
"' 2>&1'",
";",
"$",
"this",
"->",
"log",
"(",
"'Running: '",
".",
"$",
"command",
",",
"Project",
... | Encodes a file using currently defined Zend Guard settings
@param string $filePath Path to the encoded file
@throws BuildException
@return bool | [
"Encodes",
"a",
"file",
"using",
"currently",
"defined",
"Zend",
"Guard",
"settings"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/zendguard/ZendGuardEncodeTask.php#L510-L522 | train |
phingofficial/phing | classes/phing/types/CommandlineArgument.php | CommandlineArgument.setLine | public function setLine($line)
{
if ($line === null) {
return;
}
$this->parts = $this->outer::translateCommandline($line);
} | php | public function setLine($line)
{
if ($line === null) {
return;
}
$this->parts = $this->outer::translateCommandline($line);
} | [
"public",
"function",
"setLine",
"(",
"$",
"line",
")",
"{",
"if",
"(",
"$",
"line",
"===",
"null",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"parts",
"=",
"$",
"this",
"->",
"outer",
"::",
"translateCommandline",
"(",
"$",
"line",
")",
";",... | Line to split into several commandline arguments.
@param string $line line to split into several commandline arguments
@throws \BuildException | [
"Line",
"to",
"split",
"into",
"several",
"commandline",
"arguments",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/CommandlineArgument.php#L46-L52 | train |
phingofficial/phing | classes/phing/tasks/system/MapEntry.php | MapEntry.apply | public function apply($elem)
{
if ($this->outer->from === null || $this->outer->to === null) {
throw new BuildException(
"Both 'from' and 'to' must be set "
. "in a map entry"
);
}
// If we're on windows, then do the comparison ignoring case
$cmpElem = $this->outer->onWindows ? strtolower($elem) : $elem;
$cmpFrom = $this->outer->onWindows ? strtolower(
str_replace('/', '\\', $this->outer->from)
) : $this->outer->from;
// If the element starts with the configured prefix, then
// convert the prefix to the configured 'to' value.
if (StringHelper::startsWith($cmpFrom, $cmpElem)) {
$len = strlen($this->outer->from);
if ($len >= strlen($elem)) {
$elem = $this->outer->to;
} else {
$elem = $this->outer->to . StringHelper::substring($elem, $len);
}
}
return $elem;
} | php | public function apply($elem)
{
if ($this->outer->from === null || $this->outer->to === null) {
throw new BuildException(
"Both 'from' and 'to' must be set "
. "in a map entry"
);
}
// If we're on windows, then do the comparison ignoring case
$cmpElem = $this->outer->onWindows ? strtolower($elem) : $elem;
$cmpFrom = $this->outer->onWindows ? strtolower(
str_replace('/', '\\', $this->outer->from)
) : $this->outer->from;
// If the element starts with the configured prefix, then
// convert the prefix to the configured 'to' value.
if (StringHelper::startsWith($cmpFrom, $cmpElem)) {
$len = strlen($this->outer->from);
if ($len >= strlen($elem)) {
$elem = $this->outer->to;
} else {
$elem = $this->outer->to . StringHelper::substring($elem, $len);
}
}
return $elem;
} | [
"public",
"function",
"apply",
"(",
"$",
"elem",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"outer",
"->",
"from",
"===",
"null",
"||",
"$",
"this",
"->",
"outer",
"->",
"to",
"===",
"null",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"Both 'from... | Apply this map entry to a given path element
@param string $elem Path element to process
@return string Updated path element after mapping
@throws BuildException | [
"Apply",
"this",
"map",
"entry",
"to",
"a",
"given",
"path",
"element"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/MapEntry.php#L46-L75 | train |
phingofficial/phing | classes/phing/tasks/ext/phpunit/PHPUnitTask.php | PHPUnitTask.handlePHPUnitConfiguration | protected function handlePHPUnitConfiguration(PhingFile $configuration)
{
if (!$configuration->exists()) {
throw new BuildException("Unable to find PHPUnit configuration file '" . (string) $configuration . "'");
}
if (class_exists('PHPUnit_Util_Configuration')) {
$config = PHPUnit_Util_Configuration::getInstance($configuration->getAbsolutePath());
} else {
$config = \PHPUnit\Util\Configuration::getInstance($configuration->getAbsolutePath());
}
if (empty($config)) {
return;
}
$phpunit = $config->getPHPUnitConfiguration();
if (empty($phpunit)) {
return;
}
$config->handlePHPConfiguration();
if (isset($phpunit['bootstrap'])) {
$this->setBootstrap($phpunit['bootstrap']);
}
if (isset($phpunit['stopOnFailure'])) {
$this->setHaltonfailure($phpunit['stopOnFailure']);
}
if (isset($phpunit['stopOnError'])) {
$this->setHaltonerror($phpunit['stopOnError']);
}
if (isset($phpunit['stopOnSkipped'])) {
$this->setHaltonskipped($phpunit['stopOnSkipped']);
}
if (isset($phpunit['stopOnIncomplete'])) {
$this->setHaltonincomplete($phpunit['stopOnIncomplete']);
}
if (isset($phpunit['processIsolation'])) {
$this->setProcessIsolation($phpunit['processIsolation']);
}
foreach ($config->getListenerConfiguration() as $listener) {
if (!class_exists($listener['class'], false)
&& $listener['file'] !== ''
) {
include_once $listener['file'];
}
if (class_exists($listener['class'])) {
if (count($listener['arguments']) == 0) {
$listener = new $listener['class'];
} else {
$listenerClass = new ReflectionClass(
$listener['class']
);
$listener = $listenerClass->newInstanceArgs(
$listener['arguments']
);
}
if ($listener instanceof \PHPUnit\Framework\TestListener) {
$this->addListener($listener);
}
}
}
if (method_exists($config, 'getSeleniumBrowserConfiguration')) {
$browsers = $config->getSeleniumBrowserConfiguration();
if (!empty($browsers)
&& class_exists('PHPUnit_Extensions_SeleniumTestCase')
) {
PHPUnit_Extensions_SeleniumTestCase::$browsers = $browsers;
}
}
return $phpunit;
} | php | protected function handlePHPUnitConfiguration(PhingFile $configuration)
{
if (!$configuration->exists()) {
throw new BuildException("Unable to find PHPUnit configuration file '" . (string) $configuration . "'");
}
if (class_exists('PHPUnit_Util_Configuration')) {
$config = PHPUnit_Util_Configuration::getInstance($configuration->getAbsolutePath());
} else {
$config = \PHPUnit\Util\Configuration::getInstance($configuration->getAbsolutePath());
}
if (empty($config)) {
return;
}
$phpunit = $config->getPHPUnitConfiguration();
if (empty($phpunit)) {
return;
}
$config->handlePHPConfiguration();
if (isset($phpunit['bootstrap'])) {
$this->setBootstrap($phpunit['bootstrap']);
}
if (isset($phpunit['stopOnFailure'])) {
$this->setHaltonfailure($phpunit['stopOnFailure']);
}
if (isset($phpunit['stopOnError'])) {
$this->setHaltonerror($phpunit['stopOnError']);
}
if (isset($phpunit['stopOnSkipped'])) {
$this->setHaltonskipped($phpunit['stopOnSkipped']);
}
if (isset($phpunit['stopOnIncomplete'])) {
$this->setHaltonincomplete($phpunit['stopOnIncomplete']);
}
if (isset($phpunit['processIsolation'])) {
$this->setProcessIsolation($phpunit['processIsolation']);
}
foreach ($config->getListenerConfiguration() as $listener) {
if (!class_exists($listener['class'], false)
&& $listener['file'] !== ''
) {
include_once $listener['file'];
}
if (class_exists($listener['class'])) {
if (count($listener['arguments']) == 0) {
$listener = new $listener['class'];
} else {
$listenerClass = new ReflectionClass(
$listener['class']
);
$listener = $listenerClass->newInstanceArgs(
$listener['arguments']
);
}
if ($listener instanceof \PHPUnit\Framework\TestListener) {
$this->addListener($listener);
}
}
}
if (method_exists($config, 'getSeleniumBrowserConfiguration')) {
$browsers = $config->getSeleniumBrowserConfiguration();
if (!empty($browsers)
&& class_exists('PHPUnit_Extensions_SeleniumTestCase')
) {
PHPUnit_Extensions_SeleniumTestCase::$browsers = $browsers;
}
}
return $phpunit;
} | [
"protected",
"function",
"handlePHPUnitConfiguration",
"(",
"PhingFile",
"$",
"configuration",
")",
"{",
"if",
"(",
"!",
"$",
"configuration",
"->",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"Unable to find PHPUnit configuration file '\"",... | Load and processes the PHPUnit configuration
@param $configuration
@throws BuildException
@return array | [
"Load",
"and",
"processes",
"the",
"PHPUnit",
"configuration"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/phpunit/PHPUnitTask.php#L307-L391 | train |
phingofficial/phing | classes/phing/filters/StripLineBreaks.php | StripLineBreaks.read | public function read($len = null)
{
if (!$this->getInitialized()) {
$this->_initialize();
$this->setInitialized(true);
}
$buffer = $this->in->read($len);
if ($buffer === -1) {
return -1;
}
$buffer = preg_replace("/[" . $this->_lineBreaks . "]/", '', $buffer);
return $buffer;
} | php | public function read($len = null)
{
if (!$this->getInitialized()) {
$this->_initialize();
$this->setInitialized(true);
}
$buffer = $this->in->read($len);
if ($buffer === -1) {
return -1;
}
$buffer = preg_replace("/[" . $this->_lineBreaks . "]/", '', $buffer);
return $buffer;
} | [
"public",
"function",
"read",
"(",
"$",
"len",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getInitialized",
"(",
")",
")",
"{",
"$",
"this",
"->",
"_initialize",
"(",
")",
";",
"$",
"this",
"->",
"setInitialized",
"(",
"true",
")",
... | Returns the filtered stream, only including
characters not in the set of line-breaking characters.
@param null $len
@return mixed the resulting stream, or -1
if the end of the resulting stream has been reached.
@exception IOException if the underlying stream throws an IOException
during reading | [
"Returns",
"the",
"filtered",
"stream",
"only",
"including",
"characters",
"not",
"in",
"the",
"set",
"of",
"line",
"-",
"breaking",
"characters",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/StripLineBreaks.php#L71-L86 | train |
phingofficial/phing | classes/phing/filters/StripLineBreaks.php | StripLineBreaks.chain | public function chain(Reader $reader)
{
$newFilter = new StripLineBreaks($reader);
$newFilter->setLineBreaks($this->getLineBreaks());
$newFilter->setInitialized(true);
$newFilter->setProject($this->getProject());
return $newFilter;
} | php | public function chain(Reader $reader)
{
$newFilter = new StripLineBreaks($reader);
$newFilter->setLineBreaks($this->getLineBreaks());
$newFilter->setInitialized(true);
$newFilter->setProject($this->getProject());
return $newFilter;
} | [
"public",
"function",
"chain",
"(",
"Reader",
"$",
"reader",
")",
"{",
"$",
"newFilter",
"=",
"new",
"StripLineBreaks",
"(",
"$",
"reader",
")",
";",
"$",
"newFilter",
"->",
"setLineBreaks",
"(",
"$",
"this",
"->",
"getLineBreaks",
"(",
")",
")",
";",
... | Creates a new StripLineBreaks using the passed in
Reader for instantiation.
@param Reader $reader
@internal param A $object Reader object providing the underlying stream.
Must not be <code>null</code>.
@return object A new filter based on this configuration, but filtering
the specified reader | [
"Creates",
"a",
"new",
"StripLineBreaks",
"using",
"the",
"passed",
"in",
"Reader",
"for",
"instantiation",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/StripLineBreaks.php#L120-L128 | train |
phingofficial/phing | classes/phing/filters/StripLineBreaks.php | StripLineBreaks._initialize | private function _initialize()
{
$userDefinedLineBreaks = null;
$params = $this->getParameters();
if ($params !== null) {
for ($i = 0, $paramsCount = count($params); $i < $paramsCount; $i++) {
if (self::LINES_BREAKS_KEY === $params[$i]->getName()) {
$userDefinedLineBreaks = $params[$i]->getValue();
break;
}
}
}
if ($userDefinedLineBreaks !== null) {
$this->_lineBreaks = $userDefinedLineBreaks;
}
} | php | private function _initialize()
{
$userDefinedLineBreaks = null;
$params = $this->getParameters();
if ($params !== null) {
for ($i = 0, $paramsCount = count($params); $i < $paramsCount; $i++) {
if (self::LINES_BREAKS_KEY === $params[$i]->getName()) {
$userDefinedLineBreaks = $params[$i]->getValue();
break;
}
}
}
if ($userDefinedLineBreaks !== null) {
$this->_lineBreaks = $userDefinedLineBreaks;
}
} | [
"private",
"function",
"_initialize",
"(",
")",
"{",
"$",
"userDefinedLineBreaks",
"=",
"null",
";",
"$",
"params",
"=",
"$",
"this",
"->",
"getParameters",
"(",
")",
";",
"if",
"(",
"$",
"params",
"!==",
"null",
")",
"{",
"for",
"(",
"$",
"i",
"=",
... | Parses the parameters to set the line-breaking characters. | [
"Parses",
"the",
"parameters",
"to",
"set",
"the",
"line",
"-",
"breaking",
"characters",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/StripLineBreaks.php#L133-L149 | train |
phingofficial/phing | classes/phing/tasks/system/ExecTask.php | ExecTask.prepare | protected function prepare()
{
if ($this->dir === null) {
$this->dir = $this->getProject()->getBasedir();
}
if ($this->commandline->getExecutable() === null) {
throw new BuildException(
'ExecTask: Please provide "executable"'
);
}
// expand any symbolic links first
try {
if (!$this->dir->getCanonicalFile()->exists()) {
throw new BuildException(
"The directory '" . (string) $this->dir . "' does not exist"
);
}
if (!$this->dir->getCanonicalFile()->isDirectory()) {
throw new BuildException(
"'" . (string) $this->dir . "' is not a directory"
);
}
} catch (IOException $e) {
throw new BuildException(
"'" . (string) $this->dir . "' is not a readable directory"
);
}
$this->currdir = getcwd();
@chdir($this->dir->getPath());
$this->commandline->setEscape($this->escape);
} | php | protected function prepare()
{
if ($this->dir === null) {
$this->dir = $this->getProject()->getBasedir();
}
if ($this->commandline->getExecutable() === null) {
throw new BuildException(
'ExecTask: Please provide "executable"'
);
}
// expand any symbolic links first
try {
if (!$this->dir->getCanonicalFile()->exists()) {
throw new BuildException(
"The directory '" . (string) $this->dir . "' does not exist"
);
}
if (!$this->dir->getCanonicalFile()->isDirectory()) {
throw new BuildException(
"'" . (string) $this->dir . "' is not a directory"
);
}
} catch (IOException $e) {
throw new BuildException(
"'" . (string) $this->dir . "' is not a readable directory"
);
}
$this->currdir = getcwd();
@chdir($this->dir->getPath());
$this->commandline->setEscape($this->escape);
} | [
"protected",
"function",
"prepare",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"dir",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"dir",
"=",
"$",
"this",
"->",
"getProject",
"(",
")",
"->",
"getBasedir",
"(",
")",
";",
"}",
"if",
"(",
"$",
"... | Prepares the command building and execution, i.e.
changes to the specified directory.
@throws BuildException
@return void | [
"Prepares",
"the",
"command",
"building",
"and",
"execution",
"i",
".",
"e",
".",
"changes",
"to",
"the",
"specified",
"directory",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/ExecTask.php#L182-L215 | train |
phingofficial/phing | classes/phing/tasks/system/ExecTask.php | ExecTask.setCommand | public function setCommand($command): void
{
$this->log(
"The command attribute is deprecated.\nPlease use the executable attribute and nested arg elements.",
Project::MSG_WARN
);
$this->commandline = new Commandline($command);
$this->executable = $this->commandline->getExecutable();
} | php | public function setCommand($command): void
{
$this->log(
"The command attribute is deprecated.\nPlease use the executable attribute and nested arg elements.",
Project::MSG_WARN
);
$this->commandline = new Commandline($command);
$this->executable = $this->commandline->getExecutable();
} | [
"public",
"function",
"setCommand",
"(",
"$",
"command",
")",
":",
"void",
"{",
"$",
"this",
"->",
"log",
"(",
"\"The command attribute is deprecated.\\nPlease use the executable attribute and nested arg elements.\"",
",",
"Project",
"::",
"MSG_WARN",
")",
";",
"$",
"th... | The command to use.
@param string $command String or string-compatible (e.g. w/ __toString()).
@return void
@throws \BuildException | [
"The",
"command",
"to",
"use",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/ExecTask.php#L369-L377 | train |
phingofficial/phing | classes/phing/tasks/system/ExecTask.php | ExecTask.setExecutable | public function setExecutable($value): void
{
if (is_bool($value)) {
$value = $value === true ? 'true' : 'false';
}
$this->executable = $value;
$this->commandline->setExecutable($value);
} | php | public function setExecutable($value): void
{
if (is_bool($value)) {
$value = $value === true ? 'true' : 'false';
}
$this->executable = $value;
$this->commandline->setExecutable($value);
} | [
"public",
"function",
"setExecutable",
"(",
"$",
"value",
")",
":",
"void",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"$",
"value",
"===",
"true",
"?",
"'true'",
":",
"'false'",
";",
"}",
"$",
"this",
"->",
"... | The executable to use.
@param string|bool $value String or string-compatible (e.g. w/ __toString()).
@return void | [
"The",
"executable",
"to",
"use",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/ExecTask.php#L386-L393 | train |
phingofficial/phing | classes/phing/tasks/system/ExecTask.php | ExecTask.isValidOs | protected function isValidOs(): bool
{
//hand osfamily off to OsCondition class, if set
if ($this->osFamily !== null && !OsCondition::isFamily($this->osFamily)) {
return false;
}
//the Exec OS check is different from Os.isOs(), which
//probes for a specific OS. Instead it searches the os field
//for the current os.name
$myos = Phing::getProperty("os.name");
$this->log("Current OS is " . $myos, Project::MSG_VERBOSE);
if (($this->os !== null) && (strpos($this->os, $myos) === false)) {
// this command will be executed only on the specified OS
$this->log(
"This OS, " . $myos
. " was not found in the specified list of valid OSes: " . $this->os,
Project::MSG_VERBOSE
);
return false;
}
return true;
} | php | protected function isValidOs(): bool
{
//hand osfamily off to OsCondition class, if set
if ($this->osFamily !== null && !OsCondition::isFamily($this->osFamily)) {
return false;
}
//the Exec OS check is different from Os.isOs(), which
//probes for a specific OS. Instead it searches the os field
//for the current os.name
$myos = Phing::getProperty("os.name");
$this->log("Current OS is " . $myos, Project::MSG_VERBOSE);
if (($this->os !== null) && (strpos($this->os, $myos) === false)) {
// this command will be executed only on the specified OS
$this->log(
"This OS, " . $myos
. " was not found in the specified list of valid OSes: " . $this->os,
Project::MSG_VERBOSE
);
return false;
}
return true;
} | [
"protected",
"function",
"isValidOs",
"(",
")",
":",
"bool",
"{",
"//hand osfamily off to OsCondition class, if set",
"if",
"(",
"$",
"this",
"->",
"osFamily",
"!==",
"null",
"&&",
"!",
"OsCondition",
"::",
"isFamily",
"(",
"$",
"this",
"->",
"osFamily",
")",
... | Is this the OS the user wanted?
@return boolean.
<ul>
<li>
<li><code>true</code> if the os and osfamily attributes are null.</li>
<li><code>true</code> if osfamily is set, and the os family and must match
that of the current OS, according to the logic of
{@link Os#isOs(String, String, String, String)}, and the result of the
<code>os</code> attribute must also evaluate true.
</li>
<li>
<code>true</code> if os is set, and the system.property os.name
is found in the os attribute,</li>
<li><code>false</code> otherwise.</li>
</ul> | [
"Is",
"this",
"the",
"OS",
"the",
"user",
"wanted?"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/ExecTask.php#L631-L652 | train |
phingofficial/phing | classes/phing/mappers/GlobMapper.php | GlobMapper.extractVariablePart | private function extractVariablePart($name)
{
return StringHelper::substring($name, $this->prefixLength, strlen($name) - $this->postfixLength - 1);
} | php | private function extractVariablePart($name)
{
return StringHelper::substring($name, $this->prefixLength, strlen($name) - $this->postfixLength - 1);
} | [
"private",
"function",
"extractVariablePart",
"(",
"$",
"name",
")",
"{",
"return",
"StringHelper",
"::",
"substring",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"prefixLength",
",",
"strlen",
"(",
"$",
"name",
")",
"-",
"$",
"this",
"->",
"postfixLength",
... | Extracts the variable part.
@param string $name
@return string | [
"Extracts",
"the",
"variable",
"part",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/mappers/GlobMapper.php#L189-L192 | train |
phingofficial/phing | classes/phing/mappers/GlobMapper.php | GlobMapper.modifyName | private function modifyName($name)
{
if (!$this->caseSensitive) {
$name = strtolower($name);
}
if ($this->handleDirSep) {
if (strpos('\\', $name) !== false) {
$name = str_replace('\\', '/', $name);
}
}
return $name;
} | php | private function modifyName($name)
{
if (!$this->caseSensitive) {
$name = strtolower($name);
}
if ($this->handleDirSep) {
if (strpos('\\', $name) !== false) {
$name = str_replace('\\', '/', $name);
}
}
return $name;
} | [
"private",
"function",
"modifyName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"caseSensitive",
")",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"$",
"name",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"handleDirSep",
")",
"{",
... | modify string based on dir char mapping and case sensitivity
@param string $name the name to convert
@return string the converted name | [
"modify",
"string",
"based",
"on",
"dir",
"char",
"mapping",
"and",
"case",
"sensitivity"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/mappers/GlobMapper.php#L200-L212 | train |
phingofficial/phing | classes/phing/filters/XincludeFilter.php | XincludeFilter.process | protected function process($xml)
{
if ($this->basedir) {
$cwd = getcwd();
chdir($this->basedir);
}
// Create and setup document.
$xmlDom = new DomDocument();
$xmlDom->resolveExternals = $this->resolveExternals;
$xmlDom->loadXML($xml);
$xmlDom->xinclude();
if ($this->basedir) {
chdir($cwd);
}
return $xmlDom->saveXML();
} | php | protected function process($xml)
{
if ($this->basedir) {
$cwd = getcwd();
chdir($this->basedir);
}
// Create and setup document.
$xmlDom = new DomDocument();
$xmlDom->resolveExternals = $this->resolveExternals;
$xmlDom->loadXML($xml);
$xmlDom->xinclude();
if ($this->basedir) {
chdir($cwd);
}
return $xmlDom->saveXML();
} | [
"protected",
"function",
"process",
"(",
"$",
"xml",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"basedir",
")",
"{",
"$",
"cwd",
"=",
"getcwd",
"(",
")",
";",
"chdir",
"(",
"$",
"this",
"->",
"basedir",
")",
";",
"}",
"// Create and setup document.",
"$... | Try to process the Xinclude transformation
@param string XML to process.
@return string
@throws BuildException On errors | [
"Try",
"to",
"process",
"the",
"Xinclude",
"transformation"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/XincludeFilter.php#L140-L160 | train |
phingofficial/phing | classes/phing/filters/XincludeFilter.php | XincludeFilter.chain | public function chain(Reader $reader)
{
$newFilter = new XincludeFilter($reader);
$newFilter->setProject($this->getProject());
$newFilter->setBasedir($this->getBasedir());
return $newFilter;
} | php | public function chain(Reader $reader)
{
$newFilter = new XincludeFilter($reader);
$newFilter->setProject($this->getProject());
$newFilter->setBasedir($this->getBasedir());
return $newFilter;
} | [
"public",
"function",
"chain",
"(",
"Reader",
"$",
"reader",
")",
"{",
"$",
"newFilter",
"=",
"new",
"XincludeFilter",
"(",
"$",
"reader",
")",
";",
"$",
"newFilter",
"->",
"setProject",
"(",
"$",
"this",
"->",
"getProject",
"(",
")",
")",
";",
"$",
... | Creates a new XincludeFilter using the passed in
Reader for instantiation.
@param Reader A Reader object providing the underlying stream.
Must not be <code>null</code>.
@return Reader A new filter based on this configuration, but filtering
the specified reader | [
"Creates",
"a",
"new",
"XincludeFilter",
"using",
"the",
"passed",
"in",
"Reader",
"for",
"instantiation",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/XincludeFilter.php#L172-L179 | train |
phingofficial/phing | classes/phing/tasks/ext/ComposerTask.php | ComposerTask.getComposer | public function getComposer()
{
$composerFile = new SplFileInfo($this->composer);
if (false === $composerFile->isFile()) {
$message = sprintf('Composer binary not found at "%s"', $composerFile);
$this->log($message, Project::MSG_WARN);
$composerLocation = FileSystem::getFileSystem()->which('composer');
if (!empty($composerLocation)) {
$message = sprintf('Composer binary found at "%s", updating location', $composerLocation[0]);
$this->log($message, Project::MSG_INFO);
$this->setComposer($composerLocation);
}
}
return $this->composer;
} | php | public function getComposer()
{
$composerFile = new SplFileInfo($this->composer);
if (false === $composerFile->isFile()) {
$message = sprintf('Composer binary not found at "%s"', $composerFile);
$this->log($message, Project::MSG_WARN);
$composerLocation = FileSystem::getFileSystem()->which('composer');
if (!empty($composerLocation)) {
$message = sprintf('Composer binary found at "%s", updating location', $composerLocation[0]);
$this->log($message, Project::MSG_INFO);
$this->setComposer($composerLocation);
}
}
return $this->composer;
} | [
"public",
"function",
"getComposer",
"(",
")",
"{",
"$",
"composerFile",
"=",
"new",
"SplFileInfo",
"(",
"$",
"this",
"->",
"composer",
")",
";",
"if",
"(",
"false",
"===",
"$",
"composerFile",
"->",
"isFile",
"(",
")",
")",
"{",
"$",
"message",
"=",
... | Returns the path to Composer application.
If the filepath is non existent, try to find it on the system.
@return string
@throws IOException | [
"Returns",
"the",
"path",
"to",
"Composer",
"application",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/ComposerTask.php#L133-L147 | train |
phingofficial/phing | classes/phing/tasks/ext/ComposerTask.php | ComposerTask.prepareCommandLine | private function prepareCommandLine()
{
$this->commandLine->setExecutable($this->getPhp());
//We are un-shifting arguments to the beginning of the command line because arguments should be at the end
$this->commandLine->createArgument(true)->setValue($this->getCommand());
$this->commandLine->createArgument(true)->setValue($this->getComposer());
$commandLine = (string) $this->commandLine;
//Creating new Commandline instance. It allows to handle subsequent calls correctly
$this->commandLine = new Commandline();
return $commandLine;
} | php | private function prepareCommandLine()
{
$this->commandLine->setExecutable($this->getPhp());
//We are un-shifting arguments to the beginning of the command line because arguments should be at the end
$this->commandLine->createArgument(true)->setValue($this->getCommand());
$this->commandLine->createArgument(true)->setValue($this->getComposer());
$commandLine = (string) $this->commandLine;
//Creating new Commandline instance. It allows to handle subsequent calls correctly
$this->commandLine = new Commandline();
return $commandLine;
} | [
"private",
"function",
"prepareCommandLine",
"(",
")",
"{",
"$",
"this",
"->",
"commandLine",
"->",
"setExecutable",
"(",
"$",
"this",
"->",
"getPhp",
"(",
")",
")",
";",
"//We are un-shifting arguments to the beginning of the command line because arguments should be at the... | Prepares the command string to be executed.
@return string
@throws IOException | [
"Prepares",
"the",
"command",
"string",
"to",
"be",
"executed",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/ComposerTask.php#L166-L177 | train |
phingofficial/phing | classes/phing/tasks/ext/ComposerTask.php | ComposerTask.main | public function main()
{
$commandLine = $this->prepareCommandLine();
$this->log("Executing " . $commandLine);
passthru($commandLine, $returnCode);
if ($returnCode > 0) {
throw new BuildException("Composer execution failed");
}
} | php | public function main()
{
$commandLine = $this->prepareCommandLine();
$this->log("Executing " . $commandLine);
passthru($commandLine, $returnCode);
if ($returnCode > 0) {
throw new BuildException("Composer execution failed");
}
} | [
"public",
"function",
"main",
"(",
")",
"{",
"$",
"commandLine",
"=",
"$",
"this",
"->",
"prepareCommandLine",
"(",
")",
";",
"$",
"this",
"->",
"log",
"(",
"\"Executing \"",
".",
"$",
"commandLine",
")",
";",
"passthru",
"(",
"$",
"commandLine",
",",
... | Executes the Composer task.
@throws IOException | [
"Executes",
"the",
"Composer",
"task",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/ComposerTask.php#L184-L193 | train |
phingofficial/phing | classes/phing/tasks/system/AdhocTask.php | AdhocTask.execute | protected function execute()
{
$classes = get_declared_classes();
eval($this->script);
$this->newClasses = array_diff(get_declared_classes(), $classes);
} | php | protected function execute()
{
$classes = get_declared_classes();
eval($this->script);
$this->newClasses = array_diff(get_declared_classes(), $classes);
} | [
"protected",
"function",
"execute",
"(",
")",
"{",
"$",
"classes",
"=",
"get_declared_classes",
"(",
")",
";",
"eval",
"(",
"$",
"this",
"->",
"script",
")",
";",
"$",
"this",
"->",
"newClasses",
"=",
"array_diff",
"(",
"get_declared_classes",
"(",
")",
... | Load the adhoc class, and perform any core validation.
@return string The classname of the ProjectComponent class.
@throws BuildException - if more than one class is defined. | [
"Load",
"the",
"adhoc",
"class",
"and",
"perform",
"any",
"core",
"validation",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/AdhocTask.php#L76-L81 | train |
phingofficial/phing | classes/phing/tasks/system/MoveTask.php | MoveTask.okToDelete | private function okToDelete(PhingFile $d)
{
$list = $d->listDir();
if ($list === null) {
return false; // maybe io error?
}
foreach ($list as $s) {
$f = new PhingFile($d, $s);
if ($f->isDirectory()) {
if (!$this->okToDelete($f)) {
return false;
}
} else {
// found a file
return false;
}
}
return true;
} | php | private function okToDelete(PhingFile $d)
{
$list = $d->listDir();
if ($list === null) {
return false; // maybe io error?
}
foreach ($list as $s) {
$f = new PhingFile($d, $s);
if ($f->isDirectory()) {
if (!$this->okToDelete($f)) {
return false;
}
} else {
// found a file
return false;
}
}
return true;
} | [
"private",
"function",
"okToDelete",
"(",
"PhingFile",
"$",
"d",
")",
"{",
"$",
"list",
"=",
"$",
"d",
"->",
"listDir",
"(",
")",
";",
"if",
"(",
"$",
"list",
"===",
"null",
")",
"{",
"return",
"false",
";",
"// maybe io error?",
"}",
"foreach",
"(",... | Its only ok to delete a dir tree if there are no files in it.
@param $d
@throws IOException
@return bool | [
"Its",
"only",
"ok",
"to",
"delete",
"a",
"dir",
"tree",
"if",
"there",
"are",
"no",
"files",
"in",
"it",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/MoveTask.php#L183-L203 | train |
phingofficial/phing | classes/phing/tasks/system/MoveTask.php | MoveTask.deleteDir | private function deleteDir(PhingFile $d)
{
$list = $d->listDir();
if ($list === null) {
return; // on an io error list() can return null
}
foreach ($list as $fname) {
$f = new PhingFile($d, $fname);
if ($f->isDirectory()) {
$this->deleteDir($f);
} else {
throw new BuildException("UNEXPECTED ERROR - The file " . $f->getAbsolutePath() . " should not exist!");
}
}
$this->log("Deleting directory " . $d->getPath(), $this->verbosity);
try {
$d->delete();
} catch (Exception $e) {
$this->logError("Unable to delete directory " . $d->__toString() . ": " . $e->getMessage());
}
} | php | private function deleteDir(PhingFile $d)
{
$list = $d->listDir();
if ($list === null) {
return; // on an io error list() can return null
}
foreach ($list as $fname) {
$f = new PhingFile($d, $fname);
if ($f->isDirectory()) {
$this->deleteDir($f);
} else {
throw new BuildException("UNEXPECTED ERROR - The file " . $f->getAbsolutePath() . " should not exist!");
}
}
$this->log("Deleting directory " . $d->getPath(), $this->verbosity);
try {
$d->delete();
} catch (Exception $e) {
$this->logError("Unable to delete directory " . $d->__toString() . ": " . $e->getMessage());
}
} | [
"private",
"function",
"deleteDir",
"(",
"PhingFile",
"$",
"d",
")",
"{",
"$",
"list",
"=",
"$",
"d",
"->",
"listDir",
"(",
")",
";",
"if",
"(",
"$",
"list",
"===",
"null",
")",
"{",
"return",
";",
"// on an io error list() can return null",
"}",
"foreac... | Go and delete the directory tree.
@param $d
@throws BuildException
@throws IOException | [
"Go",
"and",
"delete",
"the",
"directory",
"tree",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/MoveTask.php#L213-L235 | train |
phingofficial/phing | classes/phing/tasks/ext/property/Variable.php | Variable.removeProperty | private function removeProperty($name)
{
$properties = null;
try {
$properties = $this->getPropValue($this->getProject(), 'properties');
if ($properties !== null) {
unset($properties[$name]);
$this->setPropValue($properties, $this->getProject(), 'properties');
}
} catch (Exception $e) {
}
try {
$properties = $this->getPropValue($this->getProject(), 'userProperties');
if ($properties !== null) {
unset($properties[$name]);
$this->setPropValue($properties, $this->getProject(), 'userProperties');
}
} catch (Exception $e) {
}
} | php | private function removeProperty($name)
{
$properties = null;
try {
$properties = $this->getPropValue($this->getProject(), 'properties');
if ($properties !== null) {
unset($properties[$name]);
$this->setPropValue($properties, $this->getProject(), 'properties');
}
} catch (Exception $e) {
}
try {
$properties = $this->getPropValue($this->getProject(), 'userProperties');
if ($properties !== null) {
unset($properties[$name]);
$this->setPropValue($properties, $this->getProject(), 'userProperties');
}
} catch (Exception $e) {
}
} | [
"private",
"function",
"removeProperty",
"(",
"$",
"name",
")",
"{",
"$",
"properties",
"=",
"null",
";",
"try",
"{",
"$",
"properties",
"=",
"$",
"this",
"->",
"getPropValue",
"(",
"$",
"this",
"->",
"getProject",
"(",
")",
",",
"'properties'",
")",
"... | Remove a property from the project's property table and the userProperty table.
Note that Ant 1.6 uses a helper for this. | [
"Remove",
"a",
"property",
"from",
"the",
"project",
"s",
"property",
"table",
"and",
"the",
"userProperty",
"table",
".",
"Note",
"that",
"Ant",
"1",
".",
"6",
"uses",
"a",
"helper",
"for",
"this",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/property/Variable.php#L80-L99 | train |
phingofficial/phing | classes/phing/tasks/ext/property/Variable.php | Variable.getField | private function getField($thisClass, $fieldName)
{
$refClazz = new ReflectionObject($thisClass);
if (!$refClazz->hasProperty($fieldName)) {
throw new Exception("Invalid field : $fieldName");
}
return $refClazz->getProperty($fieldName);
} | php | private function getField($thisClass, $fieldName)
{
$refClazz = new ReflectionObject($thisClass);
if (!$refClazz->hasProperty($fieldName)) {
throw new Exception("Invalid field : $fieldName");
}
return $refClazz->getProperty($fieldName);
} | [
"private",
"function",
"getField",
"(",
"$",
"thisClass",
",",
"$",
"fieldName",
")",
"{",
"$",
"refClazz",
"=",
"new",
"ReflectionObject",
"(",
"$",
"thisClass",
")",
";",
"if",
"(",
"!",
"$",
"refClazz",
"->",
"hasProperty",
"(",
"$",
"fieldName",
")",... | Get a private property of a class
@param mixed $thisClass The class
@param string $fieldName The property to get
@return ReflectionProperty The property value
@throws Exception | [
"Get",
"a",
"private",
"property",
"of",
"a",
"class"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/property/Variable.php#L124-L132 | train |
phingofficial/phing | classes/phing/tasks/ext/property/Variable.php | Variable.getPropValue | private function getPropValue($instance, $fieldName)
{
$field = $this->getField($instance, $fieldName);
$field->setAccessible(true);
return $field->getValue($instance);
} | php | private function getPropValue($instance, $fieldName)
{
$field = $this->getField($instance, $fieldName);
$field->setAccessible(true);
return $field->getValue($instance);
} | [
"private",
"function",
"getPropValue",
"(",
"$",
"instance",
",",
"$",
"fieldName",
")",
"{",
"$",
"field",
"=",
"$",
"this",
"->",
"getField",
"(",
"$",
"instance",
",",
"$",
"fieldName",
")",
";",
"$",
"field",
"->",
"setAccessible",
"(",
"true",
")"... | Get a private property of an object
@param mixed $instance the object instance
@param string $fieldName the name of the field
@return mixed an object representing the value of the field
@throws Exception | [
"Get",
"a",
"private",
"property",
"of",
"an",
"object"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/property/Variable.php#L142-L147 | train |
phingofficial/phing | classes/phing/tasks/ext/property/Variable.php | Variable.loadFile | protected function loadFile(PhingFile $file)
{
$props = new Properties();
try {
if ($file->exists()) {
$props->load($file);
$this->addProperties($props);
} else {
$this->log(
'Unable to find property file: ' . $file->getAbsolutePath(),
Project::MSG_VERBOSE
);
}
} catch (IOException $ex) {
throw new BuildException($ex, $this->getLocation());
}
} | php | protected function loadFile(PhingFile $file)
{
$props = new Properties();
try {
if ($file->exists()) {
$props->load($file);
$this->addProperties($props);
} else {
$this->log(
'Unable to find property file: ' . $file->getAbsolutePath(),
Project::MSG_VERBOSE
);
}
} catch (IOException $ex) {
throw new BuildException($ex, $this->getLocation());
}
} | [
"protected",
"function",
"loadFile",
"(",
"PhingFile",
"$",
"file",
")",
"{",
"$",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"try",
"{",
"if",
"(",
"$",
"file",
"->",
"exists",
"(",
")",
")",
"{",
"$",
"props",
"->",
"load",
"(",
"$",
"fi... | load variables from a file
@param PhingFile $file file to load
@throws BuildException | [
"load",
"variables",
"from",
"a",
"file"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/property/Variable.php#L162-L179 | train |
phingofficial/phing | classes/phing/types/Description.php | Description.addText | public function addText($text)
{
$currentDescription = $this->project->getDescription();
if ($currentDescription === null) {
$this->project->setDescription($text);
} else {
$this->project->setDescription($currentDescription . $text);
}
} | php | public function addText($text)
{
$currentDescription = $this->project->getDescription();
if ($currentDescription === null) {
$this->project->setDescription($text);
} else {
$this->project->setDescription($currentDescription . $text);
}
} | [
"public",
"function",
"addText",
"(",
"$",
"text",
")",
"{",
"$",
"currentDescription",
"=",
"$",
"this",
"->",
"project",
"->",
"getDescription",
"(",
")",
";",
"if",
"(",
"$",
"currentDescription",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"project",... | Adds descriptive text to the project.
@param $text
@return void | [
"Adds",
"descriptive",
"text",
"to",
"the",
"project",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Description.php#L43-L51 | train |
phingofficial/phing | classes/phing/filters/ExpandProperties.php | ExpandProperties.read | public function read($len = null)
{
$buffer = $this->in->read($len);
if ($buffer === -1) {
return -1;
}
/**
* @var Project $project
*/
$project = $this->getProject();
$buffer = $project->replaceProperties($buffer);
return $buffer;
} | php | public function read($len = null)
{
$buffer = $this->in->read($len);
if ($buffer === -1) {
return -1;
}
/**
* @var Project $project
*/
$project = $this->getProject();
$buffer = $project->replaceProperties($buffer);
return $buffer;
} | [
"public",
"function",
"read",
"(",
"$",
"len",
"=",
"null",
")",
"{",
"$",
"buffer",
"=",
"$",
"this",
"->",
"in",
"->",
"read",
"(",
"$",
"len",
")",
";",
"if",
"(",
"$",
"buffer",
"===",
"-",
"1",
")",
"{",
"return",
"-",
"1",
";",
"}",
"... | Returns the filtered stream.
The original stream is first read in fully, and the Phing properties are expanded.
@param null $len
@return mixed the filtered stream, or -1 if the end of the resulting stream has been reached.
@exception IOException if the underlying stream throws an IOException
during reading | [
"Returns",
"the",
"filtered",
"stream",
".",
"The",
"original",
"stream",
"is",
"first",
"read",
"in",
"fully",
"and",
"the",
"Phing",
"properties",
"are",
"expanded",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/ExpandProperties.php#L45-L60 | train |
phingofficial/phing | classes/phing/filters/ExpandProperties.php | ExpandProperties.chain | public function chain(Reader $reader)
{
$newFilter = new ExpandProperties($reader);
$newFilter->setProject($this->getProject());
return $newFilter;
} | php | public function chain(Reader $reader)
{
$newFilter = new ExpandProperties($reader);
$newFilter->setProject($this->getProject());
return $newFilter;
} | [
"public",
"function",
"chain",
"(",
"Reader",
"$",
"reader",
")",
"{",
"$",
"newFilter",
"=",
"new",
"ExpandProperties",
"(",
"$",
"reader",
")",
";",
"$",
"newFilter",
"->",
"setProject",
"(",
"$",
"this",
"->",
"getProject",
"(",
")",
")",
";",
"retu... | Creates a new ExpandProperties filter using the passed in
Reader for instantiation.
@param Reader $reader A Reader object providing the underlying stream.
Must not be <code>null</code>.
@return ExpandProperties A new filter based on this configuration, but filtering
the specified reader | [
"Creates",
"a",
"new",
"ExpandProperties",
"filter",
"using",
"the",
"passed",
"in",
"Reader",
"for",
"instantiation",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/ExpandProperties.php#L72-L78 | train |
phingofficial/phing | classes/phing/parser/ExpatParser.php | ExpatParser.parse | public function parse()
{
while (($data = $this->reader->read()) !== -1) {
if (!xml_parse($this->parser, $data, $this->reader->eof())) {
$error = xml_error_string(xml_get_error_code($this->parser));
$e = new ExpatParseException($error, $this->getLocation());
xml_parser_free($this->parser);
throw $e;
}
}
xml_parser_free($this->parser);
return 1;
} | php | public function parse()
{
while (($data = $this->reader->read()) !== -1) {
if (!xml_parse($this->parser, $data, $this->reader->eof())) {
$error = xml_error_string(xml_get_error_code($this->parser));
$e = new ExpatParseException($error, $this->getLocation());
xml_parser_free($this->parser);
throw $e;
}
}
xml_parser_free($this->parser);
return 1;
} | [
"public",
"function",
"parse",
"(",
")",
"{",
"while",
"(",
"(",
"$",
"data",
"=",
"$",
"this",
"->",
"reader",
"->",
"read",
"(",
")",
")",
"!==",
"-",
"1",
")",
"{",
"if",
"(",
"!",
"xml_parse",
"(",
"$",
"this",
"->",
"parser",
",",
"$",
"... | Starts the parsing process.
@return int 1 if the parsing succeeded
@throws ExpatParseException if something gone wrong during parsing
@throws IOException if XML file can not be accessed | [
"Starts",
"the",
"parsing",
"process",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/parser/ExpatParser.php#L128-L141 | train |
phingofficial/phing | classes/phing/tasks/system/PathConvert.php | PathConvert.createPath | public function createPath()
{
if ($this->isReference()) {
throw $this->noChildrenAllowed();
}
if ($this->path === null) {
$this->path = new Path($this->getProject());
}
return $this->path->createPath();
} | php | public function createPath()
{
if ($this->isReference()) {
throw $this->noChildrenAllowed();
}
if ($this->path === null) {
$this->path = new Path($this->getProject());
}
return $this->path->createPath();
} | [
"public",
"function",
"createPath",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isReference",
"(",
")",
")",
"{",
"throw",
"$",
"this",
"->",
"noChildrenAllowed",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"path",
"===",
"null",
")",
"{",
... | Create a nested PATH element | [
"Create",
"a",
"nested",
"PATH",
"element"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PathConvert.php#L93-L103 | train |
phingofficial/phing | classes/phing/tasks/system/PathConvert.php | PathConvert.setRefid | public function setRefid(Reference $r)
{
if ($this->path !== null) {
throw $this->noChildrenAllowed();
}
$this->refid = $r;
} | php | public function setRefid(Reference $r)
{
if ($this->path !== null) {
throw $this->noChildrenAllowed();
}
$this->refid = $r;
} | [
"public",
"function",
"setRefid",
"(",
"Reference",
"$",
"r",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"path",
"!==",
"null",
")",
"{",
"throw",
"$",
"this",
"->",
"noChildrenAllowed",
"(",
")",
";",
"}",
"$",
"this",
"->",
"refid",
"=",
"$",
"r",
... | Adds a reference to a Path, FileSet, DirSet, or FileList defined
elsewhere.
@param Reference $r
@throws BuildException | [
"Adds",
"a",
"reference",
"to",
"a",
"Path",
"FileSet",
"DirSet",
"or",
"FileList",
"defined",
"elsewhere",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PathConvert.php#L159-L166 | train |
phingofficial/phing | classes/phing/tasks/system/PathConvert.php | PathConvert.mapElement | private function mapElement($elem)
{
$size = count($this->prefixMap);
if ($size !== 0) {
// Iterate over the map entries and apply each one.
// Stop when one of the entries actually changes the element.
foreach ($this->prefixMap as $entry) {
$newElem = $entry->apply((string) $elem);
// Note I'm using "!=" to see if we got a new object back from
// the apply method.
if ($newElem !== (string) $elem) {
$elem = $newElem;
break;// We applied one, so we're done
}
}
}
return $elem;
} | php | private function mapElement($elem)
{
$size = count($this->prefixMap);
if ($size !== 0) {
// Iterate over the map entries and apply each one.
// Stop when one of the entries actually changes the element.
foreach ($this->prefixMap as $entry) {
$newElem = $entry->apply((string) $elem);
// Note I'm using "!=" to see if we got a new object back from
// the apply method.
if ($newElem !== (string) $elem) {
$elem = $newElem;
break;// We applied one, so we're done
}
}
}
return $elem;
} | [
"private",
"function",
"mapElement",
"(",
"$",
"elem",
")",
"{",
"$",
"size",
"=",
"count",
"(",
"$",
"this",
"->",
"prefixMap",
")",
";",
"if",
"(",
"$",
"size",
"!==",
"0",
")",
"{",
"// Iterate over the map entries and apply each one.",
"// Stop when one of... | Apply the configured map to a path element. The map is used to convert
between Windows drive letters and Unix paths. If no map is configured,
then the input string is returned unchanged.
@param string $elem The path element to apply the map to
@return String Updated element | [
"Apply",
"the",
"configured",
"map",
"to",
"a",
"path",
"element",
".",
"The",
"map",
"is",
"used",
"to",
"convert",
"between",
"Windows",
"drive",
"letters",
"and",
"Unix",
"paths",
".",
"If",
"no",
"map",
"is",
"configured",
"then",
"the",
"input",
"st... | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PathConvert.php#L316-L338 | train |
phingofficial/phing | classes/phing/tasks/system/PathConvert.php | PathConvert.validateSetup | private function validateSetup()
{
if ($this->path === null) {
throw new BuildException("You must specify a path to convert");
}
if ($this->property === null) {
throw new BuildException("You must specify a property");
}
// Must either have a target OS or both a dirSep and pathSep
if ($this->targetOS == null && $this->pathSep == null && $this->dirSep == null) {
throw new BuildException(
"You must specify at least one of "
. "targetOS, dirSep, or pathSep"
);
}
// Determine the separator strings. The dirsep and pathsep attributes
// override the targetOS settings.
$dsep = PhingFile::$separator;
$psep = PhingFile::$pathSeparator;
if ($this->targetOS !== null) {
$psep = $this->targetWindows ? ";" : ":";
$dsep = $this->targetWindows ? "\\" : "/";
}
if ($this->pathSep !== null) {// override with pathsep=
$psep = $this->pathSep;
}
if ($this->dirSep !== null) {// override with dirsep=
$dsep = $this->dirSep;
}
$this->pathSep = $psep;
$this->dirSep = $dsep;
} | php | private function validateSetup()
{
if ($this->path === null) {
throw new BuildException("You must specify a path to convert");
}
if ($this->property === null) {
throw new BuildException("You must specify a property");
}
// Must either have a target OS or both a dirSep and pathSep
if ($this->targetOS == null && $this->pathSep == null && $this->dirSep == null) {
throw new BuildException(
"You must specify at least one of "
. "targetOS, dirSep, or pathSep"
);
}
// Determine the separator strings. The dirsep and pathsep attributes
// override the targetOS settings.
$dsep = PhingFile::$separator;
$psep = PhingFile::$pathSeparator;
if ($this->targetOS !== null) {
$psep = $this->targetWindows ? ";" : ":";
$dsep = $this->targetWindows ? "\\" : "/";
}
if ($this->pathSep !== null) {// override with pathsep=
$psep = $this->pathSep;
}
if ($this->dirSep !== null) {// override with dirsep=
$dsep = $this->dirSep;
}
$this->pathSep = $psep;
$this->dirSep = $dsep;
} | [
"private",
"function",
"validateSetup",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"path",
"===",
"null",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"You must specify a path to convert\"",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"property",
... | Validate that all our parameters have been properly initialized.
@throws BuildException if something is not setup properly | [
"Validate",
"that",
"all",
"our",
"parameters",
"have",
"been",
"properly",
"initialized",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PathConvert.php#L359-L398 | train |
phingofficial/phing | classes/phing/tasks/system/TempFile.php | TempFile.setDestDir | public function setDestDir($destDir)
{
if ($destDir instanceof PhingFile) {
$this->destDir = $destDir;
} else {
$this->destDir = new PhingFile($destDir);
}
} | php | public function setDestDir($destDir)
{
if ($destDir instanceof PhingFile) {
$this->destDir = $destDir;
} else {
$this->destDir = new PhingFile($destDir);
}
} | [
"public",
"function",
"setDestDir",
"(",
"$",
"destDir",
")",
"{",
"if",
"(",
"$",
"destDir",
"instanceof",
"PhingFile",
")",
"{",
"$",
"this",
"->",
"destDir",
"=",
"$",
"destDir",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"destDir",
"=",
"new",
"Ph... | Sets the destination directory. If not set,
the basedir directory is used instead.
@param string|PhingFile $destDir The new destDir value | [
"Sets",
"the",
"destination",
"directory",
".",
"If",
"not",
"set",
"the",
"basedir",
"directory",
"is",
"used",
"instead",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/TempFile.php#L91-L98 | train |
phingofficial/phing | classes/phing/tasks/system/TempFile.php | TempFile.main | public function main()
{
if ($this->property === '') {
throw new BuildException('no property specified');
}
if ($this->destDir === null) {
$this->destDir = $this->getProject()->resolveFile('.');
}
$fu = new FileUtils;
$tmpFile = $fu->createTempFile(
$this->prefix,
$this->suffix,
$this->destDir,
$this->deleteOnExit,
$this->createFile
);
$this->getProject()->setNewProperty($this->property, (string) $tmpFile);
} | php | public function main()
{
if ($this->property === '') {
throw new BuildException('no property specified');
}
if ($this->destDir === null) {
$this->destDir = $this->getProject()->resolveFile('.');
}
$fu = new FileUtils;
$tmpFile = $fu->createTempFile(
$this->prefix,
$this->suffix,
$this->destDir,
$this->deleteOnExit,
$this->createFile
);
$this->getProject()->setNewProperty($this->property, (string) $tmpFile);
} | [
"public",
"function",
"main",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"property",
"===",
"''",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"'no property specified'",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"destDir",
"===",
"null",
")",
... | Creates the temporary file.
@throws BuildException if something goes wrong with the build | [
"Creates",
"the",
"temporary",
"file",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/TempFile.php#L168-L185 | train |
phingofficial/phing | classes/phing/tasks/system/TouchTask.php | TouchTask.main | public function main()
{
$savedMillis = $this->millis;
if ($this->file === null && count($this->filesets) === 0 && count($this->filelists) === 0) {
throw new BuildException("Specify at least one source - a file, a fileset or a filelist.");
}
if ($this->file !== null && $this->file->exists() && $this->file->isDirectory()) {
throw new BuildException("Use a fileset to touch directories.");
}
try { // try to touch file
if ($this->dateTime !== null) {
$this->setMillis(strtotime($this->dateTime));
if ($this->millis < 0) {
throw new BuildException("Date of {$this->dateTime} results in negative milliseconds value relative to epoch (January 1, 1970, 00:00:00 GMT).");
}
}
$this->_touch();
} catch (Exception $ex) {
throw new BuildException("Error touch()ing file", $ex, $this->getLocation());
}
$this->millis = $savedMillis;
} | php | public function main()
{
$savedMillis = $this->millis;
if ($this->file === null && count($this->filesets) === 0 && count($this->filelists) === 0) {
throw new BuildException("Specify at least one source - a file, a fileset or a filelist.");
}
if ($this->file !== null && $this->file->exists() && $this->file->isDirectory()) {
throw new BuildException("Use a fileset to touch directories.");
}
try { // try to touch file
if ($this->dateTime !== null) {
$this->setMillis(strtotime($this->dateTime));
if ($this->millis < 0) {
throw new BuildException("Date of {$this->dateTime} results in negative milliseconds value relative to epoch (January 1, 1970, 00:00:00 GMT).");
}
}
$this->_touch();
} catch (Exception $ex) {
throw new BuildException("Error touch()ing file", $ex, $this->getLocation());
}
$this->millis = $savedMillis;
} | [
"public",
"function",
"main",
"(",
")",
"{",
"$",
"savedMillis",
"=",
"$",
"this",
"->",
"millis",
";",
"if",
"(",
"$",
"this",
"->",
"file",
"===",
"null",
"&&",
"count",
"(",
"$",
"this",
"->",
"filesets",
")",
"===",
"0",
"&&",
"count",
"(",
"... | Execute the touch operation.
@throws BuildException
@throws IOException | [
"Execute",
"the",
"touch",
"operation",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/TouchTask.php#L117-L142 | train |
phingofficial/phing | classes/phing/types/selectors/TypeSelector.php | TypeSelector.verifySettings | public function verifySettings()
{
if ($this->type === null) {
$this->setError("The type attribute is required");
} elseif (!in_array($this->type, self::$types, true)) {
$this->setError("Invalid type specified; must be one of (" . implode(self::$types) . ")");
}
} | php | public function verifySettings()
{
if ($this->type === null) {
$this->setError("The type attribute is required");
} elseif (!in_array($this->type, self::$types, true)) {
$this->setError("Invalid type specified; must be one of (" . implode(self::$types) . ")");
}
} | [
"public",
"function",
"verifySettings",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"type",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"setError",
"(",
"\"The type attribute is required\"",
")",
";",
"}",
"elseif",
"(",
"!",
"in_array",
"(",
"$",
"this... | Checks to make sure all settings are kosher. In this case, it
means that the pattern attribute has been set. | [
"Checks",
"to",
"make",
"sure",
"all",
"settings",
"are",
"kosher",
".",
"In",
"this",
"case",
"it",
"means",
"that",
"the",
"pattern",
"attribute",
"has",
"been",
"set",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/selectors/TypeSelector.php#L87-L94 | train |
phingofficial/phing | classes/phing/tasks/system/AttribTask.php | AttribTask.setFile | public function setFile(PhingFile $src)
{
$fs = new FileSet();
$fs->setFile($src);
$this->addFileSet($fs);
} | php | public function setFile(PhingFile $src)
{
$fs = new FileSet();
$fs->setFile($src);
$this->addFileSet($fs);
} | [
"public",
"function",
"setFile",
"(",
"PhingFile",
"$",
"src",
")",
"{",
"$",
"fs",
"=",
"new",
"FileSet",
"(",
")",
";",
"$",
"fs",
"->",
"setFile",
"(",
"$",
"src",
")",
";",
"$",
"this",
"->",
"addFileSet",
"(",
"$",
"fs",
")",
";",
"}"
] | A file to be attribed.
@param PhingFile $src a file | [
"A",
"file",
"to",
"be",
"attribed",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/AttribTask.php#L74-L79 | train |
phingofficial/phing | classes/phing/filters/IconvFilter.php | IconvFilter.chain | public function chain(Reader $reader)
{
$filter = new self($reader);
$filter->setInputEncoding($this->getInputEncoding());
$filter->setOutputEncoding($this->getOutputEncoding());
$filter->setInitialized(true);
$filter->setProject($this->getProject());
return $filter;
} | php | public function chain(Reader $reader)
{
$filter = new self($reader);
$filter->setInputEncoding($this->getInputEncoding());
$filter->setOutputEncoding($this->getOutputEncoding());
$filter->setInitialized(true);
$filter->setProject($this->getProject());
return $filter;
} | [
"public",
"function",
"chain",
"(",
"Reader",
"$",
"reader",
")",
"{",
"$",
"filter",
"=",
"new",
"self",
"(",
"$",
"reader",
")",
";",
"$",
"filter",
"->",
"setInputEncoding",
"(",
"$",
"this",
"->",
"getInputEncoding",
"(",
")",
")",
";",
"$",
"fil... | Creates a new IconvFilter using the passed in Reader for instantiation.
@param Reader $reader
@internal param A $object Reader object providing the underlying stream. Must not be <code>null</code>.
@return self A new filter based on this configuration, but filtering the specified reader. | [
"Creates",
"a",
"new",
"IconvFilter",
"using",
"the",
"passed",
"in",
"Reader",
"for",
"instantiation",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/IconvFilter.php#L121-L132 | train |
phingofficial/phing | classes/phing/filters/IconvFilter.php | IconvFilter._initialize | private function _initialize()
{
if ($this->getInitialized()) {
return;
}
$params = $this->getParameters();
if ($params !== null) {
foreach ($params as $param) {
if ('in' == $param->getName()) {
$this->setInputEncoding($param->getValue());
} else {
if ('out' == $param->getName()) {
$this->setOutputEncoding($param->getValue());
}
}
}
}
$this->setInitialized(true);
} | php | private function _initialize()
{
if ($this->getInitialized()) {
return;
}
$params = $this->getParameters();
if ($params !== null) {
foreach ($params as $param) {
if ('in' == $param->getName()) {
$this->setInputEncoding($param->getValue());
} else {
if ('out' == $param->getName()) {
$this->setOutputEncoding($param->getValue());
}
}
}
}
$this->setInitialized(true);
} | [
"private",
"function",
"_initialize",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getInitialized",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"params",
"=",
"$",
"this",
"->",
"getParameters",
"(",
")",
";",
"if",
"(",
"$",
"params",
"!==",
"nu... | Configuring object from the parameters list. | [
"Configuring",
"object",
"from",
"the",
"parameters",
"list",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/IconvFilter.php#L137-L157 | train |
phingofficial/phing | classes/phing/tasks/ext/inifile/IniFileTask.php | IniFileTask.checkReadFile | public function checkReadFile($readFile)
{
if (null === $readFile) {
return false;
}
if (!file_exists($readFile)) {
$msg = "$readFile does not exist.";
if ($this->haltonerror) {
throw new BuildException($msg);
}
$this->log($msg, Project::MSG_ERR);
return false;
}
if (!is_readable($readFile)) {
$msg = "$readFile is not readable.";
if ($this->haltonerror) {
throw new BuildException($msg);
}
$this->log($msg, Project::MSG_ERR);
return false;
}
$this->ini->read($readFile);
$this->log("Read from $readFile");
return true;
} | php | public function checkReadFile($readFile)
{
if (null === $readFile) {
return false;
}
if (!file_exists($readFile)) {
$msg = "$readFile does not exist.";
if ($this->haltonerror) {
throw new BuildException($msg);
}
$this->log($msg, Project::MSG_ERR);
return false;
}
if (!is_readable($readFile)) {
$msg = "$readFile is not readable.";
if ($this->haltonerror) {
throw new BuildException($msg);
}
$this->log($msg, Project::MSG_ERR);
return false;
}
$this->ini->read($readFile);
$this->log("Read from $readFile");
return true;
} | [
"public",
"function",
"checkReadFile",
"(",
"$",
"readFile",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"readFile",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"readFile",
")",
")",
"{",
"$",
"msg",
"=",
"\"$readFile... | Check file to be read from
@param string $readFile Filename
@return bool | [
"Check",
"file",
"to",
"be",
"read",
"from"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/inifile/IniFileTask.php#L102-L126 | train |
phingofficial/phing | classes/phing/tasks/ext/inifile/IniFileTask.php | IniFileTask.checkWriteFile | public function checkWriteFile($writeFile)
{
if (file_exists($writeFile) && !is_writable($writeFile)) {
$msg = "$writeFile is not writable";
if ($this->haltonerror) {
throw new BuildException($msg);
}
$this->log($msg, Project::MSG_ERR);
return false;
}
return true;
} | php | public function checkWriteFile($writeFile)
{
if (file_exists($writeFile) && !is_writable($writeFile)) {
$msg = "$writeFile is not writable";
if ($this->haltonerror) {
throw new BuildException($msg);
}
$this->log($msg, Project::MSG_ERR);
return false;
}
return true;
} | [
"public",
"function",
"checkWriteFile",
"(",
"$",
"writeFile",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"writeFile",
")",
"&&",
"!",
"is_writable",
"(",
"$",
"writeFile",
")",
")",
"{",
"$",
"msg",
"=",
"\"$writeFile is not writable\"",
";",
"if",
"("... | Check file to write to
@param string $writeFile Filename
@return bool | [
"Check",
"file",
"to",
"write",
"to"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/inifile/IniFileTask.php#L135-L146 | train |
phingofficial/phing | classes/phing/tasks/ext/inifile/IniFileTask.php | IniFileTask.enumerateGets | public function enumerateGets()
{
foreach ($this->gets as $get) {
$outProperty = $get->getOutputProperty();
$property = $get->getProperty();
$section = $get->getSection();
$value = '';
if ($property === null) {
throw new BuildException("property must be set");
}
if ($outProperty === null) {
throw new BuildException("outputproperty must be set");
}
if ($section === null) {
throw new BuildException("section must be set");
}
try {
$value = $this->ini->get($section, $property);
} catch (RuntimeException $ex) {
$this->logDebugOrMore(
sprintf(
'%s: section = %s; key = %s',
$ex->getMessage(),
$section,
$property
)
);
} finally {
if ($value === '') {
$value = $get->getDefault();
}
}
$project = $this->getProject();
$project->setProperty($outProperty, $value);
$this->logDebugOrMore(
sprintf(
'Set property %s to value \'%s\' read from key %s in section %s',
$outProperty,
$value,
$property,
$section
)
);
}
} | php | public function enumerateGets()
{
foreach ($this->gets as $get) {
$outProperty = $get->getOutputProperty();
$property = $get->getProperty();
$section = $get->getSection();
$value = '';
if ($property === null) {
throw new BuildException("property must be set");
}
if ($outProperty === null) {
throw new BuildException("outputproperty must be set");
}
if ($section === null) {
throw new BuildException("section must be set");
}
try {
$value = $this->ini->get($section, $property);
} catch (RuntimeException $ex) {
$this->logDebugOrMore(
sprintf(
'%s: section = %s; key = %s',
$ex->getMessage(),
$section,
$property
)
);
} finally {
if ($value === '') {
$value = $get->getDefault();
}
}
$project = $this->getProject();
$project->setProperty($outProperty, $value);
$this->logDebugOrMore(
sprintf(
'Set property %s to value \'%s\' read from key %s in section %s',
$outProperty,
$value,
$property,
$section
)
);
}
} | [
"public",
"function",
"enumerateGets",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"gets",
"as",
"$",
"get",
")",
"{",
"$",
"outProperty",
"=",
"$",
"get",
"->",
"getOutputProperty",
"(",
")",
";",
"$",
"property",
"=",
"$",
"get",
"->",
"getPr... | Work through all Get commands.
@return void | [
"Work",
"through",
"all",
"Get",
"commands",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/inifile/IniFileTask.php#L215-L261 | train |
phingofficial/phing | classes/phing/tasks/ext/inifile/IniFileTask.php | IniFileTask.enumerateSets | public function enumerateSets()
{
foreach ($this->sets as $set) {
$value = $set->getValue();
$key = $set->getProperty();
$section = $set->getSection();
$operation = $set->getOperation();
if ($value !== null) {
try {
$this->ini->set($section, $key, $value);
$this->logDebugOrMore("[$section] $key set to $value");
} catch (Exception $ex) {
$this->log(
"Error setting value for section '" . $section .
"', key '" . $key ."'",
Project::MSG_ERR
);
$this->logDebugOrMore($ex->getMessage());
}
} elseif ($operation !== null) {
$v = $this->ini->get($section, $key);
// value might be wrapped in quotes with a semicolon at the end
if (!is_numeric($v)) {
if (preg_match('/^"(\d*)";?$/', $v, $match)) {
$v = $match[1];
} elseif (preg_match("/^'(\d*)';?$/", $v, $match)) {
$v = $match[1];
} else {
$this->log(
"Value $v is not numeric. Skipping $operation operation."
);
continue;
}
}
if ($operation == '+') {
++$v;
} elseif ($operation == '-') {
--$v;
} else {
if (($operation != '-') && ($operation != '+')) {
$msg = "Unrecognised operation $operation";
if ($this->haltonerror) {
throw new BuildException($msg);
}
$this->log($msg, Project::MSG_ERR);
}
}
try {
$this->ini->set($section, $key, $v);
$this->logDebugOrMore("[$section] $key set to $v");
} catch (Exception $ex) {
$this->log(
"Error setting value for section '" . $section .
"', key '" . $key ."'"
);
$this->logDebugOrMore($ex->getMessage());
}
} else {
$this->log(
"Set: value and operation are both not set",
Project::MSG_ERR
);
}
}
} | php | public function enumerateSets()
{
foreach ($this->sets as $set) {
$value = $set->getValue();
$key = $set->getProperty();
$section = $set->getSection();
$operation = $set->getOperation();
if ($value !== null) {
try {
$this->ini->set($section, $key, $value);
$this->logDebugOrMore("[$section] $key set to $value");
} catch (Exception $ex) {
$this->log(
"Error setting value for section '" . $section .
"', key '" . $key ."'",
Project::MSG_ERR
);
$this->logDebugOrMore($ex->getMessage());
}
} elseif ($operation !== null) {
$v = $this->ini->get($section, $key);
// value might be wrapped in quotes with a semicolon at the end
if (!is_numeric($v)) {
if (preg_match('/^"(\d*)";?$/', $v, $match)) {
$v = $match[1];
} elseif (preg_match("/^'(\d*)';?$/", $v, $match)) {
$v = $match[1];
} else {
$this->log(
"Value $v is not numeric. Skipping $operation operation."
);
continue;
}
}
if ($operation == '+') {
++$v;
} elseif ($operation == '-') {
--$v;
} else {
if (($operation != '-') && ($operation != '+')) {
$msg = "Unrecognised operation $operation";
if ($this->haltonerror) {
throw new BuildException($msg);
}
$this->log($msg, Project::MSG_ERR);
}
}
try {
$this->ini->set($section, $key, $v);
$this->logDebugOrMore("[$section] $key set to $v");
} catch (Exception $ex) {
$this->log(
"Error setting value for section '" . $section .
"', key '" . $key ."'"
);
$this->logDebugOrMore($ex->getMessage());
}
} else {
$this->log(
"Set: value and operation are both not set",
Project::MSG_ERR
);
}
}
} | [
"public",
"function",
"enumerateSets",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"sets",
"as",
"$",
"set",
")",
"{",
"$",
"value",
"=",
"$",
"set",
"->",
"getValue",
"(",
")",
";",
"$",
"key",
"=",
"$",
"set",
"->",
"getProperty",
"(",
")... | Work through all Set commands.
@return void | [
"Work",
"through",
"all",
"Set",
"commands",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/inifile/IniFileTask.php#L268-L332 | train |
phingofficial/phing | classes/phing/tasks/ext/inifile/IniFileTask.php | IniFileTask.enumerateRemoves | public function enumerateRemoves()
{
foreach ($this->removals as $remove) {
$key = $remove->getProperty();
$section = $remove->getSection();
if ($section == '') {
$this->log(
"Remove: section must be set",
Project::MSG_ERR
);
continue;
}
$this->ini->remove($section, $key);
if (($section != '') && ($key != '')) {
$this->logDebugOrMore(
"$key in section [$section] has been removed."
);
} elseif (($section != '') && ($key == '')) {
$this->logDebugOrMore("[$section] has been removed.");
}
}
} | php | public function enumerateRemoves()
{
foreach ($this->removals as $remove) {
$key = $remove->getProperty();
$section = $remove->getSection();
if ($section == '') {
$this->log(
"Remove: section must be set",
Project::MSG_ERR
);
continue;
}
$this->ini->remove($section, $key);
if (($section != '') && ($key != '')) {
$this->logDebugOrMore(
"$key in section [$section] has been removed."
);
} elseif (($section != '') && ($key == '')) {
$this->logDebugOrMore("[$section] has been removed.");
}
}
} | [
"public",
"function",
"enumerateRemoves",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"removals",
"as",
"$",
"remove",
")",
"{",
"$",
"key",
"=",
"$",
"remove",
"->",
"getProperty",
"(",
")",
";",
"$",
"section",
"=",
"$",
"remove",
"->",
"getS... | Work through all Remove commands.
@return void | [
"Work",
"through",
"all",
"Remove",
"commands",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/inifile/IniFileTask.php#L339-L360 | train |
phingofficial/phing | classes/phing/tasks/ext/inifile/IniFileTask.php | IniFileTask.logDebugOrMore | public function logDebugOrMore($message)
{
$this->log($message, Project::MSG_DEBUG);
if ($this->verbose) {
$this->log($message);
return true;
}
return false;
} | php | public function logDebugOrMore($message)
{
$this->log($message, Project::MSG_DEBUG);
if ($this->verbose) {
$this->log($message);
return true;
}
return false;
} | [
"public",
"function",
"logDebugOrMore",
"(",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"$",
"message",
",",
"Project",
"::",
"MSG_DEBUG",
")",
";",
"if",
"(",
"$",
"this",
"->",
"verbose",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"$"... | Log message at Debug level. If verbose prop is set, also log it at normal
@param string $message Message to log
@return bool False if message is only logged at debug level. | [
"Log",
"message",
"at",
"Debug",
"level",
".",
"If",
"verbose",
"prop",
"is",
"set",
"also",
"log",
"it",
"at",
"normal"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/inifile/IniFileTask.php#L455-L463 | train |
phingofficial/phing | classes/phing/tasks/system/MatchingTask.php | MatchingTask.getDirectoryScanner | protected function getDirectoryScanner(PhingFile $baseDir)
{
$this->fileset->setDir($baseDir);
$this->fileset->setDefaultexcludes($this->useDefaultExcludes);
return $this->fileset->getDirectoryScanner($this->project);
} | php | protected function getDirectoryScanner(PhingFile $baseDir)
{
$this->fileset->setDir($baseDir);
$this->fileset->setDefaultexcludes($this->useDefaultExcludes);
return $this->fileset->getDirectoryScanner($this->project);
} | [
"protected",
"function",
"getDirectoryScanner",
"(",
"PhingFile",
"$",
"baseDir",
")",
"{",
"$",
"this",
"->",
"fileset",
"->",
"setDir",
"(",
"$",
"baseDir",
")",
";",
"$",
"this",
"->",
"fileset",
"->",
"setDefaultexcludes",
"(",
"$",
"this",
"->",
"useD... | Returns the directory scanner needed to access the files to process.
@param PhingFile $baseDir
@throws BuildException
@return DirectoryScanner | [
"Returns",
"the",
"directory",
"scanner",
"needed",
"to",
"access",
"the",
"files",
"to",
"process",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/MatchingTask.php#L159-L165 | train |
phingofficial/phing | classes/phing/tasks/ext/phpmd/PHPMDTask.php | PHPMDTask.main | public function main()
{
$className = $this->loadDependencies();
if (!isset($this->file) and count($this->filesets) == 0) {
throw new BuildException('Missing either a nested fileset or attribute "file" set');
}
if (count($this->formatters) == 0) {
// turn legacy format attribute into formatter
$fmt = new PHPMDFormatterElement();
$fmt->setType($this->format);
$fmt->setUseFile(false);
$this->formatters[] = $fmt;
}
$reportRenderers = [];
foreach ($this->formatters as $fe) {
if ($fe->getType() == '') {
throw new BuildException('Formatter missing required "type" attribute.');
}
if ($fe->getUsefile() && $fe->getOutfile() === null) {
throw new BuildException('Formatter requires "outfile" attribute when "useFile" is true.');
}
$reportRenderers[] = $fe->getRenderer();
}
if ($this->newVersion && $this->cache) {
$reportRenderers[] = new PHPMDRendererRemoveFromCache($this->cache);
} else {
$this->cache = null; // cache not compatible to old version
}
// Create a rule set factory
if ($this->newVersion) {
$ruleSetFactory = new \PHPMD\RuleSetFactory();
} else {
if (!class_exists("PHP_PMD_RuleSetFactory")) {
@include 'PHP/PMD/RuleSetFactory.php';
}
$ruleSetFactory = new PHP_PMD_RuleSetFactory();
}
$ruleSetFactory->setMinimumPriority($this->minimumPriority);
/**
* @var PHPMD\PHPMD $phpmd
*/
$phpmd = new $className();
$phpmd->setFileExtensions($this->allowedFileExtensions);
$phpmd->setIgnorePattern($this->ignorePatterns);
$filesToParse = $this->getFilesToParse();
if (count($filesToParse) > 0) {
$inputPath = implode(',', $filesToParse);
$this->log('Processing files...');
$phpmd->processFiles($inputPath, $this->rulesets, $reportRenderers, $ruleSetFactory);
if ($this->cache) {
$this->cache->commit();
}
$this->log('Finished processing files');
} else {
$this->log('No files to process');
}
} | php | public function main()
{
$className = $this->loadDependencies();
if (!isset($this->file) and count($this->filesets) == 0) {
throw new BuildException('Missing either a nested fileset or attribute "file" set');
}
if (count($this->formatters) == 0) {
// turn legacy format attribute into formatter
$fmt = new PHPMDFormatterElement();
$fmt->setType($this->format);
$fmt->setUseFile(false);
$this->formatters[] = $fmt;
}
$reportRenderers = [];
foreach ($this->formatters as $fe) {
if ($fe->getType() == '') {
throw new BuildException('Formatter missing required "type" attribute.');
}
if ($fe->getUsefile() && $fe->getOutfile() === null) {
throw new BuildException('Formatter requires "outfile" attribute when "useFile" is true.');
}
$reportRenderers[] = $fe->getRenderer();
}
if ($this->newVersion && $this->cache) {
$reportRenderers[] = new PHPMDRendererRemoveFromCache($this->cache);
} else {
$this->cache = null; // cache not compatible to old version
}
// Create a rule set factory
if ($this->newVersion) {
$ruleSetFactory = new \PHPMD\RuleSetFactory();
} else {
if (!class_exists("PHP_PMD_RuleSetFactory")) {
@include 'PHP/PMD/RuleSetFactory.php';
}
$ruleSetFactory = new PHP_PMD_RuleSetFactory();
}
$ruleSetFactory->setMinimumPriority($this->minimumPriority);
/**
* @var PHPMD\PHPMD $phpmd
*/
$phpmd = new $className();
$phpmd->setFileExtensions($this->allowedFileExtensions);
$phpmd->setIgnorePattern($this->ignorePatterns);
$filesToParse = $this->getFilesToParse();
if (count($filesToParse) > 0) {
$inputPath = implode(',', $filesToParse);
$this->log('Processing files...');
$phpmd->processFiles($inputPath, $this->rulesets, $reportRenderers, $ruleSetFactory);
if ($this->cache) {
$this->cache->commit();
}
$this->log('Finished processing files');
} else {
$this->log('No files to process');
}
} | [
"public",
"function",
"main",
"(",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"loadDependencies",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"file",
")",
"and",
"count",
"(",
"$",
"this",
"->",
"filesets",
")",
"==",
... | Executes PHPMD against PhingFile or a FileSet
@throws BuildException - if the phpmd classes can't be loaded. | [
"Executes",
"PHPMD",
"against",
"PhingFile",
"or",
"a",
"FileSet"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/phpmd/PHPMDTask.php#L282-L354 | train |
phingofficial/phing | classes/phing/UnknownElement.php | UnknownElement.maybeConfigure | public function maybeConfigure()
{
$this->realThing = $this->makeObject($this, $this->wrapper);
$this->wrapper->setProxy($this->realThing);
if ($this->realThing instanceof Task) {
$this->realThing->setRuntimeConfigurableWrapper($this->wrapper);
$this->realThing->maybeConfigure();
} else {
$this->wrapper->maybeConfigure($this->getProject());
}
$this->handleChildren($this->realThing, $this->wrapper);
} | php | public function maybeConfigure()
{
$this->realThing = $this->makeObject($this, $this->wrapper);
$this->wrapper->setProxy($this->realThing);
if ($this->realThing instanceof Task) {
$this->realThing->setRuntimeConfigurableWrapper($this->wrapper);
$this->realThing->maybeConfigure();
} else {
$this->wrapper->maybeConfigure($this->getProject());
}
$this->handleChildren($this->realThing, $this->wrapper);
} | [
"public",
"function",
"maybeConfigure",
"(",
")",
"{",
"$",
"this",
"->",
"realThing",
"=",
"$",
"this",
"->",
"makeObject",
"(",
"$",
"this",
",",
"$",
"this",
"->",
"wrapper",
")",
";",
"$",
"this",
"->",
"wrapper",
"->",
"setProxy",
"(",
"$",
"thi... | Tries to configure the unknown element
@throws BuildException if the element can not be configured | [
"Tries",
"to",
"configure",
"the",
"unknown",
"element"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/UnknownElement.php#L65-L76 | train |
phingofficial/phing | classes/phing/UnknownElement.php | UnknownElement.main | public function main()
{
if ($this->realThing === null) {
// plain impossible to get here, maybeConfigure should
// have thrown an exception.
throw new BuildException("Should not be executing UnknownElement::main() -- task/type: {$this->elementName}");
}
if ($this->realThing instanceof Task) {
$this->realThing->main();
}
} | php | public function main()
{
if ($this->realThing === null) {
// plain impossible to get here, maybeConfigure should
// have thrown an exception.
throw new BuildException("Should not be executing UnknownElement::main() -- task/type: {$this->elementName}");
}
if ($this->realThing instanceof Task) {
$this->realThing->main();
}
} | [
"public",
"function",
"main",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"realThing",
"===",
"null",
")",
"{",
"// plain impossible to get here, maybeConfigure should",
"// have thrown an exception.",
"throw",
"new",
"BuildException",
"(",
"\"Should not be executing Unk... | Called when the real task has been configured for the first time.
@throws BuildException if the task can not be created | [
"Called",
"when",
"the",
"real",
"task",
"has",
"been",
"configured",
"for",
"the",
"first",
"time",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/UnknownElement.php#L83-L94 | train |
phingofficial/phing | classes/phing/UnknownElement.php | UnknownElement.handleChildren | public function handleChildren($parent, $parentWrapper)
{
if ($parent instanceof TaskAdapter) {
$parent = $parent->getProxy();
}
$parentClass = $parent === null ? get_class() : get_class($parent);
$ih = IntrospectionHelper::getHelper($parentClass);
for ($i = 0, $childrenCount = count($this->children); $i < $childrenCount; $i++) {
$childWrapper = $parentWrapper->getChild($i);
$child = $this->children[$i];
$realChild = null;
if ($parent instanceof TaskContainer) {
$parent->addTask($child);
continue;
}
$project = $this->project === null ? $parent->project : $this->project;
$realChild = $ih->createElement($project, $parent, $child->getTag());
$childWrapper->setProxy($realChild);
if ($realChild instanceof Task) {
$realChild->setRuntimeConfigurableWrapper($childWrapper);
}
$childWrapper->maybeConfigure($this->project);
$child->handleChildren($realChild, $childWrapper);
}
} | php | public function handleChildren($parent, $parentWrapper)
{
if ($parent instanceof TaskAdapter) {
$parent = $parent->getProxy();
}
$parentClass = $parent === null ? get_class() : get_class($parent);
$ih = IntrospectionHelper::getHelper($parentClass);
for ($i = 0, $childrenCount = count($this->children); $i < $childrenCount; $i++) {
$childWrapper = $parentWrapper->getChild($i);
$child = $this->children[$i];
$realChild = null;
if ($parent instanceof TaskContainer) {
$parent->addTask($child);
continue;
}
$project = $this->project === null ? $parent->project : $this->project;
$realChild = $ih->createElement($project, $parent, $child->getTag());
$childWrapper->setProxy($realChild);
if ($realChild instanceof Task) {
$realChild->setRuntimeConfigurableWrapper($childWrapper);
}
$childWrapper->maybeConfigure($this->project);
$child->handleChildren($realChild, $childWrapper);
}
} | [
"public",
"function",
"handleChildren",
"(",
"$",
"parent",
",",
"$",
"parentWrapper",
")",
"{",
"if",
"(",
"$",
"parent",
"instanceof",
"TaskAdapter",
")",
"{",
"$",
"parent",
"=",
"$",
"parent",
"->",
"getProxy",
"(",
")",
";",
"}",
"$",
"parentClass",... | Handle child elemets of the unknown element, if any.
@param object $parent The parent object the unknown element belongs to
@param object $parentWrapper The parent wrapper object | [
"Handle",
"child",
"elemets",
"of",
"the",
"unknown",
"element",
"if",
"any",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/UnknownElement.php#L113-L143 | train |
phingofficial/phing | classes/phing/UnknownElement.php | UnknownElement.getTaskName | public function getTaskName()
{
return $this->realThing === null || !$this->realThing instanceof Task
? parent::getTaskName()
: $this->realThing->getTaskName();
} | php | public function getTaskName()
{
return $this->realThing === null || !$this->realThing instanceof Task
? parent::getTaskName()
: $this->realThing->getTaskName();
} | [
"public",
"function",
"getTaskName",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"realThing",
"===",
"null",
"||",
"!",
"$",
"this",
"->",
"realThing",
"instanceof",
"Task",
"?",
"parent",
"::",
"getTaskName",
"(",
")",
":",
"$",
"this",
"->",
"realThing... | Get the name of the task to use in logging messages.
@return string The task's name | [
"Get",
"the",
"name",
"of",
"the",
"task",
"to",
"use",
"in",
"logging",
"messages",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/UnknownElement.php#L214-L219 | train |
phingofficial/phing | classes/phing/types/selectors/DependSelector.php | DependSelector.verifySettings | public function verifySettings()
{
if ($this->targetdir === null) {
$this->setError("The targetdir attribute is required.");
}
if ($this->mapperElement === null) {
$this->map = new IdentityMapper();
} else {
$this->map = $this->mapperElement->getImplementation();
}
if ($this->map === null) {
$this->setError("Could not set <mapper> element.");
}
} | php | public function verifySettings()
{
if ($this->targetdir === null) {
$this->setError("The targetdir attribute is required.");
}
if ($this->mapperElement === null) {
$this->map = new IdentityMapper();
} else {
$this->map = $this->mapperElement->getImplementation();
}
if ($this->map === null) {
$this->setError("Could not set <mapper> element.");
}
} | [
"public",
"function",
"verifySettings",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"targetdir",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"setError",
"(",
"\"The targetdir attribute is required.\"",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"mapperE... | Checks to make sure all settings are kosher. In this case, it
means that the dest attribute has been set and we have a mapper. | [
"Checks",
"to",
"make",
"sure",
"all",
"settings",
"are",
"kosher",
".",
"In",
"this",
"case",
"it",
"means",
"that",
"the",
"dest",
"attribute",
"has",
"been",
"set",
"and",
"we",
"have",
"a",
"mapper",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/selectors/DependSelector.php#L104-L117 | train |
phingofficial/phing | classes/phing/filters/PrefixLines.php | PrefixLines.read | public function read($len = null)
{
if (!$this->getInitialized()) {
$this->_initialize();
$this->setInitialized(true);
}
$buffer = $this->in->read($len);
if ($buffer === -1) {
return -1;
}
$lines = explode("\n", $buffer);
$filtered = [];
foreach ($lines as $line) {
$line = $this->_prefix . $line;
$filtered[] = $line;
}
$filtered_buffer = implode("\n", $filtered);
return $filtered_buffer;
} | php | public function read($len = null)
{
if (!$this->getInitialized()) {
$this->_initialize();
$this->setInitialized(true);
}
$buffer = $this->in->read($len);
if ($buffer === -1) {
return -1;
}
$lines = explode("\n", $buffer);
$filtered = [];
foreach ($lines as $line) {
$line = $this->_prefix . $line;
$filtered[] = $line;
}
$filtered_buffer = implode("\n", $filtered);
return $filtered_buffer;
} | [
"public",
"function",
"read",
"(",
"$",
"len",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getInitialized",
"(",
")",
")",
"{",
"$",
"this",
"->",
"_initialize",
"(",
")",
";",
"$",
"this",
"->",
"setInitialized",
"(",
"true",
")",
... | Adds a prefix to each line of input stream and returns resulting stream.
@param null $len
@return mixed buffer, -1 on EOF | [
"Adds",
"a",
"prefix",
"to",
"each",
"line",
"of",
"input",
"stream",
"and",
"returns",
"resulting",
"stream",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/PrefixLines.php#L60-L84 | train |
phingofficial/phing | classes/phing/Target.php | Target.setDepends | public function setDepends($depends)
{
// explode should be faster than strtok
$deps = explode(',', $depends);
for ($i = 0, $size = count($deps); $i < $size; $i++) {
$trimmed = trim($deps[$i]);
if ($trimmed === "") {
throw new BuildException(
"Syntax Error: Depend attribute for target " . $this->getName() . " is malformed."
);
}
$this->addDependency($trimmed);
}
} | php | public function setDepends($depends)
{
// explode should be faster than strtok
$deps = explode(',', $depends);
for ($i = 0, $size = count($deps); $i < $size; $i++) {
$trimmed = trim($deps[$i]);
if ($trimmed === "") {
throw new BuildException(
"Syntax Error: Depend attribute for target " . $this->getName() . " is malformed."
);
}
$this->addDependency($trimmed);
}
} | [
"public",
"function",
"setDepends",
"(",
"$",
"depends",
")",
"{",
"// explode should be faster than strtok",
"$",
"deps",
"=",
"explode",
"(",
"','",
",",
"$",
"depends",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
",",
"$",
"size",
"=",
"count",
"(",
"... | Sets the target dependencies from xml
@param string $depends Comma separated list of targetnames that depend on
this target
@throws BuildException | [
"Sets",
"the",
"target",
"dependencies",
"from",
"xml"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Target.php#L122-L135 | train |
phingofficial/phing | classes/phing/Target.php | Target.getTasks | public function getTasks()
{
$tasks = [];
for ($i = 0, $size = count($this->children); $i < $size; $i++) {
$tsk = $this->children[$i];
if ($tsk instanceof Task) {
// note: we're copying objects here!
$tasks[] = clone $tsk;
}
}
return $tasks;
} | php | public function getTasks()
{
$tasks = [];
for ($i = 0, $size = count($this->children); $i < $size; $i++) {
$tsk = $this->children[$i];
if ($tsk instanceof Task) {
// note: we're copying objects here!
$tasks[] = clone $tsk;
}
}
return $tasks;
} | [
"public",
"function",
"getTasks",
"(",
")",
"{",
"$",
"tasks",
"=",
"[",
"]",
";",
"for",
"(",
"$",
"i",
"=",
"0",
",",
"$",
"size",
"=",
"count",
"(",
"$",
"this",
"->",
"children",
")",
";",
"$",
"i",
"<",
"$",
"size",
";",
"$",
"i",
"++"... | Returns an array of all tasks this target has as childrens.
The task objects are copied here. Don't use this method to modify
task objects.
@return array Task[] | [
"Returns",
"an",
"array",
"of",
"all",
"tasks",
"this",
"target",
"has",
"as",
"childrens",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Target.php#L239-L251 | train |
phingofficial/phing | classes/phing/Target.php | Target.setDescription | public function setDescription($description)
{
if ($description !== null && strcmp($description, "") !== 0) {
$this->description = (string) $description;
} else {
$this->description = null;
}
} | php | public function setDescription($description)
{
if ($description !== null && strcmp($description, "") !== 0) {
$this->description = (string) $description;
} else {
$this->description = null;
}
} | [
"public",
"function",
"setDescription",
"(",
"$",
"description",
")",
"{",
"if",
"(",
"$",
"description",
"!==",
"null",
"&&",
"strcmp",
"(",
"$",
"description",
",",
"\"\"",
")",
"!==",
"0",
")",
"{",
"$",
"this",
"->",
"description",
"=",
"(",
"strin... | Sets a textual description of this target.
@param string $description The description text | [
"Sets",
"a",
"textual",
"description",
"of",
"this",
"target",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Target.php#L281-L288 | train |
phingofficial/phing | classes/phing/Target.php | Target.main | public function main()
{
if ($this->testIfCondition() && $this->testUnlessCondition()) {
foreach ($this->children as $o) {
if ($o instanceof Task) {
// child is a task
$o->perform();
} elseif ($o instanceof RuntimeConfigurable) {
// child is a RuntimeConfigurable
$o->maybeConfigure($this->project);
}
}
} elseif (!$this->testIfCondition()) {
$this->project->log(
"Skipped target '" . $this->name . "' because property '" . $this->ifCondition . "' not set.",
$this->getLogSkipped() ? Project::MSG_INFO : Project::MSG_VERBOSE
);
} else {
$this->project->log(
"Skipped target '" . $this->name . "' because property '" . $this->unlessCondition . "' set.",
$this->getLogSkipped() ? Project::MSG_INFO : Project::MSG_VERBOSE
);
}
} | php | public function main()
{
if ($this->testIfCondition() && $this->testUnlessCondition()) {
foreach ($this->children as $o) {
if ($o instanceof Task) {
// child is a task
$o->perform();
} elseif ($o instanceof RuntimeConfigurable) {
// child is a RuntimeConfigurable
$o->maybeConfigure($this->project);
}
}
} elseif (!$this->testIfCondition()) {
$this->project->log(
"Skipped target '" . $this->name . "' because property '" . $this->ifCondition . "' not set.",
$this->getLogSkipped() ? Project::MSG_INFO : Project::MSG_VERBOSE
);
} else {
$this->project->log(
"Skipped target '" . $this->name . "' because property '" . $this->unlessCondition . "' set.",
$this->getLogSkipped() ? Project::MSG_INFO : Project::MSG_VERBOSE
);
}
} | [
"public",
"function",
"main",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"testIfCondition",
"(",
")",
"&&",
"$",
"this",
"->",
"testUnlessCondition",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"children",
"as",
"$",
"o",
")",
"{",
"if... | The entry point for this class. Does some checking, then processes and
performs the tasks for this target. | [
"The",
"entry",
"point",
"for",
"this",
"class",
".",
"Does",
"some",
"checking",
"then",
"processes",
"and",
"performs",
"the",
"tasks",
"for",
"this",
"target",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Target.php#L335-L358 | train |
phingofficial/phing | classes/phing/Target.php | Target.performTasks | public function performTasks()
{
try { // try to execute this target
$this->project->fireTargetStarted($this);
$this->main();
$this->project->fireTargetFinished($this, $null = null);
} catch (BuildException $exc) {
// log here and rethrow
$this->project->fireTargetFinished($this, $exc);
throw $exc;
}
} | php | public function performTasks()
{
try { // try to execute this target
$this->project->fireTargetStarted($this);
$this->main();
$this->project->fireTargetFinished($this, $null = null);
} catch (BuildException $exc) {
// log here and rethrow
$this->project->fireTargetFinished($this, $exc);
throw $exc;
}
} | [
"public",
"function",
"performTasks",
"(",
")",
"{",
"try",
"{",
"// try to execute this target",
"$",
"this",
"->",
"project",
"->",
"fireTargetStarted",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"main",
"(",
")",
";",
"$",
"this",
"->",
"project",
... | Performs the tasks by calling the main method of this target that
actually executes the tasks.
This method is for ZE2 and used for proper exception handling of
task exceptions. | [
"Performs",
"the",
"tasks",
"by",
"calling",
"the",
"main",
"method",
"of",
"this",
"target",
"that",
"actually",
"executes",
"the",
"tasks",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Target.php#L367-L378 | train |
phingofficial/phing | classes/phing/PropertyHelper.php | PropertyHelper.getPropertyHelper | public static function getPropertyHelper(Project $project)
{
/**
* @var PropertyHelper $helper
*/
$helper = $project->getReference('phing.PropertyHelper');
if ($helper !== null) {
return $helper;
}
$helper = new self();
$helper->setProject($project);
$project->addReference('phing.PropertyHelper', $helper);
return $helper;
} | php | public static function getPropertyHelper(Project $project)
{
/**
* @var PropertyHelper $helper
*/
$helper = $project->getReference('phing.PropertyHelper');
if ($helper !== null) {
return $helper;
}
$helper = new self();
$helper->setProject($project);
$project->addReference('phing.PropertyHelper', $helper);
return $helper;
} | [
"public",
"static",
"function",
"getPropertyHelper",
"(",
"Project",
"$",
"project",
")",
"{",
"/**\n * @var PropertyHelper $helper\n */",
"$",
"helper",
"=",
"$",
"project",
"->",
"getReference",
"(",
"'phing.PropertyHelper'",
")",
";",
"if",
"(",
"$"... | Factory method to create a property processor.
Users can provide their own or replace it using "ant.PropertyHelper"
reference. User tasks can also add themselves to the chain, and provide
dynamic properties.
@param Project $project the project fro which the property helper is required.
@return PropertyHelper the project's property helper. | [
"Factory",
"method",
"to",
"create",
"a",
"property",
"processor",
".",
"Users",
"can",
"provide",
"their",
"own",
"or",
"replace",
"it",
"using",
"ant",
".",
"PropertyHelper",
"reference",
".",
"User",
"tasks",
"can",
"also",
"add",
"themselves",
"to",
"the... | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/PropertyHelper.php#L87-L101 | train |
phingofficial/phing | classes/phing/PropertyHelper.php | PropertyHelper.getPropertyHook | public function getPropertyHook($ns, $name, $user)
{
if ($this->getNext() !== null) {
$o = $this->getNext()->getPropertyHook($ns, $name, $user);
if ($o !== null) {
return $o;
}
}
if (self::$project !== null && StringHelper::startsWith('toString:', $name)) {
$name = StringHelper::substring($name, strlen('toString:'));
$v = self::$project->getReference($name);
return ($v === null) ? null : (string) $v;
}
return null;
} | php | public function getPropertyHook($ns, $name, $user)
{
if ($this->getNext() !== null) {
$o = $this->getNext()->getPropertyHook($ns, $name, $user);
if ($o !== null) {
return $o;
}
}
if (self::$project !== null && StringHelper::startsWith('toString:', $name)) {
$name = StringHelper::substring($name, strlen('toString:'));
$v = self::$project->getReference($name);
return ($v === null) ? null : (string) $v;
}
return null;
} | [
"public",
"function",
"getPropertyHook",
"(",
"$",
"ns",
",",
"$",
"name",
",",
"$",
"user",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getNext",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"o",
"=",
"$",
"this",
"->",
"getNext",
"(",
")",
"->",
"get... | Get a property. If all hooks return null, the default
tables will be used.
@param string $ns namespace of the sought property.
@param string $name name of the sought property.
@param bool $user True if this is a user property.
@return string The property, if returned by a hook, or null if none. | [
"Get",
"a",
"property",
".",
"If",
"all",
"hooks",
"return",
"null",
"the",
"default",
"tables",
"will",
"be",
"used",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/PropertyHelper.php#L149-L165 | train |
phingofficial/phing | classes/phing/PropertyHelper.php | PropertyHelper.setProperty | public function setProperty($ns, $name, $value, $verbose)
{
// user (CLI) properties take precedence
if (isset($this->userProperties[$name])) {
if ($verbose) {
self::$project->log('Override ignored for user property ' . $name, Project::MSG_VERBOSE);
}
return false;
}
$done = $this->setPropertyHook($ns, $name, $value, false, false, false);
if ($done) {
return true;
}
if ($verbose && isset($this->properties[$name])) {
self::$project->log(
'Overriding previous definition of property ' . $name,
Project::MSG_VERBOSE
);
}
if ($verbose) {
self::$project->log(
'Setting project property: ' . $name . " -> "
. $value,
Project::MSG_DEBUG
);
}
$this->properties[$name] = $value;
self::$project->addReference($name, new PropertyValue($value));
return true;
} | php | public function setProperty($ns, $name, $value, $verbose)
{
// user (CLI) properties take precedence
if (isset($this->userProperties[$name])) {
if ($verbose) {
self::$project->log('Override ignored for user property ' . $name, Project::MSG_VERBOSE);
}
return false;
}
$done = $this->setPropertyHook($ns, $name, $value, false, false, false);
if ($done) {
return true;
}
if ($verbose && isset($this->properties[$name])) {
self::$project->log(
'Overriding previous definition of property ' . $name,
Project::MSG_VERBOSE
);
}
if ($verbose) {
self::$project->log(
'Setting project property: ' . $name . " -> "
. $value,
Project::MSG_DEBUG
);
}
$this->properties[$name] = $value;
self::$project->addReference($name, new PropertyValue($value));
return true;
} | [
"public",
"function",
"setProperty",
"(",
"$",
"ns",
",",
"$",
"name",
",",
"$",
"value",
",",
"$",
"verbose",
")",
"{",
"// user (CLI) properties take precedence",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"userProperties",
"[",
"$",
"name",
"]",
")",
... | Default implementation of setProperty. Will be called from Project.
This is the original 1.5 implementation, with calls to the hook
added.
@param string $ns The namespace for the property (currently not used).
@param string $name The name of the property.
@param string $value The value to set the property to.
@param bool $verbose If this is true output extra log messages.
@return bool true if the property is set. | [
"Default",
"implementation",
"of",
"setProperty",
".",
"Will",
"be",
"called",
"from",
"Project",
".",
"This",
"is",
"the",
"original",
"1",
".",
"5",
"implementation",
"with",
"calls",
"to",
"the",
"hook",
"added",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/PropertyHelper.php#L267-L299 | train |
phingofficial/phing | classes/phing/PropertyHelper.php | PropertyHelper.getProperty | public function getProperty($ns, $name)
{
if ($name === null) {
return null;
}
$o = $this->getPropertyHook($ns, $name, false);
if ($o !== null) {
return $o;
}
$found = $this->properties[$name] ?? null;
// check to see if there are unresolved property references
if (false !== strpos($found, '${')) {
// attempt to resolve properties
$found = $this->replaceProperties(null, $found, null);
// save resolved value
$this->properties[$name] = $found;
}
return $found;
} | php | public function getProperty($ns, $name)
{
if ($name === null) {
return null;
}
$o = $this->getPropertyHook($ns, $name, false);
if ($o !== null) {
return $o;
}
$found = $this->properties[$name] ?? null;
// check to see if there are unresolved property references
if (false !== strpos($found, '${')) {
// attempt to resolve properties
$found = $this->replaceProperties(null, $found, null);
// save resolved value
$this->properties[$name] = $found;
}
return $found;
} | [
"public",
"function",
"getProperty",
"(",
"$",
"ns",
",",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"name",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"$",
"o",
"=",
"$",
"this",
"->",
"getPropertyHook",
"(",
"$",
"ns",
",",
"$",
"name",
... | Returns the value of a property, if it is set. You can override
this method in order to plug your own storage.
@param string $ns The namespace for the property (currently not used).
@param string $name The name of the property.
May be <code>null</code>, in which case
the return value is also <code>null</code>.
@return string the property value, or <code>null</code> for no match
or if a <code>null</code> name is provided. | [
"Returns",
"the",
"value",
"of",
"a",
"property",
"if",
"it",
"is",
"set",
".",
"You",
"can",
"override",
"this",
"method",
"in",
"order",
"to",
"plug",
"your",
"own",
"storage",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/PropertyHelper.php#L407-L427 | train |
phingofficial/phing | classes/phing/PropertyHelper.php | PropertyHelper.getUserProperty | public function getUserProperty($ns, $name)
{
if ($name === null) {
return null;
}
$o = $this->getPropertyHook($ns, $name, true);
if ($o !== null) {
return $o;
}
return $this->userProperties[$name] ?? null;
} | php | public function getUserProperty($ns, $name)
{
if ($name === null) {
return null;
}
$o = $this->getPropertyHook($ns, $name, true);
if ($o !== null) {
return $o;
}
return $this->userProperties[$name] ?? null;
} | [
"public",
"function",
"getUserProperty",
"(",
"$",
"ns",
",",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"name",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"$",
"o",
"=",
"$",
"this",
"->",
"getPropertyHook",
"(",
"$",
"ns",
",",
"$",
"name... | Returns the value of a user property, if it is set.
@param string $ns The namespace for the property (currently not used).
@param string $name The name of the property.
May be <code>null</code>, in which case
the return value is also <code>null</code>.
@return string the property value, or <code>null</code> for no match
or if a <code>null</code> name is provided. | [
"Returns",
"the",
"value",
"of",
"a",
"user",
"property",
"if",
"it",
"is",
"set",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/PropertyHelper.php#L439-L449 | train |
phingofficial/phing | classes/phing/PropertyHelper.php | PropertyHelper.copyInheritedProperties | public function copyInheritedProperties(Project $other)
{
foreach ($this->inheritedProperties as $arg => $value) {
if ($other->getUserProperty($arg) !== null) {
continue;
}
$value = $this->inheritedProperties[$arg];
$other->setInheritedProperty($arg, (string) $value);
}
} | php | public function copyInheritedProperties(Project $other)
{
foreach ($this->inheritedProperties as $arg => $value) {
if ($other->getUserProperty($arg) !== null) {
continue;
}
$value = $this->inheritedProperties[$arg];
$other->setInheritedProperty($arg, (string) $value);
}
} | [
"public",
"function",
"copyInheritedProperties",
"(",
"Project",
"$",
"other",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"inheritedProperties",
"as",
"$",
"arg",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"other",
"->",
"getUserProperty",
"(",
"$",
... | Copies all user properties that have not been set on the
command line or a GUI tool from this instance to the Project
instance given as the argument.
<p>To copy all "user" properties, you will also have to call
{@link #copyUserProperties copyUserProperties}.</p>
@param Project $other the project to copy the properties to. Must not be null. | [
"Copies",
"all",
"user",
"properties",
"that",
"have",
"not",
"been",
"set",
"on",
"the",
"command",
"line",
"or",
"a",
"GUI",
"tool",
"from",
"this",
"instance",
"to",
"the",
"Project",
"instance",
"given",
"as",
"the",
"argument",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/PropertyHelper.php#L488-L497 | train |
phingofficial/phing | classes/phing/PropertyHelper.php | PropertyHelper.copyUserProperties | public function copyUserProperties(Project $other)
{
foreach ($this->userProperties as $arg => $value) {
if (isset($this->inheritedProperties[$arg])) {
continue;
}
$other->setUserProperty($arg, $value);
}
} | php | public function copyUserProperties(Project $other)
{
foreach ($this->userProperties as $arg => $value) {
if (isset($this->inheritedProperties[$arg])) {
continue;
}
$other->setUserProperty($arg, $value);
}
} | [
"public",
"function",
"copyUserProperties",
"(",
"Project",
"$",
"other",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"userProperties",
"as",
"$",
"arg",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"inheritedProperties",
"[... | Copies all user properties that have been set on the command
line or a GUI tool from this instance to the Project instance
given as the argument.
<p>To copy all "user" properties, you will also have to call
{@link #copyInheritedProperties copyInheritedProperties}.</p>
@param Project $other the project to copy the properties to. Must not be null. | [
"Copies",
"all",
"user",
"properties",
"that",
"have",
"been",
"set",
"on",
"the",
"command",
"line",
"or",
"a",
"GUI",
"tool",
"from",
"this",
"instance",
"to",
"the",
"Project",
"instance",
"given",
"as",
"the",
"argument",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/PropertyHelper.php#L509-L517 | train |
phingofficial/phing | classes/phing/tasks/ext/hg/HgLogTask.php | HgLogTask.main | public function main()
{
$clone = $this->getFactoryInstance('log');
if ($this->repository === '') {
$project = $this->getProject();
$dir = $project->getProperty('application.startdir');
} else {
$dir = $this->repository;
}
$clone->setCwd($dir);
if ($this->maxCount !== null) {
$max = filter_var($this->maxCount, FILTER_VALIDATE_INT);
if ($max) {
$max = (int) $this->maxCount;
}
if (!$max || (int) $this->maxCount <= 0) {
throw new BuildException("maxcount should be a positive integer.");
}
$clone->setLimit('' . $this->maxCount);
}
if ($this->format !== null) {
$clone->setTemplate($this->format);
}
if ($this->revision !== '') {
$clone->setRev($this->revision);
}
try {
$this->log("Executing: " . $clone->asString(), Project::MSG_INFO);
$output = $clone->execute();
if ($this->outputProperty !== null) {
$this->project->setProperty($this->outputProperty, $output);
} else {
if ($output !== '') {
$this->log(PHP_EOL . $output);
}
}
} catch (Exception $ex) {
$msg = $ex->getMessage();
$p = strpos($msg, 'hg returned:');
if ($p !== false) {
$msg = substr($msg, $p + 13);
}
throw new BuildException($msg);
}
} | php | public function main()
{
$clone = $this->getFactoryInstance('log');
if ($this->repository === '') {
$project = $this->getProject();
$dir = $project->getProperty('application.startdir');
} else {
$dir = $this->repository;
}
$clone->setCwd($dir);
if ($this->maxCount !== null) {
$max = filter_var($this->maxCount, FILTER_VALIDATE_INT);
if ($max) {
$max = (int) $this->maxCount;
}
if (!$max || (int) $this->maxCount <= 0) {
throw new BuildException("maxcount should be a positive integer.");
}
$clone->setLimit('' . $this->maxCount);
}
if ($this->format !== null) {
$clone->setTemplate($this->format);
}
if ($this->revision !== '') {
$clone->setRev($this->revision);
}
try {
$this->log("Executing: " . $clone->asString(), Project::MSG_INFO);
$output = $clone->execute();
if ($this->outputProperty !== null) {
$this->project->setProperty($this->outputProperty, $output);
} else {
if ($output !== '') {
$this->log(PHP_EOL . $output);
}
}
} catch (Exception $ex) {
$msg = $ex->getMessage();
$p = strpos($msg, 'hg returned:');
if ($p !== false) {
$msg = substr($msg, $p + 13);
}
throw new BuildException($msg);
}
} | [
"public",
"function",
"main",
"(",
")",
"{",
"$",
"clone",
"=",
"$",
"this",
"->",
"getFactoryInstance",
"(",
"'log'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"repository",
"===",
"''",
")",
"{",
"$",
"project",
"=",
"$",
"this",
"->",
"getProject",
... | Main entry point for this task
@return void | [
"Main",
"entry",
"point",
"for",
"this",
"task"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/hg/HgLogTask.php#L126-L175 | train |
phingofficial/phing | classes/phing/filters/util/IniFileTokenReader.php | IniFileTokenReader.readToken | public function readToken()
{
if ($this->file === null) {
throw new BuildException("No File set for IniFileTokenReader");
}
if ($this->tokens === null) {
$this->processFile();
}
if (count($this->tokens) > 0) {
return array_pop($this->tokens);
} else {
return null;
}
} | php | public function readToken()
{
if ($this->file === null) {
throw new BuildException("No File set for IniFileTokenReader");
}
if ($this->tokens === null) {
$this->processFile();
}
if (count($this->tokens) > 0) {
return array_pop($this->tokens);
} else {
return null;
}
} | [
"public",
"function",
"readToken",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"file",
"===",
"null",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"No File set for IniFileTokenReader\"",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"tokens",
"===",
... | Reads the next token from the INI file
@throws BuildException
@return Token | [
"Reads",
"the",
"next",
"token",
"from",
"the",
"INI",
"file"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/util/IniFileTokenReader.php#L54-L69 | train |
phingofficial/phing | classes/phing/filters/util/IniFileTokenReader.php | IniFileTokenReader.processFile | protected function processFile()
{
$arr = parse_ini_file($this->file->getAbsolutePath(), true);
if ($this->section !== null) {
if (isset($arr[$this->section])) {
$this->processSection($arr[$this->section]);
}
return;
}
$values = array_values($arr);
if (!is_array($values[0])) {
$this->processSection($arr);
return;
}
foreach ($values as $subArr) {
$this->processSection($subArr);
}
} | php | protected function processFile()
{
$arr = parse_ini_file($this->file->getAbsolutePath(), true);
if ($this->section !== null) {
if (isset($arr[$this->section])) {
$this->processSection($arr[$this->section]);
}
return;
}
$values = array_values($arr);
if (!is_array($values[0])) {
$this->processSection($arr);
return;
}
foreach ($values as $subArr) {
$this->processSection($subArr);
}
} | [
"protected",
"function",
"processFile",
"(",
")",
"{",
"$",
"arr",
"=",
"parse_ini_file",
"(",
"$",
"this",
"->",
"file",
"->",
"getAbsolutePath",
"(",
")",
",",
"true",
")",
";",
"if",
"(",
"$",
"this",
"->",
"section",
"!==",
"null",
")",
"{",
"if"... | Parse & process the ini file | [
"Parse",
"&",
"process",
"the",
"ini",
"file"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/util/IniFileTokenReader.php#L74-L97 | train |
phingofficial/phing | classes/phing/filters/util/IniFileTokenReader.php | IniFileTokenReader.processSection | protected function processSection(array $section)
{
foreach ($section as $key => $value) {
$tok = new Token();
$tok->setKey($key);
$tok->setValue($value);
$this->tokens[] = $tok;
}
} | php | protected function processSection(array $section)
{
foreach ($section as $key => $value) {
$tok = new Token();
$tok->setKey($key);
$tok->setValue($value);
$this->tokens[] = $tok;
}
} | [
"protected",
"function",
"processSection",
"(",
"array",
"$",
"section",
")",
"{",
"foreach",
"(",
"$",
"section",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"tok",
"=",
"new",
"Token",
"(",
")",
";",
"$",
"tok",
"->",
"setKey",
"(",
"$",... | Process an individual section
@param array $section | [
"Process",
"an",
"individual",
"section"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/util/IniFileTokenReader.php#L104-L112 | train |
phingofficial/phing | classes/phing/filters/Token.php | Token.setValue | public function setValue($value)
{
// special case for boolean values
if (is_bool($value)) {
if ($value) {
$this->_value = "true";
} else {
$this->_value = "false";
}
} else {
$this->_value = (string) $value;
}
} | php | public function setValue($value)
{
// special case for boolean values
if (is_bool($value)) {
if ($value) {
$this->_value = "true";
} else {
$this->_value = "false";
}
} else {
$this->_value = (string) $value;
}
} | [
"public",
"function",
"setValue",
"(",
"$",
"value",
")",
"{",
"// special case for boolean values",
"if",
"(",
"is_bool",
"(",
"$",
"value",
")",
")",
"{",
"if",
"(",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"_value",
"=",
"\"true\"",
";",
"}",
"els... | Sets the token value.
@param string $value The value for this token. Must not be <code>null</code>. | [
"Sets",
"the",
"token",
"value",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/Token.php#L40-L52 | train |
phingofficial/phing | classes/phing/ComponentHelper.php | ComponentHelper.createTask | public function createTask($taskType)
{
try {
$classname = "";
$tasklwr = strtolower($taskType);
foreach ($this->taskdefs as $name => $class) {
if (strtolower($name) === $tasklwr) {
$classname = $class;
break;
}
}
if ($classname === "") {
return null;
}
$o = $this->createObject($classname);
if ($o instanceof Task) {
$task = $o;
} else {
$this->project->log(" (Using TaskAdapter for: $taskType)", Project::MSG_DEBUG);
// not a real task, try adapter
$taskA = new TaskAdapter();
$taskA->setProxy($o);
$task = $taskA;
}
$task->setProject($this->project);
$task->setTaskType($taskType);
// set default value, can be changed by the user
$task->setTaskName($taskType);
$this->project->log(" +Task: " . $taskType, Project::MSG_DEBUG);
} catch (Exception $t) {
throw new BuildException("Could not create task of type: " . $taskType, $t);
}
// everything fine return reference
return $task;
} | php | public function createTask($taskType)
{
try {
$classname = "";
$tasklwr = strtolower($taskType);
foreach ($this->taskdefs as $name => $class) {
if (strtolower($name) === $tasklwr) {
$classname = $class;
break;
}
}
if ($classname === "") {
return null;
}
$o = $this->createObject($classname);
if ($o instanceof Task) {
$task = $o;
} else {
$this->project->log(" (Using TaskAdapter for: $taskType)", Project::MSG_DEBUG);
// not a real task, try adapter
$taskA = new TaskAdapter();
$taskA->setProxy($o);
$task = $taskA;
}
$task->setProject($this->project);
$task->setTaskType($taskType);
// set default value, can be changed by the user
$task->setTaskName($taskType);
$this->project->log(" +Task: " . $taskType, Project::MSG_DEBUG);
} catch (Exception $t) {
throw new BuildException("Could not create task of type: " . $taskType, $t);
}
// everything fine return reference
return $task;
} | [
"public",
"function",
"createTask",
"(",
"$",
"taskType",
")",
"{",
"try",
"{",
"$",
"classname",
"=",
"\"\"",
";",
"$",
"tasklwr",
"=",
"strtolower",
"(",
"$",
"taskType",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"taskdefs",
"as",
"$",
"name",
"... | Create a new task instance and return reference to it.
@param string $taskType Task name
@return Task A task object
@throws BuildException | [
"Create",
"a",
"new",
"task",
"instance",
"and",
"return",
"reference",
"to",
"it",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/ComponentHelper.php#L166-L203 | train |
phingofficial/phing | classes/phing/ComponentHelper.php | ComponentHelper.createCondition | public function createCondition($conditionType)
{
try {
$classname = "";
$tasklwr = strtolower($conditionType);
foreach ($this->typedefs as $name => $class) {
if (strtolower($name) === $tasklwr) {
$classname = $class;
break;
}
}
if ($classname === "") {
return null;
}
$o = $this->createObject($classname);
if ($o instanceof Condition) {
return $o;
} else {
throw new BuildException("Not actually a condition");
}
} catch (Exception $e) {
throw new BuildException("Could not create condition of type: " . $conditionType, $e);
}
} | php | public function createCondition($conditionType)
{
try {
$classname = "";
$tasklwr = strtolower($conditionType);
foreach ($this->typedefs as $name => $class) {
if (strtolower($name) === $tasklwr) {
$classname = $class;
break;
}
}
if ($classname === "") {
return null;
}
$o = $this->createObject($classname);
if ($o instanceof Condition) {
return $o;
} else {
throw new BuildException("Not actually a condition");
}
} catch (Exception $e) {
throw new BuildException("Could not create condition of type: " . $conditionType, $e);
}
} | [
"public",
"function",
"createCondition",
"(",
"$",
"conditionType",
")",
"{",
"try",
"{",
"$",
"classname",
"=",
"\"\"",
";",
"$",
"tasklwr",
"=",
"strtolower",
"(",
"$",
"conditionType",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"typedefs",
"as",
"$"... | Creates a new condition and returns the reference to it
@param string $conditionType
@return Condition
@throws BuildException | [
"Creates",
"a",
"new",
"condition",
"and",
"returns",
"the",
"reference",
"to",
"it"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/ComponentHelper.php#L212-L238 | train |
phingofficial/phing | classes/phing/tasks/ext/PatchTask.php | PatchTask.setPatchFile | public function setPatchFile(PhingFile $file)
{
if (!$file->exists()) {
throw new BuildException('patchfile ' . $file . " doesn't exist", $this->getLocation());
}
$this->cmd->createArgument()->setValue('-i');
$this->cmd->createArgument()->setFile($file);
$this->havePatchFile = true;
} | php | public function setPatchFile(PhingFile $file)
{
if (!$file->exists()) {
throw new BuildException('patchfile ' . $file . " doesn't exist", $this->getLocation());
}
$this->cmd->createArgument()->setValue('-i');
$this->cmd->createArgument()->setFile($file);
$this->havePatchFile = true;
} | [
"public",
"function",
"setPatchFile",
"(",
"PhingFile",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"$",
"file",
"->",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"'patchfile '",
".",
"$",
"file",
".",
"\" doesn't exist\"",
",",
"$",
... | The file containing the diff output
Required.
@param PhingFile $file File containing the diff output
@return void
@throws BuildException if $file not exists | [
"The",
"file",
"containing",
"the",
"diff",
"output"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/PatchTask.php#L81-L89 | train |
phingofficial/phing | classes/phing/types/selectors/DepthSelector.php | DepthSelector.verifySettings | public function verifySettings()
{
if ($this->min < 0 && $this->max < 0) {
$this->setError(
"You must set at least one of the min or the " .
"max levels."
);
}
if ($this->max < $this->min && $this->max > -1) {
$this->setError("The maximum depth is lower than the minimum.");
}
} | php | public function verifySettings()
{
if ($this->min < 0 && $this->max < 0) {
$this->setError(
"You must set at least one of the min or the " .
"max levels."
);
}
if ($this->max < $this->min && $this->max > -1) {
$this->setError("The maximum depth is lower than the minimum.");
}
} | [
"public",
"function",
"verifySettings",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"min",
"<",
"0",
"&&",
"$",
"this",
"->",
"max",
"<",
"0",
")",
"{",
"$",
"this",
"->",
"setError",
"(",
"\"You must set at least one of the min or the \"",
".",
"\"max le... | Checks to make sure all settings are kosher. In this case, it
means that the max depth is not lower than the min depth.
{@inheritdoc}
@return void | [
"Checks",
"to",
"make",
"sure",
"all",
"settings",
"are",
"kosher",
".",
"In",
"this",
"case",
"it",
"means",
"that",
"the",
"max",
"depth",
"is",
"not",
"lower",
"than",
"the",
"min",
"depth",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/selectors/DepthSelector.php#L121-L132 | train |
phingofficial/phing | classes/phing/tasks/ext/JsonValidateTask.php | JsonValidateTask.main | public function main()
{
if (null === $this->getFile()) {
$msg = "JsonValidate: file is not defined.";
$this->log($msg, Project::MSG_ERR);
throw new \BuildException($msg);
}
if (!file_exists($this->getFile()) || is_dir($this->getFile())) {
$msg = "JsonValidate: file not found " . $this->getFile();
$this->log($msg, Project::MSG_ERR);
throw new \BuildException($msg);
}
$decoded = json_decode(file_get_contents($this->getFile()));
if (null === $decoded) {
$msg = "JsonValidate: decoding " . $this->getFile() . " failed.";
$this->log($msg, Project::MSG_ERR);
throw new \BuildException($msg);
}
$this->log($this->getFile() . " is valid JSON", Project::MSG_INFO);
} | php | public function main()
{
if (null === $this->getFile()) {
$msg = "JsonValidate: file is not defined.";
$this->log($msg, Project::MSG_ERR);
throw new \BuildException($msg);
}
if (!file_exists($this->getFile()) || is_dir($this->getFile())) {
$msg = "JsonValidate: file not found " . $this->getFile();
$this->log($msg, Project::MSG_ERR);
throw new \BuildException($msg);
}
$decoded = json_decode(file_get_contents($this->getFile()));
if (null === $decoded) {
$msg = "JsonValidate: decoding " . $this->getFile() . " failed.";
$this->log($msg, Project::MSG_ERR);
throw new \BuildException($msg);
}
$this->log($this->getFile() . " is valid JSON", Project::MSG_INFO);
} | [
"public",
"function",
"main",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"getFile",
"(",
")",
")",
"{",
"$",
"msg",
"=",
"\"JsonValidate: file is not defined.\"",
";",
"$",
"this",
"->",
"log",
"(",
"$",
"msg",
",",
"Project",
"::",
... | executes the ValidJson task | [
"executes",
"the",
"ValidJson",
"task"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/JsonValidateTask.php#L35-L56 | train |
phingofficial/phing | classes/phing/types/Path.php | Path.setDir | public function setDir(PhingFile $location)
{
if ($this->isReference()) {
throw $this->tooManyAttributes();
}
$this->createPathElement()->setDir($location);
} | php | public function setDir(PhingFile $location)
{
if ($this->isReference()) {
throw $this->tooManyAttributes();
}
$this->createPathElement()->setDir($location);
} | [
"public",
"function",
"setDir",
"(",
"PhingFile",
"$",
"location",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isReference",
"(",
")",
")",
"{",
"throw",
"$",
"this",
"->",
"tooManyAttributes",
"(",
")",
";",
"}",
"$",
"this",
"->",
"createPathElement",
"... | Adds a element definition to the path.
@param PhingFile $location the location of the element to add (must not be
<code>null</code> nor empty.
@return void
@throws BuildException | [
"Adds",
"a",
"element",
"definition",
"to",
"the",
"path",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Path.php#L91-L97 | train |
phingofficial/phing | classes/phing/types/Path.php | Path.setPath | public function setPath($path)
{
if ($this->isReference()) {
throw $this->tooManyAttributes();
}
$this->createPathElement()->setPath($path);
} | php | public function setPath($path)
{
if ($this->isReference()) {
throw $this->tooManyAttributes();
}
$this->createPathElement()->setPath($path);
} | [
"public",
"function",
"setPath",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isReference",
"(",
")",
")",
"{",
"throw",
"$",
"this",
"->",
"tooManyAttributes",
"(",
")",
";",
"}",
"$",
"this",
"->",
"createPathElement",
"(",
")",
"->",... | Parses a path definition and creates single PathElements.
@param $path the path definition.
@throws BuildException | [
"Parses",
"a",
"path",
"definition",
"and",
"creates",
"single",
"PathElements",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Path.php#L106-L112 | train |
phingofficial/phing | classes/phing/types/Path.php | Path.setRefid | public function setRefid(Reference $r)
{
if (!empty($this->elements)) {
throw $this->tooManyAttributes();
}
$this->elements[] = $r;
parent::setRefid($r);
} | php | public function setRefid(Reference $r)
{
if (!empty($this->elements)) {
throw $this->tooManyAttributes();
}
$this->elements[] = $r;
parent::setRefid($r);
} | [
"public",
"function",
"setRefid",
"(",
"Reference",
"$",
"r",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"elements",
")",
")",
"{",
"throw",
"$",
"this",
"->",
"tooManyAttributes",
"(",
")",
";",
"}",
"$",
"this",
"->",
"elements",
... | Makes this instance in effect a reference to another Path instance.
<p>You must not set another attribute or nest elements inside
this element if you make it a reference.</p>
@param Reference $r
@return void
@throws BuildException | [
"Makes",
"this",
"instance",
"in",
"effect",
"a",
"reference",
"to",
"another",
"Path",
"instance",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Path.php#L126-L133 | train |
phingofficial/phing | classes/phing/types/Path.php | Path.append | public function append(Path $other)
{
if ($other === null) {
return;
}
$l = $other->listPaths();
foreach ($l as $path) {
if (!in_array($path, $this->elements, true)) {
$this->elements[] = $path;
}
}
} | php | public function append(Path $other)
{
if ($other === null) {
return;
}
$l = $other->listPaths();
foreach ($l as $path) {
if (!in_array($path, $this->elements, true)) {
$this->elements[] = $path;
}
}
} | [
"public",
"function",
"append",
"(",
"Path",
"$",
"other",
")",
"{",
"if",
"(",
"$",
"other",
"===",
"null",
")",
"{",
"return",
";",
"}",
"$",
"l",
"=",
"$",
"other",
"->",
"listPaths",
"(",
")",
";",
"foreach",
"(",
"$",
"l",
"as",
"$",
"path... | Append the contents of the other Path instance to this.
@param Path $other
@return void
@throws BuildException | [
"Append",
"the",
"contents",
"of",
"the",
"other",
"Path",
"instance",
"to",
"this",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Path.php#L235-L246 | train |
phingofficial/phing | classes/phing/types/Path.php | Path.addExisting | public function addExisting(Path $source)
{
$list = $source->listPaths();
foreach ($list as $el) {
$f = null;
if ($this->project !== null) {
$f = $this->project->resolveFile($el);
} else {
$f = new PhingFile($el);
}
if ($f->exists()) {
$this->setDir($f);
} else {
$this->log(
"dropping " . $f->__toString() . " from path as it doesn't exist",
Project::MSG_VERBOSE
);
}
}
} | php | public function addExisting(Path $source)
{
$list = $source->listPaths();
foreach ($list as $el) {
$f = null;
if ($this->project !== null) {
$f = $this->project->resolveFile($el);
} else {
$f = new PhingFile($el);
}
if ($f->exists()) {
$this->setDir($f);
} else {
$this->log(
"dropping " . $f->__toString() . " from path as it doesn't exist",
Project::MSG_VERBOSE
);
}
}
} | [
"public",
"function",
"addExisting",
"(",
"Path",
"$",
"source",
")",
"{",
"$",
"list",
"=",
"$",
"source",
"->",
"listPaths",
"(",
")",
";",
"foreach",
"(",
"$",
"list",
"as",
"$",
"el",
")",
"{",
"$",
"f",
"=",
"null",
";",
"if",
"(",
"$",
"t... | Adds the components on the given path which exist to this
Path. Components that don't exist, aren't added.
@param Path $source - Source path whose components are examined for existence.
@return void | [
"Adds",
"the",
"components",
"on",
"the",
"given",
"path",
"which",
"exist",
"to",
"this",
"Path",
".",
"Components",
"that",
"don",
"t",
"exist",
"aren",
"t",
"added",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Path.php#L256-L276 | train |
phingofficial/phing | classes/phing/types/Path.php | Path.translateFile | public static function translateFile($source)
{
if ($source == null) {
return "";
}
$result = $source;
for ($i = 0, $_i = strlen($source); $i < $_i; $i++) {
self::translateFileSep($result, $i);
}
return $result;
} | php | public static function translateFile($source)
{
if ($source == null) {
return "";
}
$result = $source;
for ($i = 0, $_i = strlen($source); $i < $_i; $i++) {
self::translateFileSep($result, $i);
}
return $result;
} | [
"public",
"static",
"function",
"translateFile",
"(",
"$",
"source",
")",
"{",
"if",
"(",
"$",
"source",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"}",
"$",
"result",
"=",
"$",
"source",
";",
"for",
"(",
"$",
"i",
"=",
"0",
",",
"$",
"_i",
... | Returns its argument with all file separator characters
replaced so that they match the local OS conventions.
@param string $source
@return string | [
"Returns",
"its",
"argument",
"with",
"all",
"file",
"separator",
"characters",
"replaced",
"so",
"that",
"they",
"match",
"the",
"local",
"OS",
"conventions",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Path.php#L425-L437 | train |
phingofficial/phing | classes/phing/types/Path.php | Path.dieOnCircularReference | public function dieOnCircularReference(&$stk, Project $p = null)
{
if ($this->checked) {
return;
}
// elements can contain strings, FileSets, Reference, etc.
foreach ($this->elements as $o) {
if ($o instanceof Reference) {
$o = $o->getReferencedObject($p);
}
if ($o instanceof DataType) {
if (in_array($o, $stk, true)) {
throw $this->circularReference();
} else {
$stk[] = $o;
$o->dieOnCircularReference($stk, $p);
array_pop($stk);
}
}
}
$this->checked = true;
} | php | public function dieOnCircularReference(&$stk, Project $p = null)
{
if ($this->checked) {
return;
}
// elements can contain strings, FileSets, Reference, etc.
foreach ($this->elements as $o) {
if ($o instanceof Reference) {
$o = $o->getReferencedObject($p);
}
if ($o instanceof DataType) {
if (in_array($o, $stk, true)) {
throw $this->circularReference();
} else {
$stk[] = $o;
$o->dieOnCircularReference($stk, $p);
array_pop($stk);
}
}
}
$this->checked = true;
} | [
"public",
"function",
"dieOnCircularReference",
"(",
"&",
"$",
"stk",
",",
"Project",
"$",
"p",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"checked",
")",
"{",
"return",
";",
"}",
"// elements can contain strings, FileSets, Reference, etc.",
"foreach",... | Overrides the version of DataType to recurse on all DataType
child elements that may have been added.
@param $stk
@param Project $p
@return void
@throws BuildException | [
"Overrides",
"the",
"version",
"of",
"DataType",
"to",
"recurse",
"on",
"all",
"DataType",
"child",
"elements",
"that",
"may",
"have",
"been",
"added",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Path.php#L483-L507 | train |
phingofficial/phing | classes/phing/types/Path.php | Path.resolveFile | private static function resolveFile(Project $project, $relativeName)
{
if ($project !== null) {
$f = $project->resolveFile($relativeName);
return $f->getAbsolutePath();
}
return $relativeName;
} | php | private static function resolveFile(Project $project, $relativeName)
{
if ($project !== null) {
$f = $project->resolveFile($relativeName);
return $f->getAbsolutePath();
}
return $relativeName;
} | [
"private",
"static",
"function",
"resolveFile",
"(",
"Project",
"$",
"project",
",",
"$",
"relativeName",
")",
"{",
"if",
"(",
"$",
"project",
"!==",
"null",
")",
"{",
"$",
"f",
"=",
"$",
"project",
"->",
"resolveFile",
"(",
"$",
"relativeName",
")",
"... | Resolve a filename with Project's help - if we know one that is.
<p>Assume the filename is absolute if project is null.</p>
@param Project $project
@param $relativeName
@return string | [
"Resolve",
"a",
"filename",
"with",
"Project",
"s",
"help",
"-",
"if",
"we",
"know",
"one",
"that",
"is",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Path.php#L519-L528 | train |
phingofficial/phing | classes/phing/tasks/system/EchoTask.php | EchoTask.getFilesetsMsg | protected function getFilesetsMsg()
{
$project = $this->getProject();
$msg = '';
foreach ($this->filesets as $fs) {
$ds = $fs->getDirectoryScanner($project);
$fromDir = $fs->getDir($project);
$srcDirs = $ds->getIncludedDirectories();
$srcFiles = $ds->getIncludedFiles();
$msg .= 'Directory: ' . $fromDir . ' => '
. realpath($fromDir) . "\n";
foreach ($srcDirs as $dir) {
$relPath = $fromDir . DIRECTORY_SEPARATOR . $dir;
$msg .= $relPath . "\n";
}
foreach ($srcFiles as $file) {
$relPath = $fromDir . DIRECTORY_SEPARATOR . $file;
$msg .= $relPath . "\n";
}
}
return $msg;
} | php | protected function getFilesetsMsg()
{
$project = $this->getProject();
$msg = '';
foreach ($this->filesets as $fs) {
$ds = $fs->getDirectoryScanner($project);
$fromDir = $fs->getDir($project);
$srcDirs = $ds->getIncludedDirectories();
$srcFiles = $ds->getIncludedFiles();
$msg .= 'Directory: ' . $fromDir . ' => '
. realpath($fromDir) . "\n";
foreach ($srcDirs as $dir) {
$relPath = $fromDir . DIRECTORY_SEPARATOR . $dir;
$msg .= $relPath . "\n";
}
foreach ($srcFiles as $file) {
$relPath = $fromDir . DIRECTORY_SEPARATOR . $file;
$msg .= $relPath . "\n";
}
}
return $msg;
} | [
"protected",
"function",
"getFilesetsMsg",
"(",
")",
"{",
"$",
"project",
"=",
"$",
"this",
"->",
"getProject",
"(",
")",
";",
"$",
"msg",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"filesets",
"as",
"$",
"fs",
")",
"{",
"$",
"ds",
"=",
"... | Merges all filesets into a string to be echoed out
@return string String to echo | [
"Merges",
"all",
"filesets",
"into",
"a",
"string",
"to",
"be",
"echoed",
"out"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/EchoTask.php#L90-L112 | train |
phingofficial/phing | classes/phing/tasks/ext/phpcs/ReportsPhingRemoveFromCache.php | ReportsPhingRemoveFromCache.generateFileReport | public function generateFileReport(
$report,
PHP_CodeSniffer_File $phpcsFile,
$showSources = false,
$width = 80
) {
if (!self::$cache || ($report['errors'] === 0 && $report['warnings'] === 0)) {
// Nothing to do
return false;
}
self::$cache->remove($report['filename']);
return false;
} | php | public function generateFileReport(
$report,
PHP_CodeSniffer_File $phpcsFile,
$showSources = false,
$width = 80
) {
if (!self::$cache || ($report['errors'] === 0 && $report['warnings'] === 0)) {
// Nothing to do
return false;
}
self::$cache->remove($report['filename']);
return false;
} | [
"public",
"function",
"generateFileReport",
"(",
"$",
"report",
",",
"PHP_CodeSniffer_File",
"$",
"phpcsFile",
",",
"$",
"showSources",
"=",
"false",
",",
"$",
"width",
"=",
"80",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"cache",
"||",
"(",
"$",
"r... | Remove file from cache if contains errors
@param array $report Prepared report data.
@param PHP_CodeSniffer_File $phpcsFile The file being reported on.
@param boolean $showSources Show sources?
@param int $width Maximum allowed line width.
@return boolean | [
"Remove",
"file",
"from",
"cache",
"if",
"contains",
"errors"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/phpcs/ReportsPhingRemoveFromCache.php#L56-L69 | train |
phingofficial/phing | classes/phing/types/TokenSource.php | TokenSource.load | public function load()
{
// Create new Reader
if ($this->classname === null) {
throw new BuildException("No Classname given to TokenSource.");
}
$classname = Phing::import($this->classname);
$this->reader = new $classname($this->project);
// Configure Reader
$this->configureTokenReader($this->reader);
// Load Tokens
try {
while ($token = $this->reader->readToken()) {
$this->tokens[] = $token;
}
} catch (BuildException $e) {
$this->log("Error reading TokenSource: " . $e->getMessage(), Project::MSG_WARN);
} catch (IOException $e) {
$this->log("Error reading TokenSource: " . $e->getMessage(), Project::MSG_WARN);
}
} | php | public function load()
{
// Create new Reader
if ($this->classname === null) {
throw new BuildException("No Classname given to TokenSource.");
}
$classname = Phing::import($this->classname);
$this->reader = new $classname($this->project);
// Configure Reader
$this->configureTokenReader($this->reader);
// Load Tokens
try {
while ($token = $this->reader->readToken()) {
$this->tokens[] = $token;
}
} catch (BuildException $e) {
$this->log("Error reading TokenSource: " . $e->getMessage(), Project::MSG_WARN);
} catch (IOException $e) {
$this->log("Error reading TokenSource: " . $e->getMessage(), Project::MSG_WARN);
}
} | [
"public",
"function",
"load",
"(",
")",
"{",
"// Create new Reader",
"if",
"(",
"$",
"this",
"->",
"classname",
"===",
"null",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"No Classname given to TokenSource.\"",
")",
";",
"}",
"$",
"classname",
"=",
"Phi... | This method is called to load the sources from the reader
into the buffer of the source. | [
"This",
"method",
"is",
"called",
"to",
"load",
"the",
"sources",
"from",
"the",
"reader",
"into",
"the",
"buffer",
"of",
"the",
"source",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/TokenSource.php#L77-L100 | train |
phingofficial/phing | classes/phing/types/TokenSource.php | TokenSource.configureTokenReader | private function configureTokenReader(TokenReader $reader)
{
$count = count($this->parameters);
for ($i = 0; $i < $count; $i++) {
$method_name = "Set" . $this->parameters[$i]->getName();
$value = $this->parameters[$i]->getValue();
$reader->$method_name($value);
}
} | php | private function configureTokenReader(TokenReader $reader)
{
$count = count($this->parameters);
for ($i = 0; $i < $count; $i++) {
$method_name = "Set" . $this->parameters[$i]->getName();
$value = $this->parameters[$i]->getValue();
$reader->$method_name($value);
}
} | [
"private",
"function",
"configureTokenReader",
"(",
"TokenReader",
"$",
"reader",
")",
"{",
"$",
"count",
"=",
"count",
"(",
"$",
"this",
"->",
"parameters",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"count",
";",
"$",
"i",... | Configures a TokenReader with the parameters passed to the
TokenSource.
@param TokenReader $reader | [
"Configures",
"a",
"TokenReader",
"with",
"the",
"parameters",
"passed",
"to",
"the",
"TokenSource",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/TokenSource.php#L121-L129 | train |
phingofficial/phing | classes/phing/tasks/ext/phpcpd/PHPCPDTask.php | PHPCPDTask.createFormatter | public function createFormatter()
{
$num = array_push($this->formatters, new PHPCPDFormatterElement($this));
return $this->formatters[$num - 1];
} | php | public function createFormatter()
{
$num = array_push($this->formatters, new PHPCPDFormatterElement($this));
return $this->formatters[$num - 1];
} | [
"public",
"function",
"createFormatter",
"(",
")",
"{",
"$",
"num",
"=",
"array_push",
"(",
"$",
"this",
"->",
"formatters",
",",
"new",
"PHPCPDFormatterElement",
"(",
"$",
"this",
")",
")",
";",
"return",
"$",
"this",
"->",
"formatters",
"[",
"$",
"num"... | Create object for nested formatter element.
@return PHPCPDFormatterElement | [
"Create",
"object",
"for",
"nested",
"formatter",
"element",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/phpcpd/PHPCPDTask.php#L189-L194 | train |
phingofficial/phing | classes/phing/tasks/ext/phpcpd/PHPCPDTask.php | PHPCPDTask.main | public function main()
{
$this->loadDependencies();
if (!isset($this->file) && count($this->filesets) == 0) {
throw new BuildException('Missing either a nested fileset or attribute "file" set');
}
if (count($this->formatters) == 0) {
// turn legacy format attribute into formatter
$fmt = new PHPCPDFormatterElement($this);
$fmt->setType($this->format);
$fmt->setUseFile(false);
$this->formatters[] = $fmt;
}
$this->validateFormatters();
$filesToParse = [];
if ($this->file instanceof PhingFile) {
$filesToParse[] = $this->file->getPath();
} else {
// append any files in filesets
foreach ($this->filesets as $fs) {
$files = $fs->getDirectoryScanner($this->project)->getIncludedFiles();
foreach ($files as $filename) {
$f = new PhingFile($fs->getDir($this->project), $filename);
$filesToParse[] = $f->getAbsolutePath();
}
}
}
$this->log('Processing files...');
if ($this->oldVersion) {
$detectorClass = 'PHPCPD_Detector';
$strategyClass = 'PHPCPD_Detector_Strategy_Default';
} else {
$detectorClass = '\\SebastianBergmann\\PHPCPD\\Detector\\Detector';
$strategyClass = '\\SebastianBergmann\\PHPCPD\\Detector\\Strategy\\DefaultStrategy';
}
$detector = new $detectorClass(new $strategyClass());
$clones = $detector->copyPasteDetection(
$filesToParse,
$this->minLines,
$this->minTokens,
$this->fuzzy
);
$this->log('Finished copy/paste detection');
foreach ($this->formatters as $fe) {
$formatter = $fe->getFormatter();
$formatter->processClones(
$clones,
$this->project,
$fe->getUseFile(),
$fe->getOutfile()
);
}
} | php | public function main()
{
$this->loadDependencies();
if (!isset($this->file) && count($this->filesets) == 0) {
throw new BuildException('Missing either a nested fileset or attribute "file" set');
}
if (count($this->formatters) == 0) {
// turn legacy format attribute into formatter
$fmt = new PHPCPDFormatterElement($this);
$fmt->setType($this->format);
$fmt->setUseFile(false);
$this->formatters[] = $fmt;
}
$this->validateFormatters();
$filesToParse = [];
if ($this->file instanceof PhingFile) {
$filesToParse[] = $this->file->getPath();
} else {
// append any files in filesets
foreach ($this->filesets as $fs) {
$files = $fs->getDirectoryScanner($this->project)->getIncludedFiles();
foreach ($files as $filename) {
$f = new PhingFile($fs->getDir($this->project), $filename);
$filesToParse[] = $f->getAbsolutePath();
}
}
}
$this->log('Processing files...');
if ($this->oldVersion) {
$detectorClass = 'PHPCPD_Detector';
$strategyClass = 'PHPCPD_Detector_Strategy_Default';
} else {
$detectorClass = '\\SebastianBergmann\\PHPCPD\\Detector\\Detector';
$strategyClass = '\\SebastianBergmann\\PHPCPD\\Detector\\Strategy\\DefaultStrategy';
}
$detector = new $detectorClass(new $strategyClass());
$clones = $detector->copyPasteDetection(
$filesToParse,
$this->minLines,
$this->minTokens,
$this->fuzzy
);
$this->log('Finished copy/paste detection');
foreach ($this->formatters as $fe) {
$formatter = $fe->getFormatter();
$formatter->processClones(
$clones,
$this->project,
$fe->getUseFile(),
$fe->getOutfile()
);
}
} | [
"public",
"function",
"main",
"(",
")",
"{",
"$",
"this",
"->",
"loadDependencies",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"file",
")",
"&&",
"count",
"(",
"$",
"this",
"->",
"filesets",
")",
"==",
"0",
")",
"{",
"throw",... | Executes PHPCPD against PhingFile or a FileSet
@throws BuildException | [
"Executes",
"PHPCPD",
"against",
"PhingFile",
"or",
"a",
"FileSet"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/phpcpd/PHPCPDTask.php#L262-L326 | train |
phingofficial/phing | classes/phing/tasks/ext/phpcpd/PHPCPDTask.php | PHPCPDTask.validateFormatters | protected function validateFormatters()
{
foreach ($this->formatters as $fe) {
if ($fe->getType() == '') {
throw new BuildException('Formatter missing required "type" attribute.');
}
if ($fe->getUsefile() && $fe->getOutfile() === null) {
throw new BuildException('Formatter requires "outfile" attribute when "useFile" is true.');
}
}
} | php | protected function validateFormatters()
{
foreach ($this->formatters as $fe) {
if ($fe->getType() == '') {
throw new BuildException('Formatter missing required "type" attribute.');
}
if ($fe->getUsefile() && $fe->getOutfile() === null) {
throw new BuildException('Formatter requires "outfile" attribute when "useFile" is true.');
}
}
} | [
"protected",
"function",
"validateFormatters",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"formatters",
"as",
"$",
"fe",
")",
"{",
"if",
"(",
"$",
"fe",
"->",
"getType",
"(",
")",
"==",
"''",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"'... | Validates the available formatters
@throws BuildException | [
"Validates",
"the",
"available",
"formatters"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/phpcpd/PHPCPDTask.php#L333-L344 | train |
phingofficial/phing | classes/phing/types/selectors/FilenameSelector.php | FilenameSelector.setName | public function setName($pattern)
{
$pattern = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $pattern);
if (StringHelper::endsWith(DIRECTORY_SEPARATOR, $pattern)) {
$pattern .= "**";
}
$this->pattern = $pattern;
} | php | public function setName($pattern)
{
$pattern = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $pattern);
if (StringHelper::endsWith(DIRECTORY_SEPARATOR, $pattern)) {
$pattern .= "**";
}
$this->pattern = $pattern;
} | [
"public",
"function",
"setName",
"(",
"$",
"pattern",
")",
"{",
"$",
"pattern",
"=",
"str_replace",
"(",
"[",
"'\\\\'",
",",
"'/'",
"]",
",",
"DIRECTORY_SEPARATOR",
",",
"$",
"pattern",
")",
";",
"if",
"(",
"StringHelper",
"::",
"endsWith",
"(",
"DIRECTO... | The name of the file, or the pattern for the name, that
should be used for selection.
@param string $pattern the file pattern that any filename must match
against in order to be selected.
@return void | [
"The",
"name",
"of",
"the",
"file",
"or",
"the",
"pattern",
"for",
"the",
"name",
"that",
"should",
"be",
"used",
"for",
"selection",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/selectors/FilenameSelector.php#L80-L88 | train |
phingofficial/phing | classes/phing/types/selectors/FilenameSelector.php | FilenameSelector.verifySettings | public function verifySettings()
{
if ($this->pattern === null && $this->regex === null) {
$this->setError("The name or regex attribute is required");
} elseif ($this->pattern !== null && $this->regex !== null) {
$this->setError("Only one of name and regex attribute is allowed");
}
} | php | public function verifySettings()
{
if ($this->pattern === null && $this->regex === null) {
$this->setError("The name or regex attribute is required");
} elseif ($this->pattern !== null && $this->regex !== null) {
$this->setError("Only one of name and regex attribute is allowed");
}
} | [
"public",
"function",
"verifySettings",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"pattern",
"===",
"null",
"&&",
"$",
"this",
"->",
"regex",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"setError",
"(",
"\"The name or regex attribute is required\"",
")",
... | Checks to make sure all settings are kosher. In this case, it
means that the name attribute has been set.
{@inheritdoc}
@return void | [
"Checks",
"to",
"make",
"sure",
"all",
"settings",
"are",
"kosher",
".",
"In",
"this",
"case",
"it",
"means",
"that",
"the",
"name",
"attribute",
"has",
"been",
"set",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/selectors/FilenameSelector.php#L171-L178 | train |
phingofficial/phing | classes/phing/tasks/ext/Service/Amazon/S3.php | S3.getClient | public function getClient()
{
if ($this->_client === null) {
try {
$s3Client = new Aws\S3\S3Client(
[
'key' => $this->getKey(),
'secret' => $this->getSecret(),
]
);
} catch (InvalidArgumentException $e) {
throw new BuildException($e);
}
$this->_client = $s3Client;
}
return $this->_client;
} | php | public function getClient()
{
if ($this->_client === null) {
try {
$s3Client = new Aws\S3\S3Client(
[
'key' => $this->getKey(),
'secret' => $this->getSecret(),
]
);
} catch (InvalidArgumentException $e) {
throw new BuildException($e);
}
$this->_client = $s3Client;
}
return $this->_client;
} | [
"public",
"function",
"getClient",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_client",
"===",
"null",
")",
"{",
"try",
"{",
"$",
"s3Client",
"=",
"new",
"Aws",
"\\",
"S3",
"\\",
"S3Client",
"(",
"[",
"'key'",
"=>",
"$",
"this",
"->",
"getKey",
... | We only instantiate the client once per task call
@return Aws\S3\S3Client
@throws \BuildException | [
"We",
"only",
"instantiate",
"the",
"client",
"once",
"per",
"task",
"call"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/Service/Amazon/S3.php#L47-L65 | train |
phingofficial/phing | classes/phing/tasks/ext/Service/Amazon/S3.php | S3.createBucket | public function createBucket()
{
$client = $this->getClientInstance();
$client->createBucket(['Bucket' => $this->getBucket()]);
return $this->isBucketAvailable();
} | php | public function createBucket()
{
$client = $this->getClientInstance();
$client->createBucket(['Bucket' => $this->getBucket()]);
return $this->isBucketAvailable();
} | [
"public",
"function",
"createBucket",
"(",
")",
"{",
"$",
"client",
"=",
"$",
"this",
"->",
"getClientInstance",
"(",
")",
";",
"$",
"client",
"->",
"createBucket",
"(",
"[",
"'Bucket'",
"=>",
"$",
"this",
"->",
"getBucket",
"(",
")",
"]",
")",
";",
... | Create a bucket
@return bool
@throws \BuildException | [
"Create",
"a",
"bucket"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/Service/Amazon/S3.php#L148-L154 | train |
phingofficial/phing | classes/phing/listener/ProgressLogger.php | ProgressLogger.buildStarted | public function buildStarted(BuildEvent $event)
{
$this->startTime = Phing::currentTimeMillis();
$this->bar->setMessage($event->getProject()->getProperty("phing.file"), 'buildfile');
} | php | public function buildStarted(BuildEvent $event)
{
$this->startTime = Phing::currentTimeMillis();
$this->bar->setMessage($event->getProject()->getProperty("phing.file"), 'buildfile');
} | [
"public",
"function",
"buildStarted",
"(",
"BuildEvent",
"$",
"event",
")",
"{",
"$",
"this",
"->",
"startTime",
"=",
"Phing",
"::",
"currentTimeMillis",
"(",
")",
";",
"$",
"this",
"->",
"bar",
"->",
"setMessage",
"(",
"$",
"event",
"->",
"getProject",
... | Fired before any targets are started.
@param BuildEvent $event The BuildEvent | [
"Fired",
"before",
"any",
"targets",
"are",
"started",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/ProgressLogger.php#L39-L43 | train |
phingofficial/phing | classes/phing/listener/ProgressLogger.php | ProgressLogger.targetStarted | public function targetStarted(BuildEvent $event)
{
$this->bar->setMessage($event->getTarget()->getName(), 'target');
$this->determineDepth($event);
} | php | public function targetStarted(BuildEvent $event)
{
$this->bar->setMessage($event->getTarget()->getName(), 'target');
$this->determineDepth($event);
} | [
"public",
"function",
"targetStarted",
"(",
"BuildEvent",
"$",
"event",
")",
"{",
"$",
"this",
"->",
"bar",
"->",
"setMessage",
"(",
"$",
"event",
"->",
"getTarget",
"(",
")",
"->",
"getName",
"(",
")",
",",
"'target'",
")",
";",
"$",
"this",
"->",
"... | Fired when a target is started.
@param BuildEvent $event The BuildEvent
@see BuildEvent::getTarget() | [
"Fired",
"when",
"a",
"target",
"is",
"started",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/ProgressLogger.php#L65-L69 | train |
phingofficial/phing | classes/phing/listener/ProgressLogger.php | ProgressLogger.taskStarted | public function taskStarted(BuildEvent $event)
{
// ignore tasks in root
if ($event->getTarget()->getName() == "") {
return;
}
$this->bar->setMessage($event->getTask()->getTaskName(), 'task');
$this->determineDepth($event);
} | php | public function taskStarted(BuildEvent $event)
{
// ignore tasks in root
if ($event->getTarget()->getName() == "") {
return;
}
$this->bar->setMessage($event->getTask()->getTaskName(), 'task');
$this->determineDepth($event);
} | [
"public",
"function",
"taskStarted",
"(",
"BuildEvent",
"$",
"event",
")",
"{",
"// ignore tasks in root",
"if",
"(",
"$",
"event",
"->",
"getTarget",
"(",
")",
"->",
"getName",
"(",
")",
"==",
"\"\"",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"... | Fired when a task is started.
@param BuildEvent $event The BuildEvent
@see BuildEvent::getTask() | [
"Fired",
"when",
"a",
"task",
"is",
"started",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/ProgressLogger.php#L88-L98 | train |
phingofficial/phing | classes/phing/listener/ProgressLogger.php | ProgressLogger.taskFinished | public function taskFinished(BuildEvent $event)
{
// ignore tasks in root
if ($event->getTarget()->getName() == "") {
return;
}
$this->remTasks--;
$this->bar->advance();
} | php | public function taskFinished(BuildEvent $event)
{
// ignore tasks in root
if ($event->getTarget()->getName() == "") {
return;
}
$this->remTasks--;
$this->bar->advance();
} | [
"public",
"function",
"taskFinished",
"(",
"BuildEvent",
"$",
"event",
")",
"{",
"// ignore tasks in root",
"if",
"(",
"$",
"event",
"->",
"getTarget",
"(",
")",
"->",
"getName",
"(",
")",
"==",
"\"\"",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
... | Fired when a task has finished.
@param BuildEvent $event The BuildEvent
@see BuildEvent::getException() | [
"Fired",
"when",
"a",
"task",
"has",
"finished",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/ProgressLogger.php#L106-L115 | train |
phingofficial/phing | classes/phing/listener/ProgressLogger.php | ProgressLogger.messageLogged | public function messageLogged(BuildEvent $event)
{
$priority = $event->getPriority();
if ($priority <= $this->msgOutputLevel) {
$this->bar->setMessage(str_replace(["\n", "\r"], ["", ""], $event->getMessage()));
$this->bar->display();
}
} | php | public function messageLogged(BuildEvent $event)
{
$priority = $event->getPriority();
if ($priority <= $this->msgOutputLevel) {
$this->bar->setMessage(str_replace(["\n", "\r"], ["", ""], $event->getMessage()));
$this->bar->display();
}
} | [
"public",
"function",
"messageLogged",
"(",
"BuildEvent",
"$",
"event",
")",
"{",
"$",
"priority",
"=",
"$",
"event",
"->",
"getPriority",
"(",
")",
";",
"if",
"(",
"$",
"priority",
"<=",
"$",
"this",
"->",
"msgOutputLevel",
")",
"{",
"$",
"this",
"->"... | Fired whenever a message is logged.
@param BuildEvent $event The BuildEvent
@see BuildEvent::getMessage() | [
"Fired",
"whenever",
"a",
"message",
"is",
"logged",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/ProgressLogger.php#L123-L130 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.