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/system/io/UnixFileSystem.php
UnixFileSystem.setReadOnly
public function setReadOnly($f) { if ($f instanceof PhingFile) { $strPath = (string) $f->getPath(); $perms = (int) (@fileperms($strPath) & 0444); FileSystem::getFileSystem()->chmod($strPath, $perms); } else { throw new Exception("IllegalArgumentType: Argument is not File"); } }
php
public function setReadOnly($f) { if ($f instanceof PhingFile) { $strPath = (string) $f->getPath(); $perms = (int) (@fileperms($strPath) & 0444); FileSystem::getFileSystem()->chmod($strPath, $perms); } else { throw new Exception("IllegalArgumentType: Argument is not File"); } }
[ "public", "function", "setReadOnly", "(", "$", "f", ")", "{", "if", "(", "$", "f", "instanceof", "PhingFile", ")", "{", "$", "strPath", "=", "(", "string", ")", "$", "f", "->", "getPath", "(", ")", ";", "$", "perms", "=", "(", "int", ")", "(", ...
set file readonly on unix @param PhingFile $f @throws Exception @throws IOException
[ "set", "file", "readonly", "on", "unix" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/UnixFileSystem.php#L267-L277
train
phingofficial/phing
classes/phing/system/io/UnixFileSystem.php
UnixFileSystem.copy
public function copy(PhingFile $src, PhingFile $dest) { global $php_errormsg; if (!$src->isLink()) { parent::copy($src, $dest); return; } $srcPath = $src->getAbsolutePath(); $destPath = $dest->getAbsolutePath(); $linkTarget = $src->getLinkTarget(); if (false === @symlink($linkTarget, $destPath)) { $msg = "FileSystem::copy() FAILED. Cannot create symlink from $destPath to $linkTarget."; throw new Exception($msg); } }
php
public function copy(PhingFile $src, PhingFile $dest) { global $php_errormsg; if (!$src->isLink()) { parent::copy($src, $dest); return; } $srcPath = $src->getAbsolutePath(); $destPath = $dest->getAbsolutePath(); $linkTarget = $src->getLinkTarget(); if (false === @symlink($linkTarget, $destPath)) { $msg = "FileSystem::copy() FAILED. Cannot create symlink from $destPath to $linkTarget."; throw new Exception($msg); } }
[ "public", "function", "copy", "(", "PhingFile", "$", "src", ",", "PhingFile", "$", "dest", ")", "{", "global", "$", "php_errormsg", ";", "if", "(", "!", "$", "src", "->", "isLink", "(", ")", ")", "{", "parent", "::", "copy", "(", "$", "src", ",", ...
Copy a file, takes care of symbolic links @param PhingFile $src Source path and name file to copy. @param PhingFile $dest Destination path and name of new file. @return void @throws Exception if file cannot be copied.
[ "Copy", "a", "file", "takes", "care", "of", "symbolic", "links" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/UnixFileSystem.php#L303-L320
train
phingofficial/phing
classes/phing/types/DataType.php
DataType.getCheckedRef
public function getCheckedRef($requiredClass, $dataTypeName) { if (!$this->checked) { // should be in stack $stk = []; $stk[] = $this; $this->dieOnCircularReference($stk, $this->getProject()); } $o = $this->ref->getReferencedObject($this->getProject()); if (!($o instanceof $requiredClass)) { throw new BuildException($this->ref->getRefId() . " doesn't denote a " . $dataTypeName); } else { return $o; } }
php
public function getCheckedRef($requiredClass, $dataTypeName) { if (!$this->checked) { // should be in stack $stk = []; $stk[] = $this; $this->dieOnCircularReference($stk, $this->getProject()); } $o = $this->ref->getReferencedObject($this->getProject()); if (!($o instanceof $requiredClass)) { throw new BuildException($this->ref->getRefId() . " doesn't denote a " . $dataTypeName); } else { return $o; } }
[ "public", "function", "getCheckedRef", "(", "$", "requiredClass", ",", "$", "dataTypeName", ")", "{", "if", "(", "!", "$", "this", "->", "checked", ")", "{", "// should be in stack", "$", "stk", "=", "[", "]", ";", "$", "stk", "[", "]", "=", "$", "th...
Performs the check for circular references and returns the referenced object. @param $requiredClass @param $dataTypeName @throws BuildException @return mixed
[ "Performs", "the", "check", "for", "circular", "references", "and", "returns", "the", "referenced", "object", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/DataType.php#L158-L173
train
phingofficial/phing
classes/phing/types/selectors/MappingSelector.php
MappingSelector.addConfigured
public function addConfigured(FileNameMapper $fileNameMapper) { if ($this->map !== null || $this->mapperElement !== null) { throw new BuildException('Cannot define more than one mapper'); } $this->map = $fileNameMapper; }
php
public function addConfigured(FileNameMapper $fileNameMapper) { if ($this->map !== null || $this->mapperElement !== null) { throw new BuildException('Cannot define more than one mapper'); } $this->map = $fileNameMapper; }
[ "public", "function", "addConfigured", "(", "FileNameMapper", "$", "fileNameMapper", ")", "{", "if", "(", "$", "this", "->", "map", "!==", "null", "||", "$", "this", "->", "mapperElement", "!==", "null", ")", "{", "throw", "new", "BuildException", "(", "'C...
Add a configured FileNameMapper instance. @param FileNameMapper $fileNameMapper the FileNameMapper to add @throws BuildException if more than one mapper defined
[ "Add", "a", "configured", "FileNameMapper", "instance", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/selectors/MappingSelector.php#L77-L83
train
phingofficial/phing
classes/phing/tasks/ext/svn/SvnBaseTask.php
SvnBaseTask.run
protected function run($args = [], $switches = []) { $tempArgs = array_merge($this->svnArgs, $args); $tempSwitches = array_merge($this->svnSwitches, $switches); if ($this->oldVersion) { $svnstack = PEAR_ErrorStack::singleton('VersionControl_SVN'); if ($output = $this->svn->run($tempArgs, $tempSwitches)) { return $output; } if (count($errs = $svnstack->getErrors())) { $err = current($errs); $errorMessage = $err['message']; if (isset($err['params']['errstr'])) { $errorMessage = $err['params']['errstr']; } throw new BuildException("Failed to run the 'svn " . $this->mode . "' command: " . $errorMessage); } } else { try { return $this->svn->run($tempArgs, $tempSwitches); } catch (Exception $e) { throw new BuildException("Failed to run the 'svn " . $this->mode . "' command: " . $e->getMessage()); } } }
php
protected function run($args = [], $switches = []) { $tempArgs = array_merge($this->svnArgs, $args); $tempSwitches = array_merge($this->svnSwitches, $switches); if ($this->oldVersion) { $svnstack = PEAR_ErrorStack::singleton('VersionControl_SVN'); if ($output = $this->svn->run($tempArgs, $tempSwitches)) { return $output; } if (count($errs = $svnstack->getErrors())) { $err = current($errs); $errorMessage = $err['message']; if (isset($err['params']['errstr'])) { $errorMessage = $err['params']['errstr']; } throw new BuildException("Failed to run the 'svn " . $this->mode . "' command: " . $errorMessage); } } else { try { return $this->svn->run($tempArgs, $tempSwitches); } catch (Exception $e) { throw new BuildException("Failed to run the 'svn " . $this->mode . "' command: " . $e->getMessage()); } } }
[ "protected", "function", "run", "(", "$", "args", "=", "[", "]", ",", "$", "switches", "=", "[", "]", ")", "{", "$", "tempArgs", "=", "array_merge", "(", "$", "this", "->", "svnArgs", ",", "$", "args", ")", ";", "$", "tempSwitches", "=", "array_mer...
Executes the constructed VersionControl_SVN instance @param array $args @param array $switches @throws BuildException @internal param Additional $array arguments to pass to SVN. @internal param Switches $array to pass to SVN. @return string Output generated by SVN.
[ "Executes", "the", "constructed", "VersionControl_SVN", "instance" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/svn/SvnBaseTask.php#L342-L371
train
phingofficial/phing
classes/phing/system/util/Properties.php
Properties.load
public function load(PhingFile $file) { if ($file->canRead()) { $this->parse($file); $this->file = $file; } else { throw new IOException("Can not read file " . $file->getPath()); } }
php
public function load(PhingFile $file) { if ($file->canRead()) { $this->parse($file); $this->file = $file; } else { throw new IOException("Can not read file " . $file->getPath()); } }
[ "public", "function", "load", "(", "PhingFile", "$", "file", ")", "{", "if", "(", "$", "file", "->", "canRead", "(", ")", ")", "{", "$", "this", "->", "parse", "(", "$", "file", ")", ";", "$", "this", "->", "file", "=", "$", "file", ";", "}", ...
Load properties from a file. @param PhingFile $file @return void @throws IOException - if unable to read file.
[ "Load", "properties", "from", "a", "file", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/util/Properties.php#L66-L75
train
phingofficial/phing
classes/phing/system/util/Properties.php
Properties.store
public function store(PhingFile $file = null, $header = null) { if ($file == null) { $file = $this->file; } if ($file == null) { throw new IOException("Unable to write to empty filename"); } // stores the properties in this object in the file denoted // if file is not given and the properties were loaded from a // file prior, this method stores them in the file used by load() try { $fw = new FileWriter($file); if ($header !== null) { $fw->write("# " . $header . PHP_EOL); } $fw->write((string) $this); $fw->close(); } catch (IOException $e) { throw new IOException("Error writing property file: " . $e->getMessage()); } }
php
public function store(PhingFile $file = null, $header = null) { if ($file == null) { $file = $this->file; } if ($file == null) { throw new IOException("Unable to write to empty filename"); } // stores the properties in this object in the file denoted // if file is not given and the properties were loaded from a // file prior, this method stores them in the file used by load() try { $fw = new FileWriter($file); if ($header !== null) { $fw->write("# " . $header . PHP_EOL); } $fw->write((string) $this); $fw->close(); } catch (IOException $e) { throw new IOException("Error writing property file: " . $e->getMessage()); } }
[ "public", "function", "store", "(", "PhingFile", "$", "file", "=", "null", ",", "$", "header", "=", "null", ")", "{", "if", "(", "$", "file", "==", "null", ")", "{", "$", "file", "=", "$", "this", "->", "file", ";", "}", "if", "(", "$", "file",...
Stores current properties to specified file. @param PhingFile $file File to create/overwrite with properties. @param string $header Header text that will be placed (within comments) at the top of properties file. @return void @throws IOException - on error writing properties file.
[ "Stores", "current", "properties", "to", "specified", "file", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/util/Properties.php#L131-L154
train
phingofficial/phing
classes/phing/system/util/Properties.php
Properties.get
public function get($prop) { if (!isset($this->properties[$prop])) { return null; } return $this->properties[$prop]; }
php
public function get($prop) { if (!isset($this->properties[$prop])) { return null; } return $this->properties[$prop]; }
[ "public", "function", "get", "(", "$", "prop", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "properties", "[", "$", "prop", "]", ")", ")", "{", "return", "null", ";", "}", "return", "$", "this", "->", "properties", "[", "$", "prop",...
Get value for specified property. This function exists to provide a hashtable-like interface for properties. @param string $prop The property name (key). @return mixed @see getProperty()
[ "Get", "value", "for", "specified", "property", ".", "This", "function", "exists", "to", "provide", "a", "hashtable", "-", "like", "interface", "for", "properties", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/util/Properties.php#L224-L231
train
phingofficial/phing
classes/phing/system/util/Properties.php
Properties.setProperty
public function setProperty($key, $value) { $oldValue = null; if (isset($this->properties[$key])) { $oldValue = $this->properties[$key]; } $this->properties[$key] = $value; return $oldValue; }
php
public function setProperty($key, $value) { $oldValue = null; if (isset($this->properties[$key])) { $oldValue = $this->properties[$key]; } $this->properties[$key] = $value; return $oldValue; }
[ "public", "function", "setProperty", "(", "$", "key", ",", "$", "value", ")", "{", "$", "oldValue", "=", "null", ";", "if", "(", "isset", "(", "$", "this", "->", "properties", "[", "$", "key", "]", ")", ")", "{", "$", "oldValue", "=", "$", "this"...
Set the value for a property. @param string $key @param mixed $value @return mixed Old property value or null if none was set.
[ "Set", "the", "value", "for", "a", "property", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/util/Properties.php#L240-L249
train
phingofficial/phing
classes/phing/system/util/Properties.php
Properties.append
public function append($key, $value, $delimiter = ',') { $newValue = $value; if (isset($this->properties[$key]) && !empty($this->properties[$key])) { $newValue = $this->properties[$key] . $delimiter . $value; } $this->properties[$key] = $newValue; }
php
public function append($key, $value, $delimiter = ',') { $newValue = $value; if (isset($this->properties[$key]) && !empty($this->properties[$key])) { $newValue = $this->properties[$key] . $delimiter . $value; } $this->properties[$key] = $newValue; }
[ "public", "function", "append", "(", "$", "key", ",", "$", "value", ",", "$", "delimiter", "=", "','", ")", "{", "$", "newValue", "=", "$", "value", ";", "if", "(", "isset", "(", "$", "this", "->", "properties", "[", "$", "key", "]", ")", "&&", ...
Appends a value to a property if it already exists with a delimiter If the property does not, it just adds it. @param string $key @param mixed $value @param string $delimiter
[ "Appends", "a", "value", "to", "a", "property", "if", "it", "already", "exists", "with", "a", "delimiter" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/util/Properties.php#L274-L281
train
phingofficial/phing
classes/phing/types/selectors/SizeSelector.php
SizeSelector.setValue
public function setValue($size) { $this->size = $size; if (($this->multiplier !== 0) && ($this->size > -1)) { $this->sizelimit = $size * $this->multiplier; } }
php
public function setValue($size) { $this->size = $size; if (($this->multiplier !== 0) && ($this->size > -1)) { $this->sizelimit = $size * $this->multiplier; } }
[ "public", "function", "setValue", "(", "$", "size", ")", "{", "$", "this", "->", "size", "=", "$", "size", ";", "if", "(", "(", "$", "this", "->", "multiplier", "!==", "0", ")", "&&", "(", "$", "this", "->", "size", ">", "-", "1", ")", ")", "...
A size selector needs to know what size to base its selecting on. This will be further modified by the multiplier to get an actual size limit. @param int $size the size to select against expressed in units @return void
[ "A", "size", "selector", "needs", "to", "know", "what", "size", "to", "base", "its", "selecting", "on", ".", "This", "will", "be", "further", "modified", "by", "the", "multiplier", "to", "get", "an", "actual", "size", "limit", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/selectors/SizeSelector.php#L131-L137
train
phingofficial/phing
classes/phing/types/selectors/SizeSelector.php
SizeSelector.setWhen
public function setWhen($cmp) { $c = array_search($cmp, self::$sizeComparisons, true); if ($c !== false) { $this->cmp = $c; } }
php
public function setWhen($cmp) { $c = array_search($cmp, self::$sizeComparisons, true); if ($c !== false) { $this->cmp = $c; } }
[ "public", "function", "setWhen", "(", "$", "cmp", ")", "{", "$", "c", "=", "array_search", "(", "$", "cmp", ",", "self", "::", "$", "sizeComparisons", ",", "true", ")", ";", "if", "(", "$", "c", "!==", "false", ")", "{", "$", "this", "->", "cmp",...
This specifies when the file should be selected, whether it be when the file matches a particular size, when it is smaller, or whether it is larger. @param array $cmp The comparison to perform, an EnumeratedAttribute @return void
[ "This", "specifies", "when", "the", "file", "should", "be", "selected", "whether", "it", "be", "when", "the", "file", "matches", "a", "particular", "size", "when", "it", "is", "smaller", "or", "whether", "it", "is", "larger", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/selectors/SizeSelector.php#L205-L211
train
phingofficial/phing
classes/phing/util/DirectoryScanner.php
DirectoryScanner.matchPath
public function matchPath($pattern, $str, $isCaseSensitive = true) { return SelectorUtils::matchPath($pattern, $str, $isCaseSensitive); }
php
public function matchPath($pattern, $str, $isCaseSensitive = true) { return SelectorUtils::matchPath($pattern, $str, $isCaseSensitive); }
[ "public", "function", "matchPath", "(", "$", "pattern", ",", "$", "str", ",", "$", "isCaseSensitive", "=", "true", ")", "{", "return", "SelectorUtils", "::", "matchPath", "(", "$", "pattern", ",", "$", "str", ",", "$", "isCaseSensitive", ")", ";", "}" ]
Matches a path against a pattern. @param string $pattern the (non-null) pattern to match against @param string $str the (non-null) string (path) to match @param bool $isCaseSensitive must a case sensitive match be done? @return bool true when the pattern matches against the string. false otherwise.
[ "Matches", "a", "path", "against", "a", "pattern", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/DirectoryScanner.php#L274-L277
train
phingofficial/phing
classes/phing/util/DirectoryScanner.php
DirectoryScanner.addDefaultExclude
public static function addDefaultExclude($s) { if (!in_array($s, self::$defaultExcludeList)) { $return = true; self::$defaultExcludeList[] = $s; } else { $return = false; } return $return; }
php
public static function addDefaultExclude($s) { if (!in_array($s, self::$defaultExcludeList)) { $return = true; self::$defaultExcludeList[] = $s; } else { $return = false; } return $return; }
[ "public", "static", "function", "addDefaultExclude", "(", "$", "s", ")", "{", "if", "(", "!", "in_array", "(", "$", "s", ",", "self", "::", "$", "defaultExcludeList", ")", ")", "{", "$", "return", "=", "true", ";", "self", "::", "$", "defaultExcludeLis...
Add a pattern to the default excludes unless it is already a default exclude. @param string $s A string to add as an exclude pattern. @return boolean <code>true</code> if the string was added; <code>false</code> if it already existed.
[ "Add", "a", "pattern", "to", "the", "default", "excludes", "unless", "it", "is", "already", "a", "default", "exclude", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/DirectoryScanner.php#L318-L328
train
phingofficial/phing
classes/phing/util/DirectoryScanner.php
DirectoryScanner.removeDefaultExclude
public static function removeDefaultExclude($s) { $key = array_search($s, self::$defaultExcludeList); if ($key !== false) { unset(self::$defaultExcludeList[$key]); self::$defaultExcludeList = array_values(self::$defaultExcludeList); return true; } return false; }
php
public static function removeDefaultExclude($s) { $key = array_search($s, self::$defaultExcludeList); if ($key !== false) { unset(self::$defaultExcludeList[$key]); self::$defaultExcludeList = array_values(self::$defaultExcludeList); return true; } return false; }
[ "public", "static", "function", "removeDefaultExclude", "(", "$", "s", ")", "{", "$", "key", "=", "array_search", "(", "$", "s", ",", "self", "::", "$", "defaultExcludeList", ")", ";", "if", "(", "$", "key", "!==", "false", ")", "{", "unset", "(", "s...
Remove a string if it is a default exclude. @param string $s The string to attempt to remove. @return boolean <code>true</code> if <code>s</code> was a default exclude (and thus was removed); <code>false</code> if <code>s</code> was not in the default excludes list to begin with.
[ "Remove", "a", "string", "if", "it", "is", "a", "default", "exclude", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/DirectoryScanner.php#L339-L350
train
phingofficial/phing
classes/phing/util/DirectoryScanner.php
DirectoryScanner.scan
public function scan() { if (empty($this->basedir)) { return false; } else { $exception = null; if (!@file_exists($this->basedir)) { if ($this->errorOnMissingDir) { $exception = new BuildException( "basedir $this->basedir does not exist." ); } else { return false; } } elseif (!@is_dir($this->basedir)) { $exception = new BuildException( "basedir $this->basedir is not a directory." ); } if ($exception !== null) { throw $exception; } } if ($this->includes === null) { // No includes supplied, so set it to 'matches all' $this->includes = ["**"]; } if (null === $this->excludes) { $this->excludes = []; } $this->filesIncluded = []; $this->filesNotIncluded = []; $this->filesExcluded = []; $this->dirsIncluded = []; $this->dirsNotIncluded = []; $this->dirsExcluded = []; $this->dirsDeselected = []; $this->filesDeselected = []; if ($this->isIncluded("")) { if (!$this->isExcluded("")) { if ($this->isSelected("", $this->basedir)) { $this->dirsIncluded[] = ""; } else { $this->dirsDeselected[] = ""; } } else { $this->dirsExcluded[] = ""; } } else { $this->dirsNotIncluded[] = ""; } $this->scandir($this->basedir, "", true); return true; }
php
public function scan() { if (empty($this->basedir)) { return false; } else { $exception = null; if (!@file_exists($this->basedir)) { if ($this->errorOnMissingDir) { $exception = new BuildException( "basedir $this->basedir does not exist." ); } else { return false; } } elseif (!@is_dir($this->basedir)) { $exception = new BuildException( "basedir $this->basedir is not a directory." ); } if ($exception !== null) { throw $exception; } } if ($this->includes === null) { // No includes supplied, so set it to 'matches all' $this->includes = ["**"]; } if (null === $this->excludes) { $this->excludes = []; } $this->filesIncluded = []; $this->filesNotIncluded = []; $this->filesExcluded = []; $this->dirsIncluded = []; $this->dirsNotIncluded = []; $this->dirsExcluded = []; $this->dirsDeselected = []; $this->filesDeselected = []; if ($this->isIncluded("")) { if (!$this->isExcluded("")) { if ($this->isSelected("", $this->basedir)) { $this->dirsIncluded[] = ""; } else { $this->dirsDeselected[] = ""; } } else { $this->dirsExcluded[] = ""; } } else { $this->dirsNotIncluded[] = ""; } $this->scandir($this->basedir, "", true); return true; }
[ "public", "function", "scan", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "basedir", ")", ")", "{", "return", "false", ";", "}", "else", "{", "$", "exception", "=", "null", ";", "if", "(", "!", "@", "file_exists", "(", "$", "this",...
Scans the base directory for files that match at least one include pattern, and don't match any exclude patterns.
[ "Scans", "the", "base", "directory", "for", "files", "that", "match", "at", "least", "one", "include", "pattern", "and", "don", "t", "match", "any", "exclude", "patterns", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/DirectoryScanner.php#L467-L526
train
phingofficial/phing
classes/phing/util/DirectoryScanner.php
DirectoryScanner.slowScan
protected function slowScan() { if ($this->haveSlowResults) { return; } // copy trie object add CopyInto() method $excl = $this->dirsExcluded; $notIncl = $this->dirsNotIncluded; for ($i = 0, $_i = count($excl); $i < $_i; $i++) { if (!$this->couldHoldIncluded($excl[$i])) { $this->scandir($this->basedir . $excl[$i], $excl[$i] . DIRECTORY_SEPARATOR, false); } } for ($i = 0, $_i = count($notIncl); $i < $_i; $i++) { if (!$this->couldHoldIncluded($notIncl[$i])) { $this->scandir($this->basedir . $notIncl[$i], $notIncl[$i] . DIRECTORY_SEPARATOR, false); } } $this->haveSlowResults = true; }
php
protected function slowScan() { if ($this->haveSlowResults) { return; } // copy trie object add CopyInto() method $excl = $this->dirsExcluded; $notIncl = $this->dirsNotIncluded; for ($i = 0, $_i = count($excl); $i < $_i; $i++) { if (!$this->couldHoldIncluded($excl[$i])) { $this->scandir($this->basedir . $excl[$i], $excl[$i] . DIRECTORY_SEPARATOR, false); } } for ($i = 0, $_i = count($notIncl); $i < $_i; $i++) { if (!$this->couldHoldIncluded($notIncl[$i])) { $this->scandir($this->basedir . $notIncl[$i], $notIncl[$i] . DIRECTORY_SEPARATOR, false); } } $this->haveSlowResults = true; }
[ "protected", "function", "slowScan", "(", ")", "{", "if", "(", "$", "this", "->", "haveSlowResults", ")", "{", "return", ";", "}", "// copy trie object add CopyInto() method", "$", "excl", "=", "$", "this", "->", "dirsExcluded", ";", "$", "notIncl", "=", "$"...
Toplevel invocation for the scan. Returns immediately if a slow scan has already been requested.
[ "Toplevel", "invocation", "for", "the", "scan", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/DirectoryScanner.php#L533-L556
train
phingofficial/phing
classes/phing/util/DirectoryScanner.php
DirectoryScanner.isIncluded
protected function isIncluded($_name) { for ($i = 0, $_i = count($this->includes); $i < $_i; $i++) { if ($this->matchPath($this->includes[$i], $_name, $this->isCaseSensitive)) { return true; } } return false; }
php
protected function isIncluded($_name) { for ($i = 0, $_i = count($this->includes); $i < $_i; $i++) { if ($this->matchPath($this->includes[$i], $_name, $this->isCaseSensitive)) { return true; } } return false; }
[ "protected", "function", "isIncluded", "(", "$", "_name", ")", "{", "for", "(", "$", "i", "=", "0", ",", "$", "_i", "=", "count", "(", "$", "this", "->", "includes", ")", ";", "$", "i", "<", "$", "_i", ";", "$", "i", "++", ")", "{", "if", "...
Tests whether a name matches against at least one include pattern. @param string $_name the name to match @return bool <code>true</code> when the name matches against at least one
[ "Tests", "whether", "a", "name", "matches", "against", "at", "least", "one", "include", "pattern", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/DirectoryScanner.php#L680-L689
train
phingofficial/phing
classes/phing/util/DirectoryScanner.php
DirectoryScanner.couldHoldIncluded
protected function couldHoldIncluded($_name) { for ($i = 0, $includesCount = count($this->includes); $i < $includesCount; $i++) { if ($this->matchPatternStart($this->includes[$i], $_name, $this->isCaseSensitive)) { return true; } } return false; }
php
protected function couldHoldIncluded($_name) { for ($i = 0, $includesCount = count($this->includes); $i < $includesCount; $i++) { if ($this->matchPatternStart($this->includes[$i], $_name, $this->isCaseSensitive)) { return true; } } return false; }
[ "protected", "function", "couldHoldIncluded", "(", "$", "_name", ")", "{", "for", "(", "$", "i", "=", "0", ",", "$", "includesCount", "=", "count", "(", "$", "this", "->", "includes", ")", ";", "$", "i", "<", "$", "includesCount", ";", "$", "i", "+...
Tests whether a name matches the start of at least one include pattern. @param string $_name the name to match @return bool <code>true</code> when the name matches against at least one include pattern, <code>false</code> otherwise.
[ "Tests", "whether", "a", "name", "matches", "the", "start", "of", "at", "least", "one", "include", "pattern", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/DirectoryScanner.php#L698-L707
train
phingofficial/phing
classes/phing/util/DirectoryScanner.php
DirectoryScanner.isExcluded
protected function isExcluded($_name) { for ($i = 0, $excludesCount = count($this->excludes); $i < $excludesCount; $i++) { if ($this->matchPath($this->excludes[$i], $_name, $this->isCaseSensitive)) { return true; } } return false; }
php
protected function isExcluded($_name) { for ($i = 0, $excludesCount = count($this->excludes); $i < $excludesCount; $i++) { if ($this->matchPath($this->excludes[$i], $_name, $this->isCaseSensitive)) { return true; } } return false; }
[ "protected", "function", "isExcluded", "(", "$", "_name", ")", "{", "for", "(", "$", "i", "=", "0", ",", "$", "excludesCount", "=", "count", "(", "$", "this", "->", "excludes", ")", ";", "$", "i", "<", "$", "excludesCount", ";", "$", "i", "++", "...
Tests whether a name matches against at least one exclude pattern. @param string $_name the name to match @return bool <code>true</code> when the name matches against at least one exclude pattern, <code>false</code> otherwise.
[ "Tests", "whether", "a", "name", "matches", "against", "at", "least", "one", "exclude", "pattern", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/DirectoryScanner.php#L716-L725
train
phingofficial/phing
classes/phing/util/DirectoryScanner.php
DirectoryScanner.getIncludedFiles
public function getIncludedFiles(): array { if ($this->filesIncluded === null) { throw new UnexpectedValueException('Must call scan() first'); } sort($this->filesIncluded); return $this->filesIncluded; }
php
public function getIncludedFiles(): array { if ($this->filesIncluded === null) { throw new UnexpectedValueException('Must call scan() first'); } sort($this->filesIncluded); return $this->filesIncluded; }
[ "public", "function", "getIncludedFiles", "(", ")", ":", "array", "{", "if", "(", "$", "this", "->", "filesIncluded", "===", "null", ")", "{", "throw", "new", "UnexpectedValueException", "(", "'Must call scan() first'", ")", ";", "}", "sort", "(", "$", "this...
Get the names of the files that matched at least one of the include patterns, and matched none of the exclude patterns. The names are relative to the basedir. @return array names of the files @throws \UnexpectedValueException
[ "Get", "the", "names", "of", "the", "files", "that", "matched", "at", "least", "one", "of", "the", "include", "patterns", "and", "matched", "none", "of", "the", "exclude", "patterns", ".", "The", "names", "are", "relative", "to", "the", "basedir", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/DirectoryScanner.php#L750-L759
train
phingofficial/phing
classes/phing/util/DirectoryScanner.php
DirectoryScanner.getIncludedDirectories
public function getIncludedDirectories() { if ($this->dirsIncluded === null) { throw new UnexpectedValueException('Must call scan() first'); } sort($this->dirsIncluded); return $this->dirsIncluded; }
php
public function getIncludedDirectories() { if ($this->dirsIncluded === null) { throw new UnexpectedValueException('Must call scan() first'); } sort($this->dirsIncluded); return $this->dirsIncluded; }
[ "public", "function", "getIncludedDirectories", "(", ")", "{", "if", "(", "$", "this", "->", "dirsIncluded", "===", "null", ")", "{", "throw", "new", "UnexpectedValueException", "(", "'Must call scan() first'", ")", ";", "}", "sort", "(", "$", "this", "->", ...
Get the names of the directories that matched at least one of the include patterns, an matched none of the exclude patterns. The names are relative to the basedir. @return array the names of the directories @throws \UnexpectedValueException
[ "Get", "the", "names", "of", "the", "directories", "that", "matched", "at", "least", "one", "of", "the", "include", "patterns", "an", "matched", "none", "of", "the", "exclude", "patterns", ".", "The", "names", "are", "relative", "to", "the", "basedir", "."...
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/DirectoryScanner.php#L816-L825
train
phingofficial/phing
classes/phing/util/DirectoryScanner.php
DirectoryScanner.addDefaultExcludes
public function addDefaultExcludes() { $defaultExcludesTemp = self::getDefaultExcludes(); $newExcludes = []; foreach ($defaultExcludesTemp as $temp) { $newExcludes[] = str_replace(['\\', '/'], PhingFile::$separator, $temp); } $this->excludes = array_merge((array) $this->excludes, $newExcludes); }
php
public function addDefaultExcludes() { $defaultExcludesTemp = self::getDefaultExcludes(); $newExcludes = []; foreach ($defaultExcludesTemp as $temp) { $newExcludes[] = str_replace(['\\', '/'], PhingFile::$separator, $temp); } $this->excludes = array_merge((array) $this->excludes, $newExcludes); }
[ "public", "function", "addDefaultExcludes", "(", ")", "{", "$", "defaultExcludesTemp", "=", "self", "::", "getDefaultExcludes", "(", ")", ";", "$", "newExcludes", "=", "[", "]", ";", "foreach", "(", "$", "defaultExcludesTemp", "as", "$", "temp", ")", "{", ...
Adds the array with default exclusions to the current exclusions set.
[ "Adds", "the", "array", "with", "default", "exclusions", "to", "the", "current", "exclusions", "set", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/DirectoryScanner.php#L891-L899
train
phingofficial/phing
classes/phing/util/DirectoryScanner.php
DirectoryScanner.isSelected
protected function isSelected($name, $file) { if ($this->selectorsList !== null) { $basedir = new PhingFile($this->basedir); $file = new PhingFile($file); if (!$file->canRead()) { return false; } foreach ($this->selectorsList as $selector) { if (!$selector->isSelected($basedir, $name, $file)) { return false; } } } return true; }
php
protected function isSelected($name, $file) { if ($this->selectorsList !== null) { $basedir = new PhingFile($this->basedir); $file = new PhingFile($file); if (!$file->canRead()) { return false; } foreach ($this->selectorsList as $selector) { if (!$selector->isSelected($basedir, $name, $file)) { return false; } } } return true; }
[ "protected", "function", "isSelected", "(", "$", "name", ",", "$", "file", ")", "{", "if", "(", "$", "this", "->", "selectorsList", "!==", "null", ")", "{", "$", "basedir", "=", "new", "PhingFile", "(", "$", "this", "->", "basedir", ")", ";", "$", ...
Tests whether a name should be selected. @param string $name The filename to check for selecting. @param string $file The full file path. @return boolean False when the selectors says that the file should not be selected, True otherwise. @throws \BuildException @throws \IOException @throws NullPointerException
[ "Tests", "whether", "a", "name", "should", "be", "selected", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/DirectoryScanner.php#L933-L950
train
phingofficial/phing
classes/phing/Task.php
Task.log
public function log($msg, $level = Project::MSG_INFO, Exception $t = null) { if ($this->getProject() !== null) { $this->getProject()->logObject($this, $msg, $level, $t); } else { parent::log($msg, $level); } }
php
public function log($msg, $level = Project::MSG_INFO, Exception $t = null) { if ($this->getProject() !== null) { $this->getProject()->logObject($this, $msg, $level, $t); } else { parent::log($msg, $level); } }
[ "public", "function", "log", "(", "$", "msg", ",", "$", "level", "=", "Project", "::", "MSG_INFO", ",", "Exception", "$", "t", "=", "null", ")", "{", "if", "(", "$", "this", "->", "getProject", "(", ")", "!==", "null", ")", "{", "$", "this", "->"...
Provides a project level log event to the task. @param string $msg The message to log @param int $level The priority of the message @param Exception|null $t @see BuildEvent @see BuildListener
[ "Provides", "a", "project", "level", "log", "event", "to", "the", "task", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Task.php#L151-L158
train
phingofficial/phing
classes/phing/Task.php
Task.getRuntimeConfigurableWrapper
public function getRuntimeConfigurableWrapper() { if ($this->wrapper === null) { $this->wrapper = new RuntimeConfigurable($this, $this->getTaskName()); } return $this->wrapper; }
php
public function getRuntimeConfigurableWrapper() { if ($this->wrapper === null) { $this->wrapper = new RuntimeConfigurable($this, $this->getTaskName()); } return $this->wrapper; }
[ "public", "function", "getRuntimeConfigurableWrapper", "(", ")", "{", "if", "(", "$", "this", "->", "wrapper", "===", "null", ")", "{", "$", "this", "->", "wrapper", "=", "new", "RuntimeConfigurable", "(", "$", "this", ",", "$", "this", "->", "getTaskName"...
Returns the wrapper object for runtime configuration @return RuntimeConfigurable The wrapper object used by this task
[ "Returns", "the", "wrapper", "object", "for", "runtime", "configuration" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Task.php#L189-L196
train
phingofficial/phing
classes/phing/Task.php
Task.perform
public function perform(): void { $reason = null; try { // try executing task $this->project->fireTaskStarted($this); $this->maybeConfigure(); DispatchUtils::main($this); } catch (\BuildException $ex) { $loc = $ex->getLocation(); if ($loc === null || (string) $loc === '') { $ex->setLocation($this->getLocation()); } $reason = $ex; throw $ex; } catch (\Exception $ex) { $reason = $ex; $be = new \BuildException($ex); $be->setLocation($this->getLocation()); throw $be; } catch (\Error $ex) { $reason = $ex; throw $ex; } finally { $this->project->fireTaskFinished($this, $reason); } }
php
public function perform(): void { $reason = null; try { // try executing task $this->project->fireTaskStarted($this); $this->maybeConfigure(); DispatchUtils::main($this); } catch (\BuildException $ex) { $loc = $ex->getLocation(); if ($loc === null || (string) $loc === '') { $ex->setLocation($this->getLocation()); } $reason = $ex; throw $ex; } catch (\Exception $ex) { $reason = $ex; $be = new \BuildException($ex); $be->setLocation($this->getLocation()); throw $be; } catch (\Error $ex) { $reason = $ex; throw $ex; } finally { $this->project->fireTaskFinished($this, $reason); } }
[ "public", "function", "perform", "(", ")", ":", "void", "{", "$", "reason", "=", "null", ";", "try", "{", "// try executing task", "$", "this", "->", "project", "->", "fireTaskStarted", "(", "$", "this", ")", ";", "$", "this", "->", "maybeConfigure", "("...
Perfrom this task @return void @throws BuildException @throws Error
[ "Perfrom", "this", "task" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Task.php#L227-L252
train
phingofficial/phing
classes/phing/filters/BaseFilterReader.php
BaseFilterReader.log
public function log($msg, $level = Project::MSG_INFO) { if ($this->project !== null) { $this->project->log("[filter:" . get_class($this) . "] " . $msg, $level); } }
php
public function log($msg, $level = Project::MSG_INFO) { if ($this->project !== null) { $this->project->log("[filter:" . get_class($this) . "] " . $msg, $level); } }
[ "public", "function", "log", "(", "$", "msg", ",", "$", "level", "=", "Project", "::", "MSG_INFO", ")", "{", "if", "(", "$", "this", "->", "project", "!==", "null", ")", "{", "$", "this", "->", "project", "->", "log", "(", "\"[filter:\"", ".", "get...
Convenience method to support logging in filters. @param string $msg Message to log. @param int $level Priority level. @return void
[ "Convenience", "method", "to", "support", "logging", "in", "filters", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/BaseFilterReader.php#L160-L165
train
phingofficial/phing
classes/phing/filters/BaseParamFilterReader.php
BaseParamFilterReader.setParameters
public function setParameters($parameters) { // type check, error must never occur, bad code of it does if (!is_array($parameters)) { throw new Exception("Expected parameters array got something else"); } $this->_parameters = $parameters; $this->setInitialized(false); }
php
public function setParameters($parameters) { // type check, error must never occur, bad code of it does if (!is_array($parameters)) { throw new Exception("Expected parameters array got something else"); } $this->_parameters = $parameters; $this->setInitialized(false); }
[ "public", "function", "setParameters", "(", "$", "parameters", ")", "{", "// type check, error must never occur, bad code of it does", "if", "(", "!", "is_array", "(", "$", "parameters", ")", ")", "{", "throw", "new", "Exception", "(", "\"Expected parameters array got s...
Sets the parameters used by this filter, and sets the filter to an uninitialized status. @param array $parameters Array of parameters to be used by this filter. Should not be <code>null</code>. @return void @throws Exception
[ "Sets", "the", "parameters", "used", "by", "this", "filter", "and", "sets", "the", "filter", "to", "an", "uninitialized", "status", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/BaseParamFilterReader.php#L49-L58
train
phingofficial/phing
classes/phing/util/regexp/Regexp.php
Regexp.replace
public function replace($subject) { if ($this->pattern === null || $this->replace === null) { throw new RegexpException("Missing pattern or replacement string regexp replace()."); } return $this->engine->replace($this->pattern, $this->replace, $subject); }
php
public function replace($subject) { if ($this->pattern === null || $this->replace === null) { throw new RegexpException("Missing pattern or replacement string regexp replace()."); } return $this->engine->replace($this->pattern, $this->replace, $subject); }
[ "public", "function", "replace", "(", "$", "subject", ")", "{", "if", "(", "$", "this", "->", "pattern", "===", "null", "||", "$", "this", "->", "replace", "===", "null", ")", "{", "throw", "new", "RegexpException", "(", "\"Missing pattern or replacement str...
Performs replacement of specified pattern and replacement strings. @param string $subject Text on which to perform replacement. @throws RegexpException @return string subject after replacement has been performed.
[ "Performs", "replacement", "of", "specified", "pattern", "and", "replacement", "strings", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/regexp/Regexp.php#L137-L144
train
phingofficial/phing
classes/phing/util/regexp/Regexp.php
Regexp.getGroup
public function getGroup($idx) { if (!isset($this->groups[$idx])) { return null; } return $this->groups[$idx]; }
php
public function getGroup($idx) { if (!isset($this->groups[$idx])) { return null; } return $this->groups[$idx]; }
[ "public", "function", "getGroup", "(", "$", "idx", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "groups", "[", "$", "idx", "]", ")", ")", "{", "return", "null", ";", "}", "return", "$", "this", "->", "groups", "[", "$", "idx", "]"...
Get specific matched group. @param integer $idx @return string specified group or NULL if group is not set.
[ "Get", "specific", "matched", "group", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/util/regexp/Regexp.php#L162-L169
train
phingofficial/phing
classes/phing/listener/ProfileLogger.php
ProfileLogger.targetStarted
public function targetStarted(BuildEvent $event) { if (@date_default_timezone_get() === 'UTC') { date_default_timezone_set('Europe/Berlin'); } $now = Phing::currentTimeMillis(); $name = "Target " . $event->getTarget()->getName(); $this->logStart($event, $now, $name); $this->profileData[] = $now; }
php
public function targetStarted(BuildEvent $event) { if (@date_default_timezone_get() === 'UTC') { date_default_timezone_set('Europe/Berlin'); } $now = Phing::currentTimeMillis(); $name = "Target " . $event->getTarget()->getName(); $this->logStart($event, $now, $name); $this->profileData[] = $now; }
[ "public", "function", "targetStarted", "(", "BuildEvent", "$", "event", ")", "{", "if", "(", "@", "date_default_timezone_get", "(", ")", "===", "'UTC'", ")", "{", "date_default_timezone_set", "(", "'Europe/Berlin'", ")", ";", "}", "$", "now", "=", "Phing", "...
Logs a message to say that the target has started. @param BuildEvent $event An event with any relevant extra information. Must not be <code>null</code>.
[ "Logs", "a", "message", "to", "say", "that", "the", "target", "has", "started", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/ProfileLogger.php#L39-L48
train
phingofficial/phing
classes/phing/listener/ProfileLogger.php
ProfileLogger.targetFinished
public function targetFinished(BuildEvent $event) { $start = array_pop($this->profileData); $name = "Target " . $event->getTarget()->getName(); $this->logFinish($event, $start, $name); }
php
public function targetFinished(BuildEvent $event) { $start = array_pop($this->profileData); $name = "Target " . $event->getTarget()->getName(); $this->logFinish($event, $start, $name); }
[ "public", "function", "targetFinished", "(", "BuildEvent", "$", "event", ")", "{", "$", "start", "=", "array_pop", "(", "$", "this", "->", "profileData", ")", ";", "$", "name", "=", "\"Target \"", ".", "$", "event", "->", "getTarget", "(", ")", "->", "...
Logs a message to say that the target has finished. @param BuildEvent $event An event with any relevant extra information. Must not be <code>null</code>.
[ "Logs", "a", "message", "to", "say", "that", "the", "target", "has", "finished", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/ProfileLogger.php#L57-L63
train
phingofficial/phing
classes/phing/listener/ProfileLogger.php
ProfileLogger.taskStarted
public function taskStarted(BuildEvent $event) { $name = $event->getTask()->getTaskName(); $now = Phing::currentTimeMillis(); $this->logStart($event, $now, $name); $this->profileData[] = $now; }
php
public function taskStarted(BuildEvent $event) { $name = $event->getTask()->getTaskName(); $now = Phing::currentTimeMillis(); $this->logStart($event, $now, $name); $this->profileData[] = $now; }
[ "public", "function", "taskStarted", "(", "BuildEvent", "$", "event", ")", "{", "$", "name", "=", "$", "event", "->", "getTask", "(", ")", "->", "getTaskName", "(", ")", ";", "$", "now", "=", "Phing", "::", "currentTimeMillis", "(", ")", ";", "$", "t...
Logs a message to say that the task has started. @param BuildEvent $event An event with any relevant extra information. Must not be <code>null</code>.
[ "Logs", "a", "message", "to", "say", "that", "the", "task", "has", "started", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/ProfileLogger.php#L72-L78
train
phingofficial/phing
classes/phing/listener/ProfileLogger.php
ProfileLogger.taskFinished
public function taskFinished(BuildEvent $event) { $start = array_pop($this->profileData); $name = $event->getTask()->getTaskName(); $this->logFinish($event, $start, $name); }
php
public function taskFinished(BuildEvent $event) { $start = array_pop($this->profileData); $name = $event->getTask()->getTaskName(); $this->logFinish($event, $start, $name); }
[ "public", "function", "taskFinished", "(", "BuildEvent", "$", "event", ")", "{", "$", "start", "=", "array_pop", "(", "$", "this", "->", "profileData", ")", ";", "$", "name", "=", "$", "event", "->", "getTask", "(", ")", "->", "getTaskName", "(", ")", ...
Logs a message to say that the task has finished. @param BuildEvent $event An event with any relevant extra information. Must not be <code>null</code>.
[ "Logs", "a", "message", "to", "say", "that", "the", "task", "has", "finished", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/ProfileLogger.php#L87-L93
train
phingofficial/phing
classes/phing/tasks/ext/UntarTask.php
UntarTask.initTar
private function initTar(PhingFile $tarfile) { $compression = null; $tarfileName = $tarfile->getName(); $mode = strtolower(substr($tarfileName, strrpos($tarfileName, '.'))); $compressions = [ 'gz' => ['.gz', '.tgz',], 'bz2' => ['.bz2',], ]; foreach ($compressions as $algo => $ext) { if (in_array($mode, $ext)) { $compression = $algo; break; } } return new Archive_Tar($tarfile->getAbsolutePath(), $compression); }
php
private function initTar(PhingFile $tarfile) { $compression = null; $tarfileName = $tarfile->getName(); $mode = strtolower(substr($tarfileName, strrpos($tarfileName, '.'))); $compressions = [ 'gz' => ['.gz', '.tgz',], 'bz2' => ['.bz2',], ]; foreach ($compressions as $algo => $ext) { if (in_array($mode, $ext)) { $compression = $algo; break; } } return new Archive_Tar($tarfile->getAbsolutePath(), $compression); }
[ "private", "function", "initTar", "(", "PhingFile", "$", "tarfile", ")", "{", "$", "compression", "=", "null", ";", "$", "tarfileName", "=", "$", "tarfile", "->", "getName", "(", ")", ";", "$", "mode", "=", "strtolower", "(", "substr", "(", "$", "tarfi...
Init a Archive_Tar class with correct compression for the given file. @param PhingFile $tarfile @return Archive_Tar the tar class instance
[ "Init", "a", "Archive_Tar", "class", "with", "correct", "compression", "for", "the", "given", "file", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/UntarTask.php#L94-L112
train
phingofficial/phing
classes/phing/types/PatternSet.php
PatternSet.setExcludesFile
public function setExcludesFile($excludesFile) { if ($this->isReference()) { throw $this->tooManyAttributes(); } if ($excludesFile instanceof PhingFile) { $excludesFile = $excludesFile->getPath(); } $o = $this->createExcludesFile(); $o->setName($excludesFile); }
php
public function setExcludesFile($excludesFile) { if ($this->isReference()) { throw $this->tooManyAttributes(); } if ($excludesFile instanceof PhingFile) { $excludesFile = $excludesFile->getPath(); } $o = $this->createExcludesFile(); $o->setName($excludesFile); }
[ "public", "function", "setExcludesFile", "(", "$", "excludesFile", ")", "{", "if", "(", "$", "this", "->", "isReference", "(", ")", ")", "{", "throw", "$", "this", "->", "tooManyAttributes", "(", ")", ";", "}", "if", "(", "$", "excludesFile", "instanceof...
Sets the name of the file containing the excludes patterns. @param PhingFile $excludesFile file to fetch the exclude patterns from. @throws BuildException
[ "Sets", "the", "name", "of", "the", "file", "containing", "the", "excludes", "patterns", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/PatternSet.php#L195-L205
train
phingofficial/phing
classes/phing/types/PatternSet.php
PatternSet.readPatterns
private function readPatterns(PhingFile $patternfile, &$patternlist, Project $p) { $patternReader = null; try { // Get a FileReader $patternReader = new BufferedReader(new FileReader($patternfile)); // Create one NameEntry in the appropriate pattern list for each // line in the file. $line = $patternReader->readLine(); while ($line !== null) { if (!empty($line)) { $line = $p->replaceProperties($line); $this->addPatternToList($patternlist)->setName($line); } $line = $patternReader->readLine(); } } catch (IOException $ioe) { $msg = "An error occurred while reading from pattern file: " . $patternfile->__toString(); if ($patternReader) { $patternReader->close(); } throw new BuildException($msg, $ioe); } $patternReader->close(); }
php
private function readPatterns(PhingFile $patternfile, &$patternlist, Project $p) { $patternReader = null; try { // Get a FileReader $patternReader = new BufferedReader(new FileReader($patternfile)); // Create one NameEntry in the appropriate pattern list for each // line in the file. $line = $patternReader->readLine(); while ($line !== null) { if (!empty($line)) { $line = $p->replaceProperties($line); $this->addPatternToList($patternlist)->setName($line); } $line = $patternReader->readLine(); } } catch (IOException $ioe) { $msg = "An error occurred while reading from pattern file: " . $patternfile->__toString(); if ($patternReader) { $patternReader->close(); } throw new BuildException($msg, $ioe); } $patternReader->close(); }
[ "private", "function", "readPatterns", "(", "PhingFile", "$", "patternfile", ",", "&", "$", "patternlist", ",", "Project", "$", "p", ")", "{", "$", "patternReader", "=", "null", ";", "try", "{", "// Get a FileReader", "$", "patternReader", "=", "new", "Buffe...
Reads path matching patterns from a file and adds them to the includes or excludes list @param PhingFile $patternfile @param $patternlist @param Project $p @throws BuildException
[ "Reads", "path", "matching", "patterns", "from", "a", "file", "and", "adds", "them", "to", "the", "includes", "or", "excludes", "list" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/PatternSet.php#L217-L243
train
phingofficial/phing
classes/phing/types/PatternSet.php
PatternSet.append
public function append($other, $p) { if ($this->isReference()) { throw new BuildException("Cannot append to a reference"); } $incl = $other->getIncludePatterns($p); if ($incl !== null) { foreach ($incl as $incl_name) { $o = $this->createInclude(); $o->setName($incl_name); } } $excl = $other->getExcludePatterns($p); if ($excl !== null) { foreach ($excl as $excl_name) { $o = $this->createExclude(); $o->setName($excl_name); } } }
php
public function append($other, $p) { if ($this->isReference()) { throw new BuildException("Cannot append to a reference"); } $incl = $other->getIncludePatterns($p); if ($incl !== null) { foreach ($incl as $incl_name) { $o = $this->createInclude(); $o->setName($incl_name); } } $excl = $other->getExcludePatterns($p); if ($excl !== null) { foreach ($excl as $excl_name) { $o = $this->createExclude(); $o->setName($excl_name); } } }
[ "public", "function", "append", "(", "$", "other", ",", "$", "p", ")", "{", "if", "(", "$", "this", "->", "isReference", "(", ")", ")", "{", "throw", "new", "BuildException", "(", "\"Cannot append to a reference\"", ")", ";", "}", "$", "incl", "=", "$"...
Adds the patterns of the other instance to this set. @param $other @param Project $p @throws BuildException
[ "Adds", "the", "patterns", "of", "the", "other", "instance", "to", "this", "set", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/PatternSet.php#L253-L274
train
phingofficial/phing
classes/phing/types/PatternSet.php
PatternSet.getIncludePatterns
public function getIncludePatterns(Project $p) { if ($this->isReference()) { $o = $this->getRef($p); return $o->getIncludePatterns($p); } else { $this->readFiles($p); return $this->makeArray($this->includeList, $p); } }
php
public function getIncludePatterns(Project $p) { if ($this->isReference()) { $o = $this->getRef($p); return $o->getIncludePatterns($p); } else { $this->readFiles($p); return $this->makeArray($this->includeList, $p); } }
[ "public", "function", "getIncludePatterns", "(", "Project", "$", "p", ")", "{", "if", "(", "$", "this", "->", "isReference", "(", ")", ")", "{", "$", "o", "=", "$", "this", "->", "getRef", "(", "$", "p", ")", ";", "return", "$", "o", "->", "getIn...
Returns the filtered include patterns. @param Project $p @throws BuildException @return array
[ "Returns", "the", "filtered", "include", "patterns", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/PatternSet.php#L285-L296
train
phingofficial/phing
classes/phing/types/PatternSet.php
PatternSet.getExcludePatterns
public function getExcludePatterns(Project $p) { if ($this->isReference()) { $o = $this->getRef($p); return $o->getExcludePatterns($p); } else { $this->readFiles($p); return $this->makeArray($this->excludeList, $p); } }
php
public function getExcludePatterns(Project $p) { if ($this->isReference()) { $o = $this->getRef($p); return $o->getExcludePatterns($p); } else { $this->readFiles($p); return $this->makeArray($this->excludeList, $p); } }
[ "public", "function", "getExcludePatterns", "(", "Project", "$", "p", ")", "{", "if", "(", "$", "this", "->", "isReference", "(", ")", ")", "{", "$", "o", "=", "$", "this", "->", "getRef", "(", "$", "p", ")", ";", "return", "$", "o", "->", "getEx...
Returns the filtered exclude patterns. @param Project $p @throws BuildException @return array
[ "Returns", "the", "filtered", "exclude", "patterns", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/PatternSet.php#L307-L318
train
phingofficial/phing
classes/phing/types/PatternSet.php
PatternSet.hasPatterns
public function hasPatterns() { return (boolean) count($this->includesFileList) > 0 || count($this->excludesFileList) > 0 || count($this->includeList) > 0 || count($this->excludeList) > 0; }
php
public function hasPatterns() { return (boolean) count($this->includesFileList) > 0 || count($this->excludesFileList) > 0 || count($this->includeList) > 0 || count($this->excludeList) > 0; }
[ "public", "function", "hasPatterns", "(", ")", "{", "return", "(", "boolean", ")", "count", "(", "$", "this", "->", "includesFileList", ")", ">", "0", "||", "count", "(", "$", "this", "->", "excludesFileList", ")", ">", "0", "||", "count", "(", "$", ...
helper for FileSet. @return bool
[ "helper", "for", "FileSet", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/PatternSet.php#L325-L329
train
phingofficial/phing
classes/phing/types/PatternSet.php
PatternSet.makeArray
private function makeArray(&$list, Project $p) { if (count($list) === 0) { return null; } $tmpNames = []; foreach ($list as $ne) { $pattern = (string) $ne->evalName($p); if ($pattern !== null && strlen($pattern) > 0) { $tmpNames[] = $pattern; } } return $tmpNames; }
php
private function makeArray(&$list, Project $p) { if (count($list) === 0) { return null; } $tmpNames = []; foreach ($list as $ne) { $pattern = (string) $ne->evalName($p); if ($pattern !== null && strlen($pattern) > 0) { $tmpNames[] = $pattern; } } return $tmpNames; }
[ "private", "function", "makeArray", "(", "&", "$", "list", ",", "Project", "$", "p", ")", "{", "if", "(", "count", "(", "$", "list", ")", "===", "0", ")", "{", "return", "null", ";", "}", "$", "tmpNames", "=", "[", "]", ";", "foreach", "(", "$"...
Convert a array of PatternSetNameEntry elements into an array of Strings. @param array $list @param Project $p @return array
[ "Convert", "a", "array", "of", "PatternSetNameEntry", "elements", "into", "an", "array", "of", "Strings", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/PatternSet.php#L355-L370
train
phingofficial/phing
classes/phing/types/PatternSet.php
PatternSet.readFiles
private function readFiles(Project $p) { if (!empty($this->includesFileList)) { foreach ($this->includesFileList as $ne) { $fileName = (string) $ne->evalName($p); if ($fileName !== null) { $inclFile = $p->resolveFile($fileName); if (!$inclFile->exists()) { throw new BuildException("Includesfile " . $inclFile->getAbsolutePath() . " not found."); } $this->readPatterns($inclFile, $this->includeList, $p); } } $this->includesFileList = []; } if (!empty($this->excludesFileList)) { foreach ($this->excludesFileList as $ne) { $fileName = (string) $ne->evalName($p); if ($fileName !== null) { $exclFile = $p->resolveFile($fileName); if (!$exclFile->exists()) { throw new BuildException("Excludesfile " . $exclFile->getAbsolutePath() . " not found."); } $this->readPatterns($exclFile, $this->excludeList, $p); } } $this->excludesFileList = []; } }
php
private function readFiles(Project $p) { if (!empty($this->includesFileList)) { foreach ($this->includesFileList as $ne) { $fileName = (string) $ne->evalName($p); if ($fileName !== null) { $inclFile = $p->resolveFile($fileName); if (!$inclFile->exists()) { throw new BuildException("Includesfile " . $inclFile->getAbsolutePath() . " not found."); } $this->readPatterns($inclFile, $this->includeList, $p); } } $this->includesFileList = []; } if (!empty($this->excludesFileList)) { foreach ($this->excludesFileList as $ne) { $fileName = (string) $ne->evalName($p); if ($fileName !== null) { $exclFile = $p->resolveFile($fileName); if (!$exclFile->exists()) { throw new BuildException("Excludesfile " . $exclFile->getAbsolutePath() . " not found."); } $this->readPatterns($exclFile, $this->excludeList, $p); } } $this->excludesFileList = []; } }
[ "private", "function", "readFiles", "(", "Project", "$", "p", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "includesFileList", ")", ")", "{", "foreach", "(", "$", "this", "->", "includesFileList", "as", "$", "ne", ")", "{", "$", "fileNa...
Read includesfile or excludesfile if not already done so. @param Project $p @throws BuildException
[ "Read", "includesfile", "or", "excludesfile", "if", "not", "already", "done", "so", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/PatternSet.php#L379-L408
train
phingofficial/phing
classes/phing/tasks/system/AppendTask.php
AppendTask.setEol
public function setEol($crlf) { $s = $crlf; if ($s === "cr" || $s === "mac") { $this->eolString = "\r"; } elseif ($s === "lf" || $s === "unix") { $this->eolString = "\n"; } elseif ($s === "crlf" || $s === "dos") { $this->eolString = "\r\n"; } else { $this->eolString = $this->getProject()->getProperty('line.separator'); } }
php
public function setEol($crlf) { $s = $crlf; if ($s === "cr" || $s === "mac") { $this->eolString = "\r"; } elseif ($s === "lf" || $s === "unix") { $this->eolString = "\n"; } elseif ($s === "crlf" || $s === "dos") { $this->eolString = "\r\n"; } else { $this->eolString = $this->getProject()->getProperty('line.separator'); } }
[ "public", "function", "setEol", "(", "$", "crlf", ")", "{", "$", "s", "=", "$", "crlf", ";", "if", "(", "$", "s", "===", "\"cr\"", "||", "$", "s", "===", "\"mac\"", ")", "{", "$", "this", "->", "eolString", "=", "\"\\r\"", ";", "}", "elseif", "...
Specify the end of line to find and to add if not present at end of each input file. This attribute is used in conjunction with fixlastline. @param string $crlf the type of new line to add - cr, mac, lf, unix, crlf, or dos
[ "Specify", "the", "end", "of", "line", "to", "find", "and", "to", "add", "if", "not", "present", "at", "end", "of", "each", "input", "file", ".", "This", "attribute", "is", "used", "in", "conjunction", "with", "fixlastline", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/AppendTask.php#L137-L149
train
phingofficial/phing
classes/phing/tasks/system/AppendTask.php
AppendTask.appendFiles
private function appendFiles(Writer $writer, $files, PhingFile $dir = null) { if (!empty($files)) { $this->log( "Attempting to append " . count( $files ) . " files" . ($dir !== null ? ", using basedir " . $dir->getPath() : "") ); $basenameSlot = Register::getSlot("task.append.current_file"); $pathSlot = Register::getSlot("task.append.current_file.path"); foreach ($files as $file) { try { if (!$this->checkFilename($file, $dir)) { continue; } if ($dir !== null) { $file = is_string($file) ? new PhingFile($dir->getPath(), $file) : $file; } else { $file = is_string($file) ? new PhingFile($file) : $file; } $basenameSlot->setValue($file); $pathSlot->setValue($file->getPath()); $this->appendFile($writer, $file); } catch (IOException $ioe) { $this->log( "Unable to append contents of file " . $file . ": " . $ioe->getMessage(), Project::MSG_WARN ); } catch (NullPointerException $npe) { $this->log( "Unable to append contents of file " . $file . ": " . $npe->getMessage(), Project::MSG_WARN ); } } } }
php
private function appendFiles(Writer $writer, $files, PhingFile $dir = null) { if (!empty($files)) { $this->log( "Attempting to append " . count( $files ) . " files" . ($dir !== null ? ", using basedir " . $dir->getPath() : "") ); $basenameSlot = Register::getSlot("task.append.current_file"); $pathSlot = Register::getSlot("task.append.current_file.path"); foreach ($files as $file) { try { if (!$this->checkFilename($file, $dir)) { continue; } if ($dir !== null) { $file = is_string($file) ? new PhingFile($dir->getPath(), $file) : $file; } else { $file = is_string($file) ? new PhingFile($file) : $file; } $basenameSlot->setValue($file); $pathSlot->setValue($file->getPath()); $this->appendFile($writer, $file); } catch (IOException $ioe) { $this->log( "Unable to append contents of file " . $file . ": " . $ioe->getMessage(), Project::MSG_WARN ); } catch (NullPointerException $npe) { $this->log( "Unable to append contents of file " . $file . ": " . $npe->getMessage(), Project::MSG_WARN ); } } } }
[ "private", "function", "appendFiles", "(", "Writer", "$", "writer", ",", "$", "files", ",", "PhingFile", "$", "dir", "=", "null", ")", "{", "if", "(", "!", "empty", "(", "$", "files", ")", ")", "{", "$", "this", "->", "log", "(", "\"Attempting to app...
Append an array of files in a directory. @param Writer $writer The FileWriter that is appending to target file. @param array $files array of files to delete; can be of zero length @param PhingFile $dir directory to work from @return void
[ "Append", "an", "array", "of", "files", "in", "a", "directory", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/AppendTask.php#L365-L402
train
phingofficial/phing
classes/phing/tasks/system/AvailableTask.php
AvailableTask.setFilepath
public function setFilepath(Path $filepath) { if ($this->filepath === null) { $this->filepath = $filepath; } else { $this->filepath->append($filepath); } }
php
public function setFilepath(Path $filepath) { if ($this->filepath === null) { $this->filepath = $filepath; } else { $this->filepath->append($filepath); } }
[ "public", "function", "setFilepath", "(", "Path", "$", "filepath", ")", "{", "if", "(", "$", "this", "->", "filepath", "===", "null", ")", "{", "$", "this", "->", "filepath", "=", "$", "filepath", ";", "}", "else", "{", "$", "this", "->", "filepath",...
Set the path to use when looking for a file. @param Path $filepath a Path instance containing the search path for files.
[ "Set", "the", "path", "to", "use", "when", "looking", "for", "a", "file", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/AvailableTask.php#L123-L130
train
phingofficial/phing
classes/phing/tasks/system/AvailableTask.php
AvailableTask.createFilepath
public function createFilepath() { if ($this->filepath === null) { $this->filepath = new Path($this->project); } return $this->filepath->createPath(); }
php
public function createFilepath() { if ($this->filepath === null) { $this->filepath = new Path($this->project); } return $this->filepath->createPath(); }
[ "public", "function", "createFilepath", "(", ")", "{", "if", "(", "$", "this", "->", "filepath", "===", "null", ")", "{", "$", "this", "->", "filepath", "=", "new", "Path", "(", "$", "this", "->", "project", ")", ";", "}", "return", "$", "this", "-...
Creates a path to be configured @return Path
[ "Creates", "a", "path", "to", "be", "configured" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/AvailableTask.php#L137-L144
train
phingofficial/phing
classes/phing/tasks/ext/VersionTask.php
VersionTask.loadProperties
private function loadProperties() { try { $properties = new Properties(); $properties->load($this->file); } catch (IOException $ioe) { throw new BuildException($ioe); } return $properties; }
php
private function loadProperties() { try { $properties = new Properties(); $properties->load($this->file); } catch (IOException $ioe) { throw new BuildException($ioe); } return $properties; }
[ "private", "function", "loadProperties", "(", ")", "{", "try", "{", "$", "properties", "=", "new", "Properties", "(", ")", ";", "$", "properties", "->", "load", "(", "$", "this", "->", "file", ")", ";", "}", "catch", "(", "IOException", "$", "ioe", "...
Utility method to load properties from file. @return Properties the loaded properties @throws BuildException
[ "Utility", "method", "to", "load", "properties", "from", "file", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/VersionTask.php#L179-L188
train
phingofficial/phing
classes/phing/tasks/ext/VersionTask.php
VersionTask.getVersion
private function getVersion($oldVersion) { preg_match('#^(?<PREFIX>v)?(?<MAJOR>\d+)?(?:\.(?<MINOR>\d+))?(?:\.(?<BUGFIX>\d+))?#', $oldVersion, $version); // Setting values if not captured $version['PREFIX'] = $version['PREFIX'] ?? ''; $version[self::RELEASETYPE_MAJOR] = $version[self::RELEASETYPE_MAJOR] ?? '0'; $version[self::RELEASETYPE_MINOR] = $version[self::RELEASETYPE_MINOR] ?? '0'; $version[self::RELEASETYPE_BUGFIX] = $version[self::RELEASETYPE_BUGFIX] ?? '0'; // Resetting Minor and/or Bugfix number according to release type switch ($this->releasetype) { case self::RELEASETYPE_MAJOR: $version[self::RELEASETYPE_MINOR] = '0'; // no break case self::RELEASETYPE_MINOR: $version[self::RELEASETYPE_BUGFIX] = '0'; break; } $version[$this->releasetype]++; return sprintf( '%s%u.%u.%u', $version['PREFIX'], $version[self::RELEASETYPE_MAJOR], $version[self::RELEASETYPE_MINOR], $version[self::RELEASETYPE_BUGFIX] ); }
php
private function getVersion($oldVersion) { preg_match('#^(?<PREFIX>v)?(?<MAJOR>\d+)?(?:\.(?<MINOR>\d+))?(?:\.(?<BUGFIX>\d+))?#', $oldVersion, $version); // Setting values if not captured $version['PREFIX'] = $version['PREFIX'] ?? ''; $version[self::RELEASETYPE_MAJOR] = $version[self::RELEASETYPE_MAJOR] ?? '0'; $version[self::RELEASETYPE_MINOR] = $version[self::RELEASETYPE_MINOR] ?? '0'; $version[self::RELEASETYPE_BUGFIX] = $version[self::RELEASETYPE_BUGFIX] ?? '0'; // Resetting Minor and/or Bugfix number according to release type switch ($this->releasetype) { case self::RELEASETYPE_MAJOR: $version[self::RELEASETYPE_MINOR] = '0'; // no break case self::RELEASETYPE_MINOR: $version[self::RELEASETYPE_BUGFIX] = '0'; break; } $version[$this->releasetype]++; return sprintf( '%s%u.%u.%u', $version['PREFIX'], $version[self::RELEASETYPE_MAJOR], $version[self::RELEASETYPE_MINOR], $version[self::RELEASETYPE_BUGFIX] ); }
[ "private", "function", "getVersion", "(", "$", "oldVersion", ")", "{", "preg_match", "(", "'#^(?<PREFIX>v)?(?<MAJOR>\\d+)?(?:\\.(?<MINOR>\\d+))?(?:\\.(?<BUGFIX>\\d+))?#'", ",", "$", "oldVersion", ",", "$", "version", ")", ";", "// Setting values if not captured", "$", "vers...
Returns new version number corresponding to Release type @param string $oldVersion @return string
[ "Returns", "new", "version", "number", "corresponding", "to", "Release", "type" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/VersionTask.php#L196-L225
train
phingofficial/phing
classes/phing/tasks/ext/VersionTask.php
VersionTask.checkReleasetype
private function checkReleasetype() { // check Releasetype if (null === $this->releasetype) { throw new BuildException('releasetype attribute is required', $this->getLocation()); } // known releasetypes $releaseTypes = [ self::RELEASETYPE_MAJOR, self::RELEASETYPE_MINOR, self::RELEASETYPE_BUGFIX ]; if (!in_array($this->releasetype, $releaseTypes)) { throw new BuildException( sprintf( 'Unknown Releasetype %s..Must be one of Major, Minor or Bugfix', $this->releasetype ), $this->getLocation() ); } }
php
private function checkReleasetype() { // check Releasetype if (null === $this->releasetype) { throw new BuildException('releasetype attribute is required', $this->getLocation()); } // known releasetypes $releaseTypes = [ self::RELEASETYPE_MAJOR, self::RELEASETYPE_MINOR, self::RELEASETYPE_BUGFIX ]; if (!in_array($this->releasetype, $releaseTypes)) { throw new BuildException( sprintf( 'Unknown Releasetype %s..Must be one of Major, Minor or Bugfix', $this->releasetype ), $this->getLocation() ); } }
[ "private", "function", "checkReleasetype", "(", ")", "{", "// check Releasetype", "if", "(", "null", "===", "$", "this", "->", "releasetype", ")", "{", "throw", "new", "BuildException", "(", "'releasetype attribute is required'", ",", "$", "this", "->", "getLocati...
checks releasetype attribute @return void @throws BuildException
[ "checks", "releasetype", "attribute" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/VersionTask.php#L233-L255
train
phingofficial/phing
classes/phing/tasks/system/FailTask.php
FailTask.createCondition
public function createCondition() { if ($this->nestedCondition !== null) { throw new BuildException("Only one nested condition is allowed."); } $this->nestedCondition = new NestedCondition(); return $this->nestedCondition; }
php
public function createCondition() { if ($this->nestedCondition !== null) { throw new BuildException("Only one nested condition is allowed."); } $this->nestedCondition = new NestedCondition(); return $this->nestedCondition; }
[ "public", "function", "createCondition", "(", ")", "{", "if", "(", "$", "this", "->", "nestedCondition", "!==", "null", ")", "{", "throw", "new", "BuildException", "(", "\"Only one nested condition is allowed.\"", ")", ";", "}", "$", "this", "->", "nestedConditi...
Add a condition element. @return NestedCondition @throws BuildException
[ "Add", "a", "condition", "element", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/FailTask.php#L167-L174
train
phingofficial/phing
classes/phing/tasks/system/FailTask.php
FailTask.addText
public function addText($msg) { if ($this->message === null) { $this->message = ""; } $this->message .= $this->project->replaceProperties($msg); }
php
public function addText($msg) { if ($this->message === null) { $this->message = ""; } $this->message .= $this->project->replaceProperties($msg); }
[ "public", "function", "addText", "(", "$", "msg", ")", "{", "if", "(", "$", "this", "->", "message", "===", "null", ")", "{", "$", "this", "->", "message", "=", "\"\"", ";", "}", "$", "this", "->", "message", ".=", "$", "this", "->", "project", "...
Set a multiline message. @param string $msg @return void
[ "Set", "a", "multiline", "message", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/FailTask.php#L183-L189
train
phingofficial/phing
classes/phing/system/util/RegisterSlot.php
RegisterSlot.implodeArray
private function implodeArray(array $arr) { $values = []; foreach ($arr as $value) { if (is_array($value)) { $values[] = $this->implodeArray($value); } else { $values[] = $value; } } return "{" . implode(",", $values) . "}"; }
php
private function implodeArray(array $arr) { $values = []; foreach ($arr as $value) { if (is_array($value)) { $values[] = $this->implodeArray($value); } else { $values[] = $value; } } return "{" . implode(",", $values) . "}"; }
[ "private", "function", "implodeArray", "(", "array", "$", "arr", ")", "{", "$", "values", "=", "[", "]", ";", "foreach", "(", "$", "arr", "as", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "$", "values", "[", ...
Recursively implodes an array to a comma-separated string @param array $arr @return string
[ "Recursively", "implodes", "an", "array", "to", "a", "comma", "-", "separated", "string" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/util/RegisterSlot.php#L77-L90
train
phingofficial/phing
classes/phing/tasks/ext/pdepend/PhpDependLoggerElement.php
PhpDependLoggerElement.setType
public function setType($type) { $this->type = $type; switch ($this->type) { case 'jdepend-chart': case 'jdepend-xml': case 'overview-pyramid': case 'phpunit-xml': case 'summary-xml': break; default: throw new BuildException('Logger "' . $this->type . '" not implemented'); } }
php
public function setType($type) { $this->type = $type; switch ($this->type) { case 'jdepend-chart': case 'jdepend-xml': case 'overview-pyramid': case 'phpunit-xml': case 'summary-xml': break; default: throw new BuildException('Logger "' . $this->type . '" not implemented'); } }
[ "public", "function", "setType", "(", "$", "type", ")", "{", "$", "this", "->", "type", "=", "$", "type", ";", "switch", "(", "$", "this", "->", "type", ")", "{", "case", "'jdepend-chart'", ":", "case", "'jdepend-xml'", ":", "case", "'overview-pyramid'",...
Sets the logger type. @param string $type Type of the logger @throws BuildException
[ "Sets", "the", "logger", "type", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdepend/PhpDependLoggerElement.php#L52-L67
train
phingofficial/phing
classes/phing/Phing.php
Phing.start
public static function start($args, array $additionalUserProperties = null) { try { $m = new Phing(); $m->execute($args); } catch (Exception $exc) { self::handleLogfile(); self::printMessage($exc); self::statusExit(1); return; } if ($additionalUserProperties !== null) { foreach ($additionalUserProperties as $key => $value) { $m::setDefinedProperty($key, $value); } } // expect the worst $exitCode = 1; try { try { $m->runBuild(); $exitCode = 0; } catch (ExitStatusException $ese) { $exitCode = $ese->getCode(); if ($exitCode !== 0) { self::handleLogfile(); throw $ese; } } } catch (BuildException $exc) { // avoid printing output twice: self::printMessage($exc); } catch (Throwable $exc) { self::printMessage($exc); } finally { self::handleLogfile(); } self::statusExit($exitCode); }
php
public static function start($args, array $additionalUserProperties = null) { try { $m = new Phing(); $m->execute($args); } catch (Exception $exc) { self::handleLogfile(); self::printMessage($exc); self::statusExit(1); return; } if ($additionalUserProperties !== null) { foreach ($additionalUserProperties as $key => $value) { $m::setDefinedProperty($key, $value); } } // expect the worst $exitCode = 1; try { try { $m->runBuild(); $exitCode = 0; } catch (ExitStatusException $ese) { $exitCode = $ese->getCode(); if ($exitCode !== 0) { self::handleLogfile(); throw $ese; } } } catch (BuildException $exc) { // avoid printing output twice: self::printMessage($exc); } catch (Throwable $exc) { self::printMessage($exc); } finally { self::handleLogfile(); } self::statusExit($exitCode); }
[ "public", "static", "function", "start", "(", "$", "args", ",", "array", "$", "additionalUserProperties", "=", "null", ")", "{", "try", "{", "$", "m", "=", "new", "Phing", "(", ")", ";", "$", "m", "->", "execute", "(", "$", "args", ")", ";", "}", ...
Entry point allowing for more options from other front ends. This method encapsulates the complete build lifecycle. @param array $args The commandline args passed to phing shell script. @param array $additionalUserProperties Any additional properties to be passed to Phing (alternative front-end might implement this). These additional properties will be available using the getDefinedProperty() method and will be added to the project's "user" properties @see execute() @see runBuild() @throws Exception - if there is an error during build
[ "Entry", "point", "allowing", "for", "more", "options", "from", "other", "front", "ends", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L198-L237
train
phingofficial/phing
classes/phing/Phing.php
Phing.printMessage
public static function printMessage(Throwable $t) { if (self::$err === null) { // Make sure our error output is initialized self::initializeOutputStreams(); } if (self::getMsgOutputLevel() >= Project::MSG_VERBOSE) { self::$err->write((string) $t . PHP_EOL); } else { self::$err->write($t->getMessage() . PHP_EOL); } }
php
public static function printMessage(Throwable $t) { if (self::$err === null) { // Make sure our error output is initialized self::initializeOutputStreams(); } if (self::getMsgOutputLevel() >= Project::MSG_VERBOSE) { self::$err->write((string) $t . PHP_EOL); } else { self::$err->write($t->getMessage() . PHP_EOL); } }
[ "public", "static", "function", "printMessage", "(", "Throwable", "$", "t", ")", "{", "if", "(", "self", "::", "$", "err", "===", "null", ")", "{", "// Make sure our error output is initialized", "self", "::", "initializeOutputStreams", "(", ")", ";", "}", "if...
Prints the message of the Exception if it's not null. @param Exception $t
[ "Prints", "the", "message", "of", "the", "Exception", "if", "it", "s", "not", "null", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L256-L266
train
phingofficial/phing
classes/phing/Phing.php
Phing.initializeOutputStreams
private static function initializeOutputStreams() { if (self::$out === null) { if (!defined('STDOUT')) { self::$out = new OutputStream(fopen('php://stdout', 'w')); } else { self::$out = new OutputStream(STDOUT); } } if (self::$err === null) { if (!defined('STDERR')) { self::$err = new OutputStream(fopen('php://stderr', 'w')); } else { self::$err = new OutputStream(STDERR); } } }
php
private static function initializeOutputStreams() { if (self::$out === null) { if (!defined('STDOUT')) { self::$out = new OutputStream(fopen('php://stdout', 'w')); } else { self::$out = new OutputStream(STDOUT); } } if (self::$err === null) { if (!defined('STDERR')) { self::$err = new OutputStream(fopen('php://stderr', 'w')); } else { self::$err = new OutputStream(STDERR); } } }
[ "private", "static", "function", "initializeOutputStreams", "(", ")", "{", "if", "(", "self", "::", "$", "out", "===", "null", ")", "{", "if", "(", "!", "defined", "(", "'STDOUT'", ")", ")", "{", "self", "::", "$", "out", "=", "new", "OutputStream", ...
Sets the stdout and stderr streams if they are not already set.
[ "Sets", "the", "stdout", "and", "stderr", "streams", "if", "they", "are", "not", "already", "set", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L271-L287
train
phingofficial/phing
classes/phing/Phing.php
Phing.handleArgPropertyFile
private function handleArgPropertyFile(array $args, int $pos): int { if (!isset($args[$pos + 1])) { throw new ConfigurationException('You must specify a filename when using the -propertyfile argument'); } $this->propertyFiles[] = $args[++$pos]; return $pos; }
php
private function handleArgPropertyFile(array $args, int $pos): int { if (!isset($args[$pos + 1])) { throw new ConfigurationException('You must specify a filename when using the -propertyfile argument'); } $this->propertyFiles[] = $args[++$pos]; return $pos; }
[ "private", "function", "handleArgPropertyFile", "(", "array", "$", "args", ",", "int", "$", "pos", ")", ":", "int", "{", "if", "(", "!", "isset", "(", "$", "args", "[", "$", "pos", "+", "1", "]", ")", ")", "{", "throw", "new", "ConfigurationException...
Handle the -propertyfile argument. @param array $args @param int $pos @return int @throws ConfigurationException @throws IOException
[ "Handle", "the", "-", "propertyfile", "argument", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L612-L621
train
phingofficial/phing
classes/phing/Phing.php
Phing._getParentFile
private function _getParentFile(PhingFile $file) { $filename = $file->getAbsolutePath(); $file = new PhingFile($filename); $filename = $file->getParent(); return ($filename === null) ? null : new PhingFile($filename); }
php
private function _getParentFile(PhingFile $file) { $filename = $file->getAbsolutePath(); $file = new PhingFile($filename); $filename = $file->getParent(); return ($filename === null) ? null : new PhingFile($filename); }
[ "private", "function", "_getParentFile", "(", "PhingFile", "$", "file", ")", "{", "$", "filename", "=", "$", "file", "->", "getAbsolutePath", "(", ")", ";", "$", "file", "=", "new", "PhingFile", "(", "$", "filename", ")", ";", "$", "filename", "=", "$"...
Helper to get the parent file for a given file. @param PhingFile $file @return PhingFile Parent file or null if none
[ "Helper", "to", "get", "the", "parent", "file", "for", "a", "given", "file", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L650-L657
train
phingofficial/phing
classes/phing/Phing.php
Phing._findBuildFile
private function _findBuildFile($start, $suffix) { $startf = new PhingFile($start); $parent = new PhingFile($startf->getAbsolutePath()); $file = new PhingFile($parent, $suffix); // check if the target file exists in the current directory while (!$file->exists()) { // change to parent directory $parent = $this->_getParentFile($parent); // if parent is null, then we are at the root of the fs, // complain that we can't find the build file. if ($parent === null) { throw new ConfigurationException("Could not locate a build file!"); } // refresh our file handle $file = new PhingFile($parent, $suffix); } return $file; }
php
private function _findBuildFile($start, $suffix) { $startf = new PhingFile($start); $parent = new PhingFile($startf->getAbsolutePath()); $file = new PhingFile($parent, $suffix); // check if the target file exists in the current directory while (!$file->exists()) { // change to parent directory $parent = $this->_getParentFile($parent); // if parent is null, then we are at the root of the fs, // complain that we can't find the build file. if ($parent === null) { throw new ConfigurationException("Could not locate a build file!"); } // refresh our file handle $file = new PhingFile($parent, $suffix); } return $file; }
[ "private", "function", "_findBuildFile", "(", "$", "start", ",", "$", "suffix", ")", "{", "$", "startf", "=", "new", "PhingFile", "(", "$", "start", ")", ";", "$", "parent", "=", "new", "PhingFile", "(", "$", "startf", "->", "getAbsolutePath", "(", ")"...
Search parent directories for the build file. Takes the given target as a suffix to append to each parent directory in search of a build file. Once the root of the file-system has been reached an exception is thrown. @param string $start Start file path. @param string $suffix Suffix filename to look for in parents. @throws ConfigurationException @return PhingFile A handle to the build file
[ "Search", "parent", "directories", "for", "the", "build", "file", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L674-L695
train
phingofficial/phing
classes/phing/Phing.php
Phing.addBuildListeners
private function addBuildListeners(Project $project) { // Add the default listener $project->addBuildListener($this->createLogger()); foreach ($this->listeners as $listenerClassname) { try { $clz = Phing::import($listenerClassname); } catch (Exception $e) { $msg = "Unable to instantiate specified listener " . "class " . $listenerClassname . " : " . $e->getMessage(); throw new ConfigurationException($msg); } $listener = new $clz(); if ($listener instanceof StreamRequiredBuildLogger) { throw new ConfigurationException("Unable to add " . $listenerClassname . " as a listener, since it requires explicit error/output streams. (You can specify it as a -logger.)"); } $project->addBuildListener($listener); } }
php
private function addBuildListeners(Project $project) { // Add the default listener $project->addBuildListener($this->createLogger()); foreach ($this->listeners as $listenerClassname) { try { $clz = Phing::import($listenerClassname); } catch (Exception $e) { $msg = "Unable to instantiate specified listener " . "class " . $listenerClassname . " : " . $e->getMessage(); throw new ConfigurationException($msg); } $listener = new $clz(); if ($listener instanceof StreamRequiredBuildLogger) { throw new ConfigurationException("Unable to add " . $listenerClassname . " as a listener, since it requires explicit error/output streams. (You can specify it as a -logger.)"); } $project->addBuildListener($listener); } }
[ "private", "function", "addBuildListeners", "(", "Project", "$", "project", ")", "{", "// Add the default listener", "$", "project", "->", "addBuildListener", "(", "$", "this", "->", "createLogger", "(", ")", ")", ";", "foreach", "(", "$", "this", "->", "liste...
Bind any registered build listeners to this project. This means adding the logger and any build listeners that were specified with -listener arg. @param Project $project @throws BuildException @throws ConfigurationException @return void
[ "Bind", "any", "registered", "build", "listeners", "to", "this", "project", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L846-L868
train
phingofficial/phing
classes/phing/Phing.php
Phing.addInputHandler
private function addInputHandler(Project $project) { if ($this->inputHandlerClassname === null) { $handler = new ConsoleInputHandler(STDIN, new ConsoleOutput()); } else { try { $clz = Phing::import($this->inputHandlerClassname); $handler = new $clz(); if ($project !== null && method_exists($handler, 'setProject')) { $handler->setProject($project); } } catch (Exception $e) { $msg = "Unable to instantiate specified input handler " . "class " . $this->inputHandlerClassname . " : " . $e->getMessage(); throw new ConfigurationException($msg); } } $project->setInputHandler($handler); }
php
private function addInputHandler(Project $project) { if ($this->inputHandlerClassname === null) { $handler = new ConsoleInputHandler(STDIN, new ConsoleOutput()); } else { try { $clz = Phing::import($this->inputHandlerClassname); $handler = new $clz(); if ($project !== null && method_exists($handler, 'setProject')) { $handler->setProject($project); } } catch (Exception $e) { $msg = "Unable to instantiate specified input handler " . "class " . $this->inputHandlerClassname . " : " . $e->getMessage(); throw new ConfigurationException($msg); } } $project->setInputHandler($handler); }
[ "private", "function", "addInputHandler", "(", "Project", "$", "project", ")", "{", "if", "(", "$", "this", "->", "inputHandlerClassname", "===", "null", ")", "{", "$", "handler", "=", "new", "ConsoleInputHandler", "(", "STDIN", ",", "new", "ConsoleOutput", ...
Creates the InputHandler and adds it to the project. @param Project $project the project instance. @throws ConfigurationException
[ "Creates", "the", "InputHandler", "and", "adds", "it", "to", "the", "project", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L877-L896
train
phingofficial/phing
classes/phing/Phing.php
Phing.createLogger
private function createLogger() { if ($this->silent) { $logger = new SilentLogger(); self::$msgOutputLevel = Project::MSG_WARN; } elseif ($this->loggerClassname !== null) { self::import($this->loggerClassname); // get class name part $classname = self::import($this->loggerClassname); $logger = new $classname(); if (!($logger instanceof BuildLogger)) { throw new BuildException($classname . ' does not implement the BuildLogger interface.'); } } else { $logger = new DefaultLogger(); } $logger->setMessageOutputLevel(self::$msgOutputLevel); $logger->setOutputStream(self::$out); $logger->setErrorStream(self::$err); $logger->setEmacsMode($this->emacsMode); return $logger; }
php
private function createLogger() { if ($this->silent) { $logger = new SilentLogger(); self::$msgOutputLevel = Project::MSG_WARN; } elseif ($this->loggerClassname !== null) { self::import($this->loggerClassname); // get class name part $classname = self::import($this->loggerClassname); $logger = new $classname(); if (!($logger instanceof BuildLogger)) { throw new BuildException($classname . ' does not implement the BuildLogger interface.'); } } else { $logger = new DefaultLogger(); } $logger->setMessageOutputLevel(self::$msgOutputLevel); $logger->setOutputStream(self::$out); $logger->setErrorStream(self::$err); $logger->setEmacsMode($this->emacsMode); return $logger; }
[ "private", "function", "createLogger", "(", ")", "{", "if", "(", "$", "this", "->", "silent", ")", "{", "$", "logger", "=", "new", "SilentLogger", "(", ")", ";", "self", "::", "$", "msgOutputLevel", "=", "Project", "::", "MSG_WARN", ";", "}", "elseif",...
Creates the default build logger for sending build events to the log. @throws BuildException @return BuildLogger The created Logger
[ "Creates", "the", "default", "build", "logger", "for", "sending", "build", "events", "to", "the", "log", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L904-L926
train
phingofficial/phing
classes/phing/Phing.php
Phing.handlePhpError
public static function handlePhpError($level, $message, $file, $line) { // don't want to print suppressed errors if (error_reporting() > 0) { if (self::$phpErrorCapture) { self::$capturedPhpErrors[] = [ 'message' => $message, 'level' => $level, 'line' => $line, 'file' => $file ]; } else { $message = '[PHP Error] ' . $message; $message .= ' [line ' . $line . ' of ' . $file . ']'; switch ($level) { case E_USER_DEPRECATED: case E_DEPRECATED: case E_STRICT: case E_NOTICE: case E_USER_NOTICE: self::log($message, Project::MSG_VERBOSE); break; case E_WARNING: case E_USER_WARNING: self::log($message, Project::MSG_WARN); break; case E_ERROR: case E_USER_ERROR: default: self::log($message, Project::MSG_ERR); } // switch } // if phpErrorCapture } // if not @ }
php
public static function handlePhpError($level, $message, $file, $line) { // don't want to print suppressed errors if (error_reporting() > 0) { if (self::$phpErrorCapture) { self::$capturedPhpErrors[] = [ 'message' => $message, 'level' => $level, 'line' => $line, 'file' => $file ]; } else { $message = '[PHP Error] ' . $message; $message .= ' [line ' . $line . ' of ' . $file . ']'; switch ($level) { case E_USER_DEPRECATED: case E_DEPRECATED: case E_STRICT: case E_NOTICE: case E_USER_NOTICE: self::log($message, Project::MSG_VERBOSE); break; case E_WARNING: case E_USER_WARNING: self::log($message, Project::MSG_WARN); break; case E_ERROR: case E_USER_ERROR: default: self::log($message, Project::MSG_ERR); } // switch } // if phpErrorCapture } // if not @ }
[ "public", "static", "function", "handlePhpError", "(", "$", "level", ",", "$", "message", ",", "$", "file", ",", "$", "line", ")", "{", "// don't want to print suppressed errors", "if", "(", "error_reporting", "(", ")", ">", "0", ")", "{", "if", "(", "self...
Error handler for PHP errors encountered during the build. This uses the logging for the currently configured project. @param $level @param string $message @param $file @param $line
[ "Error", "handler", "for", "PHP", "errors", "encountered", "during", "the", "build", ".", "This", "uses", "the", "logging", "for", "the", "currently", "configured", "project", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L980-L1015
train
phingofficial/phing
classes/phing/Phing.php
Phing.printUsage
public static function printUsage() { $msg = ""; $msg .= "phing [options] [target [target2 [target3] ...]]" . PHP_EOL; $msg .= "Options: " . PHP_EOL; $msg .= " -h -help print this message" . PHP_EOL; $msg .= " -l -list list available targets in this project" . PHP_EOL; $msg .= " -i -init [file] generates an initial buildfile" . PHP_EOL; $msg .= " -v -version print the version information and exit" . PHP_EOL; $msg .= " -q -quiet be extra quiet" . PHP_EOL; $msg .= " -S -silent print nothing but task outputs and build failures" . PHP_EOL; $msg .= " -verbose be extra verbose" . PHP_EOL; $msg .= " -debug print debugging information" . PHP_EOL; $msg .= " -emacs, -e produce logging information without adornments" . PHP_EOL; $msg .= " -diagnostics print diagnostics information" . PHP_EOL; $msg .= " -strict runs build in strict mode, considering a warning as error" . PHP_EOL; $msg .= " -no-strict runs build normally (overrides buildfile attribute)" . PHP_EOL; $msg .= " -longtargets show target descriptions during build" . PHP_EOL; $msg .= " -logfile <file> use given file for log" . PHP_EOL; $msg .= " -logger <classname> the class which is to perform logging" . PHP_EOL; $msg .= " -listener <classname> add an instance of class as a project listener" . PHP_EOL; $msg .= " -f -buildfile <file> use given buildfile" . PHP_EOL; $msg .= " -D<property>=<value> use value for given property" . PHP_EOL; $msg .= " -keep-going, -k execute all targets that do not depend" . PHP_EOL; $msg .= " on failed target(s)" . PHP_EOL; $msg .= " -propertyfile <file> load all properties from file" . PHP_EOL; $msg .= " -propertyfileoverride values in property file override existing values" . PHP_EOL; $msg .= " -find <file> search for buildfile towards the root of the" . PHP_EOL; $msg .= " filesystem and use it" . PHP_EOL; $msg .= " -inputhandler <file> the class to use to handle user input" . PHP_EOL; //$msg .= " -recursive <file> search for buildfile downwards and use it" . PHP_EOL; $msg .= PHP_EOL; $msg .= "Report bugs to <dev@phing.tigris.org>" . PHP_EOL; self::$err->write($msg); }
php
public static function printUsage() { $msg = ""; $msg .= "phing [options] [target [target2 [target3] ...]]" . PHP_EOL; $msg .= "Options: " . PHP_EOL; $msg .= " -h -help print this message" . PHP_EOL; $msg .= " -l -list list available targets in this project" . PHP_EOL; $msg .= " -i -init [file] generates an initial buildfile" . PHP_EOL; $msg .= " -v -version print the version information and exit" . PHP_EOL; $msg .= " -q -quiet be extra quiet" . PHP_EOL; $msg .= " -S -silent print nothing but task outputs and build failures" . PHP_EOL; $msg .= " -verbose be extra verbose" . PHP_EOL; $msg .= " -debug print debugging information" . PHP_EOL; $msg .= " -emacs, -e produce logging information without adornments" . PHP_EOL; $msg .= " -diagnostics print diagnostics information" . PHP_EOL; $msg .= " -strict runs build in strict mode, considering a warning as error" . PHP_EOL; $msg .= " -no-strict runs build normally (overrides buildfile attribute)" . PHP_EOL; $msg .= " -longtargets show target descriptions during build" . PHP_EOL; $msg .= " -logfile <file> use given file for log" . PHP_EOL; $msg .= " -logger <classname> the class which is to perform logging" . PHP_EOL; $msg .= " -listener <classname> add an instance of class as a project listener" . PHP_EOL; $msg .= " -f -buildfile <file> use given buildfile" . PHP_EOL; $msg .= " -D<property>=<value> use value for given property" . PHP_EOL; $msg .= " -keep-going, -k execute all targets that do not depend" . PHP_EOL; $msg .= " on failed target(s)" . PHP_EOL; $msg .= " -propertyfile <file> load all properties from file" . PHP_EOL; $msg .= " -propertyfileoverride values in property file override existing values" . PHP_EOL; $msg .= " -find <file> search for buildfile towards the root of the" . PHP_EOL; $msg .= " filesystem and use it" . PHP_EOL; $msg .= " -inputhandler <file> the class to use to handle user input" . PHP_EOL; //$msg .= " -recursive <file> search for buildfile downwards and use it" . PHP_EOL; $msg .= PHP_EOL; $msg .= "Report bugs to <dev@phing.tigris.org>" . PHP_EOL; self::$err->write($msg); }
[ "public", "static", "function", "printUsage", "(", ")", "{", "$", "msg", "=", "\"\"", ";", "$", "msg", ".=", "\"phing [options] [target [target2 [target3] ...]]\"", ".", "PHP_EOL", ";", "$", "msg", ".=", "\"Options: \"", ".", "PHP_EOL", ";", "$", "msg", ".=", ...
Prints the usage of how to use this class
[ "Prints", "the", "usage", "of", "how", "to", "use", "this", "class" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L1057-L1091
train
phingofficial/phing
classes/phing/Phing.php
Phing.initPath
protected static function initPath($path) { // Fallback if (empty($path)) { $defaultDir = self::getProperty('application.startdir'); $path = $defaultDir . DIRECTORY_SEPARATOR . self::DEFAULT_BUILD_FILENAME; } // Adding filename if necessary if (is_dir($path)) { $path .= DIRECTORY_SEPARATOR . self::DEFAULT_BUILD_FILENAME; } // Check if path is available $dirname = dirname($path); if (is_dir($dirname) && !is_file($path)) { return $path; } // Path is valid, but buildfile already exists if (is_file($path)) { throw new ConfigurationException('Buildfile already exists.'); } throw new ConfigurationException('Invalid path for sample buildfile.'); }
php
protected static function initPath($path) { // Fallback if (empty($path)) { $defaultDir = self::getProperty('application.startdir'); $path = $defaultDir . DIRECTORY_SEPARATOR . self::DEFAULT_BUILD_FILENAME; } // Adding filename if necessary if (is_dir($path)) { $path .= DIRECTORY_SEPARATOR . self::DEFAULT_BUILD_FILENAME; } // Check if path is available $dirname = dirname($path); if (is_dir($dirname) && !is_file($path)) { return $path; } // Path is valid, but buildfile already exists if (is_file($path)) { throw new ConfigurationException('Buildfile already exists.'); } throw new ConfigurationException('Invalid path for sample buildfile.'); }
[ "protected", "static", "function", "initPath", "(", "$", "path", ")", "{", "// Fallback", "if", "(", "empty", "(", "$", "path", ")", ")", "{", "$", "defaultDir", "=", "self", "::", "getProperty", "(", "'application.startdir'", ")", ";", "$", "path", "=",...
Returns buildfile's path @param $path @return string @throws ConfigurationException
[ "Returns", "buildfile", "s", "path" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L1122-L1147
train
phingofficial/phing
classes/phing/Phing.php
Phing.initWrite
protected static function initWrite($buildfilePath) { // Overwriting protection if (file_exists($buildfilePath)) { throw new ConfigurationException('Cannot overwrite existing file.'); } $content = '<?xml version="1.0" encoding="UTF-8" ?>' . PHP_EOL; $content .= '' . PHP_EOL; $content .= '<project name="" description="" default="">' . PHP_EOL; $content .= ' ' . PHP_EOL; $content .= ' <target name="" description="">' . PHP_EOL; $content .= ' ' . PHP_EOL; $content .= ' </target>' . PHP_EOL; $content .= ' ' . PHP_EOL; $content .= '</project>' . PHP_EOL; file_put_contents($buildfilePath, $content); }
php
protected static function initWrite($buildfilePath) { // Overwriting protection if (file_exists($buildfilePath)) { throw new ConfigurationException('Cannot overwrite existing file.'); } $content = '<?xml version="1.0" encoding="UTF-8" ?>' . PHP_EOL; $content .= '' . PHP_EOL; $content .= '<project name="" description="" default="">' . PHP_EOL; $content .= ' ' . PHP_EOL; $content .= ' <target name="" description="">' . PHP_EOL; $content .= ' ' . PHP_EOL; $content .= ' </target>' . PHP_EOL; $content .= ' ' . PHP_EOL; $content .= '</project>' . PHP_EOL; file_put_contents($buildfilePath, $content); }
[ "protected", "static", "function", "initWrite", "(", "$", "buildfilePath", ")", "{", "// Overwriting protection", "if", "(", "file_exists", "(", "$", "buildfilePath", ")", ")", "{", "throw", "new", "ConfigurationException", "(", "'Cannot overwrite existing file.'", ")...
Writes sample buildfile If $buildfilePath does not exist, the buildfile is created. @param $buildfilePath buildfile's location @return null @throws ConfigurationException
[ "Writes", "sample", "buildfile" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L1160-L1178
train
phingofficial/phing
classes/phing/Phing.php
Phing.getPhingVersion
public static function getPhingVersion() { $versionPath = self::getResourcePath("phing/etc/VERSION.TXT"); if ($versionPath === null) { $versionPath = self::getResourcePath("etc/VERSION.TXT"); } if ($versionPath === null) { throw new ConfigurationException("No VERSION.TXT file found; try setting phing.home environment variable."); } try { // try to read file $file = new PhingFile($versionPath); $reader = new FileReader($file); $phingVersion = trim($reader->read()); } catch (IOException $iox) { throw new ConfigurationException("Can't read version information file"); } $basePath = dirname(__DIR__, 2); $version = new Version($phingVersion, $basePath); return "Phing " . $version->getVersion(); }
php
public static function getPhingVersion() { $versionPath = self::getResourcePath("phing/etc/VERSION.TXT"); if ($versionPath === null) { $versionPath = self::getResourcePath("etc/VERSION.TXT"); } if ($versionPath === null) { throw new ConfigurationException("No VERSION.TXT file found; try setting phing.home environment variable."); } try { // try to read file $file = new PhingFile($versionPath); $reader = new FileReader($file); $phingVersion = trim($reader->read()); } catch (IOException $iox) { throw new ConfigurationException("Can't read version information file"); } $basePath = dirname(__DIR__, 2); $version = new Version($phingVersion, $basePath); return "Phing " . $version->getVersion(); }
[ "public", "static", "function", "getPhingVersion", "(", ")", "{", "$", "versionPath", "=", "self", "::", "getResourcePath", "(", "\"phing/etc/VERSION.TXT\"", ")", ";", "if", "(", "$", "versionPath", "===", "null", ")", "{", "$", "versionPath", "=", "self", "...
Gets the current Phing version based on VERSION.TXT file. @throws ConfigurationException @return string
[ "Gets", "the", "current", "Phing", "version", "based", "on", "VERSION", ".", "TXT", "file", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L1187-L1209
train
phingofficial/phing
classes/phing/Phing.php
Phing.printDescription
public function printDescription(Project $project) { if ($project->getDescription() !== null) { self::$out->write($project->getDescription() . PHP_EOL); } }
php
public function printDescription(Project $project) { if ($project->getDescription() !== null) { self::$out->write($project->getDescription() . PHP_EOL); } }
[ "public", "function", "printDescription", "(", "Project", "$", "project", ")", "{", "if", "(", "$", "project", "->", "getDescription", "(", ")", "!==", "null", ")", "{", "self", "::", "$", "out", "->", "write", "(", "$", "project", "->", "getDescription"...
Print the project description, if any @param Project $project @throws IOException
[ "Print", "the", "project", "description", "if", "any" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L1218-L1223
train
phingofficial/phing
classes/phing/Phing.php
Phing.printTargets
public function printTargets($project) { // find the target with the longest name $maxLength = 0; $targets = $project->getTargets(); $targetName = null; $targetDescription = null; $currentTarget = null; // split the targets in top-level and sub-targets depending // on the presence of a description $subNames = []; $topNameDescMap = []; foreach ($targets as $currentTarget) { $targetName = $currentTarget->getName(); $targetDescription = $currentTarget->getDescription(); if ($currentTarget->isHidden()) { continue; } // subtargets are targets w/o descriptions if ($targetDescription === null) { $subNames[] = $targetName; } else { // topNames and topDescriptions are handled later // here we store in hash map (for sorting purposes) $topNameDescMap[$targetName] = $targetDescription; if (strlen($targetName) > $maxLength) { $maxLength = strlen($targetName); } } } // Sort the arrays sort($subNames); // sort array values, resetting keys (which are numeric) ksort($topNameDescMap); // sort the keys (targetName) keeping key=>val associations $topNames = array_keys($topNameDescMap); $topDescriptions = array_values($topNameDescMap); $defaultTarget = $project->getDefaultTarget(); if ($defaultTarget !== null && $defaultTarget !== "") { $defaultName = []; $defaultDesc = []; $defaultName[] = $defaultTarget; $indexOfDefDesc = array_search($defaultTarget, $topNames, true); if ($indexOfDefDesc !== false && $indexOfDefDesc >= 0) { $defaultDesc = []; $defaultDesc[] = $topDescriptions[$indexOfDefDesc]; } $this->_printTargets($defaultName, $defaultDesc, "Default target:", $maxLength); } $this->_printTargets($topNames, $topDescriptions, "Main targets:", $maxLength); $this->_printTargets($subNames, null, "Subtargets:", 0); }
php
public function printTargets($project) { // find the target with the longest name $maxLength = 0; $targets = $project->getTargets(); $targetName = null; $targetDescription = null; $currentTarget = null; // split the targets in top-level and sub-targets depending // on the presence of a description $subNames = []; $topNameDescMap = []; foreach ($targets as $currentTarget) { $targetName = $currentTarget->getName(); $targetDescription = $currentTarget->getDescription(); if ($currentTarget->isHidden()) { continue; } // subtargets are targets w/o descriptions if ($targetDescription === null) { $subNames[] = $targetName; } else { // topNames and topDescriptions are handled later // here we store in hash map (for sorting purposes) $topNameDescMap[$targetName] = $targetDescription; if (strlen($targetName) > $maxLength) { $maxLength = strlen($targetName); } } } // Sort the arrays sort($subNames); // sort array values, resetting keys (which are numeric) ksort($topNameDescMap); // sort the keys (targetName) keeping key=>val associations $topNames = array_keys($topNameDescMap); $topDescriptions = array_values($topNameDescMap); $defaultTarget = $project->getDefaultTarget(); if ($defaultTarget !== null && $defaultTarget !== "") { $defaultName = []; $defaultDesc = []; $defaultName[] = $defaultTarget; $indexOfDefDesc = array_search($defaultTarget, $topNames, true); if ($indexOfDefDesc !== false && $indexOfDefDesc >= 0) { $defaultDesc = []; $defaultDesc[] = $topDescriptions[$indexOfDefDesc]; } $this->_printTargets($defaultName, $defaultDesc, "Default target:", $maxLength); } $this->_printTargets($topNames, $topDescriptions, "Main targets:", $maxLength); $this->_printTargets($subNames, null, "Subtargets:", 0); }
[ "public", "function", "printTargets", "(", "$", "project", ")", "{", "// find the target with the longest name", "$", "maxLength", "=", "0", ";", "$", "targets", "=", "$", "project", "->", "getTargets", "(", ")", ";", "$", "targetName", "=", "null", ";", "$"...
Print out a list of all targets in the current buildfile @param $project
[ "Print", "out", "a", "list", "of", "all", "targets", "in", "the", "current", "buildfile" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L1230-L1289
train
phingofficial/phing
classes/phing/Phing.php
Phing._printTargets
private function _printTargets($names, $descriptions, $heading, $maxlen) { $spaces = ' '; while (strlen($spaces) < $maxlen) { $spaces .= $spaces; } $msg = ""; $msg .= $heading . PHP_EOL; $msg .= str_repeat("-", 79) . PHP_EOL; $total = count($names); for ($i = 0; $i < $total; $i++) { $msg .= " "; $msg .= $names[$i]; if (!empty($descriptions)) { $msg .= substr($spaces, 0, $maxlen - strlen($names[$i]) + 2); $msg .= $descriptions[$i]; } $msg .= PHP_EOL; } if ($total > 0) { self::$out->write($msg . PHP_EOL); } }
php
private function _printTargets($names, $descriptions, $heading, $maxlen) { $spaces = ' '; while (strlen($spaces) < $maxlen) { $spaces .= $spaces; } $msg = ""; $msg .= $heading . PHP_EOL; $msg .= str_repeat("-", 79) . PHP_EOL; $total = count($names); for ($i = 0; $i < $total; $i++) { $msg .= " "; $msg .= $names[$i]; if (!empty($descriptions)) { $msg .= substr($spaces, 0, $maxlen - strlen($names[$i]) + 2); $msg .= $descriptions[$i]; } $msg .= PHP_EOL; } if ($total > 0) { self::$out->write($msg . PHP_EOL); } }
[ "private", "function", "_printTargets", "(", "$", "names", ",", "$", "descriptions", ",", "$", "heading", ",", "$", "maxlen", ")", "{", "$", "spaces", "=", "' '", ";", "while", "(", "strlen", "(", "$", "spaces", ")", "<", "$", "maxlen", ")", "{", ...
Writes a formatted list of target names with an optional description. @param array $names The names to be printed. Must not be <code>null</code>. @param array $descriptions The associated target descriptions. May be <code>null</code>, in which case no descriptions are displayed. If non-<code>null</code>, this should have as many elements as <code>names</code>. @param string $heading The heading to display. Should not be <code>null</code>. @param int $maxlen The maximum length of the names of the targets. If descriptions are given, they are padded to this position so they line up (so long as the names really <i>are</i> shorter than this).
[ "Writes", "a", "formatted", "list", "of", "target", "names", "with", "an", "optional", "description", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L1308-L1331
train
phingofficial/phing
classes/phing/Phing.php
Phing.__import
public static function __import($path, $classpath = null) { if ($classpath) { // Apparently casting to (string) no longer invokes __toString() automatically. if (is_object($classpath)) { $classpath = $classpath->__toString(); } // classpaths are currently additive, but we also don't want to just // indiscriminantly prepand/append stuff to the include_path. This means // we need to parse current incldue_path, and prepend any // specified classpath locations that are not already in the include_path. // // NOTE: the reason why we do it this way instead of just changing include_path // and then changing it back, is that in many cases applications (e.g. Propel) will // include/require class files from within method calls. This means that not all // necessary files will be included in this import() call, and hence we can't // change the include_path back without breaking those apps. While this method could // be more expensive than switching & switching back (not sure, but maybe), it makes it // possible to write far less expensive run-time applications (e.g. using Propel), which is // really where speed matters more. $curr_parts = Phing::explodeIncludePath(); $add_parts = Phing::explodeIncludePath($classpath); $new_parts = array_diff($add_parts, $curr_parts); if ($new_parts) { set_include_path(implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts))); } } $ret = include_once $path; if ($ret === false) { $msg = "Error importing $path"; if (self::getMsgOutputLevel() >= Project::MSG_DEBUG) { $x = new Exception("for-path-trace-only"); $msg .= $x->getTraceAsString(); } throw new ConfigurationException($msg); } }
php
public static function __import($path, $classpath = null) { if ($classpath) { // Apparently casting to (string) no longer invokes __toString() automatically. if (is_object($classpath)) { $classpath = $classpath->__toString(); } // classpaths are currently additive, but we also don't want to just // indiscriminantly prepand/append stuff to the include_path. This means // we need to parse current incldue_path, and prepend any // specified classpath locations that are not already in the include_path. // // NOTE: the reason why we do it this way instead of just changing include_path // and then changing it back, is that in many cases applications (e.g. Propel) will // include/require class files from within method calls. This means that not all // necessary files will be included in this import() call, and hence we can't // change the include_path back without breaking those apps. While this method could // be more expensive than switching & switching back (not sure, but maybe), it makes it // possible to write far less expensive run-time applications (e.g. using Propel), which is // really where speed matters more. $curr_parts = Phing::explodeIncludePath(); $add_parts = Phing::explodeIncludePath($classpath); $new_parts = array_diff($add_parts, $curr_parts); if ($new_parts) { set_include_path(implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts))); } } $ret = include_once $path; if ($ret === false) { $msg = "Error importing $path"; if (self::getMsgOutputLevel() >= Project::MSG_DEBUG) { $x = new Exception("for-path-trace-only"); $msg .= $x->getTraceAsString(); } throw new ConfigurationException($msg); } }
[ "public", "static", "function", "__import", "(", "$", "path", ",", "$", "classpath", "=", "null", ")", "{", "if", "(", "$", "classpath", ")", "{", "// Apparently casting to (string) no longer invokes __toString() automatically.", "if", "(", "is_object", "(", "$", ...
Import a PHP file @param string $path Path to the PHP file @param mixed $classpath String or object supporting __toString() @throws ConfigurationException
[ "Import", "a", "PHP", "file" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L1395-L1435
train
phingofficial/phing
classes/phing/Phing.php
Phing.getResourcePath
public static function getResourcePath($path) { if (self::$importPaths === null) { self::$importPaths = self::explodeIncludePath(); } $path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $path); foreach (self::$importPaths as $prefix) { $testPath = $prefix . DIRECTORY_SEPARATOR . $path; if (file_exists($testPath)) { return $testPath; } } // Check for the property phing.home $homeDir = self::getProperty(self::PHING_HOME); if ($homeDir) { $testPath = $homeDir . DIRECTORY_SEPARATOR . $path; if (file_exists($testPath)) { return $testPath; } } // Check for the phing home of phar archive if (strpos(self::$importPaths[0], 'phar://') === 0) { $testPath = self::$importPaths[0] . '/../' . $path; if (file_exists($testPath)) { return $testPath; } } // Do one additional check based on path of current file (Phing.php) $maybeHomeDir = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); $testPath = $maybeHomeDir . DIRECTORY_SEPARATOR . $path; if (file_exists($testPath)) { return $testPath; } return null; }
php
public static function getResourcePath($path) { if (self::$importPaths === null) { self::$importPaths = self::explodeIncludePath(); } $path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $path); foreach (self::$importPaths as $prefix) { $testPath = $prefix . DIRECTORY_SEPARATOR . $path; if (file_exists($testPath)) { return $testPath; } } // Check for the property phing.home $homeDir = self::getProperty(self::PHING_HOME); if ($homeDir) { $testPath = $homeDir . DIRECTORY_SEPARATOR . $path; if (file_exists($testPath)) { return $testPath; } } // Check for the phing home of phar archive if (strpos(self::$importPaths[0], 'phar://') === 0) { $testPath = self::$importPaths[0] . '/../' . $path; if (file_exists($testPath)) { return $testPath; } } // Do one additional check based on path of current file (Phing.php) $maybeHomeDir = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); $testPath = $maybeHomeDir . DIRECTORY_SEPARATOR . $path; if (file_exists($testPath)) { return $testPath; } return null; }
[ "public", "static", "function", "getResourcePath", "(", "$", "path", ")", "{", "if", "(", "self", "::", "$", "importPaths", "===", "null", ")", "{", "self", "::", "$", "importPaths", "=", "self", "::", "explodeIncludePath", "(", ")", ";", "}", "$", "pa...
Looks on include path for specified file. @param string $path @return string File found (null if no file found).
[ "Looks", "on", "include", "path", "for", "specified", "file", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L1444-L1484
train
phingofficial/phing
classes/phing/Phing.php
Phing.explodeIncludePath
public static function explodeIncludePath($path = null) { if (null === $path) { $path = get_include_path(); } if (PATH_SEPARATOR == ':') { // On *nix systems, include_paths which include paths with a stream // schema cannot be safely explode'd, so we have to be a bit more // intelligent in the approach. $paths = preg_split('#:(?!//)#', $path); } else { $paths = explode(PATH_SEPARATOR, $path); } return $paths; }
php
public static function explodeIncludePath($path = null) { if (null === $path) { $path = get_include_path(); } if (PATH_SEPARATOR == ':') { // On *nix systems, include_paths which include paths with a stream // schema cannot be safely explode'd, so we have to be a bit more // intelligent in the approach. $paths = preg_split('#:(?!//)#', $path); } else { $paths = explode(PATH_SEPARATOR, $path); } return $paths; }
[ "public", "static", "function", "explodeIncludePath", "(", "$", "path", "=", "null", ")", "{", "if", "(", "null", "===", "$", "path", ")", "{", "$", "path", "=", "get_include_path", "(", ")", ";", "}", "if", "(", "PATH_SEPARATOR", "==", "':'", ")", "...
Explode an include path into an array If no path provided, uses current include_path. Works around issues that occur when the path includes stream schemas. Pulled from Zend_Loader::explodeIncludePath() in ZF1. @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) @license http://framework.zend.com/license/new-bsd New BSD License @param string|null $path @return array
[ "Explode", "an", "include", "path", "into", "an", "array" ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L1499-L1515
train
phingofficial/phing
classes/phing/Phing.php
Phing.getProperty
public static function getProperty($propName) { // some properties are detemined on each access // some are cached, see below // default is the cached value: $val = isset(self::$properties[$propName]) ? self::$properties[$propName] : null; // special exceptions switch ($propName) { case 'user.dir': $val = getcwd(); break; } return $val; }
php
public static function getProperty($propName) { // some properties are detemined on each access // some are cached, see below // default is the cached value: $val = isset(self::$properties[$propName]) ? self::$properties[$propName] : null; // special exceptions switch ($propName) { case 'user.dir': $val = getcwd(); break; } return $val; }
[ "public", "static", "function", "getProperty", "(", "$", "propName", ")", "{", "// some properties are detemined on each access", "// some are cached, see below", "// default is the cached value:", "$", "val", "=", "isset", "(", "self", "::", "$", "properties", "[", "$", ...
Returns property value for a System property. System properties are "global" properties like application.startdir, and user.dir. Many of these correspond to similar properties in Java or Ant. @param string $propName @return string Value of found property (or null, if none found).
[ "Returns", "property", "value", "for", "a", "System", "property", ".", "System", "properties", "are", "global", "properties", "like", "application", ".", "startdir", "and", "user", ".", "dir", ".", "Many", "of", "these", "correspond", "to", "similar", "propert...
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L1643-L1660
train
phingofficial/phing
classes/phing/Phing.php
Phing.setIni
private static function setIni() { self::$origIniSettings['error_reporting'] = error_reporting(E_ALL); // We won't bother storing original max_execution_time, since 1) the value in // php.ini may be wrong (and there's no way to get the current value) and // 2) it would mean something very strange to set it to a value less than time script // has already been running, which would be the likely change. set_time_limit(0); self::$origIniSettings['short_open_tag'] = ini_set('short_open_tag', 'off'); self::$origIniSettings['default_charset'] = ini_set('default_charset', 'iso-8859-1'); self::$origIniSettings['track_errors'] = ini_set('track_errors', 1); $mem_limit = (int) self::convertShorthand(ini_get('memory_limit')); if ($mem_limit < (32 * 1024 * 1024) && $mem_limit > -1) { // We do *not* need to save the original value here, since we don't plan to restore // this after shutdown (we don't trust the effectiveness of PHP's garbage collection). ini_set('memory_limit', '32M'); // nore: this may need to be higher for many projects } }
php
private static function setIni() { self::$origIniSettings['error_reporting'] = error_reporting(E_ALL); // We won't bother storing original max_execution_time, since 1) the value in // php.ini may be wrong (and there's no way to get the current value) and // 2) it would mean something very strange to set it to a value less than time script // has already been running, which would be the likely change. set_time_limit(0); self::$origIniSettings['short_open_tag'] = ini_set('short_open_tag', 'off'); self::$origIniSettings['default_charset'] = ini_set('default_charset', 'iso-8859-1'); self::$origIniSettings['track_errors'] = ini_set('track_errors', 1); $mem_limit = (int) self::convertShorthand(ini_get('memory_limit')); if ($mem_limit < (32 * 1024 * 1024) && $mem_limit > -1) { // We do *not* need to save the original value here, since we don't plan to restore // this after shutdown (we don't trust the effectiveness of PHP's garbage collection). ini_set('memory_limit', '32M'); // nore: this may need to be higher for many projects } }
[ "private", "static", "function", "setIni", "(", ")", "{", "self", "::", "$", "origIniSettings", "[", "'error_reporting'", "]", "=", "error_reporting", "(", "E_ALL", ")", ";", "// We won't bother storing original max_execution_time, since 1) the value in", "// php.ini may be...
Sets PHP INI values that Phing needs. @return void
[ "Sets", "PHP", "INI", "values", "that", "Phing", "needs", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L1747-L1768
train
phingofficial/phing
classes/phing/Phing.php
Phing.startup
public static function startup() { // setup STDOUT and STDERR defaults self::initializeOutputStreams(); // some init stuff self::getTimer()->start(); self::setSystemConstants(); self::setIncludePaths(); self::setIni(); }
php
public static function startup() { // setup STDOUT and STDERR defaults self::initializeOutputStreams(); // some init stuff self::getTimer()->start(); self::setSystemConstants(); self::setIncludePaths(); self::setIni(); }
[ "public", "static", "function", "startup", "(", ")", "{", "// setup STDOUT and STDERR defaults", "self", "::", "initializeOutputStreams", "(", ")", ";", "// some init stuff", "self", "::", "getTimer", "(", ")", "->", "start", "(", ")", ";", "self", "::", "setSys...
Start up Phing. Sets up the Phing environment but does not initiate the build process. @return void @throws Exception - If the Phing environment cannot be initialized.
[ "Start", "up", "Phing", ".", "Sets", "up", "the", "Phing", "environment", "but", "does", "not", "initiate", "the", "build", "process", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L1813-L1825
train
phingofficial/phing
classes/phing/Phing.php
Phing.shutdown
public static function shutdown() { self::$msgOutputLevel = Project::MSG_INFO; self::restoreIni(); self::getTimer()->stop(); }
php
public static function shutdown() { self::$msgOutputLevel = Project::MSG_INFO; self::restoreIni(); self::getTimer()->stop(); }
[ "public", "static", "function", "shutdown", "(", ")", "{", "self", "::", "$", "msgOutputLevel", "=", "Project", "::", "MSG_INFO", ";", "self", "::", "restoreIni", "(", ")", ";", "self", "::", "getTimer", "(", ")", "->", "stop", "(", ")", ";", "}" ]
Performs any shutdown routines, such as stopping timers. @return void
[ "Performs", "any", "shutdown", "routines", "such", "as", "stopping", "timers", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Phing.php#L1832-L1837
train
phingofficial/phing
classes/phing/filters/SuffixLines.php
SuffixLines.read
public function read($len = null) { if (!$this->getInitialized()) { $this->_initialize(); $this->setInitialized(true); } $ch = -1; if ($this->queuedData !== null && $this->queuedData === '') { $this->queuedData = null; } if ($this->queuedData !== null) { $ch = $this->queuedData[0]; $this->queuedData = substr($this->queuedData, 1); if ($this->queuedData === '') { $this->queuedData = null; } } else { $this->queuedData = $this->readLine(); if ($this->queuedData === null) { $ch = -1; } else { if ($this->suffix !== null) { $lf = ''; if (StringHelper::endsWith($this->queuedData, "\r\n")) { $lf = "\r\n"; } elseif (StringHelper::endsWith($this->queuedData, "\n")) { $lf = "\n"; } $this->queuedData = substr($this->queuedData, 0, strlen($this->queuedData) - strlen($lf)) . $this->suffix . $lf; } return $this->read(); } } return $ch; }
php
public function read($len = null) { if (!$this->getInitialized()) { $this->_initialize(); $this->setInitialized(true); } $ch = -1; if ($this->queuedData !== null && $this->queuedData === '') { $this->queuedData = null; } if ($this->queuedData !== null) { $ch = $this->queuedData[0]; $this->queuedData = substr($this->queuedData, 1); if ($this->queuedData === '') { $this->queuedData = null; } } else { $this->queuedData = $this->readLine(); if ($this->queuedData === null) { $ch = -1; } else { if ($this->suffix !== null) { $lf = ''; if (StringHelper::endsWith($this->queuedData, "\r\n")) { $lf = "\r\n"; } elseif (StringHelper::endsWith($this->queuedData, "\n")) { $lf = "\n"; } $this->queuedData = substr($this->queuedData, 0, strlen($this->queuedData) - strlen($lf)) . $this->suffix . $lf; } return $this->read(); } } return $ch; }
[ "public", "function", "read", "(", "$", "len", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "getInitialized", "(", ")", ")", "{", "$", "this", "->", "_initialize", "(", ")", ";", "$", "this", "->", "setInitialized", "(", "true", ")", ...
Adds a suffix to each line of input stream and returns resulting stream. @param null $len @return mixed buffer, -1 on EOF
[ "Adds", "a", "suffix", "to", "each", "line", "of", "input", "stream", "and", "returns", "resulting", "stream", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/SuffixLines.php#L61-L98
train
phingofficial/phing
classes/phing/types/FileList.php
FileList.setRefid
public function setRefid(Reference $r) { if ($this->dir !== null || count($this->filenames) !== 0) { throw $this->tooManyAttributes(); } parent::setRefid($r); }
php
public function setRefid(Reference $r) { if ($this->dir !== null || count($this->filenames) !== 0) { throw $this->tooManyAttributes(); } parent::setRefid($r); }
[ "public", "function", "setRefid", "(", "Reference", "$", "r", ")", "{", "if", "(", "$", "this", "->", "dir", "!==", "null", "||", "count", "(", "$", "this", "->", "filenames", ")", "!==", "0", ")", "{", "throw", "$", "this", "->", "tooManyAttributes"...
Makes this instance in effect a reference to another FileList instance. @param Reference $r @throws BuildException
[ "Makes", "this", "instance", "in", "effect", "a", "reference", "to", "another", "FileList", "instance", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/FileList.php#L84-L90
train
phingofficial/phing
classes/phing/types/FileList.php
FileList.setDir
public function setDir(PhingFile $dir) { if ($this->isReference()) { throw $this->tooManyAttributes(); } if (!($dir instanceof PhingFile)) { $dir = new PhingFile($dir); } $this->dir = $dir; }
php
public function setDir(PhingFile $dir) { if ($this->isReference()) { throw $this->tooManyAttributes(); } if (!($dir instanceof PhingFile)) { $dir = new PhingFile($dir); } $this->dir = $dir; }
[ "public", "function", "setDir", "(", "PhingFile", "$", "dir", ")", "{", "if", "(", "$", "this", "->", "isReference", "(", ")", ")", "{", "throw", "$", "this", "->", "tooManyAttributes", "(", ")", ";", "}", "if", "(", "!", "(", "$", "dir", "instance...
Base directory for files in list. @param PhingFile $dir @throws BuildException
[ "Base", "directory", "for", "files", "in", "list", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/FileList.php#L98-L107
train
phingofficial/phing
classes/phing/types/FileList.php
FileList.getDir
public function getDir(Project $p) { if ($this->isReference()) { $ref = $this->getRef($p); return $ref->getDir($p); } return $this->dir; }
php
public function getDir(Project $p) { if ($this->isReference()) { $ref = $this->getRef($p); return $ref->getDir($p); } return $this->dir; }
[ "public", "function", "getDir", "(", "Project", "$", "p", ")", "{", "if", "(", "$", "this", "->", "isReference", "(", ")", ")", "{", "$", "ref", "=", "$", "this", "->", "getRef", "(", "$", "p", ")", ";", "return", "$", "ref", "->", "getDir", "(...
Get the basedir for files in list. @param Project $p @throws BuildException @return PhingFile
[ "Get", "the", "basedir", "for", "files", "in", "list", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/FileList.php#L116-L125
train
phingofficial/phing
classes/phing/types/FileList.php
FileList.setFiles
public function setFiles($filenames) { if ($this->isReference()) { throw $this->tooManyAttributes(); } if (!empty($filenames)) { $tok = strtok($filenames, ", \t\n\r"); while ($tok !== false) { $fname = trim($tok); if ($fname !== "") { $this->filenames[] = $tok; } $tok = strtok(", \t\n\r"); } } }
php
public function setFiles($filenames) { if ($this->isReference()) { throw $this->tooManyAttributes(); } if (!empty($filenames)) { $tok = strtok($filenames, ", \t\n\r"); while ($tok !== false) { $fname = trim($tok); if ($fname !== "") { $this->filenames[] = $tok; } $tok = strtok(", \t\n\r"); } } }
[ "public", "function", "setFiles", "(", "$", "filenames", ")", "{", "if", "(", "$", "this", "->", "isReference", "(", ")", ")", "{", "throw", "$", "this", "->", "tooManyAttributes", "(", ")", ";", "}", "if", "(", "!", "empty", "(", "$", "filenames", ...
Set the array of files in list. @param array $filenames @throws BuildException
[ "Set", "the", "array", "of", "files", "in", "list", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/FileList.php#L133-L148
train
phingofficial/phing
classes/phing/types/FileList.php
FileList.getListFile
public function getListFile(Project $p) { if ($this->isReference()) { $ref = $this->getRef($p); return $ref->getListFile($p); } return $this->listfile; }
php
public function getListFile(Project $p) { if ($this->isReference()) { $ref = $this->getRef($p); return $ref->getListFile($p); } return $this->listfile; }
[ "public", "function", "getListFile", "(", "Project", "$", "p", ")", "{", "if", "(", "$", "this", "->", "isReference", "(", ")", ")", "{", "$", "ref", "=", "$", "this", "->", "getRef", "(", "$", "p", ")", ";", "return", "$", "ref", "->", "getListF...
Get the source "list" file that contains file names. @param Project $p @return PhingFile
[ "Get", "the", "source", "list", "file", "that", "contains", "file", "names", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/FileList.php#L173-L182
train
phingofficial/phing
classes/phing/types/FileList.php
FileList.getFiles
public function getFiles(Project $p) { if ($this->isReference()) { $ret = $this->getRef($p); $ret = $ret->getFiles($p); return $ret; } if ($this->listfile !== null) { $this->readListFile($p); } return $this->filenames; }
php
public function getFiles(Project $p) { if ($this->isReference()) { $ret = $this->getRef($p); $ret = $ret->getFiles($p); return $ret; } if ($this->listfile !== null) { $this->readListFile($p); } return $this->filenames; }
[ "public", "function", "getFiles", "(", "Project", "$", "p", ")", "{", "if", "(", "$", "this", "->", "isReference", "(", ")", ")", "{", "$", "ret", "=", "$", "this", "->", "getRef", "(", "$", "p", ")", ";", "$", "ret", "=", "$", "ret", "->", "...
Returns the list of files represented by this FileList. @param Project $p @return array
[ "Returns", "the", "list", "of", "files", "represented", "by", "this", "FileList", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/FileList.php#L190-L204
train
phingofficial/phing
classes/phing/types/FileList.php
FileList.readListFile
private function readListFile(Project $p) { $listReader = null; try { // Get a FileReader $listReader = new BufferedReader(new FileReader($this->listfile)); $line = $listReader->readLine(); while ($line !== null) { if (!empty($line)) { $line = $p->replaceProperties($line); $this->filenames[] = trim($line); } $line = $listReader->readLine(); } } catch (Exception $e) { if ($listReader) { $listReader->close(); } throw new BuildException( "An error occurred while reading from list file " . $this->listfile->__toString() . ": " . $e->getMessage() ); } $listReader->close(); }
php
private function readListFile(Project $p) { $listReader = null; try { // Get a FileReader $listReader = new BufferedReader(new FileReader($this->listfile)); $line = $listReader->readLine(); while ($line !== null) { if (!empty($line)) { $line = $p->replaceProperties($line); $this->filenames[] = trim($line); } $line = $listReader->readLine(); } } catch (Exception $e) { if ($listReader) { $listReader->close(); } throw new BuildException( "An error occurred while reading from list file " . $this->listfile->__toString() . ": " . $e->getMessage() ); } $listReader->close(); }
[ "private", "function", "readListFile", "(", "Project", "$", "p", ")", "{", "$", "listReader", "=", "null", ";", "try", "{", "// Get a FileReader", "$", "listReader", "=", "new", "BufferedReader", "(", "new", "FileReader", "(", "$", "this", "->", "listfile", ...
Reads file names from a file and adds them to the files array. @param Project $p @throws BuildException
[ "Reads", "file", "names", "from", "a", "file", "and", "adds", "them", "to", "the", "files", "array", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/FileList.php#L229-L254
train
phingofficial/phing
classes/phing/filters/TranslateGettext.php
TranslateGettext.xlateStringCallback
private function xlateStringCallback($matches) { $charbefore = $matches[1]; $msgid = $matches[2]; $translated = gettext($msgid); $this->log("Translating \"$msgid\" => \"$translated\"", Project::MSG_DEBUG); return $charbefore . '"' . $translated . '"'; }
php
private function xlateStringCallback($matches) { $charbefore = $matches[1]; $msgid = $matches[2]; $translated = gettext($msgid); $this->log("Translating \"$msgid\" => \"$translated\"", Project::MSG_DEBUG); return $charbefore . '"' . $translated . '"'; }
[ "private", "function", "xlateStringCallback", "(", "$", "matches", ")", "{", "$", "charbefore", "=", "$", "matches", "[", "1", "]", ";", "$", "msgid", "=", "$", "matches", "[", "2", "]", ";", "$", "translated", "=", "gettext", "(", "$", "msgid", ")",...
Performs gettext translation of msgid and returns translated text. This function simply wraps gettext() call, but provides ability to log string replacements. (alternative would be using preg_replace with /e which would probably be faster, but no ability to debug/log.) @param array $matches Array of matches; we're interested in $matches[2]. @return string Translated text
[ "Performs", "gettext", "translation", "of", "msgid", "and", "returns", "translated", "text", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/TranslateGettext.php#L197-L205
train
phingofficial/phing
classes/phing/filters/TranslateGettext.php
TranslateGettext.read
public function read($len = null) { if (!$this->getInitialized()) { $this->_initialize(); $this->setInitialized(true); } // Make sure correct params/attribs have been set $this->checkAttributes(); $buffer = $this->in->read($len); if ($buffer === -1) { return -1; } // Setup the locale/gettext environment $this->initEnvironment(); // replace any occurrences of _("") or gettext("") with // the translated value. // // ([^\w]|^)_\("((\\"|[^"])*)"\) // --$1--- -----$2---- // ---$3-- [match escaped quotes or any char that's not a quote] // // also match gettext() -- same as above $buffer = preg_replace_callback( '/(\W|^)_\("((\\\"|[^"])*)"\)/', [$this, 'xlateStringCallback'], $buffer ); $buffer = preg_replace_callback( '/(\W|^)gettext\("((\\\"|[^"])*)"\)/', [$this, 'xlateStringCallback'], $buffer ); // Check to see if there are any _('') calls and flag an error // Check to see if there are any unmatched gettext() calls -- and flag an error $matches = []; if (preg_match('/(\W|^)(gettext\([^\)]+\))/', $buffer, $matches)) { $this->log("Unable to perform translation on: " . $matches[2], Project::MSG_WARN); } $this->restoreEnvironment(); return $buffer; }
php
public function read($len = null) { if (!$this->getInitialized()) { $this->_initialize(); $this->setInitialized(true); } // Make sure correct params/attribs have been set $this->checkAttributes(); $buffer = $this->in->read($len); if ($buffer === -1) { return -1; } // Setup the locale/gettext environment $this->initEnvironment(); // replace any occurrences of _("") or gettext("") with // the translated value. // // ([^\w]|^)_\("((\\"|[^"])*)"\) // --$1--- -----$2---- // ---$3-- [match escaped quotes or any char that's not a quote] // // also match gettext() -- same as above $buffer = preg_replace_callback( '/(\W|^)_\("((\\\"|[^"])*)"\)/', [$this, 'xlateStringCallback'], $buffer ); $buffer = preg_replace_callback( '/(\W|^)gettext\("((\\\"|[^"])*)"\)/', [$this, 'xlateStringCallback'], $buffer ); // Check to see if there are any _('') calls and flag an error // Check to see if there are any unmatched gettext() calls -- and flag an error $matches = []; if (preg_match('/(\W|^)(gettext\([^\)]+\))/', $buffer, $matches)) { $this->log("Unable to perform translation on: " . $matches[2], Project::MSG_WARN); } $this->restoreEnvironment(); return $buffer; }
[ "public", "function", "read", "(", "$", "len", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "getInitialized", "(", ")", ")", "{", "$", "this", "->", "_initialize", "(", ")", ";", "$", "this", "->", "setInitialized", "(", "true", ")", ...
Returns the filtered stream. The original stream is first read in fully, and then translation is performed. @param null $len @throws BuildException @return mixed the filtered stream, or -1 if the end of the resulting stream has been reached.
[ "Returns", "the", "filtered", "stream", ".", "The", "original", "stream", "is", "first", "read", "in", "fully", "and", "then", "translation", "is", "performed", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/TranslateGettext.php#L215-L266
train
phingofficial/phing
classes/phing/filters/TranslateGettext.php
TranslateGettext.chain
public function chain(Reader $reader) { $newFilter = new TranslateGettext($reader); $newFilter->setProject($this->getProject()); $newFilter->setDomain($this->getDomain()); $newFilter->setLocale($this->getLocale()); $newFilter->setDir($this->getDir()); return $newFilter; }
php
public function chain(Reader $reader) { $newFilter = new TranslateGettext($reader); $newFilter->setProject($this->getProject()); $newFilter->setDomain($this->getDomain()); $newFilter->setLocale($this->getLocale()); $newFilter->setDir($this->getDir()); return $newFilter; }
[ "public", "function", "chain", "(", "Reader", "$", "reader", ")", "{", "$", "newFilter", "=", "new", "TranslateGettext", "(", "$", "reader", ")", ";", "$", "newFilter", "->", "setProject", "(", "$", "this", "->", "getProject", "(", ")", ")", ";", "$", ...
Creates a new TranslateGettext 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 TranslateGettext A new filter based on this configuration, but filtering the specified reader
[ "Creates", "a", "new", "TranslateGettext", "filter", "using", "the", "passed", "in", "Reader", "for", "instantiation", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/TranslateGettext.php#L278-L287
train
phingofficial/phing
classes/phing/filters/TranslateGettext.php
TranslateGettext._initialize
private function _initialize() { $params = $this->getParameters(); if ($params !== null) { foreach ($params as $param) { switch ($param->getType()) { case self::DOMAIN_KEY: $this->setDomain($param->getValue()); break; case self::DIR_KEY: $this->setDir($this->project->resolveFile($param->getValue())); break; case self::LOCALE_KEY: $this->setLocale($param->getValue()); break; } // switch } } // if params !== null }
php
private function _initialize() { $params = $this->getParameters(); if ($params !== null) { foreach ($params as $param) { switch ($param->getType()) { case self::DOMAIN_KEY: $this->setDomain($param->getValue()); break; case self::DIR_KEY: $this->setDir($this->project->resolveFile($param->getValue())); break; case self::LOCALE_KEY: $this->setLocale($param->getValue()); break; } // switch } } // if params !== null }
[ "private", "function", "_initialize", "(", ")", "{", "$", "params", "=", "$", "this", "->", "getParameters", "(", ")", ";", "if", "(", "$", "params", "!==", "null", ")", "{", "foreach", "(", "$", "params", "as", "$", "param", ")", "{", "switch", "(...
Parses the parameters if this filter is being used in "generic" mode.
[ "Parses", "the", "parameters", "if", "this", "filter", "is", "being", "used", "in", "generic", "mode", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/TranslateGettext.php#L292-L311
train
phingofficial/phing
classes/phing/system/io/YamlFileParser.php
YamlFileParser.flattenArray
private function flattenArray(array $arrayToFlatten, $separator = '.', $flattenedKey = '') { $flattenedArray = []; foreach ($arrayToFlatten as $key => $value) { $tmpFlattendKey = (!empty($flattenedKey) ? $flattenedKey . $separator : '') . $key; // only append next value if is array and is an associative array if (is_array($value) && array_keys($value) !== range(0, count($value) - 1)) { $flattenedArray = array_merge( $flattenedArray, $this->flattenArray( $value, $separator, $tmpFlattendKey ) ); } else { $flattenedArray[$tmpFlattendKey] = $value; } } return $flattenedArray; }
php
private function flattenArray(array $arrayToFlatten, $separator = '.', $flattenedKey = '') { $flattenedArray = []; foreach ($arrayToFlatten as $key => $value) { $tmpFlattendKey = (!empty($flattenedKey) ? $flattenedKey . $separator : '') . $key; // only append next value if is array and is an associative array if (is_array($value) && array_keys($value) !== range(0, count($value) - 1)) { $flattenedArray = array_merge( $flattenedArray, $this->flattenArray( $value, $separator, $tmpFlattendKey ) ); } else { $flattenedArray[$tmpFlattendKey] = $value; } } return $flattenedArray; }
[ "private", "function", "flattenArray", "(", "array", "$", "arrayToFlatten", ",", "$", "separator", "=", "'.'", ",", "$", "flattenedKey", "=", "''", ")", "{", "$", "flattenedArray", "=", "[", "]", ";", "foreach", "(", "$", "arrayToFlatten", "as", "$", "ke...
Flattens an array to key => value. @todo: milo - 20142901 - If you plan to extend phing and add a new fileparser, please move this to an abstract class. @param array $arrayToFlatten
[ "Flattens", "an", "array", "to", "key", "=", ">", "value", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/YamlFileParser.php#L74-L94
train
phingofficial/phing
classes/phing/filters/LineContainsRegexp.php
LineContainsRegexp.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); $matched = []; $regexpsSize = count($this->_regexps); foreach ($lines as $line) { for ($i = 0; $i < $regexpsSize; $i++) { $regexp = $this->_regexps[$i]; $re = $regexp->getRegexp($this->getProject()); $re->setIgnoreCase(!$this->casesensitive); $matches = $re->matches($line); if (!$matches) { $line = null; break; } } if ($line !== null) { $matched[] = $line; } } $filtered_buffer = implode("\n", $matched); if ($this->isNegated()) { $filtered_buffer = implode("\n", array_diff($lines, $matched)); } 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); $matched = []; $regexpsSize = count($this->_regexps); foreach ($lines as $line) { for ($i = 0; $i < $regexpsSize; $i++) { $regexp = $this->_regexps[$i]; $re = $regexp->getRegexp($this->getProject()); $re->setIgnoreCase(!$this->casesensitive); $matches = $re->matches($line); if (!$matches) { $line = null; break; } } if ($line !== null) { $matched[] = $line; } } $filtered_buffer = implode("\n", $matched); if ($this->isNegated()) { $filtered_buffer = implode("\n", array_diff($lines, $matched)); } return $filtered_buffer; }
[ "public", "function", "read", "(", "$", "len", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "getInitialized", "(", ")", ")", "{", "$", "this", "->", "_initialize", "(", ")", ";", "$", "this", "->", "setInitialized", "(", "true", ")", ...
Returns all lines in a buffer that contain specified strings. @param null $len @return mixed buffer, -1 on EOF
[ "Returns", "all", "lines", "in", "a", "buffer", "that", "contain", "specified", "strings", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/LineContainsRegexp.php#L77-L116
train
phingofficial/phing
classes/phing/filters/LineContainsRegexp.php
LineContainsRegexp.setRegexp
public function setRegexp($pattern) { $regexp = new RegularExpression(); $regexp->setPattern($pattern); $this->_regexps[] = $regexp; }
php
public function setRegexp($pattern) { $regexp = new RegularExpression(); $regexp->setPattern($pattern); $this->_regexps[] = $regexp; }
[ "public", "function", "setRegexp", "(", "$", "pattern", ")", "{", "$", "regexp", "=", "new", "RegularExpression", "(", ")", ";", "$", "regexp", "->", "setPattern", "(", "$", "pattern", ")", ";", "$", "this", "->", "_regexps", "[", "]", "=", "$", "reg...
Set the regular expression as an attribute.
[ "Set", "the", "regular", "expression", "as", "an", "attribute", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/LineContainsRegexp.php#L206-L211
train
phingofficial/phing
classes/phing/filters/LineContainsRegexp.php
LineContainsRegexp.chain
public function chain(Reader $reader) { $newFilter = new LineContainsRegExp($reader); $newFilter->setRegexps($this->getRegexps()); $newFilter->setNegate($this->isNegated()); $newFilter->setCaseSensitive($this->isCaseSensitive()); $newFilter->setInitialized(true); $newFilter->setProject($this->getProject()); return $newFilter; }
php
public function chain(Reader $reader) { $newFilter = new LineContainsRegExp($reader); $newFilter->setRegexps($this->getRegexps()); $newFilter->setNegate($this->isNegated()); $newFilter->setCaseSensitive($this->isCaseSensitive()); $newFilter->setInitialized(true); $newFilter->setProject($this->getProject()); return $newFilter; }
[ "public", "function", "chain", "(", "Reader", "$", "reader", ")", "{", "$", "newFilter", "=", "new", "LineContainsRegExp", "(", "$", "reader", ")", ";", "$", "newFilter", "->", "setRegexps", "(", "$", "this", "->", "getRegexps", "(", ")", ")", ";", "$"...
Creates a new LineContainsRegExp using the passed in Reader for instantiation. @param Reader $reader @throws Exception @internal param A $object Reader object providing the underlying stream. Must not be <code>null</code>. @return object A new filter based on this configuration, but filtering the specified reader
[ "Creates", "a", "new", "LineContainsRegExp", "using", "the", "passed", "in", "Reader", "for", "instantiation", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/LineContainsRegexp.php#L225-L235
train
phingofficial/phing
classes/phing/filters/LineContainsRegexp.php
LineContainsRegexp._initialize
private function _initialize() { $params = $this->getParameters(); if ($params !== null) { for ($i = 0, $paramsCount = count($params); $i < $paramsCount; $i++) { if (self::REGEXP_KEY === $params[$i]->getType()) { $pattern = $params[$i]->getValue(); $regexp = new RegularExpression(); $regexp->setPattern($pattern); $this->_regexps[] = $regexp; } elseif (self::NEGATE_KEY === $params[$i]->getType()) { $this->setNegate(Project::toBoolean($params[$i]->getValue())); } elseif (self::CS_KEY === $params[$i]->getType()) { $this->setCaseSensitive(Project::toBoolean($params[$i]->getValue())); } } } }
php
private function _initialize() { $params = $this->getParameters(); if ($params !== null) { for ($i = 0, $paramsCount = count($params); $i < $paramsCount; $i++) { if (self::REGEXP_KEY === $params[$i]->getType()) { $pattern = $params[$i]->getValue(); $regexp = new RegularExpression(); $regexp->setPattern($pattern); $this->_regexps[] = $regexp; } elseif (self::NEGATE_KEY === $params[$i]->getType()) { $this->setNegate(Project::toBoolean($params[$i]->getValue())); } elseif (self::CS_KEY === $params[$i]->getType()) { $this->setCaseSensitive(Project::toBoolean($params[$i]->getValue())); } } } }
[ "private", "function", "_initialize", "(", ")", "{", "$", "params", "=", "$", "this", "->", "getParameters", "(", ")", ";", "if", "(", "$", "params", "!==", "null", ")", "{", "for", "(", "$", "i", "=", "0", ",", "$", "paramsCount", "=", "count", ...
Parses parameters to add user defined regular expressions.
[ "Parses", "parameters", "to", "add", "user", "defined", "regular", "expressions", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/LineContainsRegexp.php#L240-L257
train
phingofficial/phing
classes/phing/tasks/system/RecorderTask.php
RecorderTask.main
public function main() { if ($this->filename == null) { throw new BuildException("No filename specified"); } $this->getProject()->log("setting a recorder for name " . $this->filename, Project::MSG_DEBUG); // get the recorder entry $recorder = $this->getRecorder($this->filename, $this->getProject()); // set the values on the recorder if ($this->loglevel === -1) { $recorder->setMessageOutputLevel($this->loglevel); } elseif (isset($this->logLevelChoices[$this->loglevel])) { $recorder->setMessageOutputLevel($this->logLevelChoices[$this->loglevel]); } else { throw new BuildException('Loglevel should be one of (error|warn|info|verbose|debug).'); } $recorder->setEmacsMode(StringHelper::booleanValue($this->emacsMode)); if ($this->start != null) { if (StringHelper::booleanValue($this->start)) { $recorder->reopenFile(); $recorder->setRecordState($this->start); } else { $recorder->setRecordState($this->start); $recorder->closeFile(); } } }
php
public function main() { if ($this->filename == null) { throw new BuildException("No filename specified"); } $this->getProject()->log("setting a recorder for name " . $this->filename, Project::MSG_DEBUG); // get the recorder entry $recorder = $this->getRecorder($this->filename, $this->getProject()); // set the values on the recorder if ($this->loglevel === -1) { $recorder->setMessageOutputLevel($this->loglevel); } elseif (isset($this->logLevelChoices[$this->loglevel])) { $recorder->setMessageOutputLevel($this->logLevelChoices[$this->loglevel]); } else { throw new BuildException('Loglevel should be one of (error|warn|info|verbose|debug).'); } $recorder->setEmacsMode(StringHelper::booleanValue($this->emacsMode)); if ($this->start != null) { if (StringHelper::booleanValue($this->start)) { $recorder->reopenFile(); $recorder->setRecordState($this->start); } else { $recorder->setRecordState($this->start); $recorder->closeFile(); } } }
[ "public", "function", "main", "(", ")", "{", "if", "(", "$", "this", "->", "filename", "==", "null", ")", "{", "throw", "new", "BuildException", "(", "\"No filename specified\"", ")", ";", "}", "$", "this", "->", "getProject", "(", ")", "->", "log", "(...
The main execution. @throws BuildException on error
[ "The", "main", "execution", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/RecorderTask.php#L142-L171
train
phingofficial/phing
classes/phing/tasks/system/RecorderTask.php
RecorderTask.getRecorder
protected function getRecorder($name, Project $proj) { // create a recorder entry $entry = isset(self::$recorderEntries[$name]) ? self::$recorderEntries[$name] : new RecorderEntry($name); if ($this->append == null) { $entry->openFile(false); } else { $entry->openFile(StringHelper::booleanValue($this->append)); } $entry->setProject($proj); self::$recorderEntries[$name] = $entry; return $entry; }
php
protected function getRecorder($name, Project $proj) { // create a recorder entry $entry = isset(self::$recorderEntries[$name]) ? self::$recorderEntries[$name] : new RecorderEntry($name); if ($this->append == null) { $entry->openFile(false); } else { $entry->openFile(StringHelper::booleanValue($this->append)); } $entry->setProject($proj); self::$recorderEntries[$name] = $entry; return $entry; }
[ "protected", "function", "getRecorder", "(", "$", "name", ",", "Project", "$", "proj", ")", "{", "// create a recorder entry", "$", "entry", "=", "isset", "(", "self", "::", "$", "recorderEntries", "[", "$", "name", "]", ")", "?", "self", "::", "$", "rec...
Gets the recorder that's associated with the passed in name. If the recorder doesn't exist, then a new one is created. @param string $name the name of the recorder @param Project $proj the current project @return RecorderEntry a recorder @throws BuildException on error
[ "Gets", "the", "recorder", "that", "s", "associated", "with", "the", "passed", "in", "name", ".", "If", "the", "recorder", "doesn", "t", "exist", "then", "a", "new", "one", "is", "created", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/RecorderTask.php#L182-L196
train
phingofficial/phing
classes/phing/tasks/system/RecorderTask.php
RecorderTask.cleanup
private function cleanup() { $entries = self::$recorderEntries; foreach ($entries as $key => $entry) { if ($entry->getProject() == $this->getProject()) { unset(self::$recorderEntries[$key]); } } $this->getProject()->removeBuildListener($this); }
php
private function cleanup() { $entries = self::$recorderEntries; foreach ($entries as $key => $entry) { if ($entry->getProject() == $this->getProject()) { unset(self::$recorderEntries[$key]); } } $this->getProject()->removeBuildListener($this); }
[ "private", "function", "cleanup", "(", ")", "{", "$", "entries", "=", "self", "::", "$", "recorderEntries", ";", "foreach", "(", "$", "entries", "as", "$", "key", "=>", "$", "entry", ")", "{", "if", "(", "$", "entry", "->", "getProject", "(", ")", ...
cleans recorder registry and removes itself from BuildListener list.
[ "cleans", "recorder", "registry", "and", "removes", "itself", "from", "BuildListener", "list", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/RecorderTask.php#L287-L296
train
phingofficial/phing
classes/phing/tasks/ext/XmlLintTask.php
XmlLintTask.main
public function main() { if (isset($this->schema) && !file_exists($this->schema->getPath())) { throw new BuildException("Schema file not found: " . $this->schema->getPath()); } if (!isset($this->file) and count($this->filesets) == 0) { throw new BuildException("Missing either a nested fileset or attribute 'file' set"); } set_error_handler([$this, 'errorHandler']); if ($this->file instanceof PhingFile) { $this->lint($this->file->getPath()); } else { // process filesets $project = $this->getProject(); foreach ($this->filesets as $fs) { $ds = $fs->getDirectoryScanner($project); $files = $ds->getIncludedFiles(); $dir = $fs->getDir($this->project)->getPath(); foreach ($files as $file) { $this->lint($dir . DIRECTORY_SEPARATOR . $file); } } } restore_error_handler(); }
php
public function main() { if (isset($this->schema) && !file_exists($this->schema->getPath())) { throw new BuildException("Schema file not found: " . $this->schema->getPath()); } if (!isset($this->file) and count($this->filesets) == 0) { throw new BuildException("Missing either a nested fileset or attribute 'file' set"); } set_error_handler([$this, 'errorHandler']); if ($this->file instanceof PhingFile) { $this->lint($this->file->getPath()); } else { // process filesets $project = $this->getProject(); foreach ($this->filesets as $fs) { $ds = $fs->getDirectoryScanner($project); $files = $ds->getIncludedFiles(); $dir = $fs->getDir($this->project)->getPath(); foreach ($files as $file) { $this->lint($dir . DIRECTORY_SEPARATOR . $file); } } } restore_error_handler(); }
[ "public", "function", "main", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "schema", ")", "&&", "!", "file_exists", "(", "$", "this", "->", "schema", "->", "getPath", "(", ")", ")", ")", "{", "throw", "new", "BuildException", "(", "\"...
Execute lint check against PhingFile or a FileSet. {@inheritdoc} @throws BuildException @return void
[ "Execute", "lint", "check", "against", "PhingFile", "or", "a", "FileSet", "." ]
4b1797694dc65505af496ca2e1a3470efb9e35e1
https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/XmlLintTask.php#L88-L112
train