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/types/Environment.php
Environment.getVariables
public function getVariables() { if ($this->variables->count() === 0) { return null; } return array_map( function ($env) { return $env->getContent(); }, $this->variables->getArrayCopy() ); }
php
public function getVariables() { if ($this->variables->count() === 0) { return null; } return array_map( function ($env) { return $env->getContent(); }, $this->variables->getArrayCopy() ); }
[ "public", "function", "getVariables", "(", ")", "{", "if", "(", "$", "this", "->", "variables", "->", "count", "(", ")", "===", "0", ")", "{", "return", "null", ";", "}", "return", "array_map", "(", "function", "(", "$", "env", ")", "{", "return", ...
get the variable list as an array @return array of key=value assignment strings @throws BuildException if any variable is misconfigured
[ "get", "the", "variable", "list", "as", "an", "array" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Environment.php#L61-L72
train
phingofficial/phing
classes/phing/types/AbstractFileSet.php
AbstractFileSet.getDirectoryScanner
public function getDirectoryScanner(Project $p = null) { if ($p === null) { $p = $this->getProject(); } if ($this->isReference()) { $o = $this->getRef($p); return $o->getDirectoryScanner($p); } if ($this->dir === null) { throw new BuildException(sprintf("No directory specified for <%s>.", strtolower(get_class($this)))); } if (!$this->dir->exists() && $this->errorOnMissingDir) { throw new BuildException("Directory " . $this->dir->getAbsolutePath() . " not found."); } if (!$this->dir->isLink() || !$this->expandSymbolicLinks) { if (!$this->dir->isDirectory()) { throw new BuildException($this->dir->getAbsolutePath() . " is not a directory."); } } $ds = new DirectoryScanner(); $ds->setExpandSymbolicLinks($this->expandSymbolicLinks); $ds->setErrorOnMissingDir($this->errorOnMissingDir); $this->setupDirectoryScanner($ds, $p); $ds->scan(); return $ds; }
php
public function getDirectoryScanner(Project $p = null) { if ($p === null) { $p = $this->getProject(); } if ($this->isReference()) { $o = $this->getRef($p); return $o->getDirectoryScanner($p); } if ($this->dir === null) { throw new BuildException(sprintf("No directory specified for <%s>.", strtolower(get_class($this)))); } if (!$this->dir->exists() && $this->errorOnMissingDir) { throw new BuildException("Directory " . $this->dir->getAbsolutePath() . " not found."); } if (!$this->dir->isLink() || !$this->expandSymbolicLinks) { if (!$this->dir->isDirectory()) { throw new BuildException($this->dir->getAbsolutePath() . " is not a directory."); } } $ds = new DirectoryScanner(); $ds->setExpandSymbolicLinks($this->expandSymbolicLinks); $ds->setErrorOnMissingDir($this->errorOnMissingDir); $this->setupDirectoryScanner($ds, $p); $ds->scan(); return $ds; }
[ "public", "function", "getDirectoryScanner", "(", "Project", "$", "p", "=", "null", ")", "{", "if", "(", "$", "p", "===", "null", ")", "{", "$", "p", "=", "$", "this", "->", "getProject", "(", ")", ";", "}", "if", "(", "$", "this", "->", "isRefer...
returns a reference to the dirscanner object belonging to this fileset @param Project $p @throws BuildException @return \DirectoryScanner
[ "returns", "a", "reference", "to", "the", "dirscanner", "object", "belonging", "to", "this", "fileset" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/AbstractFileSet.php#L324-L354
train
phingofficial/phing
classes/phing/types/AbstractFileSet.php
AbstractFileSet.setupDirectoryScanner
protected function setupDirectoryScanner(DirectoryScanner $ds, Project $p = null) { if ($p === null) { $p = $this->getProject(); } if ($this->isReference()) { $this->getRef($p)->setupDirectoryScanner($ds, $p); return; } $stk[] = $this; $this->dieOnCircularReference($stk, $p); array_pop($stk); // FIXME - pass dir directly when dirscanner supports File $ds->setBasedir($this->dir->getPath()); foreach ($this->additionalPatterns as $addPattern) { $this->defaultPatterns->append($addPattern, $p); } $ds->setIncludes($this->defaultPatterns->getIncludePatterns($p)); $ds->setExcludes($this->defaultPatterns->getExcludePatterns($p)); $p->log( $this->getDataTypeName() . ": Setup file scanner in dir " . (string) $this->dir . " with " . (string) $this->defaultPatterns, Project::MSG_DEBUG ); if ($ds instanceof SelectorScanner) { $selectors = $this->getSelectors($p); foreach ($selectors as $selector) { $p->log((string) $selector . PHP_EOL, Project::MSG_DEBUG); } $ds->setSelectors($selectors); } if ($this->useDefaultExcludes) { $ds->addDefaultExcludes(); } $ds->setCaseSensitive($this->isCaseSensitive); }
php
protected function setupDirectoryScanner(DirectoryScanner $ds, Project $p = null) { if ($p === null) { $p = $this->getProject(); } if ($this->isReference()) { $this->getRef($p)->setupDirectoryScanner($ds, $p); return; } $stk[] = $this; $this->dieOnCircularReference($stk, $p); array_pop($stk); // FIXME - pass dir directly when dirscanner supports File $ds->setBasedir($this->dir->getPath()); foreach ($this->additionalPatterns as $addPattern) { $this->defaultPatterns->append($addPattern, $p); } $ds->setIncludes($this->defaultPatterns->getIncludePatterns($p)); $ds->setExcludes($this->defaultPatterns->getExcludePatterns($p)); $p->log( $this->getDataTypeName() . ": Setup file scanner in dir " . (string) $this->dir . " with " . (string) $this->defaultPatterns, Project::MSG_DEBUG ); if ($ds instanceof SelectorScanner) { $selectors = $this->getSelectors($p); foreach ($selectors as $selector) { $p->log((string) $selector . PHP_EOL, Project::MSG_DEBUG); } $ds->setSelectors($selectors); } if ($this->useDefaultExcludes) { $ds->addDefaultExcludes(); } $ds->setCaseSensitive($this->isCaseSensitive); }
[ "protected", "function", "setupDirectoryScanner", "(", "DirectoryScanner", "$", "ds", ",", "Project", "$", "p", "=", "null", ")", "{", "if", "(", "$", "p", "===", "null", ")", "{", "$", "p", "=", "$", "this", "->", "getProject", "(", ")", ";", "}", ...
feed dirscanner with infos defined by this fileset @param DirectoryScanner $ds @param Project $p @throws BuildException
[ "feed", "dirscanner", "with", "infos", "defined", "by", "this", "fileset" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/AbstractFileSet.php#L363-L405
train
phingofficial/phing
classes/phing/types/AbstractFileSet.php
AbstractFileSet.hasSelectors
public function hasSelectors() { if ($this->isReference() && $this->getProject() !== null) { return $this->getRef($this->getProject())->hasSelectors(); } return !empty($this->selectorsList); }
php
public function hasSelectors() { if ($this->isReference() && $this->getProject() !== null) { return $this->getRef($this->getProject())->hasSelectors(); } return !empty($this->selectorsList); }
[ "public", "function", "hasSelectors", "(", ")", "{", "if", "(", "$", "this", "->", "isReference", "(", ")", "&&", "$", "this", "->", "getProject", "(", ")", "!==", "null", ")", "{", "return", "$", "this", "->", "getRef", "(", "$", "this", "->", "ge...
Indicates whether there are any selectors here. @return boolean Whether any selectors are in this container
[ "Indicates", "whether", "there", "are", "any", "selectors", "here", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/AbstractFileSet.php#L450-L457
train
phingofficial/phing
classes/phing/types/AbstractFileSet.php
AbstractFileSet.hasPatterns
public function hasPatterns() { if ($this->isReference() && $this->getProject() !== null) { return $this->getRef($this->getProject())->hasPatterns(); } if ($this->defaultPatterns->hasPatterns()) { return true; } for ($i = 0, $size = count($this->additionalPatterns); $i < $size; $i++) { $ps = $this->additionalPatterns[$i]; if ($ps->hasPatterns()) { return true; } } return false; }
php
public function hasPatterns() { if ($this->isReference() && $this->getProject() !== null) { return $this->getRef($this->getProject())->hasPatterns(); } if ($this->defaultPatterns->hasPatterns()) { return true; } for ($i = 0, $size = count($this->additionalPatterns); $i < $size; $i++) { $ps = $this->additionalPatterns[$i]; if ($ps->hasPatterns()) { return true; } } return false; }
[ "public", "function", "hasPatterns", "(", ")", "{", "if", "(", "$", "this", "->", "isReference", "(", ")", "&&", "$", "this", "->", "getProject", "(", ")", "!==", "null", ")", "{", "return", "$", "this", "->", "getRef", "(", "$", "this", "->", "get...
Indicates whether there are any patterns here. @return boolean Whether any patterns are in this container.
[ "Indicates", "whether", "there", "are", "any", "patterns", "here", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/AbstractFileSet.php#L464-L482
train
phingofficial/phing
classes/phing/types/AbstractFileSet.php
AbstractFileSet.count
public function count() { if ($this->isReference() && $this->getProject() !== null) { try { return $this->getRef($this->getProject())->count(); } catch (Exception $e) { throw $e; } } return count($this->selectorsList); }
php
public function count() { if ($this->isReference() && $this->getProject() !== null) { try { return $this->getRef($this->getProject())->count(); } catch (Exception $e) { throw $e; } } return count($this->selectorsList); }
[ "public", "function", "count", "(", ")", "{", "if", "(", "$", "this", "->", "isReference", "(", ")", "&&", "$", "this", "->", "getProject", "(", ")", "!==", "null", ")", "{", "try", "{", "return", "$", "this", "->", "getRef", "(", "$", "this", "-...
Gives the count of the number of selectors in this container @throws Exception @return int The number of selectors in this container
[ "Gives", "the", "count", "of", "the", "number", "of", "selectors", "in", "this", "container" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/AbstractFileSet.php#L490-L501
train
phingofficial/phing
classes/phing/types/AbstractFileSet.php
AbstractFileSet.selectorElements
public function selectorElements() { if ($this->isReference() && $this->getProject() !== null) { return $this->getRef($this->getProject())->selectorElements(); } return $this->selectorsList; }
php
public function selectorElements() { if ($this->isReference() && $this->getProject() !== null) { return $this->getRef($this->getProject())->selectorElements(); } return $this->selectorsList; }
[ "public", "function", "selectorElements", "(", ")", "{", "if", "(", "$", "this", "->", "isReference", "(", ")", "&&", "$", "this", "->", "getProject", "(", ")", "!==", "null", ")", "{", "return", "$", "this", "->", "getRef", "(", "$", "this", "->", ...
Returns an array for accessing the set of selectors. @return array The array of selectors
[ "Returns", "an", "array", "for", "accessing", "the", "set", "of", "selectors", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/AbstractFileSet.php#L530-L537
train
phingofficial/phing
classes/phing/filters/ReplaceRegexp.php
ReplaceRegexp.read
public function read($len = null) { $buffer = $this->in->read($len); if ($buffer === -1) { return -1; } // perform regex replace here ... foreach ($this->regexps as $exptype) { $regexp = $exptype->getRegexp($this->project); try { $buffer = $regexp->replace($buffer); $this->log( "Performing regexp replace: /" . $regexp->getPattern() . "/" . $regexp->getReplace() . "/g" . $regexp->getModifiers(), Project::MSG_VERBOSE ); } catch (Exception $e) { // perhaps mismatch in params (e.g. no replace or pattern specified) $this->log("Error performing regexp replace: " . $e->getMessage(), Project::MSG_WARN); } } return $buffer; }
php
public function read($len = null) { $buffer = $this->in->read($len); if ($buffer === -1) { return -1; } // perform regex replace here ... foreach ($this->regexps as $exptype) { $regexp = $exptype->getRegexp($this->project); try { $buffer = $regexp->replace($buffer); $this->log( "Performing regexp replace: /" . $regexp->getPattern() . "/" . $regexp->getReplace() . "/g" . $regexp->getModifiers(), Project::MSG_VERBOSE ); } catch (Exception $e) { // perhaps mismatch in params (e.g. no replace or pattern specified) $this->log("Error performing regexp replace: " . $e->getMessage(), Project::MSG_WARN); } } 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 regex replace is performed. @param int $len Required $len for Reader compliance. @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", "regex", "replace", "is", "performed", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/ReplaceRegexp.php#L87-L111
train
phingofficial/phing
classes/phing/filters/ReplaceRegexp.php
ReplaceRegexp.chain
public function chain(Reader $reader) { $newFilter = new ReplaceRegExp($reader); $newFilter->setProject($this->getProject()); $newFilter->setRegexps($this->getRegexps()); return $newFilter; }
php
public function chain(Reader $reader) { $newFilter = new ReplaceRegExp($reader); $newFilter->setProject($this->getProject()); $newFilter->setRegexps($this->getRegexps()); return $newFilter; }
[ "public", "function", "chain", "(", "Reader", "$", "reader", ")", "{", "$", "newFilter", "=", "new", "ReplaceRegExp", "(", "$", "reader", ")", ";", "$", "newFilter", "->", "setProject", "(", "$", "this", "->", "getProject", "(", ")", ")", ";", "$", "...
Creates a new ReplaceRegExp 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 ReplaceRegExp A new filter based on this configuration, but filtering the specified reader
[ "Creates", "a", "new", "ReplaceRegExp", "filter", "using", "the", "passed", "in", "Reader", "for", "instantiation", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/ReplaceRegexp.php#L123-L130
train
phingofficial/phing
classes/phing/tasks/ext/pdo/PDOSQLExecTask.php
PDOSQLExecTask.setFetchmode
public function setFetchmode($mode) { if (is_numeric($mode)) { $this->fetchMode = (int) $mode; } else { if (defined($mode)) { $this->fetchMode = constant($mode); } else { throw new BuildException("Invalid PDO fetch mode specified: " . $mode, $this->getLocation()); } } }
php
public function setFetchmode($mode) { if (is_numeric($mode)) { $this->fetchMode = (int) $mode; } else { if (defined($mode)) { $this->fetchMode = constant($mode); } else { throw new BuildException("Invalid PDO fetch mode specified: " . $mode, $this->getLocation()); } } }
[ "public", "function", "setFetchmode", "(", "$", "mode", ")", "{", "if", "(", "is_numeric", "(", "$", "mode", ")", ")", "{", "$", "this", "->", "fetchMode", "=", "(", "int", ")", "$", "mode", ";", "}", "else", "{", "if", "(", "defined", "(", "$", ...
Sets the fetch mode to use for the PDO resultset. @param mixed $mode The PDO fetchmode integer or constant name. @throws BuildException
[ "Sets", "the", "fetch", "mode", "to", "use", "for", "the", "PDO", "resultset", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdo/PDOSQLExecTask.php#L282-L293
train
phingofficial/phing
classes/phing/tasks/ext/pdo/PDOSQLExecTask.php
PDOSQLExecTask.runStatements
public function runStatements(Reader $reader) { if (self::DELIM_NONE == $this->delimiterType) { include_once 'phing/tasks/ext/pdo/DummyPDOQuerySplitter.php'; $splitter = new DummyPDOQuerySplitter($this, $reader); } elseif (self::DELIM_NORMAL == $this->delimiterType && 0 === strpos($this->getUrl(), 'pgsql:')) { include_once 'phing/tasks/ext/pdo/PgsqlPDOQuerySplitter.php'; $splitter = new PgsqlPDOQuerySplitter($this, $reader); } else { include_once 'phing/tasks/ext/pdo/DefaultPDOQuerySplitter.php'; $splitter = new DefaultPDOQuerySplitter($this, $reader, $this->delimiterType); } try { while (null !== ($query = $splitter->nextQuery())) { $this->log("SQL: " . $query, Project::MSG_VERBOSE); $this->execSQL($query); } } catch (PDOException $e) { throw $e; } }
php
public function runStatements(Reader $reader) { if (self::DELIM_NONE == $this->delimiterType) { include_once 'phing/tasks/ext/pdo/DummyPDOQuerySplitter.php'; $splitter = new DummyPDOQuerySplitter($this, $reader); } elseif (self::DELIM_NORMAL == $this->delimiterType && 0 === strpos($this->getUrl(), 'pgsql:')) { include_once 'phing/tasks/ext/pdo/PgsqlPDOQuerySplitter.php'; $splitter = new PgsqlPDOQuerySplitter($this, $reader); } else { include_once 'phing/tasks/ext/pdo/DefaultPDOQuerySplitter.php'; $splitter = new DefaultPDOQuerySplitter($this, $reader, $this->delimiterType); } try { while (null !== ($query = $splitter->nextQuery())) { $this->log("SQL: " . $query, Project::MSG_VERBOSE); $this->execSQL($query); } } catch (PDOException $e) { throw $e; } }
[ "public", "function", "runStatements", "(", "Reader", "$", "reader", ")", "{", "if", "(", "self", "::", "DELIM_NONE", "==", "$", "this", "->", "delimiterType", ")", "{", "include_once", "'phing/tasks/ext/pdo/DummyPDOQuerySplitter.php'", ";", "$", "splitter", "=", ...
read in lines and execute them @param Reader $reader @throws BuildException
[ "read", "in", "lines", "and", "execute", "them" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdo/PDOSQLExecTask.php#L452-L473
train
phingofficial/phing
classes/phing/tasks/ext/pdo/PDOSQLExecTask.php
PDOSQLExecTask.execSQL
protected function execSQL($sql) { // Check and ignore empty statements if (trim($sql) == "") { return; } try { $this->totalSql++; $this->statement = $this->conn->query($sql); $this->log($this->statement->rowCount() . " rows affected", Project::MSG_VERBOSE); // only call processResults() for statements that return actual data (such as 'select') if ($this->statement->columnCount() > 0) { $this->processResults(); } $this->statement->closeCursor(); $this->statement = null; $this->goodSql++; } catch (PDOException $e) { $this->log("Failed to execute: " . $sql, Project::MSG_ERR); if ($this->onError != "continue") { throw new BuildException("Failed to execute SQL", $e); } $this->log($e->getMessage(), Project::MSG_ERR); } }
php
protected function execSQL($sql) { // Check and ignore empty statements if (trim($sql) == "") { return; } try { $this->totalSql++; $this->statement = $this->conn->query($sql); $this->log($this->statement->rowCount() . " rows affected", Project::MSG_VERBOSE); // only call processResults() for statements that return actual data (such as 'select') if ($this->statement->columnCount() > 0) { $this->processResults(); } $this->statement->closeCursor(); $this->statement = null; $this->goodSql++; } catch (PDOException $e) { $this->log("Failed to execute: " . $sql, Project::MSG_ERR); if ($this->onError != "continue") { throw new BuildException("Failed to execute SQL", $e); } $this->log($e->getMessage(), Project::MSG_ERR); } }
[ "protected", "function", "execSQL", "(", "$", "sql", ")", "{", "// Check and ignore empty statements", "if", "(", "trim", "(", "$", "sql", ")", "==", "\"\"", ")", "{", "return", ";", "}", "try", "{", "$", "this", "->", "totalSql", "++", ";", "$", "this...
Exec the sql statement. @param $sql @throws BuildException @throws Exception
[ "Exec", "the", "sql", "statement", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdo/PDOSQLExecTask.php#L499-L528
train
phingofficial/phing
classes/phing/tasks/ext/pdo/PDOSQLExecTask.php
PDOSQLExecTask.processResults
protected function processResults() { try { $this->log("Processing new result set.", Project::MSG_VERBOSE); $formatters = $this->getConfiguredFormatters(); while ($row = $this->statement->fetch($this->fetchMode)) { foreach ($formatters as $formatter) { $formatter->processRow($row); } } } catch (Exception $x) { $this->log("Error processing reults: " . $x->getMessage(), Project::MSG_ERR); foreach ($formatters as $formatter) { $formatter->close(); } throw $x; } }
php
protected function processResults() { try { $this->log("Processing new result set.", Project::MSG_VERBOSE); $formatters = $this->getConfiguredFormatters(); while ($row = $this->statement->fetch($this->fetchMode)) { foreach ($formatters as $formatter) { $formatter->processRow($row); } } } catch (Exception $x) { $this->log("Error processing reults: " . $x->getMessage(), Project::MSG_ERR); foreach ($formatters as $formatter) { $formatter->close(); } throw $x; } }
[ "protected", "function", "processResults", "(", ")", "{", "try", "{", "$", "this", "->", "log", "(", "\"Processing new result set.\"", ",", "Project", "::", "MSG_VERBOSE", ")", ";", "$", "formatters", "=", "$", "this", "->", "getConfiguredFormatters", "(", ")"...
Passes results from query to any formatters. @throws PDOException
[ "Passes", "results", "from", "query", "to", "any", "formatters", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdo/PDOSQLExecTask.php#L573-L592
train
phingofficial/phing
classes/phing/tasks/system/DeleteTask.php
DeleteTask.setVerbose
public function setVerbose($verbosity) { if ($verbosity) { $this->verbosity = Project::MSG_INFO; } else { $this->verbosity = Project::MSG_VERBOSE; } }
php
public function setVerbose($verbosity) { if ($verbosity) { $this->verbosity = Project::MSG_INFO; } else { $this->verbosity = Project::MSG_VERBOSE; } }
[ "public", "function", "setVerbose", "(", "$", "verbosity", ")", "{", "if", "(", "$", "verbosity", ")", "{", "$", "this", "->", "verbosity", "=", "Project", "::", "MSG_INFO", ";", "}", "else", "{", "$", "this", "->", "verbosity", "=", "Project", "::", ...
Used to force listing of all names of deleted files. @param boolean $verbosity
[ "Used", "to", "force", "listing", "of", "all", "names", "of", "deleted", "files", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/DeleteTask.php#L62-L69
train
phingofficial/phing
classes/phing/tasks/system/DeleteTask.php
DeleteTask.removeDir
private function removeDir($d) { $list = $d->listDir(); if ($list === null) { $list = []; } foreach ($list as $s) { $f = new PhingFile($d, $s); if ($f->isDirectory()) { $this->removeDir($f); } else { $this->log("Deleting " . $f->__toString(), $this->verbosity); try { $f->delete(); } catch (Exception $e) { $message = "Unable to delete file " . $f->__toString() . ": " . $e->getMessage(); if ($this->failonerror) { throw new BuildException($message); } else { $this->log($message, $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN); } } } } $this->log("Deleting directory " . $d->getAbsolutePath(), $this->verbosity); try { $d->delete(); } catch (Exception $e) { $message = "Unable to delete directory " . $d->__toString() . ": " . $e->getMessage(); if ($this->failonerror) { throw new BuildException($message); } else { $this->log($message, $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN); } } }
php
private function removeDir($d) { $list = $d->listDir(); if ($list === null) { $list = []; } foreach ($list as $s) { $f = new PhingFile($d, $s); if ($f->isDirectory()) { $this->removeDir($f); } else { $this->log("Deleting " . $f->__toString(), $this->verbosity); try { $f->delete(); } catch (Exception $e) { $message = "Unable to delete file " . $f->__toString() . ": " . $e->getMessage(); if ($this->failonerror) { throw new BuildException($message); } else { $this->log($message, $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN); } } } } $this->log("Deleting directory " . $d->getAbsolutePath(), $this->verbosity); try { $d->delete(); } catch (Exception $e) { $message = "Unable to delete directory " . $d->__toString() . ": " . $e->getMessage(); if ($this->failonerror) { throw new BuildException($message); } else { $this->log($message, $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN); } } }
[ "private", "function", "removeDir", "(", "$", "d", ")", "{", "$", "list", "=", "$", "d", "->", "listDir", "(", ")", ";", "if", "(", "$", "list", "===", "null", ")", "{", "$", "list", "=", "[", "]", ";", "}", "foreach", "(", "$", "list", "as",...
Recursively removes a directory. @param PhingFile $d The directory to remove. @throws BuildException
[ "Recursively", "removes", "a", "directory", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/DeleteTask.php#L233-L269
train
phingofficial/phing
classes/phing/tasks/system/DeleteTask.php
DeleteTask.removeFiles
private function removeFiles(PhingFile $d, &$files, &$dirs) { if (count($files) > 0) { $this->log("Deleting " . count($files) . " files from " . $d->__toString()); for ($j = 0, $_j = count($files); $j < $_j; $j++) { $f = new PhingFile($d, $files[$j]); $this->log("Deleting " . $f->getAbsolutePath(), $this->verbosity); try { $f->delete(); } catch (Exception $e) { $message = "Unable to delete file " . $f->__toString() . ": " . $e->getMessage(); if ($this->failonerror) { throw new BuildException($message); } else { $this->log($message, $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN); } } } } if (count($dirs) > 0 && $this->includeEmpty) { $dirCount = 0; for ($j = count($dirs) - 1; $j >= 0; --$j) { $dir = new PhingFile($d, $dirs[$j]); $dirFiles = $dir->listDir(); if ($dirFiles === null || count($dirFiles) === 0) { $this->log("Deleting " . $dir->__toString(), $this->verbosity); try { $dir->delete(); $dirCount++; } catch (Exception $e) { $message = "Unable to delete directory " . $dir->__toString(); if ($this->failonerror) { throw new BuildException($message); } else { $this->log($message, $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN); } } } } if ($dirCount > 0) { $this->log("Deleted $dirCount director" . ($dirCount == 1 ? "y" : "ies") . " from " . $d->__toString()); } } }
php
private function removeFiles(PhingFile $d, &$files, &$dirs) { if (count($files) > 0) { $this->log("Deleting " . count($files) . " files from " . $d->__toString()); for ($j = 0, $_j = count($files); $j < $_j; $j++) { $f = new PhingFile($d, $files[$j]); $this->log("Deleting " . $f->getAbsolutePath(), $this->verbosity); try { $f->delete(); } catch (Exception $e) { $message = "Unable to delete file " . $f->__toString() . ": " . $e->getMessage(); if ($this->failonerror) { throw new BuildException($message); } else { $this->log($message, $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN); } } } } if (count($dirs) > 0 && $this->includeEmpty) { $dirCount = 0; for ($j = count($dirs) - 1; $j >= 0; --$j) { $dir = new PhingFile($d, $dirs[$j]); $dirFiles = $dir->listDir(); if ($dirFiles === null || count($dirFiles) === 0) { $this->log("Deleting " . $dir->__toString(), $this->verbosity); try { $dir->delete(); $dirCount++; } catch (Exception $e) { $message = "Unable to delete directory " . $dir->__toString(); if ($this->failonerror) { throw new BuildException($message); } else { $this->log($message, $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN); } } } } if ($dirCount > 0) { $this->log("Deleted $dirCount director" . ($dirCount == 1 ? "y" : "ies") . " from " . $d->__toString()); } } }
[ "private", "function", "removeFiles", "(", "PhingFile", "$", "d", ",", "&", "$", "files", ",", "&", "$", "dirs", ")", "{", "if", "(", "count", "(", "$", "files", ")", ">", "0", ")", "{", "$", "this", "->", "log", "(", "\"Deleting \"", ".", "count...
remove an array of files in a directory, and a list of subdirectories which will only be deleted if 'includeEmpty' is true @param PhingFile $d directory to work from @param array &$files array of files to delete; can be of zero length @param array &$dirs array of directories to delete; can of zero length @throws BuildException
[ "remove", "an", "array", "of", "files", "in", "a", "directory", "and", "a", "list", "of", "subdirectories", "which", "will", "only", "be", "deleted", "if", "includeEmpty", "is", "true" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/DeleteTask.php#L280-L324
train
phingofficial/phing
classes/phing/types/selectors/DateSelector.php
DateSelector.setWhen
public function setWhen($cmp) { $idx = array_search($cmp, self::$timeComparisons, true); if ($idx === null) { $this->setError("Invalid value for " . self::WHEN_KEY . ": " . $cmp); } else { $this->cmp = $idx; } }
php
public function setWhen($cmp) { $idx = array_search($cmp, self::$timeComparisons, true); if ($idx === null) { $this->setError("Invalid value for " . self::WHEN_KEY . ": " . $cmp); } else { $this->cmp = $idx; } }
[ "public", "function", "setWhen", "(", "$", "cmp", ")", "{", "$", "idx", "=", "array_search", "(", "$", "cmp", ",", "self", "::", "$", "timeComparisons", ",", "true", ")", ";", "if", "(", "$", "idx", "===", "null", ")", "{", "$", "this", "->", "se...
Sets the type of comparison to be done on the file's last modified date. @param string $cmp The comparison to perform
[ "Sets", "the", "type", "of", "comparison", "to", "be", "done", "on", "the", "file", "s", "last", "modified", "date", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/selectors/DateSelector.php#L151-L159
train
phingofficial/phing
classes/phing/types/selectors/DateSelector.php
DateSelector.verifySettings
public function verifySettings() { if ($this->dateTime === null && $this->seconds < 0) { $this->setError( "You must provide a datetime or the number of " . "seconds." ); } elseif ($this->seconds < 0) { $this->setError( "Date of " . $this->dateTime . " results in negative seconds" . " value relative to epoch (January 1, 1970, 00:00:00 GMT)." ); } }
php
public function verifySettings() { if ($this->dateTime === null && $this->seconds < 0) { $this->setError( "You must provide a datetime or the number of " . "seconds." ); } elseif ($this->seconds < 0) { $this->setError( "Date of " . $this->dateTime . " results in negative seconds" . " value relative to epoch (January 1, 1970, 00:00:00 GMT)." ); } }
[ "public", "function", "verifySettings", "(", ")", "{", "if", "(", "$", "this", "->", "dateTime", "===", "null", "&&", "$", "this", "->", "seconds", "<", "0", ")", "{", "$", "this", "->", "setError", "(", "\"You must provide a datetime or the number of \"", "...
This is a consistency check to ensure the selector's required values have been set.
[ "This", "is", "a", "consistency", "check", "to", "ensure", "the", "selector", "s", "required", "values", "have", "been", "set", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/selectors/DateSelector.php#L201-L215
train
phingofficial/phing
classes/phing/tasks/ext/coverage/CoverageReportTask.php
CoverageReportTask.addSubpackageToPackage
protected function addSubpackageToPackage($packageName, $subpackageName) { $package = $this->getPackageElement($packageName); $subpackage = $this->getSubpackageElement($subpackageName); if ($package === null) { $package = $this->doc->createElement('package'); $package->setAttribute('name', $packageName); $this->doc->documentElement->appendChild($package); } if ($subpackage === null) { $subpackage = $this->doc->createElement('subpackage'); $subpackage->setAttribute('name', $subpackageName); } $package->appendChild($subpackage); }
php
protected function addSubpackageToPackage($packageName, $subpackageName) { $package = $this->getPackageElement($packageName); $subpackage = $this->getSubpackageElement($subpackageName); if ($package === null) { $package = $this->doc->createElement('package'); $package->setAttribute('name', $packageName); $this->doc->documentElement->appendChild($package); } if ($subpackage === null) { $subpackage = $this->doc->createElement('subpackage'); $subpackage->setAttribute('name', $subpackageName); } $package->appendChild($subpackage); }
[ "protected", "function", "addSubpackageToPackage", "(", "$", "packageName", ",", "$", "subpackageName", ")", "{", "$", "package", "=", "$", "this", "->", "getPackageElement", "(", "$", "packageName", ")", ";", "$", "subpackage", "=", "$", "this", "->", "getS...
Adds a subpackage to their package @param string $packageName The name of the package @param string $subpackageName The name of the subpackage @author Benjamin Schultz <bschultz@proqrent.de> @return void
[ "Adds", "a", "subpackage", "to", "their", "package" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/coverage/CoverageReportTask.php#L140-L157
train
phingofficial/phing
classes/phing/tasks/ext/coverage/CoverageReportTask.php
CoverageReportTask.getSubpackageElement
protected function getSubpackageElement($subpackageName) { $subpackages = $this->doc->documentElement->getElementsByTagName('subpackage'); foreach ($subpackages as $subpackage) { if ($subpackage->getAttribute('name') == $subpackageName) { return $subpackage; } } return null; }
php
protected function getSubpackageElement($subpackageName) { $subpackages = $this->doc->documentElement->getElementsByTagName('subpackage'); foreach ($subpackages as $subpackage) { if ($subpackage->getAttribute('name') == $subpackageName) { return $subpackage; } } return null; }
[ "protected", "function", "getSubpackageElement", "(", "$", "subpackageName", ")", "{", "$", "subpackages", "=", "$", "this", "->", "doc", "->", "documentElement", "->", "getElementsByTagName", "(", "'subpackage'", ")", ";", "foreach", "(", "$", "subpackages", "a...
Returns the subpackage element @param string $subpackageName The name of the subpackage @author Benjamin Schultz <bschultz@proqrent.de> @return DOMNode|null null when no DOMNode with the given name exists
[ "Returns", "the", "subpackage", "element" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/coverage/CoverageReportTask.php#L167-L178
train
phingofficial/phing
classes/phing/tasks/ext/coverage/CoverageReportTask.php
CoverageReportTask.addClassToSubpackage
protected function addClassToSubpackage($classname, $element) { $subpackageName = PHPUnitUtil::getSubpackageName($classname); $subpackage = $this->getSubpackageElement($subpackageName); if ($subpackage === null) { $subpackage = $this->doc->createElement('subpackage'); $subpackage->setAttribute('name', $subpackageName); $this->doc->documentElement->appendChild($subpackage); } $subpackage->appendChild($element); }
php
protected function addClassToSubpackage($classname, $element) { $subpackageName = PHPUnitUtil::getSubpackageName($classname); $subpackage = $this->getSubpackageElement($subpackageName); if ($subpackage === null) { $subpackage = $this->doc->createElement('subpackage'); $subpackage->setAttribute('name', $subpackageName); $this->doc->documentElement->appendChild($subpackage); } $subpackage->appendChild($element); }
[ "protected", "function", "addClassToSubpackage", "(", "$", "classname", ",", "$", "element", ")", "{", "$", "subpackageName", "=", "PHPUnitUtil", "::", "getSubpackageName", "(", "$", "classname", ")", ";", "$", "subpackage", "=", "$", "this", "->", "getSubpack...
Adds a class to their subpackage @param string $classname The name of the class @param DOMNode $element The dom node to append to the subpackage element @author Benjamin Schultz <bschultz@proqrent.de> @return void
[ "Adds", "a", "class", "to", "their", "subpackage" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/coverage/CoverageReportTask.php#L189-L202
train
phingofficial/phing
classes/phing/system/io/XmlFileParser.php
XmlFileParser.getProperties
private function getProperties(PhingFile $file) { // load() already made sure that file is readable // but we'll double check that when reading the file into // an array if ((@file($file)) === false) { throw new IOException("Unable to parse contents of $file"); } $prop = new Properties(); $xml = simplexml_load_string(file_get_contents($file)); if ($xml === false) { throw new IOException("Unable to parse XML file $file"); } $path = []; if ($this->keepRoot) { $path[] = dom_import_simplexml($xml)->tagName; $prefix = implode('.', $path); if (!empty($prefix)) { $prefix .= '.'; } // Check for attributes foreach ($xml->attributes() as $attribute => $val) { if ($this->collapseAttr) { $prop->setProperty($prefix . (string) $attribute, (string) $val); } else { $prop->setProperty($prefix . "($attribute)", (string) $val); } } } $this->addNode($xml, $path, $prop); return $prop; }
php
private function getProperties(PhingFile $file) { // load() already made sure that file is readable // but we'll double check that when reading the file into // an array if ((@file($file)) === false) { throw new IOException("Unable to parse contents of $file"); } $prop = new Properties(); $xml = simplexml_load_string(file_get_contents($file)); if ($xml === false) { throw new IOException("Unable to parse XML file $file"); } $path = []; if ($this->keepRoot) { $path[] = dom_import_simplexml($xml)->tagName; $prefix = implode('.', $path); if (!empty($prefix)) { $prefix .= '.'; } // Check for attributes foreach ($xml->attributes() as $attribute => $val) { if ($this->collapseAttr) { $prop->setProperty($prefix . (string) $attribute, (string) $val); } else { $prop->setProperty($prefix . "($attribute)", (string) $val); } } } $this->addNode($xml, $path, $prop); return $prop; }
[ "private", "function", "getProperties", "(", "PhingFile", "$", "file", ")", "{", "// load() already made sure that file is readable", "// but we'll double check that when reading the file into", "// an array", "if", "(", "(", "@", "file", "(", "$", "file", ")", ")", "==="...
Parses an XML file and returns properties @param PhingFile $file @throws IOException @return Properties
[ "Parses", "an", "XML", "file", "and", "returns", "properties" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/XmlFileParser.php#L74-L116
train
phingofficial/phing
classes/phing/system/io/XmlFileParser.php
XmlFileParser.addNode
private function addNode($node, $path, $prop) { foreach ($node as $tag => $value) { $prefix = implode('.', $path); if ($prefix !== '') { $prefix .= '.'; } // Check for attributes foreach ($value->attributes() as $attribute => $val) { if ($this->collapseAttr) { $prop->setProperty($prefix . "$tag.$attribute", (string) $val); } else { $prop->setProperty($prefix . "$tag($attribute)", (string) $val); } } // Add tag if (count($value->children())) { $this->addNode($value, array_merge($path, [$tag]), $prop); } else { $val = (string) $value; /* Check for * and ** on 'exclude' and 'include' tag / ant seems to do this? could use FileSet here if ($tag == 'exclude') { }*/ // When property already exists, i.e. multiple xml tag // <project> // <exclude>file/a.php</exclude> // <exclude>file/a.php</exclude> // </project> // // Would be come project.exclude = file/a.php,file/a.php $p = empty($prefix) ? $tag : $prefix . $tag; $prop->append($p, (string) $val, $this->delimiter); } } }
php
private function addNode($node, $path, $prop) { foreach ($node as $tag => $value) { $prefix = implode('.', $path); if ($prefix !== '') { $prefix .= '.'; } // Check for attributes foreach ($value->attributes() as $attribute => $val) { if ($this->collapseAttr) { $prop->setProperty($prefix . "$tag.$attribute", (string) $val); } else { $prop->setProperty($prefix . "$tag($attribute)", (string) $val); } } // Add tag if (count($value->children())) { $this->addNode($value, array_merge($path, [$tag]), $prop); } else { $val = (string) $value; /* Check for * and ** on 'exclude' and 'include' tag / ant seems to do this? could use FileSet here if ($tag == 'exclude') { }*/ // When property already exists, i.e. multiple xml tag // <project> // <exclude>file/a.php</exclude> // <exclude>file/a.php</exclude> // </project> // // Would be come project.exclude = file/a.php,file/a.php $p = empty($prefix) ? $tag : $prefix . $tag; $prop->append($p, (string) $val, $this->delimiter); } } }
[ "private", "function", "addNode", "(", "$", "node", ",", "$", "path", ",", "$", "prop", ")", "{", "foreach", "(", "$", "node", "as", "$", "tag", "=>", "$", "value", ")", "{", "$", "prefix", "=", "implode", "(", "'.'", ",", "$", "path", ")", ";"...
Adds an XML node @param SimpleXMLElement $node @param array $path Path to this node @param Properties $prop Properties will be added as they are found (by reference here) @return void
[ "Adds", "an", "XML", "node" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/XmlFileParser.php#L127-L166
train
phingofficial/phing
classes/phing/tasks/system/condition/IsSetCondition.php
IsSetCondition.evaluate
public function evaluate() { if ($this->property === null) { throw new BuildException( "No property specified for isset " . "condition" ); } return $this->project->getProperty($this->property) !== null; }
php
public function evaluate() { if ($this->property === null) { throw new BuildException( "No property specified for isset " . "condition" ); } return $this->project->getProperty($this->property) !== null; }
[ "public", "function", "evaluate", "(", ")", "{", "if", "(", "$", "this", "->", "property", "===", "null", ")", "{", "throw", "new", "BuildException", "(", "\"No property specified for isset \"", ".", "\"condition\"", ")", ";", "}", "return", "$", "this", "->...
Check whether property is set. @throws BuildException
[ "Check", "whether", "property", "is", "set", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/condition/IsSetCondition.php#L44-L54
train
phingofficial/phing
classes/phing/filters/StripLineComments.php
StripLineComments.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 = []; $commentsSize = count($this->_comments); foreach ($lines as $line) { for ($i = 0; $i < $commentsSize; $i++) { $comment = $this->_comments[$i]->getValue(); if (StringHelper::startsWith($comment, ltrim($line))) { $line = null; break; } } if ($line !== null) { $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 = []; $commentsSize = count($this->_comments); foreach ($lines as $line) { for ($i = 0; $i < $commentsSize; $i++) { $comment = $this->_comments[$i]->getValue(); if (StringHelper::startsWith($comment, ltrim($line))) { $line = null; break; } } if ($line !== null) { $filtered[] = $line; } } $filtered_buffer = implode("\n", $filtered); return $filtered_buffer; }
[ "public", "function", "read", "(", "$", "len", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "getInitialized", "(", ")", ")", "{", "$", "this", "->", "_initialize", "(", ")", ";", "$", "this", "->", "setInitialized", "(", "true", ")", ...
Returns stream only including lines from the original stream which don't start with any of the specified comment prefixes. @param null $len @return mixed the resulting stream, or -1 if the end of the resulting stream has been reached.
[ "Returns", "stream", "only", "including", "lines", "from", "the", "original", "stream", "which", "don", "t", "start", "with", "any", "of", "the", "specified", "comment", "prefixes", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/StripLineComments.php#L70-L104
train
phingofficial/phing
classes/phing/types/selectors/ExtendSelector.php
ExtendSelector.selectorCreate
public function selectorCreate() { if ($this->classname !== null && $this->classname !== "") { try { // assume it's fully qualified, import it $cls = Phing::import($this->classname); // make sure class exists if (class_exists($cls)) { $this->dynselector = new $cls(); } else { $this->setError("Selector " . $this->classname . " not initialized, no such class"); } } catch (Exception $e) { $this->setError( "Selector " . $this->classname . " not initialized, could not create class.", $e ); } } else { $this->setError("There is no classname specified"); } }
php
public function selectorCreate() { if ($this->classname !== null && $this->classname !== "") { try { // assume it's fully qualified, import it $cls = Phing::import($this->classname); // make sure class exists if (class_exists($cls)) { $this->dynselector = new $cls(); } else { $this->setError("Selector " . $this->classname . " not initialized, no such class"); } } catch (Exception $e) { $this->setError( "Selector " . $this->classname . " not initialized, could not create class.", $e ); } } else { $this->setError("There is no classname specified"); } }
[ "public", "function", "selectorCreate", "(", ")", "{", "if", "(", "$", "this", "->", "classname", "!==", "null", "&&", "$", "this", "->", "classname", "!==", "\"\"", ")", "{", "try", "{", "// assume it's fully qualified, import it", "$", "cls", "=", "Phing",...
Instantiates the identified custom selector class.
[ "Instantiates", "the", "identified", "custom", "selector", "class", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/selectors/ExtendSelector.php#L49-L71
train
phingofficial/phing
classes/phing/types/selectors/ExtendSelector.php
ExtendSelector.isSelected
public function isSelected(PhingFile $basedir, $filename, PhingFile $file) { $this->validate(); if (count($this->parameters) > 0 && $this->dynselector instanceof ExtendFileSelector) { // We know that dynselector must be non-null if no error message $this->dynselector->setParameters($this->parameters); } return $this->dynselector->isSelected($basedir, $filename, $file); }
php
public function isSelected(PhingFile $basedir, $filename, PhingFile $file) { $this->validate(); if (count($this->parameters) > 0 && $this->dynselector instanceof ExtendFileSelector) { // We know that dynselector must be non-null if no error message $this->dynselector->setParameters($this->parameters); } return $this->dynselector->isSelected($basedir, $filename, $file); }
[ "public", "function", "isSelected", "(", "PhingFile", "$", "basedir", ",", "$", "filename", ",", "PhingFile", "$", "file", ")", "{", "$", "this", "->", "validate", "(", ")", ";", "if", "(", "count", "(", "$", "this", "->", "parameters", ")", ">", "0"...
Allows the custom selector to choose whether to select a file. This is also where the Parameters are passed to the custom selector. @param PhingFile $basedir @param string $filename The filename @param PhingFile $file @return bool @throws BuildException
[ "Allows", "the", "custom", "selector", "to", "choose", "whether", "to", "select", "a", "file", ".", "This", "is", "also", "where", "the", "Parameters", "are", "passed", "to", "the", "custom", "selector", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/selectors/ExtendSelector.php#L120-L130
train
phingofficial/phing
classes/phing/tasks/ext/ExportPropertiesTask.php
ExportPropertiesTask.setTargetFile
public function setTargetFile($file) { if (!is_dir(dirname($file))) { throw new BuildException("Parent directory of target file doesn't exist"); } if (!is_writable(dirname($file)) && (file_exists($file) && !is_writable($file))) { throw new BuildException("Target file isn't writable"); } $this->_targetFile = $file; return true; }
php
public function setTargetFile($file) { if (!is_dir(dirname($file))) { throw new BuildException("Parent directory of target file doesn't exist"); } if (!is_writable(dirname($file)) && (file_exists($file) && !is_writable($file))) { throw new BuildException("Target file isn't writable"); } $this->_targetFile = $file; return true; }
[ "public", "function", "setTargetFile", "(", "$", "file", ")", "{", "if", "(", "!", "is_dir", "(", "dirname", "(", "$", "file", ")", ")", ")", "{", "throw", "new", "BuildException", "(", "\"Parent directory of target file doesn't exist\"", ")", ";", "}", "if"...
setter for _targetFile @param string $file @throws BuildException @return bool
[ "setter", "for", "_targetFile" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/ExportPropertiesTask.php#L69-L82
train
phingofficial/phing
classes/phing/system/io/BufferedReader.php
BufferedReader.read
public function read($len = null) { // if $len is specified, we'll use that; otherwise, use the configured buffer size. if ($len === null) { $len = $this->bufferSize; } if (($data = $this->in->read($len)) !== -1) { // not all files end with a newline character, so we also need to check EOF if (!$this->in->eof()) { $notValidPart = strrchr($data, "\n"); $notValidPartSize = strlen($notValidPart); if ($notValidPartSize > 1) { // Block doesn't finish on a EOL // Find the last EOL and forget all following stuff $dataSize = strlen($data); $validSize = $dataSize - $notValidPartSize + 1; $data = substr($data, 0, $validSize); // Rewind to the beginning of the forgotten stuff. $this->in->skip(-$notValidPartSize + 1); } } // if !EOF } return $data; }
php
public function read($len = null) { // if $len is specified, we'll use that; otherwise, use the configured buffer size. if ($len === null) { $len = $this->bufferSize; } if (($data = $this->in->read($len)) !== -1) { // not all files end with a newline character, so we also need to check EOF if (!$this->in->eof()) { $notValidPart = strrchr($data, "\n"); $notValidPartSize = strlen($notValidPart); if ($notValidPartSize > 1) { // Block doesn't finish on a EOL // Find the last EOL and forget all following stuff $dataSize = strlen($data); $validSize = $dataSize - $notValidPartSize + 1; $data = substr($data, 0, $validSize); // Rewind to the beginning of the forgotten stuff. $this->in->skip(-$notValidPartSize + 1); } } // if !EOF } return $data; }
[ "public", "function", "read", "(", "$", "len", "=", "null", ")", "{", "// if $len is specified, we'll use that; otherwise, use the configured buffer size.", "if", "(", "$", "len", "===", "null", ")", "{", "$", "len", "=", "$", "this", "->", "bufferSize", ";", "}...
Reads and returns a chunk of data. @param int $len Number of bytes to read. Default is to read configured buffer size number of bytes. @return mixed buffer or -1 if EOF.
[ "Reads", "and", "returns", "a", "chunk", "of", "data", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/BufferedReader.php#L61-L90
train
phingofficial/phing
classes/phing/system/io/BufferedReader.php
BufferedReader.readLine
public function readLine() { $line = null; while (($ch = $this->readChar()) !== -1) { if ($ch === "\n") { break; } $line .= $ch; } // Warning : Not considering an empty line as an EOF if ($line === null && $ch !== -1) { return ""; } return $line; }
php
public function readLine() { $line = null; while (($ch = $this->readChar()) !== -1) { if ($ch === "\n") { break; } $line .= $ch; } // Warning : Not considering an empty line as an EOF if ($line === null && $ch !== -1) { return ""; } return $line; }
[ "public", "function", "readLine", "(", ")", "{", "$", "line", "=", "null", ";", "while", "(", "(", "$", "ch", "=", "$", "this", "->", "readChar", "(", ")", ")", "!==", "-", "1", ")", "{", "if", "(", "$", "ch", "===", "\"\\n\"", ")", "{", "bre...
Read a line from input stream.
[ "Read", "a", "line", "from", "input", "stream", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/BufferedReader.php#L114-L130
train
phingofficial/phing
classes/phing/system/io/BufferedReader.php
BufferedReader.readChar
public function readChar() { if ($this->buffer === null) { // Buffer is empty, fill it ... $read = $this->in->read($this->bufferSize); if ($read === -1) { $ch = -1; } else { $this->buffer = $read; return $this->readChar(); // recurse } } else { // Get next buffered char ... // handle case where buffer is read-in, but is empty. The next readChar() will return -1 EOF, // so we just return empty string (char) at this point. (Probably could also return -1 ...?) $ch = ($this->buffer !== "") ? $this->buffer{$this->bufferPos} : ''; $this->bufferPos++; if ($this->bufferPos >= strlen($this->buffer)) { $this->buffer = null; $this->bufferPos = 0; } } return $ch; }
php
public function readChar() { if ($this->buffer === null) { // Buffer is empty, fill it ... $read = $this->in->read($this->bufferSize); if ($read === -1) { $ch = -1; } else { $this->buffer = $read; return $this->readChar(); // recurse } } else { // Get next buffered char ... // handle case where buffer is read-in, but is empty. The next readChar() will return -1 EOF, // so we just return empty string (char) at this point. (Probably could also return -1 ...?) $ch = ($this->buffer !== "") ? $this->buffer{$this->bufferPos} : ''; $this->bufferPos++; if ($this->bufferPos >= strlen($this->buffer)) { $this->buffer = null; $this->bufferPos = 0; } } return $ch; }
[ "public", "function", "readChar", "(", ")", "{", "if", "(", "$", "this", "->", "buffer", "===", "null", ")", "{", "// Buffer is empty, fill it ...", "$", "read", "=", "$", "this", "->", "in", "->", "read", "(", "$", "this", "->", "bufferSize", ")", ";"...
Reads a single char from the reader. @return string single char or -1 if EOF.
[ "Reads", "a", "single", "char", "from", "the", "reader", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/BufferedReader.php#L137-L162
train
phingofficial/phing
classes/phing/types/Commandline.php
Commandline.createArgument
public function createArgument($insertAtStart = false) { $argument = new CommandlineArgument($this); if ($insertAtStart) { array_unshift($this->arguments, $argument); } else { $this->arguments[] = $argument; } return $argument; }
php
public function createArgument($insertAtStart = false) { $argument = new CommandlineArgument($this); if ($insertAtStart) { array_unshift($this->arguments, $argument); } else { $this->arguments[] = $argument; } return $argument; }
[ "public", "function", "createArgument", "(", "$", "insertAtStart", "=", "false", ")", "{", "$", "argument", "=", "new", "CommandlineArgument", "(", "$", "this", ")", ";", "if", "(", "$", "insertAtStart", ")", "{", "array_unshift", "(", "$", "this", "->", ...
Creates an argument object and adds it to our list of args. <p>Each commandline object has at most one instance of the argument class.</p> @param boolean $insertAtStart if true, the argument is inserted at the beginning of the list of args, otherwise it is appended. @return CommandlineArgument
[ "Creates", "an", "argument", "object", "and", "adds", "it", "to", "our", "list", "of", "args", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Commandline.php#L88-L98
train
phingofficial/phing
classes/phing/types/Commandline.php
Commandline.setExecutable
public function setExecutable($executable, $translateFileSeparator = true): void { if ($executable === null || $executable === '') { return; } $this->executable = $translateFileSeparator ? str_replace(['/', '\\'], PhingFile::$separator, $executable) : $executable; }
php
public function setExecutable($executable, $translateFileSeparator = true): void { if ($executable === null || $executable === '') { return; } $this->executable = $translateFileSeparator ? str_replace(['/', '\\'], PhingFile::$separator, $executable) : $executable; }
[ "public", "function", "setExecutable", "(", "$", "executable", ",", "$", "translateFileSeparator", "=", "true", ")", ":", "void", "{", "if", "(", "$", "executable", "===", "null", "||", "$", "executable", "===", "''", ")", "{", "return", ";", "}", "$", ...
Sets the executable to run. @param string $executable @param bool $translateFileSeparator
[ "Sets", "the", "executable", "to", "run", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Commandline.php#L106-L114
train
phingofficial/phing
classes/phing/types/Commandline.php
Commandline.getCommandline
public function getCommandline(): array { $args = $this->getArguments(); if ($this->executable !== null && $this->executable !== '') { array_unshift($args, $this->executable); } return $args; }
php
public function getCommandline(): array { $args = $this->getArguments(); if ($this->executable !== null && $this->executable !== '') { array_unshift($args, $this->executable); } return $args; }
[ "public", "function", "getCommandline", "(", ")", ":", "array", "{", "$", "args", "=", "$", "this", "->", "getArguments", "(", ")", ";", "if", "(", "$", "this", "->", "executable", "!==", "null", "&&", "$", "this", "->", "executable", "!==", "''", ")...
Returns the executable and all defined arguments. @return array
[ "Returns", "the", "executable", "and", "all", "defined", "arguments", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Commandline.php#L139-L147
train
phingofficial/phing
classes/phing/types/Commandline.php
Commandline.quoteArgument
public static function quoteArgument($argument, $escape = false) { if ($escape) { return escapeshellarg($argument); } if (strpos($argument, '"') !== false) { if (strpos($argument, "'") !== false) { throw new BuildException("Can't handle single and double quotes in same argument"); } return '\'' . $argument . '\''; } if (strpos($argument, "'") !== false || strpos($argument, ' ') !== false // WIN9x uses a bat file for executing commands || (OsCondition::isFamily('win32') && strpos($argument, ';') !== false) ) { return '"' . $argument . '"'; } return $argument; }
php
public static function quoteArgument($argument, $escape = false) { if ($escape) { return escapeshellarg($argument); } if (strpos($argument, '"') !== false) { if (strpos($argument, "'") !== false) { throw new BuildException("Can't handle single and double quotes in same argument"); } return '\'' . $argument . '\''; } if (strpos($argument, "'") !== false || strpos($argument, ' ') !== false // WIN9x uses a bat file for executing commands || (OsCondition::isFamily('win32') && strpos($argument, ';') !== false) ) { return '"' . $argument . '"'; } return $argument; }
[ "public", "static", "function", "quoteArgument", "(", "$", "argument", ",", "$", "escape", "=", "false", ")", "{", "if", "(", "$", "escape", ")", "{", "return", "escapeshellarg", "(", "$", "argument", ")", ";", "}", "if", "(", "strpos", "(", "$", "ar...
Put quotes around the given String if necessary. <p>If the argument doesn't include spaces or quotes, return it as is. If it contains double quotes, use single quotes - else surround the argument by double quotes.</p> @param $argument @return string @throws BuildException if the argument contains both, single and double quotes.
[ "Put", "quotes", "around", "the", "given", "String", "if", "necessary", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Commandline.php#L201-L224
train
phingofficial/phing
classes/phing/types/Commandline.php
Commandline.toString
private function toString($lines = null): string { // empty path return empty string if ($lines === null || count($lines) === 0) { return ''; } return implode( ' ', array_map( function ($arg) { return self::quoteArgument($arg, $this->escape); }, $lines ) ); }
php
private function toString($lines = null): string { // empty path return empty string if ($lines === null || count($lines) === 0) { return ''; } return implode( ' ', array_map( function ($arg) { return self::quoteArgument($arg, $this->escape); }, $lines ) ); }
[ "private", "function", "toString", "(", "$", "lines", "=", "null", ")", ":", "string", "{", "// empty path return empty string", "if", "(", "$", "lines", "===", "null", "||", "count", "(", "$", "lines", ")", "===", "0", ")", "{", "return", "''", ";", "...
Quotes the parts of the given array in way that makes them usable as command line arguments. @param $lines @return string @throws BuildException
[ "Quotes", "the", "parts", "of", "the", "given", "array", "in", "way", "that", "makes", "them", "usable", "as", "command", "line", "arguments", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Commandline.php#L236-L252
train
phingofficial/phing
classes/phing/types/Commandline.php
Commandline.translateCommandline
public static function translateCommandline(string $toProcess = null): array { if ($toProcess === null || $toProcess === '') { return []; } // parse with a simple finite state machine $normal = 0; $inQuote = 1; $inDoubleQuote = 2; $state = $normal; $args = []; $current = ""; $lastTokenHasBeenQuoted = false; $tokens = preg_split('/(["\' ])/', $toProcess, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); while (($nextTok = array_shift($tokens)) !== null) { switch ($state) { case $inQuote: if ("'" === $nextTok) { $lastTokenHasBeenQuoted = true; $state = $normal; } else { $current .= $nextTok; } break; case $inDoubleQuote: if ("\"" === $nextTok) { $lastTokenHasBeenQuoted = true; $state = $normal; } else { $current .= $nextTok; } break; default: if ("'" === $nextTok) { $state = $inQuote; } elseif ("\"" === $nextTok) { $state = $inDoubleQuote; } elseif (" " === $nextTok) { if ($lastTokenHasBeenQuoted || $current !== '') { $args[] = $current; $current = ""; } } else { $current .= $nextTok; } $lastTokenHasBeenQuoted = false; break; } } if ($lastTokenHasBeenQuoted || $current !== '') { $args[] = $current; } if ($state === $inQuote || $state === $inDoubleQuote) { throw new BuildException('unbalanced quotes in ' . $toProcess); } return $args; }
php
public static function translateCommandline(string $toProcess = null): array { if ($toProcess === null || $toProcess === '') { return []; } // parse with a simple finite state machine $normal = 0; $inQuote = 1; $inDoubleQuote = 2; $state = $normal; $args = []; $current = ""; $lastTokenHasBeenQuoted = false; $tokens = preg_split('/(["\' ])/', $toProcess, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); while (($nextTok = array_shift($tokens)) !== null) { switch ($state) { case $inQuote: if ("'" === $nextTok) { $lastTokenHasBeenQuoted = true; $state = $normal; } else { $current .= $nextTok; } break; case $inDoubleQuote: if ("\"" === $nextTok) { $lastTokenHasBeenQuoted = true; $state = $normal; } else { $current .= $nextTok; } break; default: if ("'" === $nextTok) { $state = $inQuote; } elseif ("\"" === $nextTok) { $state = $inDoubleQuote; } elseif (" " === $nextTok) { if ($lastTokenHasBeenQuoted || $current !== '') { $args[] = $current; $current = ""; } } else { $current .= $nextTok; } $lastTokenHasBeenQuoted = false; break; } } if ($lastTokenHasBeenQuoted || $current !== '') { $args[] = $current; } if ($state === $inQuote || $state === $inDoubleQuote) { throw new BuildException('unbalanced quotes in ' . $toProcess); } return $args; }
[ "public", "static", "function", "translateCommandline", "(", "string", "$", "toProcess", "=", "null", ")", ":", "array", "{", "if", "(", "$", "toProcess", "===", "null", "||", "$", "toProcess", "===", "''", ")", "{", "return", "[", "]", ";", "}", "// p...
Crack a command line. @param string $toProcess the command line to process. @return string[] the command line broken into strings. An empty or null toProcess parameter results in a zero sized array. @throws \BuildException
[ "Crack", "a", "command", "line", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Commandline.php#L264-L327
train
phingofficial/phing
classes/phing/tasks/ext/git/GitCloneTask.php
GitCloneTask.doClone
protected function doClone(VersionControl_Git $client) { $command = $client->getCommand('clone') ->setOption('q') ->setOption('bare', $this->isBare()) ->setOption('single-branch', $this->isSingleBranch()) ->setOption('depth', $this->hasDepth() ? $this->getDepth() : false) ->setOption('branch', $this->hasBranch() ? $this->getBranch() : false) ->addArgument($this->getRepository()) ->addArgument($this->getTargetPath()); if (is_dir($this->getTargetPath()) && version_compare('1.6.1.4', $client->getGitVersion(), '>=')) { $isEmptyDir = true; $entries = scandir($this->getTargetPath()); foreach ($entries as $entry) { if ('.' !== $entry && '..' !== $entry) { $isEmptyDir = false; break; } } if ($isEmptyDir) { @rmdir($this->getTargetPath()); } } $command->execute(); }
php
protected function doClone(VersionControl_Git $client) { $command = $client->getCommand('clone') ->setOption('q') ->setOption('bare', $this->isBare()) ->setOption('single-branch', $this->isSingleBranch()) ->setOption('depth', $this->hasDepth() ? $this->getDepth() : false) ->setOption('branch', $this->hasBranch() ? $this->getBranch() : false) ->addArgument($this->getRepository()) ->addArgument($this->getTargetPath()); if (is_dir($this->getTargetPath()) && version_compare('1.6.1.4', $client->getGitVersion(), '>=')) { $isEmptyDir = true; $entries = scandir($this->getTargetPath()); foreach ($entries as $entry) { if ('.' !== $entry && '..' !== $entry) { $isEmptyDir = false; break; } } if ($isEmptyDir) { @rmdir($this->getTargetPath()); } } $command->execute(); }
[ "protected", "function", "doClone", "(", "VersionControl_Git", "$", "client", ")", "{", "$", "command", "=", "$", "client", "->", "getCommand", "(", "'clone'", ")", "->", "setOption", "(", "'q'", ")", "->", "setOption", "(", "'bare'", ",", "$", "this", "...
Create a new clone @param VersionControl_Git $client @throws VersionControl_Git_Exception
[ "Create", "a", "new", "clone" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/git/GitCloneTask.php#L109-L137
train
phingofficial/phing
classes/phing/tasks/ext/PhpLintTask.php
PhpLintTask.setInterpreter
public function setInterpreter($sPhp) { if (strpos($sPhp, ' ') !== false) { $sPhp = escapeshellarg($sPhp); } $this->interpreter = $sPhp; }
php
public function setInterpreter($sPhp) { if (strpos($sPhp, ' ') !== false) { $sPhp = escapeshellarg($sPhp); } $this->interpreter = $sPhp; }
[ "public", "function", "setInterpreter", "(", "$", "sPhp", ")", "{", "if", "(", "strpos", "(", "$", "sPhp", ",", "' '", ")", "!==", "false", ")", "{", "$", "sPhp", "=", "escapeshellarg", "(", "$", "sPhp", ")", ";", "}", "$", "this", "->", "interpret...
Override default php interpreter @todo Do some sort of checking if the path is correct but would require traversing the systems executeable path too @param string $sPhp
[ "Override", "default", "php", "interpreter" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/PhpLintTask.php#L61-L67
train
phingofficial/phing
classes/phing/system/io/OutputStream.php
OutputStream.close
public function close() { if ($this->stream === null) { return; } $this->flush(); if (false === @fclose($this->stream)) { $metaData = stream_get_meta_data($this->stream); $resource = $metaData["uri"]; $msg = "Cannot close " . $resource . ": $php_errormsg"; throw new IOException($msg); } $this->stream = null; }
php
public function close() { if ($this->stream === null) { return; } $this->flush(); if (false === @fclose($this->stream)) { $metaData = stream_get_meta_data($this->stream); $resource = $metaData["uri"]; $msg = "Cannot close " . $resource . ": $php_errormsg"; throw new IOException($msg); } $this->stream = null; }
[ "public", "function", "close", "(", ")", "{", "if", "(", "$", "this", "->", "stream", "===", "null", ")", "{", "return", ";", "}", "$", "this", "->", "flush", "(", ")", ";", "if", "(", "false", "===", "@", "fclose", "(", "$", "this", "->", "str...
Closes attached stream, flushing output first. @throws IOException if cannot close stream (note that attempting to close an already closed stream will not raise an IOException) @return void
[ "Closes", "attached", "stream", "flushing", "output", "first", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/OutputStream.php#L52-L65
train
phingofficial/phing
classes/phing/tasks/system/PhpEvalTask.php
PhpEvalTask.callFunction
protected function callFunction() { if ($this->class !== null) { // import the classname & unqualify it, if necessary $this->class = Phing::import($this->class); $user_func = [$this->class, $this->function]; $h_func = $this->class . '::' . $this->function; // human-readable (for log) } else { $user_func = $this->function; $h_func = $user_func; // human-readable (for log) } // put parameters into simple array $params = []; foreach ($this->params as $p) { if ($p instanceof Parameter) { $value = $p->getParams(); array_walk_recursive( $value, function (&$item) { if ($item instanceof Parameter) { $item = $item->getValue(); } } ); if ($value === null) { continue; } $params[] = $value; } else { $params[] = $p->getValue(); } } $this->log("Calling PHP function: " . $h_func . "()", $this->logLevel); foreach ($params as $p) { $this->log(" param: " . print_r($p, true), Project::MSG_VERBOSE); } $return = call_user_func_array($user_func, $params); if ($this->returnProperty !== null) { $this->project->setProperty($this->returnProperty, $return); } }
php
protected function callFunction() { if ($this->class !== null) { // import the classname & unqualify it, if necessary $this->class = Phing::import($this->class); $user_func = [$this->class, $this->function]; $h_func = $this->class . '::' . $this->function; // human-readable (for log) } else { $user_func = $this->function; $h_func = $user_func; // human-readable (for log) } // put parameters into simple array $params = []; foreach ($this->params as $p) { if ($p instanceof Parameter) { $value = $p->getParams(); array_walk_recursive( $value, function (&$item) { if ($item instanceof Parameter) { $item = $item->getValue(); } } ); if ($value === null) { continue; } $params[] = $value; } else { $params[] = $p->getValue(); } } $this->log("Calling PHP function: " . $h_func . "()", $this->logLevel); foreach ($params as $p) { $this->log(" param: " . print_r($p, true), Project::MSG_VERBOSE); } $return = call_user_func_array($user_func, $params); if ($this->returnProperty !== null) { $this->project->setProperty($this->returnProperty, $return); } }
[ "protected", "function", "callFunction", "(", ")", "{", "if", "(", "$", "this", "->", "class", "!==", "null", ")", "{", "// import the classname & unqualify it, if necessary", "$", "this", "->", "class", "=", "Phing", "::", "import", "(", "$", "this", "->", ...
Calls function and returns results. @return mixed
[ "Calls", "function", "and", "returns", "results", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PhpEvalTask.php#L83-L128
train
phingofficial/phing
classes/phing/tasks/system/PhpEvalTask.php
PhpEvalTask.evalExpression
protected function evalExpression() { $this->log("Evaluating PHP expression: " . $this->expression, $this->logLevel); if (!StringHelper::endsWith(';', trim($this->expression))) { $this->expression .= ';'; } if ($this->returnProperty !== null) { $retval = null; eval('$retval = ' . $this->expression); $this->project->setProperty($this->returnProperty, $retval); } else { eval($this->expression); } }
php
protected function evalExpression() { $this->log("Evaluating PHP expression: " . $this->expression, $this->logLevel); if (!StringHelper::endsWith(';', trim($this->expression))) { $this->expression .= ';'; } if ($this->returnProperty !== null) { $retval = null; eval('$retval = ' . $this->expression); $this->project->setProperty($this->returnProperty, $retval); } else { eval($this->expression); } }
[ "protected", "function", "evalExpression", "(", ")", "{", "$", "this", "->", "log", "(", "\"Evaluating PHP expression: \"", ".", "$", "this", "->", "expression", ",", "$", "this", "->", "logLevel", ")", ";", "if", "(", "!", "StringHelper", "::", "endsWith", ...
Evaluates expression and returns resulting value. @return mixed
[ "Evaluates", "expression", "and", "returns", "resulting", "value", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PhpEvalTask.php#L150-L164
train
phingofficial/phing
classes/phing/tasks/system/PropertyTask.php
PropertyTask.setFile
public function setFile($file) { if (is_string($file)) { $file = new PhingFile($file); } $this->file = $file; }
php
public function setFile($file) { if (is_string($file)) { $file = new PhingFile($file); } $this->file = $file; }
[ "public", "function", "setFile", "(", "$", "file", ")", "{", "if", "(", "is_string", "(", "$", "file", ")", ")", "{", "$", "file", "=", "new", "PhingFile", "(", "$", "file", ")", ";", "}", "$", "this", "->", "file", "=", "$", "file", ";", "}" ]
Set a file to use as the source for properties. @param $file
[ "Set", "a", "file", "to", "use", "as", "the", "source", "for", "properties", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PropertyTask.php#L153-L159
train
phingofficial/phing
classes/phing/tasks/system/PropertyTask.php
PropertyTask.loadEnvironment
protected function loadEnvironment($prefix) { $props = new Properties(); if (substr($prefix, strlen($prefix) - 1) == '.') { $prefix .= "."; } $this->log("Loading Environment $prefix", Project::MSG_VERBOSE); foreach ($_ENV as $key => $value) { $props->setProperty($prefix . '.' . $key, $value); } $this->addProperties($props); }
php
protected function loadEnvironment($prefix) { $props = new Properties(); if (substr($prefix, strlen($prefix) - 1) == '.') { $prefix .= "."; } $this->log("Loading Environment $prefix", Project::MSG_VERBOSE); foreach ($_ENV as $key => $value) { $props->setProperty($prefix . '.' . $key, $value); } $this->addProperties($props); }
[ "protected", "function", "loadEnvironment", "(", "$", "prefix", ")", "{", "$", "props", "=", "new", "Properties", "(", ")", ";", "if", "(", "substr", "(", "$", "prefix", ",", "strlen", "(", "$", "prefix", ")", "-", "1", ")", "==", "'.'", ")", "{", ...
load the environment values @param string $prefix prefix to place before them
[ "load", "the", "environment", "values" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PropertyTask.php#L402-L413
train
phingofficial/phing
classes/phing/tasks/system/PropertyTask.php
PropertyTask.addProperty
protected function addProperty($name, $value) { if (count($this->filterChains) > 0) { $in = FileUtils::getChainedReader(new StringReader($value), $this->filterChains, $this->project); $value = $in->read(); } $ph = PropertyHelper::getPropertyHelper($this->getProject()); if ($this->userProperty) { if ($ph->getUserProperty(null, $name) === null || $this->override) { $ph->setInheritedProperty(null, $name, $value); } else { $this->log('Override ignored for ' . $name, Project::MSG_VERBOSE); } } else { if ($this->override) { $ph->setProperty(null, $name, $value, true); } else { $ph->setNewProperty(null, $name, $value); } } }
php
protected function addProperty($name, $value) { if (count($this->filterChains) > 0) { $in = FileUtils::getChainedReader(new StringReader($value), $this->filterChains, $this->project); $value = $in->read(); } $ph = PropertyHelper::getPropertyHelper($this->getProject()); if ($this->userProperty) { if ($ph->getUserProperty(null, $name) === null || $this->override) { $ph->setInheritedProperty(null, $name, $value); } else { $this->log('Override ignored for ' . $name, Project::MSG_VERBOSE); } } else { if ($this->override) { $ph->setProperty(null, $name, $value, true); } else { $ph->setNewProperty(null, $name, $value); } } }
[ "protected", "function", "addProperty", "(", "$", "name", ",", "$", "value", ")", "{", "if", "(", "count", "(", "$", "this", "->", "filterChains", ")", ">", "0", ")", "{", "$", "in", "=", "FileUtils", "::", "getChainedReader", "(", "new", "StringReader...
add a name value pair to the project property set @param string $name name of property @param string $value value to set
[ "add", "a", "name", "value", "pair", "to", "the", "project", "property", "set" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PropertyTask.php#L441-L462
train
phingofficial/phing
classes/phing/tasks/system/PropertyTask.php
PropertyTask.loadFile
protected function loadFile(PhingFile $file) { $fileParser = $this->fileParserFactory->createParser($file->getFileExtension()); $props = new Properties(null, $fileParser); $this->log("Loading " . $file->getAbsolutePath(), $this->logOutput ? Project::MSG_INFO : Project::MSG_VERBOSE); try { // try to load file if ($file->exists()) { $props->load($file); $this->addProperties($props); } else { $this->log( "Unable to find property file: " . $file->getAbsolutePath() . "... skipped", $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN ); } } catch (IOException $ioe) { throw new BuildException("Could not load properties from file.", $ioe); } }
php
protected function loadFile(PhingFile $file) { $fileParser = $this->fileParserFactory->createParser($file->getFileExtension()); $props = new Properties(null, $fileParser); $this->log("Loading " . $file->getAbsolutePath(), $this->logOutput ? Project::MSG_INFO : Project::MSG_VERBOSE); try { // try to load file if ($file->exists()) { $props->load($file); $this->addProperties($props); } else { $this->log( "Unable to find property file: " . $file->getAbsolutePath() . "... skipped", $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN ); } } catch (IOException $ioe) { throw new BuildException("Could not load properties from file.", $ioe); } }
[ "protected", "function", "loadFile", "(", "PhingFile", "$", "file", ")", "{", "$", "fileParser", "=", "$", "this", "->", "fileParserFactory", "->", "createParser", "(", "$", "file", "->", "getFileExtension", "(", ")", ")", ";", "$", "props", "=", "new", ...
load properties from a file. @param PhingFile $file @throws BuildException
[ "load", "properties", "from", "a", "file", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PropertyTask.php#L470-L488
train
phingofficial/phing
classes/phing/tasks/system/PropertyTask.php
PropertyTask.resolveAllProperties
protected function resolveAllProperties(Properties $props) { foreach ($props->keys() as $name) { // There may be a nice regex/callback way to handle this // replacement, but at the moment it is pretty complex, and // would probably be a lot uglier to work into a preg_replace_callback() // system. The biggest problem is the fact that a resolution may require // multiple passes. $value = $props->getProperty($name); $resolved = false; $resolveStack = []; while (!$resolved) { $fragments = []; $propertyRefs = []; PropertyHelper::getPropertyHelper($this->project)->parsePropertyString( $value, $fragments, $propertyRefs ); $resolved = true; if (count($propertyRefs) === 0) { continue; } $sb = ""; $j = $propertyRefs; foreach ($fragments as $fragment) { if ($fragment !== null) { $sb .= $fragment; continue; } $propertyName = array_shift($j); if (in_array($propertyName, $resolveStack)) { // Should we maybe just log this as an error & move on? // $this->log("Property ".$name." was circularly defined.", Project::MSG_ERR); throw new BuildException("Property " . $propertyName . " was circularly defined."); } $fragment = $this->getProject()->getProperty($propertyName); if ($fragment !== null) { $sb .= $fragment; continue; } if ($props->containsKey($propertyName)) { $fragment = $props->getProperty($propertyName); if (strpos($fragment, '${') !== false) { $resolveStack[] = $propertyName; $resolved = false; // parse again (could have been replaced w/ another var) } } else { $fragment = "\${" . $propertyName . "}"; } $sb .= $fragment; } $this->log("Resolved Property \"$value\" to \"$sb\"", Project::MSG_DEBUG); $value = $sb; $props->setProperty($name, $value); } // while (!$resolved) } // while (count($keys) }
php
protected function resolveAllProperties(Properties $props) { foreach ($props->keys() as $name) { // There may be a nice regex/callback way to handle this // replacement, but at the moment it is pretty complex, and // would probably be a lot uglier to work into a preg_replace_callback() // system. The biggest problem is the fact that a resolution may require // multiple passes. $value = $props->getProperty($name); $resolved = false; $resolveStack = []; while (!$resolved) { $fragments = []; $propertyRefs = []; PropertyHelper::getPropertyHelper($this->project)->parsePropertyString( $value, $fragments, $propertyRefs ); $resolved = true; if (count($propertyRefs) === 0) { continue; } $sb = ""; $j = $propertyRefs; foreach ($fragments as $fragment) { if ($fragment !== null) { $sb .= $fragment; continue; } $propertyName = array_shift($j); if (in_array($propertyName, $resolveStack)) { // Should we maybe just log this as an error & move on? // $this->log("Property ".$name." was circularly defined.", Project::MSG_ERR); throw new BuildException("Property " . $propertyName . " was circularly defined."); } $fragment = $this->getProject()->getProperty($propertyName); if ($fragment !== null) { $sb .= $fragment; continue; } if ($props->containsKey($propertyName)) { $fragment = $props->getProperty($propertyName); if (strpos($fragment, '${') !== false) { $resolveStack[] = $propertyName; $resolved = false; // parse again (could have been replaced w/ another var) } } else { $fragment = "\${" . $propertyName . "}"; } $sb .= $fragment; } $this->log("Resolved Property \"$value\" to \"$sb\"", Project::MSG_DEBUG); $value = $sb; $props->setProperty($name, $value); } // while (!$resolved) } // while (count($keys) }
[ "protected", "function", "resolveAllProperties", "(", "Properties", "$", "props", ")", "{", "foreach", "(", "$", "props", "->", "keys", "(", ")", "as", "$", "name", ")", "{", "// There may be a nice regex/callback way to handle this", "// replacement, but at the moment ...
Given a Properties object, this method goes through and resolves any references to properties within the object. @param Properties $props The collection of Properties that need to be resolved. @throws BuildException @return void
[ "Given", "a", "Properties", "object", "this", "method", "goes", "through", "and", "resolves", "any", "references", "to", "properties", "within", "the", "object", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PropertyTask.php#L498-L567
train
phingofficial/phing
classes/phing/tasks/ext/coverage/CoverageMergerTask.php
CoverageMergerTask.getFilenames
private function getFilenames() { $files = []; foreach ($this->filesets as $fileset) { $ds = $fileset->getDirectoryScanner($this->project); $ds->scan(); $includedFiles = $ds->getIncludedFiles(); foreach ($includedFiles as $file) { $fs = new PhingFile(basename($ds->getBaseDir()), $file); $files[] = $fs->getAbsolutePath(); } } return $files; }
php
private function getFilenames() { $files = []; foreach ($this->filesets as $fileset) { $ds = $fileset->getDirectoryScanner($this->project); $ds->scan(); $includedFiles = $ds->getIncludedFiles(); foreach ($includedFiles as $file) { $fs = new PhingFile(basename($ds->getBaseDir()), $file); $files[] = $fs->getAbsolutePath(); } } return $files; }
[ "private", "function", "getFilenames", "(", ")", "{", "$", "files", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "filesets", "as", "$", "fileset", ")", "{", "$", "ds", "=", "$", "fileset", "->", "getDirectoryScanner", "(", "$", "this", "->"...
Iterate over all filesets and return all the filenames. @return array an array of filenames
[ "Iterate", "over", "all", "filesets", "and", "return", "all", "the", "filenames", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/coverage/CoverageMergerTask.php#L36-L54
train
phingofficial/phing
classes/phing/tasks/ext/phpmd/PHPMDRendererRemoveFromCache.php
PHPMDRendererRemoveFromCache.renderReport
public function renderReport(Report $report) { foreach ($report->getRuleViolations() as $violation) { $fileName = $violation->getFileName(); $this->cache->remove($fileName, null); } }
php
public function renderReport(Report $report) { foreach ($report->getRuleViolations() as $violation) { $fileName = $violation->getFileName(); $this->cache->remove($fileName, null); } }
[ "public", "function", "renderReport", "(", "Report", "$", "report", ")", "{", "foreach", "(", "$", "report", "->", "getRuleViolations", "(", ")", "as", "$", "violation", ")", "{", "$", "fileName", "=", "$", "violation", "->", "getFileName", "(", ")", ";"...
This method will be called when the engine has finished the source analysis phase. To remove file with violations from cache. @param Report $report @return void
[ "This", "method", "will", "be", "called", "when", "the", "engine", "has", "finished", "the", "source", "analysis", "phase", ".", "To", "remove", "file", "with", "violations", "from", "cache", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/phpmd/PHPMDRendererRemoveFromCache.php#L58-L64
train
phingofficial/phing
classes/phing/tasks/system/TstampTask.php
TstampTask.setPrefix
public function setPrefix($prefix) { $this->prefix = $prefix; if (!empty($this->prefix)) { $this->prefix .= "."; } }
php
public function setPrefix($prefix) { $this->prefix = $prefix; if (!empty($this->prefix)) { $this->prefix .= "."; } }
[ "public", "function", "setPrefix", "(", "$", "prefix", ")", "{", "$", "this", "->", "prefix", "=", "$", "prefix", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "prefix", ")", ")", "{", "$", "this", "->", "prefix", ".=", "\".\"", ";", "}",...
Set a prefix for the properties. If the prefix does not end with a "." one is automatically added. @param string $prefix the prefix to use.
[ "Set", "a", "prefix", "for", "the", "properties", ".", "If", "the", "prefix", "does", "not", "end", "with", "a", ".", "one", "is", "automatically", "added", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/TstampTask.php#L43-L50
train
phingofficial/phing
classes/phing/tasks/system/TstampTask.php
TstampTask.main
public function main() { $d = $this->getNow(); foreach ($this->customFormats as $cf) { $cf->execute($this, $d, $this->getLocation()); } $dstamp = strftime('%Y%m%d', $d); $this->prefixProperty('DSTAMP', $dstamp); $tstamp = strftime('%H%M', $d); $this->prefixProperty('TSTAMP', $tstamp); $today = strftime('%B %d %Y', $d); $this->prefixProperty('TODAY', $today); }
php
public function main() { $d = $this->getNow(); foreach ($this->customFormats as $cf) { $cf->execute($this, $d, $this->getLocation()); } $dstamp = strftime('%Y%m%d', $d); $this->prefixProperty('DSTAMP', $dstamp); $tstamp = strftime('%H%M', $d); $this->prefixProperty('TSTAMP', $tstamp); $today = strftime('%B %d %Y', $d); $this->prefixProperty('TODAY', $today); }
[ "public", "function", "main", "(", ")", "{", "$", "d", "=", "$", "this", "->", "getNow", "(", ")", ";", "foreach", "(", "$", "this", "->", "customFormats", "as", "$", "cf", ")", "{", "$", "cf", "->", "execute", "(", "$", "this", ",", "$", "d", ...
Create the timestamps. Custom ones are done before the standard ones. @throws BuildException
[ "Create", "the", "timestamps", ".", "Custom", "ones", "are", "done", "before", "the", "standard", "ones", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/TstampTask.php#L68-L84
train
phingofficial/phing
classes/phing/system/io/OutputStreamWriter.php
OutputStreamWriter.write
public function write($buf, $off = null, $len = null) { return $this->outStream->write($buf, $off, $len); }
php
public function write($buf, $off = null, $len = null) { return $this->outStream->write($buf, $off, $len); }
[ "public", "function", "write", "(", "$", "buf", ",", "$", "off", "=", "null", ",", "$", "len", "=", "null", ")", "{", "return", "$", "this", "->", "outStream", "->", "write", "(", "$", "buf", ",", "$", "off", ",", "$", "len", ")", ";", "}" ]
Write char data to stream. @param string $buf @param int $off @param int $len @return void
[ "Write", "char", "data", "to", "stream", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/OutputStreamWriter.php#L66-L69
train
phingofficial/phing
classes/phing/tasks/system/CopyTask.php
CopyTask._scan
private function _scan(&$fromDir, &$toDir, &$files, &$dirs) { /* mappers should be generic, so we get the mappers here and pass them on to builMap. This method is not redundan like it seems */ $mapper = $this->getMapper(); $this->buildMap($fromDir, $toDir, $files, $mapper, $this->fileCopyMap); if ($this->includeEmpty) { $this->buildMap($fromDir, $toDir, $dirs, $mapper, $this->dirCopyMap); } }
php
private function _scan(&$fromDir, &$toDir, &$files, &$dirs) { /* mappers should be generic, so we get the mappers here and pass them on to builMap. This method is not redundan like it seems */ $mapper = $this->getMapper(); $this->buildMap($fromDir, $toDir, $files, $mapper, $this->fileCopyMap); if ($this->includeEmpty) { $this->buildMap($fromDir, $toDir, $dirs, $mapper, $this->dirCopyMap); } }
[ "private", "function", "_scan", "(", "&", "$", "fromDir", ",", "&", "$", "toDir", ",", "&", "$", "files", ",", "&", "$", "dirs", ")", "{", "/* mappers should be generic, so we get the mappers here and\n pass them on to builMap. This method is not redundan like it see...
Compares source files to destination files to see if they should be copied. @param $fromDir @param $toDir @param $files @param $dirs @return void
[ "Compares", "source", "files", "to", "destination", "files", "to", "see", "if", "they", "should", "be", "copied", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/CopyTask.php#L431-L442
train
phingofficial/phing
classes/phing/tasks/system/CopyTask.php
CopyTask.doWork
protected function doWork() { // These "slots" allow filters to retrieve information about the currently-being-process files $fromSlot = $this->getRegisterSlot("currentFromFile"); $fromBasenameSlot = $this->getRegisterSlot("currentFromFile.basename"); $toSlot = $this->getRegisterSlot("currentToFile"); $toBasenameSlot = $this->getRegisterSlot("currentToFile.basename"); $mapSize = count($this->fileCopyMap); $total = $mapSize; // handle empty dirs if appropriate if ($this->includeEmpty) { $count = 0; foreach ($this->dirCopyMap as $srcdir => $destdir) { $s = new PhingFile((string) $srcdir); $d = new PhingFile((string) $destdir); if (!$d->exists()) { // Setting source directory permissions to target // (On permissions preservation, the target directory permissions // will be inherited from the source directory, otherwise the 'mode' // will be used) $dirMode = ($this->preservePermissions ? $s->getMode() : $this->mode); // Directory creation with specific permission mode if (!$d->mkdirs($dirMode)) { $this->logError("Unable to create directory " . $d->__toString()); } else { if ($this->preserveLMT) { $d->setLastModified($s->lastModified()); } $count++; } } } if ($count > 0) { $this->log( "Created " . $count . " empty director" . ($count == 1 ? "y" : "ies") . " in " . $this->destDir->getAbsolutePath() ); } } if ($mapSize == 0) { return; } $this->log( "Copying " . $mapSize . " file" . (($mapSize) === 1 ? '' : 's') . " to " . $this->destDir->getAbsolutePath() ); // walks the map and actually copies the files $count = 0; foreach ($this->fileCopyMap as $from => $toFiles) { if (is_array($toFiles)) { foreach ($toFiles as $to) { $this->copyToSingleDestination( $from, $to, $fromSlot, $fromBasenameSlot, $toSlot, $toBasenameSlot, $count, $total ); } } else { $this->copyToSingleDestination( $from, $toFiles, $fromSlot, $fromBasenameSlot, $toSlot, $toBasenameSlot, $count, $total ); } } }
php
protected function doWork() { // These "slots" allow filters to retrieve information about the currently-being-process files $fromSlot = $this->getRegisterSlot("currentFromFile"); $fromBasenameSlot = $this->getRegisterSlot("currentFromFile.basename"); $toSlot = $this->getRegisterSlot("currentToFile"); $toBasenameSlot = $this->getRegisterSlot("currentToFile.basename"); $mapSize = count($this->fileCopyMap); $total = $mapSize; // handle empty dirs if appropriate if ($this->includeEmpty) { $count = 0; foreach ($this->dirCopyMap as $srcdir => $destdir) { $s = new PhingFile((string) $srcdir); $d = new PhingFile((string) $destdir); if (!$d->exists()) { // Setting source directory permissions to target // (On permissions preservation, the target directory permissions // will be inherited from the source directory, otherwise the 'mode' // will be used) $dirMode = ($this->preservePermissions ? $s->getMode() : $this->mode); // Directory creation with specific permission mode if (!$d->mkdirs($dirMode)) { $this->logError("Unable to create directory " . $d->__toString()); } else { if ($this->preserveLMT) { $d->setLastModified($s->lastModified()); } $count++; } } } if ($count > 0) { $this->log( "Created " . $count . " empty director" . ($count == 1 ? "y" : "ies") . " in " . $this->destDir->getAbsolutePath() ); } } if ($mapSize == 0) { return; } $this->log( "Copying " . $mapSize . " file" . (($mapSize) === 1 ? '' : 's') . " to " . $this->destDir->getAbsolutePath() ); // walks the map and actually copies the files $count = 0; foreach ($this->fileCopyMap as $from => $toFiles) { if (is_array($toFiles)) { foreach ($toFiles as $to) { $this->copyToSingleDestination( $from, $to, $fromSlot, $fromBasenameSlot, $toSlot, $toBasenameSlot, $count, $total ); } } else { $this->copyToSingleDestination( $from, $toFiles, $fromSlot, $fromBasenameSlot, $toSlot, $toBasenameSlot, $count, $total ); } } }
[ "protected", "function", "doWork", "(", ")", "{", "// These \"slots\" allow filters to retrieve information about the currently-being-process files", "$", "fromSlot", "=", "$", "this", "->", "getRegisterSlot", "(", "\"currentFromFile\"", ")", ";", "$", "fromBasenameSlot", "="...
Actually copies the files @return void @throws BuildException
[ "Actually", "copies", "the", "files" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/CopyTask.php#L512-L593
train
phingofficial/phing
classes/phing/tasks/system/RunTargetTask.php
RunTargetTask.main
public function main() { if ($this->target == null) { throw new BuildException('target property required'); } $this->getProject()->executeTarget($this->target); }
php
public function main() { if ($this->target == null) { throw new BuildException('target property required'); } $this->getProject()->executeTarget($this->target); }
[ "public", "function", "main", "(", ")", "{", "if", "(", "$", "this", "->", "target", "==", "null", ")", "{", "throw", "new", "BuildException", "(", "'target property required'", ")", ";", "}", "$", "this", "->", "getProject", "(", ")", "->", "executeTarg...
execute the target @throws BuildException if a target is not specified
[ "execute", "the", "target" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/RunTargetTask.php#L43-L50
train
phingofficial/phing
classes/phing/tasks/ext/XmlPropertyTask.php
XmlPropertyTask.loadFile
protected function loadFile(PhingFile $file) { $this->log("Loading " . $file->getAbsolutePath(), Project::MSG_INFO); try { // try to load file if ($file->exists()) { $parser = new XmlFileParser(); $parser->setCollapseAttr($this->_collapseAttr); $parser->setKeepRoot($this->_keepRoot); $parser->setDelimiter($this->_delimiter); $properties = $parser->parseFile($file); return new Properties($properties); } else { if ($this->getRequired()) { throw new BuildException("Could not load required properties file."); } else { $this->log( "Unable to find property file: " . $file->getAbsolutePath() . "... skipped", Project::MSG_WARN ); } } } catch (IOException $ioe) { throw new BuildException("Could not load properties from file.", $ioe); } }
php
protected function loadFile(PhingFile $file) { $this->log("Loading " . $file->getAbsolutePath(), Project::MSG_INFO); try { // try to load file if ($file->exists()) { $parser = new XmlFileParser(); $parser->setCollapseAttr($this->_collapseAttr); $parser->setKeepRoot($this->_keepRoot); $parser->setDelimiter($this->_delimiter); $properties = $parser->parseFile($file); return new Properties($properties); } else { if ($this->getRequired()) { throw new BuildException("Could not load required properties file."); } else { $this->log( "Unable to find property file: " . $file->getAbsolutePath() . "... skipped", Project::MSG_WARN ); } } } catch (IOException $ioe) { throw new BuildException("Could not load properties from file.", $ioe); } }
[ "protected", "function", "loadFile", "(", "PhingFile", "$", "file", ")", "{", "$", "this", "->", "log", "(", "\"Loading \"", ".", "$", "file", "->", "getAbsolutePath", "(", ")", ",", "Project", "::", "MSG_INFO", ")", ";", "try", "{", "// try to load file",...
load properties from an XML file. @param PhingFile $file @throws BuildException @return Properties
[ "load", "properties", "from", "an", "XML", "file", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/XmlPropertyTask.php#L175-L201
train
phingofficial/phing
classes/phing/tasks/ext/pdo/PgsqlPDOQuerySplitter.php
PgsqlPDOQuerySplitter.getc
public function getc() { if (!strlen($this->line) || $this->inputIndex >= strlen($this->line)) { if (null === ($line = $this->sqlReader->readLine())) { return false; } $project = $this->parent->getOwningTarget()->getProject(); $this->line = $project->replaceProperties($line) . "\n"; $this->inputIndex = 0; } return $this->line[$this->inputIndex++]; }
php
public function getc() { if (!strlen($this->line) || $this->inputIndex >= strlen($this->line)) { if (null === ($line = $this->sqlReader->readLine())) { return false; } $project = $this->parent->getOwningTarget()->getProject(); $this->line = $project->replaceProperties($line) . "\n"; $this->inputIndex = 0; } return $this->line[$this->inputIndex++]; }
[ "public", "function", "getc", "(", ")", "{", "if", "(", "!", "strlen", "(", "$", "this", "->", "line", ")", "||", "$", "this", "->", "inputIndex", ">=", "strlen", "(", "$", "this", "->", "line", ")", ")", "{", "if", "(", "null", "===", "(", "$"...
Gets next symbol from the input, false if at end @return string|bool
[ "Gets", "next", "symbol", "from", "the", "input", "false", "if", "at", "end" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdo/PgsqlPDOQuerySplitter.php#L98-L110
train
phingofficial/phing
classes/phing/RuntimeConfigurable.php
RuntimeConfigurable.maybeConfigure
public function maybeConfigure(Project $project) { if ($this->proxyConfigured) { return; } $id = null; // DataType configured in ProjectConfigurator // if ( is_a($this->wrappedObject, "DataType") ) // return; if ($this->attributes || (isset($this->characters) && $this->characters != '')) { ProjectConfigurator::configure($this->wrappedObject, $this->attributes, $project); if (isset($this->attributes["id"])) { $id = $this->attributes["id"]; } if (isset($this->characters) && $this->characters != '') { ProjectConfigurator::addText($project, $this->wrappedObject, (string) $this->characters); } if ($id !== null) { $project->addReference($id, $this->wrappedObject); } } /*if ( is_array($this->children) && !empty($this->children) ) { // Configure all child of this object ... foreach ($this->children as $child) { $child->maybeConfigure($project); ProjectConfigurator::storeChild($project, $this->wrappedObject, $child->wrappedObject, strtolower($child->getElementTag())); } }*/ $this->proxyConfigured = true; }
php
public function maybeConfigure(Project $project) { if ($this->proxyConfigured) { return; } $id = null; // DataType configured in ProjectConfigurator // if ( is_a($this->wrappedObject, "DataType") ) // return; if ($this->attributes || (isset($this->characters) && $this->characters != '')) { ProjectConfigurator::configure($this->wrappedObject, $this->attributes, $project); if (isset($this->attributes["id"])) { $id = $this->attributes["id"]; } if (isset($this->characters) && $this->characters != '') { ProjectConfigurator::addText($project, $this->wrappedObject, (string) $this->characters); } if ($id !== null) { $project->addReference($id, $this->wrappedObject); } } /*if ( is_array($this->children) && !empty($this->children) ) { // Configure all child of this object ... foreach ($this->children as $child) { $child->maybeConfigure($project); ProjectConfigurator::storeChild($project, $this->wrappedObject, $child->wrappedObject, strtolower($child->getElementTag())); } }*/ $this->proxyConfigured = true; }
[ "public", "function", "maybeConfigure", "(", "Project", "$", "project", ")", "{", "if", "(", "$", "this", "->", "proxyConfigured", ")", "{", "return", ";", "}", "$", "id", "=", "null", ";", "// DataType configured in ProjectConfigurator", "// if ( is_a($thi...
Configure the wrapped element and all children. @param Project $project @return void @throws BuildException @throws Exception
[ "Configure", "the", "wrapped", "element", "and", "all", "children", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/RuntimeConfigurable.php#L166-L202
train
phingofficial/phing
classes/phing/tasks/ext/hg/HgArchiveTask.php
HgArchiveTask.main
public function main() { $clone = $this->getFactoryInstance('archive'); if ($this->revision !== '') { $clone->setRev($this->revision); } if ($this->destination === null) { throw new BuildException("Destination must be set."); } $clone->setDestination($this->destination); try { $this->log("Executing: " . $clone->asString(), Project::MSG_INFO); $output = $clone->execute(); 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('archive'); if ($this->revision !== '') { $clone->setRev($this->revision); } if ($this->destination === null) { throw new BuildException("Destination must be set."); } $clone->setDestination($this->destination); try { $this->log("Executing: " . $clone->asString(), Project::MSG_INFO); $output = $clone->execute(); 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", "(", "'archive'", ")", ";", "if", "(", "$", "this", "->", "revision", "!==", "''", ")", "{", "$", "clone", "->", "setRev", "(", "$", "this", "-...
The main entry point for the task. @return void
[ "The", "main", "entry", "point", "for", "the", "task", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/hg/HgArchiveTask.php#L68-L94
train
phingofficial/phing
classes/phing/Project.php
Project.setProperty
public function setProperty($name, $value) { PropertyHelper::getPropertyHelper($this)->setProperty(null, $name, $value, true); }
php
public function setProperty($name, $value) { PropertyHelper::getPropertyHelper($this)->setProperty(null, $name, $value, true); }
[ "public", "function", "setProperty", "(", "$", "name", ",", "$", "value", ")", "{", "PropertyHelper", "::", "getPropertyHelper", "(", "$", "this", ")", "->", "setProperty", "(", "null", ",", "$", "name", ",", "$", "value", ",", "true", ")", ";", "}" ]
Sets a property. Any existing property of the same name is overwritten, unless it is a user property. @param string $name The name of property to set. Must not be <code>null</code>. @param string $value The new value of the property. Must not be <code>null</code>.
[ "Sets", "a", "property", ".", "Any", "existing", "property", "of", "the", "same", "name", "is", "overwritten", "unless", "it", "is", "a", "user", "property", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Project.php#L182-L185
train
phingofficial/phing
classes/phing/Project.php
Project.setName
public function setName($name) { $this->name = (string) trim($name); $this->setUserProperty("phing.project.name", $this->name); }
php
public function setName($name) { $this->name = (string) trim($name); $this->setUserProperty("phing.project.name", $this->name); }
[ "public", "function", "setName", "(", "$", "name", ")", "{", "$", "this", "->", "name", "=", "(", "string", ")", "trim", "(", "$", "name", ")", ";", "$", "this", "->", "setUserProperty", "(", "\"phing.project.name\"", ",", "$", "this", "->", "name", ...
Sets the name of the current project @param string $name name of project @return void @author Andreas Aderhold, andi@binarycloud.com
[ "Sets", "the", "name", "of", "the", "current", "project" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Project.php#L382-L386
train
phingofficial/phing
classes/phing/Project.php
Project.setPhingVersion
public function setPhingVersion($version) { $version = str_replace('phing', '', strtolower($version)); $this->phingVersion = (string) trim($version); }
php
public function setPhingVersion($version) { $version = str_replace('phing', '', strtolower($version)); $this->phingVersion = (string) trim($version); }
[ "public", "function", "setPhingVersion", "(", "$", "version", ")", "{", "$", "version", "=", "str_replace", "(", "'phing'", ",", "''", ",", "strtolower", "(", "$", "version", ")", ")", ";", "$", "this", "->", "phingVersion", "=", "(", "string", ")", "t...
Set the minimum required phing version @param string $version
[ "Set", "the", "minimum", "required", "phing", "version" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Project.php#L424-L428
train
phingofficial/phing
classes/phing/Project.php
Project.getPhingVersion
public function getPhingVersion() { if ($this->phingVersion === null) { $this->setPhingVersion(Phing::getPhingVersion()); } return $this->phingVersion; }
php
public function getPhingVersion() { if ($this->phingVersion === null) { $this->setPhingVersion(Phing::getPhingVersion()); } return $this->phingVersion; }
[ "public", "function", "getPhingVersion", "(", ")", "{", "if", "(", "$", "this", "->", "phingVersion", "===", "null", ")", "{", "$", "this", "->", "setPhingVersion", "(", "Phing", "::", "getPhingVersion", "(", ")", ")", ";", "}", "return", "$", "this", ...
Get the minimum required phing version @return string
[ "Get", "the", "minimum", "required", "phing", "version" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Project.php#L435-L442
train
phingofficial/phing
classes/phing/Project.php
Project.setBasedir
public function setBasedir($dir) { if ($dir instanceof PhingFile) { $dir = $dir->getAbsolutePath(); } $dir = $this->fileUtils->normalize($dir); $dir = FileSystem::getFileSystem()->canonicalize($dir); $dir = new PhingFile((string) $dir); if (!$dir->exists()) { throw new BuildException("Basedir " . $dir->getAbsolutePath() . " does not exist"); } if (!$dir->isDirectory()) { throw new BuildException("Basedir " . $dir->getAbsolutePath() . " is not a directory"); } $this->basedir = $dir; $this->setPropertyInternal("project.basedir", $this->basedir->getAbsolutePath()); $this->log("Project base dir set to: " . $this->basedir->getPath(), Project::MSG_VERBOSE); // [HL] added this so that ./ files resolve correctly. This may be a mistake ... or may be in wrong place. chdir($dir->getAbsolutePath()); }
php
public function setBasedir($dir) { if ($dir instanceof PhingFile) { $dir = $dir->getAbsolutePath(); } $dir = $this->fileUtils->normalize($dir); $dir = FileSystem::getFileSystem()->canonicalize($dir); $dir = new PhingFile((string) $dir); if (!$dir->exists()) { throw new BuildException("Basedir " . $dir->getAbsolutePath() . " does not exist"); } if (!$dir->isDirectory()) { throw new BuildException("Basedir " . $dir->getAbsolutePath() . " is not a directory"); } $this->basedir = $dir; $this->setPropertyInternal("project.basedir", $this->basedir->getAbsolutePath()); $this->log("Project base dir set to: " . $this->basedir->getPath(), Project::MSG_VERBOSE); // [HL] added this so that ./ files resolve correctly. This may be a mistake ... or may be in wrong place. chdir($dir->getAbsolutePath()); }
[ "public", "function", "setBasedir", "(", "$", "dir", ")", "{", "if", "(", "$", "dir", "instanceof", "PhingFile", ")", "{", "$", "dir", "=", "$", "dir", "->", "getAbsolutePath", "(", ")", ";", "}", "$", "dir", "=", "$", "this", "->", "fileUtils", "-...
Set basedir object from xm @param PhingFile|string $dir @throws BuildException
[ "Set", "basedir", "object", "from", "xm" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Project.php#L476-L498
train
phingofficial/phing
classes/phing/Project.php
Project.getBasedir
public function getBasedir() { if ($this->basedir === null) { try { // try to set it $this->setBasedir("."); } catch (BuildException $exc) { throw new BuildException("Can not set default basedir. " . $exc->getMessage()); } } return $this->basedir; }
php
public function getBasedir() { if ($this->basedir === null) { try { // try to set it $this->setBasedir("."); } catch (BuildException $exc) { throw new BuildException("Can not set default basedir. " . $exc->getMessage()); } } return $this->basedir; }
[ "public", "function", "getBasedir", "(", ")", "{", "if", "(", "$", "this", "->", "basedir", "===", "null", ")", "{", "try", "{", "// try to set it", "$", "this", "->", "setBasedir", "(", "\".\"", ")", ";", "}", "catch", "(", "BuildException", "$", "exc...
Returns the basedir of this project @return PhingFile Basedir PhingFile object @throws BuildException @author Andreas Aderhold, andi@binarycloud.com
[ "Returns", "the", "basedir", "of", "this", "project" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Project.php#L509-L520
train
phingofficial/phing
classes/phing/Project.php
Project.setSystemProperties
public function setSystemProperties() { // first get system properties $systemP = array_merge(self::getProperties(), Phing::getProperties()); foreach ($systemP as $name => $value) { $this->setPropertyInternal($name, $value); } // and now the env vars foreach ($_SERVER as $name => $value) { // skip arrays if (is_array($value)) { continue; } $this->setPropertyInternal('env.' . $name, $value); } }
php
public function setSystemProperties() { // first get system properties $systemP = array_merge(self::getProperties(), Phing::getProperties()); foreach ($systemP as $name => $value) { $this->setPropertyInternal($name, $value); } // and now the env vars foreach ($_SERVER as $name => $value) { // skip arrays if (is_array($value)) { continue; } $this->setPropertyInternal('env.' . $name, $value); } }
[ "public", "function", "setSystemProperties", "(", ")", "{", "// first get system properties", "$", "systemP", "=", "array_merge", "(", "self", "::", "getProperties", "(", ")", ",", "Phing", "::", "getProperties", "(", ")", ")", ";", "foreach", "(", "$", "syste...
Sets system properties and the environment variables for this project. @return void
[ "Sets", "system", "properties", "and", "the", "environment", "variables", "for", "this", "project", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Project.php#L553-L570
train
phingofficial/phing
classes/phing/Project.php
Project.addTarget
public function addTarget($targetName, $target) { if (isset($this->targets[$targetName])) { throw new BuildException("Duplicate target: $targetName"); } $this->addOrReplaceTarget($targetName, $target); }
php
public function addTarget($targetName, $target) { if (isset($this->targets[$targetName])) { throw new BuildException("Duplicate target: $targetName"); } $this->addOrReplaceTarget($targetName, $target); }
[ "public", "function", "addTarget", "(", "$", "targetName", ",", "$", "target", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "targets", "[", "$", "targetName", "]", ")", ")", "{", "throw", "new", "BuildException", "(", "\"Duplicate target: $targetN...
Add a new target to the project @param string $targetName @param Target $target @throws BuildException
[ "Add", "a", "new", "target", "to", "the", "project" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Project.php#L623-L629
train
phingofficial/phing
classes/phing/Project.php
Project.addOrReplaceTarget
public function addOrReplaceTarget($targetName, &$target) { $this->log(" +Target: $targetName", Project::MSG_DEBUG); $target->setProject($this); $this->targets[$targetName] = $target; $ctx = $this->getReference(ProjectConfigurator::PARSING_CONTEXT_REFERENCE); $current = $ctx->getCurrentTargets(); $current[$targetName] = $target; }
php
public function addOrReplaceTarget($targetName, &$target) { $this->log(" +Target: $targetName", Project::MSG_DEBUG); $target->setProject($this); $this->targets[$targetName] = $target; $ctx = $this->getReference(ProjectConfigurator::PARSING_CONTEXT_REFERENCE); $current = $ctx->getCurrentTargets(); $current[$targetName] = $target; }
[ "public", "function", "addOrReplaceTarget", "(", "$", "targetName", ",", "&", "$", "target", ")", "{", "$", "this", "->", "log", "(", "\" +Target: $targetName\"", ",", "Project", "::", "MSG_DEBUG", ")", ";", "$", "target", "->", "setProject", "(", "$", "t...
Adds or replaces a target in the project @param string $targetName @param Target $target
[ "Adds", "or", "replaces", "a", "target", "in", "the", "project" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Project.php#L637-L646
train
phingofficial/phing
classes/phing/Project.php
Project.executeTargets
public function executeTargets($targetNames) { $this->executedTargetNames = $targetNames; foreach ($targetNames as $tname) { $this->executeTarget($tname); } }
php
public function executeTargets($targetNames) { $this->executedTargetNames = $targetNames; foreach ($targetNames as $tname) { $this->executeTarget($tname); } }
[ "public", "function", "executeTargets", "(", "$", "targetNames", ")", "{", "$", "this", "->", "executedTargetNames", "=", "$", "targetNames", ";", "foreach", "(", "$", "targetNames", "as", "$", "tname", ")", "{", "$", "this", "->", "executeTarget", "(", "$...
Executes a list of targets @param array $targetNames List of target names to execute @return void @throws BuildException
[ "Executes", "a", "list", "of", "targets" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Project.php#L711-L718
train
phingofficial/phing
classes/phing/Project.php
Project.executeTarget
public function executeTarget($targetName) { // complain about executing void if ($targetName === null) { throw new BuildException("No target specified"); } // invoke topological sort of the target tree and run all targets // until targetName occurs. $sortedTargets = $this->topoSort($targetName); $curIndex = (int) 0; $curTarget = null; $thrownException = null; $buildException = null; do { try { $curTarget = $sortedTargets[$curIndex++]; $curTarget->performTasks(); } catch (BuildException $exc) { if (!($this->keepGoingMode)) { throw $exc; } $thrownException = $exc; } if ($thrownException != null) { if ($thrownException instanceof BuildException) { $this->log( "Target '" . $curTarget->getName() . "' failed with message '" . $thrownException->getMessage() . "'.", Project::MSG_ERR ); // only the first build exception is reported if ($buildException === null) { $buildException = $thrownException; } } else { $this->log( "Target '" . $curTarget->getName() . "' failed with message '" . $thrownException->getMessage() . "'." . PHP_EOL . $thrownException->getTraceAsString(), Project::MSG_ERR ); if ($buildException === null) { $buildException = new BuildException($thrownException); } } } } while ($curTarget->getName() !== $targetName); if ($buildException !== null) { throw $buildException; } }
php
public function executeTarget($targetName) { // complain about executing void if ($targetName === null) { throw new BuildException("No target specified"); } // invoke topological sort of the target tree and run all targets // until targetName occurs. $sortedTargets = $this->topoSort($targetName); $curIndex = (int) 0; $curTarget = null; $thrownException = null; $buildException = null; do { try { $curTarget = $sortedTargets[$curIndex++]; $curTarget->performTasks(); } catch (BuildException $exc) { if (!($this->keepGoingMode)) { throw $exc; } $thrownException = $exc; } if ($thrownException != null) { if ($thrownException instanceof BuildException) { $this->log( "Target '" . $curTarget->getName() . "' failed with message '" . $thrownException->getMessage() . "'.", Project::MSG_ERR ); // only the first build exception is reported if ($buildException === null) { $buildException = $thrownException; } } else { $this->log( "Target '" . $curTarget->getName() . "' failed with message '" . $thrownException->getMessage() . "'." . PHP_EOL . $thrownException->getTraceAsString(), Project::MSG_ERR ); if ($buildException === null) { $buildException = new BuildException($thrownException); } } } } while ($curTarget->getName() !== $targetName); if ($buildException !== null) { throw $buildException; } }
[ "public", "function", "executeTarget", "(", "$", "targetName", ")", "{", "// complain about executing void", "if", "(", "$", "targetName", "===", "null", ")", "{", "throw", "new", "BuildException", "(", "\"No target specified\"", ")", ";", "}", "// invoke topologica...
Executes a target @param string $targetName Name of Target to execute @return void @throws BuildException
[ "Executes", "a", "target" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Project.php#L727-L783
train
phingofficial/phing
classes/phing/Project.php
Project.topoSort
public function topoSort($rootTarget) { $rootTarget = (string) $rootTarget; $ret = []; $state = []; $visiting = []; // We first run a DFS based sort using the root as the starting node. // This creates the minimum sequence of Targets to the root node. // We then do a sort on any remaining unVISITED targets. // This is unnecessary for doing our build, but it catches // circular dependencies or missing Targets on the entire // dependency tree, not just on the Targets that depend on the // build Target. $this->_tsort($rootTarget, $state, $visiting, $ret); $retHuman = ""; for ($i = 0, $_i = count($ret); $i < $_i; $i++) { $retHuman .= (string) $ret[$i] . " "; } $this->log("Build sequence for target '$rootTarget' is: $retHuman", Project::MSG_VERBOSE); $keys = array_keys($this->targets); while ($keys) { $curTargetName = (string) array_shift($keys); if (!isset($state[$curTargetName])) { $st = null; } else { $st = (string) $state[$curTargetName]; } if ($st === null) { $this->_tsort($curTargetName, $state, $visiting, $ret); } elseif ($st === "VISITING") { throw new Exception("Unexpected node in visiting state: $curTargetName"); } } $retHuman = ""; for ($i = 0, $_i = count($ret); $i < $_i; $i++) { $retHuman .= (string) $ret[$i] . " "; } $this->log("Complete build sequence is: $retHuman", Project::MSG_VERBOSE); return $ret; }
php
public function topoSort($rootTarget) { $rootTarget = (string) $rootTarget; $ret = []; $state = []; $visiting = []; // We first run a DFS based sort using the root as the starting node. // This creates the minimum sequence of Targets to the root node. // We then do a sort on any remaining unVISITED targets. // This is unnecessary for doing our build, but it catches // circular dependencies or missing Targets on the entire // dependency tree, not just on the Targets that depend on the // build Target. $this->_tsort($rootTarget, $state, $visiting, $ret); $retHuman = ""; for ($i = 0, $_i = count($ret); $i < $_i; $i++) { $retHuman .= (string) $ret[$i] . " "; } $this->log("Build sequence for target '$rootTarget' is: $retHuman", Project::MSG_VERBOSE); $keys = array_keys($this->targets); while ($keys) { $curTargetName = (string) array_shift($keys); if (!isset($state[$curTargetName])) { $st = null; } else { $st = (string) $state[$curTargetName]; } if ($st === null) { $this->_tsort($curTargetName, $state, $visiting, $ret); } elseif ($st === "VISITING") { throw new Exception("Unexpected node in visiting state: $curTargetName"); } } $retHuman = ""; for ($i = 0, $_i = count($ret); $i < $_i; $i++) { $retHuman .= (string) $ret[$i] . " "; } $this->log("Complete build sequence is: $retHuman", Project::MSG_VERBOSE); return $ret; }
[ "public", "function", "topoSort", "(", "$", "rootTarget", ")", "{", "$", "rootTarget", "=", "(", "string", ")", "$", "rootTarget", ";", "$", "ret", "=", "[", "]", ";", "$", "state", "=", "[", "]", ";", "$", "visiting", "=", "[", "]", ";", "// We ...
Topologically sort a set of Targets. @param string $rootTarget is the (String) name of the root Target. The sort is created in such a way that the sequence of Targets until the root target is the minimum possible such sequence. @throws BuildException @throws Exception @return Target[] targets in sorted order
[ "Topologically", "sort", "a", "set", "of", "Targets", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Project.php#L834-L880
train
phingofficial/phing
classes/phing/Project.php
Project.getReference
public function getReference($key) { if (isset($this->references[$key])) { return $this->references[$key]; } return null; // just to be explicit }
php
public function getReference($key) { if (isset($this->references[$key])) { return $this->references[$key]; } return null; // just to be explicit }
[ "public", "function", "getReference", "(", "$", "key", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "references", "[", "$", "key", "]", ")", ")", "{", "return", "$", "this", "->", "references", "[", "$", "key", "]", ";", "}", "return", "...
Returns a specific reference. @param string $key The reference id/key. @return object Reference or null if not defined
[ "Returns", "a", "specific", "reference", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Project.php#L1011-L1018
train
phingofficial/phing
classes/phing/Project.php
Project.log
public function log($msg, $level = Project::MSG_INFO) { $this->logObject($this, $msg, $level); }
php
public function log($msg, $level = Project::MSG_INFO) { $this->logObject($this, $msg, $level); }
[ "public", "function", "log", "(", "$", "msg", ",", "$", "level", "=", "Project", "::", "MSG_INFO", ")", "{", "$", "this", "->", "logObject", "(", "$", "this", ",", "$", "msg", ",", "$", "level", ")", ";", "}" ]
Abstracting and simplifyling Logger calls for project messages @param string $msg @param int $level
[ "Abstracting", "and", "simplifyling", "Logger", "calls", "for", "project", "messages" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Project.php#L1026-L1029
train
phingofficial/phing
classes/phing/tasks/ext/sonar/SonarTask.php
SonarTask.setExecutable
public function setExecutable($executable) { $this->executable = (string) $executable; $message = sprintf("Set executable to [%s].", $this->executable); $this->log($message, Project::MSG_DEBUG); }
php
public function setExecutable($executable) { $this->executable = (string) $executable; $message = sprintf("Set executable to [%s].", $this->executable); $this->log($message, Project::MSG_DEBUG); }
[ "public", "function", "setExecutable", "(", "$", "executable", ")", "{", "$", "this", "->", "executable", "=", "(", "string", ")", "$", "executable", ";", "$", "message", "=", "sprintf", "(", "\"Set executable to [%s].\"", ",", "$", "this", "->", "executable...
Sets the path of the SonarQube Scanner executable. If the SonarQube Scanner is included in the PATH environment variable, the file name is sufficient. @param string $executable @return void
[ "Sets", "the", "path", "of", "the", "SonarQube", "Scanner", "executable", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/sonar/SonarTask.php#L88-L94
train
phingofficial/phing
classes/phing/tasks/ext/sonar/SonarTask.php
SonarTask.setConfiguration
public function setConfiguration($configuration) { $this->configuration = (string) $configuration; $message = sprintf("Set configuration to [%s].", $this->configuration); $this->log($message, Project::MSG_DEBUG); }
php
public function setConfiguration($configuration) { $this->configuration = (string) $configuration; $message = sprintf("Set configuration to [%s].", $this->configuration); $this->log($message, Project::MSG_DEBUG); }
[ "public", "function", "setConfiguration", "(", "$", "configuration", ")", "{", "$", "this", "->", "configuration", "=", "(", "string", ")", "$", "configuration", ";", "$", "message", "=", "sprintf", "(", "\"Set configuration to [%s].\"", ",", "$", "this", "->"...
Sets the path of a configuration file for SonarQube Scanner. @param string $configuration @return void
[ "Sets", "the", "path", "of", "a", "configuration", "file", "for", "SonarQube", "Scanner", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/sonar/SonarTask.php#L132-L138
train
phingofficial/phing
classes/phing/tasks/ext/sonar/SonarTask.php
SonarTask.addProperty
public function addProperty(SonarProperty $property) { $this->propertyElements[] = $property; $message = sprintf("Added property: [%s] = [%s].", $property->getName(), $property->getValue()); $this->log($message, Project::MSG_DEBUG); }
php
public function addProperty(SonarProperty $property) { $this->propertyElements[] = $property; $message = sprintf("Added property: [%s] = [%s].", $property->getName(), $property->getValue()); $this->log($message, Project::MSG_DEBUG); }
[ "public", "function", "addProperty", "(", "SonarProperty", "$", "property", ")", "{", "$", "this", "->", "propertyElements", "[", "]", "=", "$", "property", ";", "$", "message", "=", "sprintf", "(", "\"Added property: [%s] = [%s].\"", ",", "$", "property", "->...
Adds a nested Property element. @param SonarProperty $property @return void
[ "Adds", "a", "nested", "Property", "element", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/sonar/SonarTask.php#L146-L152
train
phingofficial/phing
classes/phing/tasks/ext/sonar/SonarTask.php
SonarTask.constructOptionsString
private function constructOptionsString() { $options = implode(' ', $this->commandLineOptions); foreach ($this->properties as $name => $value) { $arg = sprintf('%s=%s', $name, $value); $options .= ' -D ' . escapeshellarg($arg); } return $options; }
php
private function constructOptionsString() { $options = implode(' ', $this->commandLineOptions); foreach ($this->properties as $name => $value) { $arg = sprintf('%s=%s', $name, $value); $options .= ' -D ' . escapeshellarg($arg); } return $options; }
[ "private", "function", "constructOptionsString", "(", ")", "{", "$", "options", "=", "implode", "(", "' '", ",", "$", "this", "->", "commandLineOptions", ")", ";", "foreach", "(", "$", "this", "->", "properties", "as", "$", "name", "=>", "$", "value", ")...
Constructs command-line options string for SonarQube Scanner. @return string
[ "Constructs", "command", "-", "line", "options", "string", "for", "SonarQube", "Scanner", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/sonar/SonarTask.php#L198-L208
train
phingofficial/phing
classes/phing/tasks/ext/PhpCodeSnifferTaskFormatterElement.php
PhpCodeSnifferTaskFormatterElement.parsingComplete
public function parsingComplete() { if (empty($this->type)) { throw new BuildException("Format missing required 'type' attribute."); } if ($this->useFile && empty($this->outfile)) { throw new BuildException("Format requires 'outfile' attribute when 'useFile' is true."); } }
php
public function parsingComplete() { if (empty($this->type)) { throw new BuildException("Format missing required 'type' attribute."); } if ($this->useFile && empty($this->outfile)) { throw new BuildException("Format requires 'outfile' attribute when 'useFile' is true."); } }
[ "public", "function", "parsingComplete", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "type", ")", ")", "{", "throw", "new", "BuildException", "(", "\"Format missing required 'type' attribute.\"", ")", ";", "}", "if", "(", "$", "this", "->", ...
Validate config.
[ "Validate", "config", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/PhpCodeSnifferTaskFormatterElement.php#L33-L41
train
phingofficial/phing
classes/phing/tasks/system/condition/PhingVersion.php
PhingVersion.main
public function main() { if ($this->propertyname == null) { throw new BuildException("'property' must be set."); } if ($this->atLeast != null || $this->exactly != null) { // If condition values are set, evaluate the condition if ($this->evaluate()) { $this->getProject()->setNewProperty($this->propertyname, $this->getVersion()); } } else { // Raw task $this->getProject()->setNewProperty($this->propertyname, $this->getVersion()); } }
php
public function main() { if ($this->propertyname == null) { throw new BuildException("'property' must be set."); } if ($this->atLeast != null || $this->exactly != null) { // If condition values are set, evaluate the condition if ($this->evaluate()) { $this->getProject()->setNewProperty($this->propertyname, $this->getVersion()); } } else { // Raw task $this->getProject()->setNewProperty($this->propertyname, $this->getVersion()); } }
[ "public", "function", "main", "(", ")", "{", "if", "(", "$", "this", "->", "propertyname", "==", "null", ")", "{", "throw", "new", "BuildException", "(", "\"'property' must be set.\"", ")", ";", "}", "if", "(", "$", "this", "->", "atLeast", "!=", "null",...
Run as a task. @throws BuildException if an error occurs.
[ "Run", "as", "a", "task", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/condition/PhingVersion.php#L37-L51
train
phingofficial/phing
classes/phing/tasks/system/condition/PhingVersion.php
PhingVersion.evaluate
public function evaluate() { $this->validate(); $actual = $this->getVersion(); if (null != $this->atLeast) { return version_compare($actual, $this->atLeast, '>='); } if (null != $this->exactly) { return version_compare($actual, $this->exactly, '='); } return false; }
php
public function evaluate() { $this->validate(); $actual = $this->getVersion(); if (null != $this->atLeast) { return version_compare($actual, $this->atLeast, '>='); } if (null != $this->exactly) { return version_compare($actual, $this->exactly, '='); } return false; }
[ "public", "function", "evaluate", "(", ")", "{", "$", "this", "->", "validate", "(", ")", ";", "$", "actual", "=", "$", "this", "->", "getVersion", "(", ")", ";", "if", "(", "null", "!=", "$", "this", "->", "atLeast", ")", "{", "return", "version_c...
Evaluate the condition. @return true if the condition is true. @throws BuildException if an error occurs.
[ "Evaluate", "the", "condition", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/condition/PhingVersion.php#L59-L72
train
phingofficial/phing
classes/phing/tasks/ext/Service/Amazon/S3/S3PutTask.php
S3PutTask.getHttpHeaders
protected function getHttpHeaders() { $headers = []; if (null !== $this->_maxage) { $headers['Cache-Control'] = 'max-age=' . $this->_maxage; } if ($this->_gzipped) { $headers['Content-Encoding'] = 'gzip'; } return $headers; }
php
protected function getHttpHeaders() { $headers = []; if (null !== $this->_maxage) { $headers['Cache-Control'] = 'max-age=' . $this->_maxage; } if ($this->_gzipped) { $headers['Content-Encoding'] = 'gzip'; } return $headers; }
[ "protected", "function", "getHttpHeaders", "(", ")", "{", "$", "headers", "=", "[", "]", ";", "if", "(", "null", "!==", "$", "this", "->", "_maxage", ")", "{", "$", "headers", "[", "'Cache-Control'", "]", "=", "'max-age='", ".", "$", "this", "->", "_...
Generate HTTPHEader array sent to S3. @return array HttpHeader to set in S3 Object.
[ "Generate", "HTTPHEader", "array", "sent", "to", "S3", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/Service/Amazon/S3/S3PutTask.php#L327-L338
train
phingofficial/phing
classes/phing/tasks/ext/Service/Amazon/S3/S3PutTask.php
S3PutTask.execute
public function execute() { if (!$this->isBucketAvailable()) { if (!$this->getCreateBuckets()) { throw new BuildException('Bucket doesn\'t exist and createBuckets not specified'); } if (!$this->createBucket()) { throw new BuildException('Bucket cannot be created'); } } // Filesets take precedence if (!empty($this->_filesets)) { $objects = []; foreach ($this->_filesets as $fs) { if (!($fs instanceof FileSet)) { continue; } $ds = $fs->getDirectoryScanner($this->getProject()); $objects = array_merge($objects, $ds->getIncludedFiles()); } $fromDir = $fs->getDir($this->getProject())->getAbsolutePath(); if ($this->_fileNameOnly) { foreach ($objects as $object) { $this->_source = $object; $this->saveObject(basename($object), $fromDir . DIRECTORY_SEPARATOR . $object); } } else { foreach ($objects as $object) { $this->_source = $object; $this->saveObject( str_replace('\\', '/', $object), $fromDir . DIRECTORY_SEPARATOR . $object ); } } return; } $this->saveObject($this->getObject(), $this->getSource()); }
php
public function execute() { if (!$this->isBucketAvailable()) { if (!$this->getCreateBuckets()) { throw new BuildException('Bucket doesn\'t exist and createBuckets not specified'); } if (!$this->createBucket()) { throw new BuildException('Bucket cannot be created'); } } // Filesets take precedence if (!empty($this->_filesets)) { $objects = []; foreach ($this->_filesets as $fs) { if (!($fs instanceof FileSet)) { continue; } $ds = $fs->getDirectoryScanner($this->getProject()); $objects = array_merge($objects, $ds->getIncludedFiles()); } $fromDir = $fs->getDir($this->getProject())->getAbsolutePath(); if ($this->_fileNameOnly) { foreach ($objects as $object) { $this->_source = $object; $this->saveObject(basename($object), $fromDir . DIRECTORY_SEPARATOR . $object); } } else { foreach ($objects as $object) { $this->_source = $object; $this->saveObject( str_replace('\\', '/', $object), $fromDir . DIRECTORY_SEPARATOR . $object ); } } return; } $this->saveObject($this->getObject(), $this->getSource()); }
[ "public", "function", "execute", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isBucketAvailable", "(", ")", ")", "{", "if", "(", "!", "$", "this", "->", "getCreateBuckets", "(", ")", ")", "{", "throw", "new", "BuildException", "(", "'Bucket doesn...
Store the object on S3 @throws BuildException @return void
[ "Store", "the", "object", "on", "S3" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/Service/Amazon/S3/S3PutTask.php#L397-L443
train
phingofficial/phing
classes/phing/tasks/ext/ioncube/IoncubeLicenseTask.php
IoncubeLicenseTask.constructArguments
private function constructArguments() { $arguments = ""; if (!empty($this->passPhrase)) { $arguments .= "--passphrase '" . $this->passPhrase . "' "; } foreach ($this->comments as $comment) { $arguments .= "--header-line '" . $comment->getValue() . "' "; } if (!empty($this->licensePath)) { $arguments .= "--o '" . $this->licensePath . "' "; } if (!empty($this->allowedServer)) { $arguments .= "--allowed-server {" . $this->allowedServer . "} "; } if (!empty($this->expireOn)) { $arguments .= "--expire-on " . $this->expireOn . " "; } if (!empty($this->expireIn)) { $arguments .= "--expire-in " . $this->expireIn . " "; } return $arguments; }
php
private function constructArguments() { $arguments = ""; if (!empty($this->passPhrase)) { $arguments .= "--passphrase '" . $this->passPhrase . "' "; } foreach ($this->comments as $comment) { $arguments .= "--header-line '" . $comment->getValue() . "' "; } if (!empty($this->licensePath)) { $arguments .= "--o '" . $this->licensePath . "' "; } if (!empty($this->allowedServer)) { $arguments .= "--allowed-server {" . $this->allowedServer . "} "; } if (!empty($this->expireOn)) { $arguments .= "--expire-on " . $this->expireOn . " "; } if (!empty($this->expireIn)) { $arguments .= "--expire-in " . $this->expireIn . " "; } return $arguments; }
[ "private", "function", "constructArguments", "(", ")", "{", "$", "arguments", "=", "\"\"", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "passPhrase", ")", ")", "{", "$", "arguments", ".=", "\"--passphrase '\"", ".", "$", "this", "->", "passPhras...
Constructs an argument string for the ionCube make_license
[ "Constructs", "an", "argument", "string", "for", "the", "ionCube", "make_license" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/ioncube/IoncubeLicenseTask.php#L181-L210
train
phingofficial/phing
classes/phing/filters/TabToSpaces.php
TabToSpaces.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 = str_replace("\t", str_repeat(' ', $this->tabLength), $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 = str_replace("\t", str_repeat(' ', $this->tabLength), $buffer); return $buffer; }
[ "public", "function", "read", "(", "$", "len", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "getInitialized", "(", ")", ")", "{", "$", "this", "->", "_initialize", "(", ")", ";", "$", "this", "->", "setInitialized", "(", "true", ")", ...
Returns stream after converting tabs to the specified number of spaces. @param null $len @return int 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", "stream", "after", "converting", "tabs", "to", "the", "specified", "number", "of", "spaces", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/TabToSpaces.php#L72-L88
train
phingofficial/phing
classes/phing/filters/TabToSpaces.php
TabToSpaces.chain
public function chain(Reader $reader) { $newFilter = new TabToSpaces($reader); $newFilter->setTablength($this->getTablength()); $newFilter->setInitialized(true); $newFilter->setProject($this->getProject()); return $newFilter; }
php
public function chain(Reader $reader) { $newFilter = new TabToSpaces($reader); $newFilter->setTablength($this->getTablength()); $newFilter->setInitialized(true); $newFilter->setProject($this->getProject()); return $newFilter; }
[ "public", "function", "chain", "(", "Reader", "$", "reader", ")", "{", "$", "newFilter", "=", "new", "TabToSpaces", "(", "$", "reader", ")", ";", "$", "newFilter", "->", "setTablength", "(", "$", "this", "->", "getTablength", "(", ")", ")", ";", "$", ...
Creates a new TabsToSpaces using the passed in Reader for instantiation. @param Reader $reader A Reader object providing the underlying stream. Must not be <code>null</code>. @return TabToSpaces A new filter based on this configuration, but filtering the specified reader
[ "Creates", "a", "new", "TabsToSpaces", "using", "the", "passed", "in", "Reader", "for", "instantiation", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/TabToSpaces.php#L120-L128
train
phingofficial/phing
classes/phing/filters/TabToSpaces.php
TabToSpaces._initialize
private function _initialize() { $params = $this->getParameters(); if ($params !== null) { for ($i = 0, $paramsCount = count($params); $i < $paramsCount; $i++) { if (self::TAB_LENGTH_KEY === $params[$i]->getName()) { $this->tabLength = $params[$i]->getValue(); break; } } } }
php
private function _initialize() { $params = $this->getParameters(); if ($params !== null) { for ($i = 0, $paramsCount = count($params); $i < $paramsCount; $i++) { if (self::TAB_LENGTH_KEY === $params[$i]->getName()) { $this->tabLength = $params[$i]->getValue(); break; } } } }
[ "private", "function", "_initialize", "(", ")", "{", "$", "params", "=", "$", "this", "->", "getParameters", "(", ")", ";", "if", "(", "$", "params", "!==", "null", ")", "{", "for", "(", "$", "i", "=", "0", ",", "$", "paramsCount", "=", "count", ...
Parses the parameters to set the tab length.
[ "Parses", "the", "parameters", "to", "set", "the", "tab", "length", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/TabToSpaces.php#L133-L144
train
phingofficial/phing
classes/phing/filters/PhpArrayMapLines.php
PhpArrayMapLines.read
public function read($len = null) { if (!$this->getInitialized()) { $this->_initialize(); $this->checkAttributes(); $this->setInitialized(true); } $buffer = $this->in->read($len); if ($buffer === -1 || !function_exists($this->function)) { return -1; } $lines = explode("\n", $buffer); $filtered = array_map($this->function, $lines); $filtered_buffer = implode("\n", $filtered); return $filtered_buffer; }
php
public function read($len = null) { if (!$this->getInitialized()) { $this->_initialize(); $this->checkAttributes(); $this->setInitialized(true); } $buffer = $this->in->read($len); if ($buffer === -1 || !function_exists($this->function)) { return -1; } $lines = explode("\n", $buffer); $filtered = array_map($this->function, $lines); $filtered_buffer = implode("\n", $filtered); return $filtered_buffer; }
[ "public", "function", "read", "(", "$", "len", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "getInitialized", "(", ")", ")", "{", "$", "this", "->", "_initialize", "(", ")", ";", "$", "this", "->", "checkAttributes", "(", ")", ";", "...
Applies a native php function to the original input and returns resulting stream. @param null $len @return mixed buffer, -1 on EOF
[ "Applies", "a", "native", "php", "function", "to", "the", "original", "input", "and", "returns", "resulting", "stream", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/PhpArrayMapLines.php#L57-L78
train
phingofficial/phing
classes/phing/filters/PhpArrayMapLines.php
PhpArrayMapLines.chain
public function chain(Reader $reader) { $newFilter = new PhpArrayMapLines($reader); $newFilter->setFunction($this->getFunction()); $newFilter->setInitialized(true); $newFilter->setProject($this->getProject()); return $newFilter; }
php
public function chain(Reader $reader) { $newFilter = new PhpArrayMapLines($reader); $newFilter->setFunction($this->getFunction()); $newFilter->setInitialized(true); $newFilter->setProject($this->getProject()); return $newFilter; }
[ "public", "function", "chain", "(", "Reader", "$", "reader", ")", "{", "$", "newFilter", "=", "new", "PhpArrayMapLines", "(", "$", "reader", ")", ";", "$", "newFilter", "->", "setFunction", "(", "$", "this", "->", "getFunction", "(", ")", ")", ";", "$"...
Creates a new PhpArrayMapLines filter using the passed in Reader for instantiation. @param Reader $reader Reader object providing the underlying stream. Must not be <code>null</code>. @return PhpArrayMapLines A new filter based on this configuration, but filtering the specified reader
[ "Creates", "a", "new", "PhpArrayMapLines", "filter", "using", "the", "passed", "in", "Reader", "for", "instantiation", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/PhpArrayMapLines.php#L122-L130
train
phingofficial/phing
classes/phing/filters/PhpArrayMapLines.php
PhpArrayMapLines._initialize
private function _initialize() { $params = $this->getParameters(); if ($params !== null) { for ($i = 0, $_i = count($params); $i < $_i; $i++) { if (self::FUNCTION_KEY == $params[$i]->getName()) { $this->function = (string) $params[$i]->getValue(); break; } } } }
php
private function _initialize() { $params = $this->getParameters(); if ($params !== null) { for ($i = 0, $_i = count($params); $i < $_i; $i++) { if (self::FUNCTION_KEY == $params[$i]->getName()) { $this->function = (string) $params[$i]->getValue(); break; } } } }
[ "private", "function", "_initialize", "(", ")", "{", "$", "params", "=", "$", "this", "->", "getParameters", "(", ")", ";", "if", "(", "$", "params", "!==", "null", ")", "{", "for", "(", "$", "i", "=", "0", ",", "$", "_i", "=", "count", "(", "$...
Initializes the function if it is available from the parameters.
[ "Initializes", "the", "function", "if", "it", "is", "available", "from", "the", "parameters", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/PhpArrayMapLines.php#L135-L146
train
phingofficial/phing
classes/phing/tasks/ext/dbdeploy/DbDeployTask.php
DbDeployTask.main
public function main() { try { // get correct DbmsSyntax object $dbms = substr($this->url, 0, strpos($this->url, ':')); $dbmsSyntaxFactory = new DbmsSyntaxFactory($dbms); $this->dbmsSyntax = $dbmsSyntaxFactory->getDbmsSyntax(); // figure out which revisions are in the db already $this->appliedChangeNumbers = $this->getAppliedChangeNumbers(); $this->log('Current db revision: ' . $this->getLastChangeAppliedInDb()); $this->log('Checkall: ' . ($this->checkall ? 'On' : 'Off')); $this->deploy(); } catch (Exception $e) { throw new BuildException($e); } }
php
public function main() { try { // get correct DbmsSyntax object $dbms = substr($this->url, 0, strpos($this->url, ':')); $dbmsSyntaxFactory = new DbmsSyntaxFactory($dbms); $this->dbmsSyntax = $dbmsSyntaxFactory->getDbmsSyntax(); // figure out which revisions are in the db already $this->appliedChangeNumbers = $this->getAppliedChangeNumbers(); $this->log('Current db revision: ' . $this->getLastChangeAppliedInDb()); $this->log('Checkall: ' . ($this->checkall ? 'On' : 'Off')); $this->deploy(); } catch (Exception $e) { throw new BuildException($e); } }
[ "public", "function", "main", "(", ")", "{", "try", "{", "// get correct DbmsSyntax object", "$", "dbms", "=", "substr", "(", "$", "this", "->", "url", ",", "0", ",", "strpos", "(", "$", "this", "->", "url", ",", "':'", ")", ")", ";", "$", "dbmsSynta...
The main function for the task @throws BuildException @return void
[ "The", "main", "function", "for", "the", "task" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/dbdeploy/DbDeployTask.php#L139-L156
train
phingofficial/phing
classes/phing/tasks/ext/dbdeploy/DbDeployTask.php
DbDeployTask.getAppliedChangeNumbers
protected function getAppliedChangeNumbers() { if (count($this->appliedChangeNumbers) == 0) { $this->log('Getting applied changed numbers from DB: ' . $this->url); $appliedChangeNumbers = []; $dbh = new PDO($this->url, $this->userid, $this->password); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $this->dbmsSyntax->applyAttributes($dbh); $sql = "SELECT * FROM " . DbDeployTask::$TABLE_NAME . " WHERE delta_set = '$this->deltaSet' ORDER BY change_number"; foreach ($dbh->query($sql) as $change) { $appliedChangeNumbers[] = $change['change_number']; } $this->appliedChangeNumbers = $appliedChangeNumbers; } return $this->appliedChangeNumbers; }
php
protected function getAppliedChangeNumbers() { if (count($this->appliedChangeNumbers) == 0) { $this->log('Getting applied changed numbers from DB: ' . $this->url); $appliedChangeNumbers = []; $dbh = new PDO($this->url, $this->userid, $this->password); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $this->dbmsSyntax->applyAttributes($dbh); $sql = "SELECT * FROM " . DbDeployTask::$TABLE_NAME . " WHERE delta_set = '$this->deltaSet' ORDER BY change_number"; foreach ($dbh->query($sql) as $change) { $appliedChangeNumbers[] = $change['change_number']; } $this->appliedChangeNumbers = $appliedChangeNumbers; } return $this->appliedChangeNumbers; }
[ "protected", "function", "getAppliedChangeNumbers", "(", ")", "{", "if", "(", "count", "(", "$", "this", "->", "appliedChangeNumbers", ")", "==", "0", ")", "{", "$", "this", "->", "log", "(", "'Getting applied changed numbers from DB: '", ".", "$", "this", "->...
Get the numbers of all the patches that are already applied according to the changelog table in the database @return array
[ "Get", "the", "numbers", "of", "all", "the", "patches", "that", "are", "already", "applied", "according", "to", "the", "changelog", "table", "in", "the", "database" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/dbdeploy/DbDeployTask.php#L164-L183
train
phingofficial/phing
classes/phing/tasks/ext/dbdeploy/DbDeployTask.php
DbDeployTask.deploy
protected function deploy() { // create deploy outputfile $this->createOutputFile($this->outputFile, false); // create undo deploy outputfile $this->createOutputFile($this->undoOutputFile, true); }
php
protected function deploy() { // create deploy outputfile $this->createOutputFile($this->outputFile, false); // create undo deploy outputfile $this->createOutputFile($this->undoOutputFile, true); }
[ "protected", "function", "deploy", "(", ")", "{", "// create deploy outputfile", "$", "this", "->", "createOutputFile", "(", "$", "this", "->", "outputFile", ",", "false", ")", ";", "// create undo deploy outputfile", "$", "this", "->", "createOutputFile", "(", "$...
Create the deploy and undo deploy outputfiles @return void
[ "Create", "the", "deploy", "and", "undo", "deploy", "outputfiles" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/dbdeploy/DbDeployTask.php#L201-L208
train
phingofficial/phing
classes/phing/tasks/ext/dbdeploy/DbDeployTask.php
DbDeployTask.getDeltasFilesArray
protected function getDeltasFilesArray() { $files = []; $baseDir = realpath($this->dir); $dh = opendir($baseDir); if ($dh === false) { return $files; } $fileChangeNumberPrefix = ''; while (($file = readdir($dh)) !== false) { if (preg_match('[\d+]', $file, $fileChangeNumberPrefix)) { $files[(int) $fileChangeNumberPrefix[0]] = $file; } } return $files; }
php
protected function getDeltasFilesArray() { $files = []; $baseDir = realpath($this->dir); $dh = opendir($baseDir); if ($dh === false) { return $files; } $fileChangeNumberPrefix = ''; while (($file = readdir($dh)) !== false) { if (preg_match('[\d+]', $file, $fileChangeNumberPrefix)) { $files[(int) $fileChangeNumberPrefix[0]] = $file; } } return $files; }
[ "protected", "function", "getDeltasFilesArray", "(", ")", "{", "$", "files", "=", "[", "]", ";", "$", "baseDir", "=", "realpath", "(", "$", "this", "->", "dir", ")", ";", "$", "dh", "=", "opendir", "(", "$", "baseDir", ")", ";", "if", "(", "$", "...
Get a list of all the patch files in the patch file directory @return array
[ "Get", "a", "list", "of", "all", "the", "patch", "files", "in", "the", "patch", "file", "directory" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/dbdeploy/DbDeployTask.php#L301-L320
train
phingofficial/phing
classes/phing/tasks/system/DefaultExcludes.php
DefaultExcludes.main
public function main() { if (!$this->defaultrequested && $this->add === "" && $this->remove === "" && !$this->echo) { throw new BuildException( "<defaultexcludes> task must set at least one attribute (echo=\"false\")" . " doesn't count since that is the default" ); } if ($this->defaultrequested) { DirectoryScanner::resetDefaultExcludes(); } if ($this->add !== "") { DirectoryScanner::addDefaultExclude($this->add); } if ($this->remove !== "") { DirectoryScanner::removeDefaultExclude($this->remove); } if ($this->echo) { $lineSep = Phing::getProperty('line.separator'); $message = "Current Default Excludes:"; $message .= $lineSep; $excludes = DirectoryScanner::getDefaultExcludes(); $message .= " "; $message .= implode($lineSep . " ", $excludes); $this->log($message, $this->logLevel); } }
php
public function main() { if (!$this->defaultrequested && $this->add === "" && $this->remove === "" && !$this->echo) { throw new BuildException( "<defaultexcludes> task must set at least one attribute (echo=\"false\")" . " doesn't count since that is the default" ); } if ($this->defaultrequested) { DirectoryScanner::resetDefaultExcludes(); } if ($this->add !== "") { DirectoryScanner::addDefaultExclude($this->add); } if ($this->remove !== "") { DirectoryScanner::removeDefaultExclude($this->remove); } if ($this->echo) { $lineSep = Phing::getProperty('line.separator'); $message = "Current Default Excludes:"; $message .= $lineSep; $excludes = DirectoryScanner::getDefaultExcludes(); $message .= " "; $message .= implode($lineSep . " ", $excludes); $this->log($message, $this->logLevel); } }
[ "public", "function", "main", "(", ")", "{", "if", "(", "!", "$", "this", "->", "defaultrequested", "&&", "$", "this", "->", "add", "===", "\"\"", "&&", "$", "this", "->", "remove", "===", "\"\"", "&&", "!", "$", "this", "->", "echo", ")", "{", "...
Does the work. @throws BuildException if something goes wrong with the build
[ "Does", "the", "work", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/DefaultExcludes.php#L60-L86
train
phingofficial/phing
classes/phing/tasks/ext/coverage/CoverageSetupTask.php
CoverageSetupTask.getFilenames
private function getFilenames() { $files = []; foreach ($this->filelists as $fl) { try { $list = $fl->getFiles($this->project); foreach ($list as $file) { $fs = new PhingFile((string) $fl->getDir($this->project), $file); $files[] = ['key' => strtolower($fs->getAbsolutePath()), 'fullname' => $fs->getAbsolutePath()]; } } catch (BuildException $be) { $this->log($be->getMessage(), Project::MSG_WARN); } } foreach ($this->filesets as $fileset) { $ds = $fileset->getDirectoryScanner($this->project); $ds->scan(); $includedFiles = $ds->getIncludedFiles(); foreach ($includedFiles as $file) { $fs = new PhingFile(realpath($ds->getBaseDir()), $file); $files[] = ['key' => strtolower($fs->getAbsolutePath()), 'fullname' => $fs->getAbsolutePath()]; } } return $files; }
php
private function getFilenames() { $files = []; foreach ($this->filelists as $fl) { try { $list = $fl->getFiles($this->project); foreach ($list as $file) { $fs = new PhingFile((string) $fl->getDir($this->project), $file); $files[] = ['key' => strtolower($fs->getAbsolutePath()), 'fullname' => $fs->getAbsolutePath()]; } } catch (BuildException $be) { $this->log($be->getMessage(), Project::MSG_WARN); } } foreach ($this->filesets as $fileset) { $ds = $fileset->getDirectoryScanner($this->project); $ds->scan(); $includedFiles = $ds->getIncludedFiles(); foreach ($includedFiles as $file) { $fs = new PhingFile(realpath($ds->getBaseDir()), $file); $files[] = ['key' => strtolower($fs->getAbsolutePath()), 'fullname' => $fs->getAbsolutePath()]; } } return $files; }
[ "private", "function", "getFilenames", "(", ")", "{", "$", "files", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "filelists", "as", "$", "fl", ")", "{", "try", "{", "$", "list", "=", "$", "fl", "->", "getFiles", "(", "$", "this", "->", ...
Iterate over all filesets and return the filename of all files. @return array an array of (basedir, filenames) pairs
[ "Iterate", "over", "all", "filesets", "and", "return", "the", "filename", "of", "all", "files", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/coverage/CoverageSetupTask.php#L53-L83
train
phingofficial/phing
classes/phing/tasks/ext/HttpGetTask.php
HttpGetTask.processResponse
protected function processResponse(HTTP_Request2_Response $response) { if ($response->getStatus() != 200) { throw new BuildException( "Request unsuccessful. Response from server: " . $response->getStatus() . " " . $response->getReasonPhrase(), $this->getLocation() ); } $content = $response->getBody(); $disposition = $response->getHeader('content-disposition'); if ($this->filename) { $filename = $this->filename; } elseif ($disposition && 0 == strpos($disposition, 'attachment') && preg_match('/filename="([^"]+)"/', $disposition, $m) ) { $filename = basename($m[1]); } else { $filename = basename(parse_url($this->url, PHP_URL_PATH)); } if (!is_writable($this->dir)) { throw new BuildException("Cannot write to directory: " . $this->dir, $this->getLocation()); } $filename = $this->dir . "/" . $filename; file_put_contents($filename, $content); $this->log("Contents from " . $this->url . " saved to $filename"); }
php
protected function processResponse(HTTP_Request2_Response $response) { if ($response->getStatus() != 200) { throw new BuildException( "Request unsuccessful. Response from server: " . $response->getStatus() . " " . $response->getReasonPhrase(), $this->getLocation() ); } $content = $response->getBody(); $disposition = $response->getHeader('content-disposition'); if ($this->filename) { $filename = $this->filename; } elseif ($disposition && 0 == strpos($disposition, 'attachment') && preg_match('/filename="([^"]+)"/', $disposition, $m) ) { $filename = basename($m[1]); } else { $filename = basename(parse_url($this->url, PHP_URL_PATH)); } if (!is_writable($this->dir)) { throw new BuildException("Cannot write to directory: " . $this->dir, $this->getLocation()); } $filename = $this->dir . "/" . $filename; file_put_contents($filename, $content); $this->log("Contents from " . $this->url . " saved to $filename"); }
[ "protected", "function", "processResponse", "(", "HTTP_Request2_Response", "$", "response", ")", "{", "if", "(", "$", "response", "->", "getStatus", "(", ")", "!=", "200", ")", "{", "throw", "new", "BuildException", "(", "\"Request unsuccessful. Response from server...
Saves the response body to a specified directory @param HTTP_Request2_Response $response @return void @throws BuildException
[ "Saves", "the", "response", "body", "to", "a", "specified", "directory" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/HttpGetTask.php#L103-L134
train
phingofficial/phing
classes/phing/system/io/UnixFileSystem.php
UnixFileSystem.normalize
public function normalize($strPathname) { if (!strlen($strPathname)) { return ''; } // Start normalising after any scheme that is present. // This prevents phar:///foo being normalised into phar:/foo // Use a regex as some paths may not by parsed by parse_url(). if (preg_match('{^[a-z][a-z0-9+\-\.]+://}', $strPathname)) { $i = strpos($strPathname, '://') + 3; } else { $i = 0; } $n = strlen($strPathname); $prevChar = 0; for (; $i < $n; $i++) { $c = $strPathname{$i}; if (($prevChar === '/') && ($c === '/')) { return self::normalizer($strPathname, $n, $i - 1); } $prevChar = $c; } if ($prevChar === '/') { return self::normalizer($strPathname, $n, $n - 1); } return $strPathname; }
php
public function normalize($strPathname) { if (!strlen($strPathname)) { return ''; } // Start normalising after any scheme that is present. // This prevents phar:///foo being normalised into phar:/foo // Use a regex as some paths may not by parsed by parse_url(). if (preg_match('{^[a-z][a-z0-9+\-\.]+://}', $strPathname)) { $i = strpos($strPathname, '://') + 3; } else { $i = 0; } $n = strlen($strPathname); $prevChar = 0; for (; $i < $n; $i++) { $c = $strPathname{$i}; if (($prevChar === '/') && ($c === '/')) { return self::normalizer($strPathname, $n, $i - 1); } $prevChar = $c; } if ($prevChar === '/') { return self::normalizer($strPathname, $n, $n - 1); } return $strPathname; }
[ "public", "function", "normalize", "(", "$", "strPathname", ")", "{", "if", "(", "!", "strlen", "(", "$", "strPathname", ")", ")", "{", "return", "''", ";", "}", "// Start normalising after any scheme that is present.", "// This prevents phar:///foo being normalised int...
A normal Unix pathname contains no duplicate slashes and does not end with a slash. It may be the empty string. Check that the given pathname is normal. If not, invoke the real normalizer on the part of the pathname that requires normalization. This way we iterate through the whole pathname string only once. NOTE: this method no longer expands the tilde (~) character! @param string $strPathname @return string
[ "A", "normal", "Unix", "pathname", "contains", "no", "duplicate", "slashes", "and", "does", "not", "end", "with", "a", "slash", ".", "It", "may", "be", "the", "empty", "string", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/UnixFileSystem.php#L77-L106
train
phingofficial/phing
classes/phing/system/io/UnixFileSystem.php
UnixFileSystem.prefixLength
public function prefixLength($pathname) { if (strlen($pathname) === 0) { return 0; } if (class_exists('Phar', false) && method_exists('Phar', 'running')) { $phar = Phar::running(); $pharAlias = 'phar://' . Phing::PHAR_ALIAS; if ($phar && strpos($pathname, $phar) === 0) { return strlen($phar); } if ($phar && strpos($pathname, $pharAlias) === 0) { return strlen($pharAlias); } } return (($pathname{0} === '/') ? 1 : 0); }
php
public function prefixLength($pathname) { if (strlen($pathname) === 0) { return 0; } if (class_exists('Phar', false) && method_exists('Phar', 'running')) { $phar = Phar::running(); $pharAlias = 'phar://' . Phing::PHAR_ALIAS; if ($phar && strpos($pathname, $phar) === 0) { return strlen($phar); } if ($phar && strpos($pathname, $pharAlias) === 0) { return strlen($pharAlias); } } return (($pathname{0} === '/') ? 1 : 0); }
[ "public", "function", "prefixLength", "(", "$", "pathname", ")", "{", "if", "(", "strlen", "(", "$", "pathname", ")", "===", "0", ")", "{", "return", "0", ";", "}", "if", "(", "class_exists", "(", "'Phar'", ",", "false", ")", "&&", "method_exists", "...
Compute the length of the pathname string's prefix. The pathname string must be in normal form. @param string $pathname @return int
[ "Compute", "the", "length", "of", "the", "pathname", "string", "s", "prefix", ".", "The", "pathname", "string", "must", "be", "in", "normal", "form", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/UnixFileSystem.php#L156-L176
train
phingofficial/phing
classes/phing/system/io/UnixFileSystem.php
UnixFileSystem.resolve
public function resolve($parent, $child) { if ($child === "") { return $parent; } if ($child{0} === '/') { if ($parent === '/') { return $child; } return $parent . $child; } if ($parent === '/') { return $parent . $child; } return $parent . '/' . $child; }
php
public function resolve($parent, $child) { if ($child === "") { return $parent; } if ($child{0} === '/') { if ($parent === '/') { return $child; } return $parent . $child; } if ($parent === '/') { return $parent . $child; } return $parent . '/' . $child; }
[ "public", "function", "resolve", "(", "$", "parent", ",", "$", "child", ")", "{", "if", "(", "$", "child", "===", "\"\"", ")", "{", "return", "$", "parent", ";", "}", "if", "(", "$", "child", "{", "0", "}", "===", "'/'", ")", "{", "if", "(", ...
Resolve the child pathname string against the parent. Both strings must be in normal form, and the result will be in normal form. @param string $parent @param string $child @return string
[ "Resolve", "the", "child", "pathname", "string", "against", "the", "parent", ".", "Both", "strings", "must", "be", "in", "normal", "form", "and", "the", "result", "will", "be", "in", "normal", "form", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/UnixFileSystem.php#L188-L207
train
phingofficial/phing
classes/phing/system/io/UnixFileSystem.php
UnixFileSystem.resolveFile
public function resolveFile(PhingFile $f) { // resolve if parent is a file oject only if ($this->isAbsolute($f)) { return $f->getPath(); } else { return $this->resolve(Phing::getProperty("user.dir"), $f->getPath()); } }
php
public function resolveFile(PhingFile $f) { // resolve if parent is a file oject only if ($this->isAbsolute($f)) { return $f->getPath(); } else { return $this->resolve(Phing::getProperty("user.dir"), $f->getPath()); } }
[ "public", "function", "resolveFile", "(", "PhingFile", "$", "f", ")", "{", "// resolve if parent is a file oject only", "if", "(", "$", "this", "->", "isAbsolute", "(", "$", "f", ")", ")", "{", "return", "$", "f", "->", "getPath", "(", ")", ";", "}", "el...
the file resolver @param PhingFile $f @return string
[ "the", "file", "resolver" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/UnixFileSystem.php#L234-L242
train