repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
caxy/php-htmldiff
lib/Caxy/HtmlDiff/Table/TableDiff.php
TableDiff.parseTableStructure
protected function parseTableStructure($text) { $dom = $this->createDocumentWithHtml($text); $tableNode = $dom->getElementsByTagName('table')->item(0); $table = new Table($tableNode); $this->parseTable($table); return $table; }
php
protected function parseTableStructure($text) { $dom = $this->createDocumentWithHtml($text); $tableNode = $dom->getElementsByTagName('table')->item(0); $table = new Table($tableNode); $this->parseTable($table); return $table; }
[ "protected", "function", "parseTableStructure", "(", "$", "text", ")", "{", "$", "dom", "=", "$", "this", "->", "createDocumentWithHtml", "(", "$", "text", ")", ";", "$", "tableNode", "=", "$", "dom", "->", "getElementsByTagName", "(", "'table'", ")", "->"...
@param string $text @return Table
[ "@param", "string", "$text" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/TableDiff.php#L644-L655
caxy/php-htmldiff
lib/Caxy/HtmlDiff/Table/TableDiff.php
TableDiff.getInnerHtml
protected function getInnerHtml($node) { $innerHtml = ''; $children = $node->childNodes; foreach ($children as $child) { $innerHtml .= $this->htmlFromNode($child); } return $innerHtml; }
php
protected function getInnerHtml($node) { $innerHtml = ''; $children = $node->childNodes; foreach ($children as $child) { $innerHtml .= $this->htmlFromNode($child); } return $innerHtml; }
[ "protected", "function", "getInnerHtml", "(", "$", "node", ")", "{", "$", "innerHtml", "=", "''", ";", "$", "children", "=", "$", "node", "->", "childNodes", ";", "foreach", "(", "$", "children", "as", "$", "child", ")", "{", "$", "innerHtml", ".=", ...
@param \DOMNode $node @return string
[ "@param", "\\", "DOMNode", "$node" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/TableDiff.php#L703-L713
caxy/php-htmldiff
lib/Caxy/HtmlDiff/Table/TableDiff.php
TableDiff.htmlFromNode
protected function htmlFromNode($node) { $domDocument = new \DOMDocument(); $newNode = $domDocument->importNode($node, true); $domDocument->appendChild($newNode); return $domDocument->saveHTML(); }
php
protected function htmlFromNode($node) { $domDocument = new \DOMDocument(); $newNode = $domDocument->importNode($node, true); $domDocument->appendChild($newNode); return $domDocument->saveHTML(); }
[ "protected", "function", "htmlFromNode", "(", "$", "node", ")", "{", "$", "domDocument", "=", "new", "\\", "DOMDocument", "(", ")", ";", "$", "newNode", "=", "$", "domDocument", "->", "importNode", "(", "$", "node", ",", "true", ")", ";", "$", "domDocu...
@param \DOMNode $node @return string
[ "@param", "\\", "DOMNode", "$node" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/TableDiff.php#L720-L727
caxy/php-htmldiff
lib/Caxy/HtmlDiff/Table/TableDiff.php
TableDiff.diffCellsAndIncrementCounters
protected function diffCellsAndIncrementCounters( $oldCell, $newCell, &$cellsWithMultipleRows, $diffRow, DiffRowPosition $position, $usingExtraRow = false ) { $diffCell = $this->diffCells($oldCell, $newCell, $usingExtraRow); // Store cell in appliedRow...
php
protected function diffCellsAndIncrementCounters( $oldCell, $newCell, &$cellsWithMultipleRows, $diffRow, DiffRowPosition $position, $usingExtraRow = false ) { $diffCell = $this->diffCells($oldCell, $newCell, $usingExtraRow); // Store cell in appliedRow...
[ "protected", "function", "diffCellsAndIncrementCounters", "(", "$", "oldCell", ",", "$", "newCell", ",", "&", "$", "cellsWithMultipleRows", ",", "$", "diffRow", ",", "DiffRowPosition", "$", "position", ",", "$", "usingExtraRow", "=", "false", ")", "{", "$", "d...
@param null|TableCell $oldCell @param null|TableCell $newCell @param array $cellsWithMultipleRows @param \DOMElement $diffRow @param DiffRowPosition $position @param bool $usingExtraRow @return \DOMElement
[ "@param", "null|TableCell", "$oldCell", "@param", "null|TableCell", "$newCell", "@param", "array", "$cellsWithMultipleRows", "@param", "\\", "DOMElement", "$diffRow", "@param", "DiffRowPosition", "$position", "@param", "bool", "$usingExtraRow" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/TableDiff.php#L811-L837
caxy/php-htmldiff
lib/Caxy/HtmlDiff/Table/TableDiff.php
TableDiff.getMatchPercentage
protected function getMatchPercentage(TableRow $oldRow, TableRow $newRow, $oldIndex, $newIndex) { $firstCellWeight = 1.5; $indexDeltaWeight = 0.25 * (abs($oldIndex - $newIndex)); $thresholdCount = 0; $minCells = min(count($newRow->getCells()), count($oldRow->getCells())); $to...
php
protected function getMatchPercentage(TableRow $oldRow, TableRow $newRow, $oldIndex, $newIndex) { $firstCellWeight = 1.5; $indexDeltaWeight = 0.25 * (abs($oldIndex - $newIndex)); $thresholdCount = 0; $minCells = min(count($newRow->getCells()), count($oldRow->getCells())); $to...
[ "protected", "function", "getMatchPercentage", "(", "TableRow", "$", "oldRow", ",", "TableRow", "$", "newRow", ",", "$", "oldIndex", ",", "$", "newIndex", ")", "{", "$", "firstCellWeight", "=", "1.5", ";", "$", "indexDeltaWeight", "=", "0.25", "*", "(", "a...
@param TableRow $oldRow @param TableRow $newRow @param int $oldIndex @param int $newIndex @return float|int
[ "@param", "TableRow", "$oldRow", "@param", "TableRow", "$newRow", "@param", "int", "$oldIndex", "@param", "int", "$newIndex" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/TableDiff.php#L869-L894
caxy/php-htmldiff
lib/Caxy/HtmlDiff/HtmlDiffConfig.php
HtmlDiffConfig.addSpecialCaseChar
public function addSpecialCaseChar($char) { if (!in_array($char, $this->specialCaseChars)) { $this->specialCaseChars[] = $char; } return $this; }
php
public function addSpecialCaseChar($char) { if (!in_array($char, $this->specialCaseChars)) { $this->specialCaseChars[] = $char; } return $this; }
[ "public", "function", "addSpecialCaseChar", "(", "$", "char", ")", "{", "if", "(", "!", "in_array", "(", "$", "char", ",", "$", "this", "->", "specialCaseChars", ")", ")", "{", "$", "this", "->", "specialCaseChars", "[", "]", "=", "$", "char", ";", "...
@param string $char @return $this
[ "@param", "string", "$char" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiffConfig.php#L145-L152
caxy/php-htmldiff
lib/Caxy/HtmlDiff/HtmlDiffConfig.php
HtmlDiffConfig.removeSpecialCaseChar
public function removeSpecialCaseChar($char) { $key = array_search($char, $this->specialCaseChars); if ($key !== false) { unset($this->specialCaseChars[$key]); } return $this; }
php
public function removeSpecialCaseChar($char) { $key = array_search($char, $this->specialCaseChars); if ($key !== false) { unset($this->specialCaseChars[$key]); } return $this; }
[ "public", "function", "removeSpecialCaseChar", "(", "$", "char", ")", "{", "$", "key", "=", "array_search", "(", "$", "char", ",", "$", "this", "->", "specialCaseChars", ")", ";", "if", "(", "$", "key", "!==", "false", ")", "{", "unset", "(", "$", "t...
@param string $char @return $this
[ "@param", "string", "$char" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiffConfig.php#L159-L167
caxy/php-htmldiff
lib/Caxy/HtmlDiff/HtmlDiffConfig.php
HtmlDiffConfig.setSpecialCaseTags
public function setSpecialCaseTags(array $tags = array()) { $this->specialCaseTags = $tags; $this->specialCaseOpeningTags = array(); $this->specialCaseClosingTags = array(); foreach ($this->specialCaseTags as $tag) { $this->addSpecialCaseTag($tag); } ret...
php
public function setSpecialCaseTags(array $tags = array()) { $this->specialCaseTags = $tags; $this->specialCaseOpeningTags = array(); $this->specialCaseClosingTags = array(); foreach ($this->specialCaseTags as $tag) { $this->addSpecialCaseTag($tag); } ret...
[ "public", "function", "setSpecialCaseTags", "(", "array", "$", "tags", "=", "array", "(", ")", ")", "{", "$", "this", "->", "specialCaseTags", "=", "$", "tags", ";", "$", "this", "->", "specialCaseOpeningTags", "=", "array", "(", ")", ";", "$", "this", ...
@param array $tags @return $this
[ "@param", "array", "$tags" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiffConfig.php#L174-L185
caxy/php-htmldiff
lib/Caxy/HtmlDiff/HtmlDiffConfig.php
HtmlDiffConfig.addSpecialCaseTag
public function addSpecialCaseTag($tag) { if (!in_array($tag, $this->specialCaseTags)) { $this->specialCaseTags[] = $tag; } $opening = $this->getOpeningTag($tag); $closing = $this->getClosingTag($tag); if (!in_array($opening, $this->specialCaseOpeningTags)) { ...
php
public function addSpecialCaseTag($tag) { if (!in_array($tag, $this->specialCaseTags)) { $this->specialCaseTags[] = $tag; } $opening = $this->getOpeningTag($tag); $closing = $this->getClosingTag($tag); if (!in_array($opening, $this->specialCaseOpeningTags)) { ...
[ "public", "function", "addSpecialCaseTag", "(", "$", "tag", ")", "{", "if", "(", "!", "in_array", "(", "$", "tag", ",", "$", "this", "->", "specialCaseTags", ")", ")", "{", "$", "this", "->", "specialCaseTags", "[", "]", "=", "$", "tag", ";", "}", ...
@param string $tag @return $this
[ "@param", "string", "$tag" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiffConfig.php#L192-L209
caxy/php-htmldiff
lib/Caxy/HtmlDiff/HtmlDiffConfig.php
HtmlDiffConfig.removeSpecialCaseTag
public function removeSpecialCaseTag($tag) { if (($key = array_search($tag, $this->specialCaseTags)) !== false) { unset($this->specialCaseTags[$key]); $opening = $this->getOpeningTag($tag); $closing = $this->getClosingTag($tag); if (($key = array_search($ope...
php
public function removeSpecialCaseTag($tag) { if (($key = array_search($tag, $this->specialCaseTags)) !== false) { unset($this->specialCaseTags[$key]); $opening = $this->getOpeningTag($tag); $closing = $this->getClosingTag($tag); if (($key = array_search($ope...
[ "public", "function", "removeSpecialCaseTag", "(", "$", "tag", ")", "{", "if", "(", "(", "$", "key", "=", "array_search", "(", "$", "tag", ",", "$", "this", "->", "specialCaseTags", ")", ")", "!==", "false", ")", "{", "unset", "(", "$", "this", "->",...
@param string $tag @return $this
[ "@param", "string", "$tag" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiffConfig.php#L216-L233
caxy/php-htmldiff
lib/Caxy/HtmlDiff/HtmlDiffConfig.php
HtmlDiffConfig.addIsolatedDiffTag
public function addIsolatedDiffTag($tag, $placeholder = null) { if (null === $placeholder) { $placeholder = sprintf('[[REPLACE_%s]]', mb_strtoupper($tag)); } if ($this->isIsolatedDiffTag($tag) && $this->isolatedDiffTags[$tag] !== $placeholder) { throw new \InvalidArg...
php
public function addIsolatedDiffTag($tag, $placeholder = null) { if (null === $placeholder) { $placeholder = sprintf('[[REPLACE_%s]]', mb_strtoupper($tag)); } if ($this->isIsolatedDiffTag($tag) && $this->isolatedDiffTags[$tag] !== $placeholder) { throw new \InvalidArg...
[ "public", "function", "addIsolatedDiffTag", "(", "$", "tag", ",", "$", "placeholder", "=", "null", ")", "{", "if", "(", "null", "===", "$", "placeholder", ")", "{", "$", "placeholder", "=", "sprintf", "(", "'[[REPLACE_%s]]'", ",", "mb_strtoupper", "(", "$"...
@param string $tag @param null|string $placeholder @return $this
[ "@param", "string", "$tag", "@param", "null|string", "$placeholder" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiffConfig.php#L345-L369
caxy/php-htmldiff
lib/Caxy/HtmlDiff/HtmlDiffConfig.php
HtmlDiffConfig.setCacheProvider
public function setCacheProvider(\Doctrine\Common\Cache\Cache $cacheProvider = null) { $this->cacheProvider = $cacheProvider; return $this; }
php
public function setCacheProvider(\Doctrine\Common\Cache\Cache $cacheProvider = null) { $this->cacheProvider = $cacheProvider; return $this; }
[ "public", "function", "setCacheProvider", "(", "\\", "Doctrine", "\\", "Common", "\\", "Cache", "\\", "Cache", "$", "cacheProvider", "=", "null", ")", "{", "$", "this", "->", "cacheProvider", "=", "$", "cacheProvider", ";", "return", "$", "this", ";", "}" ...
@param null|\Doctrine\Common\Cache\Cache $cacheProvider @return $this
[ "@param", "null|", "\\", "Doctrine", "\\", "Common", "\\", "Cache", "\\", "Cache", "$cacheProvider" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiffConfig.php#L456-L461
caxy/php-htmldiff
lib/Caxy/HtmlDiff/Table/DiffRowPosition.php
DiffRowPosition.incrementIndex
public function incrementIndex($type, $increment = 1) { if ($type === 'new') { return $this->incrementIndexInNew($increment); } return $this->incrementIndexInOld($increment); }
php
public function incrementIndex($type, $increment = 1) { if ($type === 'new') { return $this->incrementIndexInNew($increment); } return $this->incrementIndexInOld($increment); }
[ "public", "function", "incrementIndex", "(", "$", "type", ",", "$", "increment", "=", "1", ")", "{", "if", "(", "$", "type", "===", "'new'", ")", "{", "return", "$", "this", "->", "incrementIndexInNew", "(", "$", "increment", ")", ";", "}", "return", ...
@param string $type @param int $increment @return int
[ "@param", "string", "$type", "@param", "int", "$increment" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/DiffRowPosition.php#L180-L187
caxy/php-htmldiff
lib/Caxy/HtmlDiff/Table/DiffRowPosition.php
DiffRowPosition.incrementColumn
public function incrementColumn($type, $increment = 1) { if ($type === 'new') { return $this->incrementColumnInNew($increment); } return $this->incrementColumnInOld($increment); }
php
public function incrementColumn($type, $increment = 1) { if ($type === 'new') { return $this->incrementColumnInNew($increment); } return $this->incrementColumnInOld($increment); }
[ "public", "function", "incrementColumn", "(", "$", "type", ",", "$", "increment", "=", "1", ")", "{", "if", "(", "$", "type", "===", "'new'", ")", "{", "return", "$", "this", "->", "incrementColumnInNew", "(", "$", "increment", ")", ";", "}", "return",...
@param string $type @param int $increment @return int
[ "@param", "string", "$type", "@param", "int", "$increment" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/DiffRowPosition.php#L195-L202
caxy/php-htmldiff
lib/Caxy/HtmlDiff/Table/DiffRowPosition.php
DiffRowPosition.isColumnLessThanOther
public function isColumnLessThanOther($type) { if ($type === 'new') { return $this->getColumnInNew() < $this->getColumnInOld(); } return $this->getColumnInOld() < $this->getColumnInNew(); }
php
public function isColumnLessThanOther($type) { if ($type === 'new') { return $this->getColumnInNew() < $this->getColumnInOld(); } return $this->getColumnInOld() < $this->getColumnInNew(); }
[ "public", "function", "isColumnLessThanOther", "(", "$", "type", ")", "{", "if", "(", "$", "type", "===", "'new'", ")", "{", "return", "$", "this", "->", "getColumnInNew", "(", ")", "<", "$", "this", "->", "getColumnInOld", "(", ")", ";", "}", "return"...
@param string $type @return bool
[ "@param", "string", "$type" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/DiffRowPosition.php#L209-L216
caxy/php-htmldiff
lib/Caxy/HtmlDiff/LcsService.php
LcsService.longestCommonSubsequence
public function longestCommonSubsequence(array $a, array $b) { $c = array(); $m = count($a); $n = count($b); for ($i = 0; $i <= $m; $i++) { $c[$i][0] = 0; } for ($j = 0; $j <= $n; $j++) { $c[0][$j] = 0; } for ($i = 1; $i <= ...
php
public function longestCommonSubsequence(array $a, array $b) { $c = array(); $m = count($a); $n = count($b); for ($i = 0; $i <= $m; $i++) { $c[$i][0] = 0; } for ($j = 0; $j <= $n; $j++) { $c[0][$j] = 0; } for ($i = 1; $i <= ...
[ "public", "function", "longestCommonSubsequence", "(", "array", "$", "a", ",", "array", "$", "b", ")", "{", "$", "c", "=", "array", "(", ")", ";", "$", "m", "=", "count", "(", "$", "a", ")", ";", "$", "n", "=", "count", "(", "$", "b", ")", ";...
@param array $a @param array $b @return array
[ "@param", "array", "$a", "@param", "array", "$b" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/LcsService.php#L35-L67
caxy/php-htmldiff
lib/Caxy/HtmlDiff/DiffCache.php
DiffCache.contains
public function contains($oldText, $newText) { return $this->cacheProvider->contains($this->getHashKey($oldText, $newText)); }
php
public function contains($oldText, $newText) { return $this->cacheProvider->contains($this->getHashKey($oldText, $newText)); }
[ "public", "function", "contains", "(", "$", "oldText", ",", "$", "newText", ")", "{", "return", "$", "this", "->", "cacheProvider", "->", "contains", "(", "$", "this", "->", "getHashKey", "(", "$", "oldText", ",", "$", "newText", ")", ")", ";", "}" ]
@param string $oldText @param string $newText @return bool
[ "@param", "string", "$oldText", "@param", "string", "$newText" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/DiffCache.php#L53-L56
caxy/php-htmldiff
lib/Caxy/HtmlDiff/DiffCache.php
DiffCache.fetch
public function fetch($oldText, $newText) { return $this->cacheProvider->fetch($this->getHashKey($oldText, $newText)); }
php
public function fetch($oldText, $newText) { return $this->cacheProvider->fetch($this->getHashKey($oldText, $newText)); }
[ "public", "function", "fetch", "(", "$", "oldText", ",", "$", "newText", ")", "{", "return", "$", "this", "->", "cacheProvider", "->", "fetch", "(", "$", "this", "->", "getHashKey", "(", "$", "oldText", ",", "$", "newText", ")", ")", ";", "}" ]
@param string $oldText @param string $newText @return string
[ "@param", "string", "$oldText", "@param", "string", "$newText" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/DiffCache.php#L64-L67
caxy/php-htmldiff
lib/Caxy/HtmlDiff/DiffCache.php
DiffCache.save
public function save($oldText, $newText, $data, $lifeTime = 0) { return $this->cacheProvider->save($this->getHashKey($oldText, $newText), $data, $lifeTime); }
php
public function save($oldText, $newText, $data, $lifeTime = 0) { return $this->cacheProvider->save($this->getHashKey($oldText, $newText), $data, $lifeTime); }
[ "public", "function", "save", "(", "$", "oldText", ",", "$", "newText", ",", "$", "data", ",", "$", "lifeTime", "=", "0", ")", "{", "return", "$", "this", "->", "cacheProvider", "->", "save", "(", "$", "this", "->", "getHashKey", "(", "$", "oldText",...
@param string $oldText @param string $newText @param string $data @param int $lifeTime @return bool
[ "@param", "string", "$oldText", "@param", "string", "$newText", "@param", "string", "$data", "@param", "int", "$lifeTime" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/DiffCache.php#L77-L80
caxy/php-htmldiff
lib/Caxy/HtmlDiff/DiffCache.php
DiffCache.delete
public function delete($oldText, $newText) { return $this->cacheProvider->delete($this->getHashKey($oldText, $newText)); }
php
public function delete($oldText, $newText) { return $this->cacheProvider->delete($this->getHashKey($oldText, $newText)); }
[ "public", "function", "delete", "(", "$", "oldText", ",", "$", "newText", ")", "{", "return", "$", "this", "->", "cacheProvider", "->", "delete", "(", "$", "this", "->", "getHashKey", "(", "$", "oldText", ",", "$", "newText", ")", ")", ";", "}" ]
@param string $oldText @param string $newText @return bool
[ "@param", "string", "$oldText", "@param", "string", "$newText" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/DiffCache.php#L88-L91
caxy/php-htmldiff
lib/Caxy/HtmlDiff/ListDiffLines.php
ListDiffLines.build
public function build() { $this->prepare(); if ($this->hasDiffCache() && $this->getDiffCache()->contains($this->oldText, $this->newText)) { $this->content = $this->getDiffCache()->fetch($this->oldText, $this->newText); return $this->content; } $matchStrateg...
php
public function build() { $this->prepare(); if ($this->hasDiffCache() && $this->getDiffCache()->contains($this->oldText, $this->newText)) { $this->content = $this->getDiffCache()->fetch($this->oldText, $this->newText); return $this->content; } $matchStrateg...
[ "public", "function", "build", "(", ")", "{", "$", "this", "->", "prepare", "(", ")", ";", "if", "(", "$", "this", "->", "hasDiffCache", "(", ")", "&&", "$", "this", "->", "getDiffCache", "(", ")", "->", "contains", "(", "$", "this", "->", "oldText...
{@inheritDoc}
[ "{" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/ListDiffLines.php#L58-L72
caxy/php-htmldiff
lib/Caxy/HtmlDiff/ListDiffLines.php
ListDiffLines.listByLines
protected function listByLines($old, $new) { /* @var $newDom \simple_html_dom */ $newDom = HtmlDomParser::str_get_html($new); /* @var $oldDom \simple_html_dom */ $oldDom = HtmlDomParser::str_get_html($old); $newListNode = $this->findListNode($newDom); $oldListNode = ...
php
protected function listByLines($old, $new) { /* @var $newDom \simple_html_dom */ $newDom = HtmlDomParser::str_get_html($new); /* @var $oldDom \simple_html_dom */ $oldDom = HtmlDomParser::str_get_html($old); $newListNode = $this->findListNode($newDom); $oldListNode = ...
[ "protected", "function", "listByLines", "(", "$", "old", ",", "$", "new", ")", "{", "/* @var $newDom \\simple_html_dom */", "$", "newDom", "=", "HtmlDomParser", "::", "str_get_html", "(", "$", "new", ")", ";", "/* @var $oldDom \\simple_html_dom */", "$", "oldDom", ...
@param string $old @param string $new @return string
[ "@param", "string", "$old", "@param", "string", "$new" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/ListDiffLines.php#L80-L93
caxy/php-htmldiff
lib/Caxy/HtmlDiff/ListDiffLines.php
ListDiffLines.getListItemOperations
protected function getListItemOperations($oldListNode, $newListNode) { // Prepare arrays of list item content to use in LCS algorithm $oldListText = $this->getListTextArray($oldListNode); $newListText = $this->getListTextArray($newListNode); $lcsMatches = $this->lcsService->longestC...
php
protected function getListItemOperations($oldListNode, $newListNode) { // Prepare arrays of list item content to use in LCS algorithm $oldListText = $this->getListTextArray($oldListNode); $newListText = $this->getListTextArray($newListNode); $lcsMatches = $this->lcsService->longestC...
[ "protected", "function", "getListItemOperations", "(", "$", "oldListNode", ",", "$", "newListNode", ")", "{", "// Prepare arrays of list item content to use in LCS algorithm", "$", "oldListText", "=", "$", "this", "->", "getListTextArray", "(", "$", "oldListNode", ")", ...
@param \simple_html_dom_node $oldListNode @param \simple_html_dom_node $newListNode @return array|Operation[]
[ "@param", "\\", "simple_html_dom_node", "$oldListNode", "@param", "\\", "simple_html_dom_node", "$newListNode" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/ListDiffLines.php#L111-L169
caxy/php-htmldiff
lib/Caxy/HtmlDiff/ListDiffLines.php
ListDiffLines.getListTextArray
protected function getListTextArray($listNode) { $output = array(); foreach ($listNode->children() as $listItem) { $output[] = $this->getRelevantNodeText($listItem); } return $output; }
php
protected function getListTextArray($listNode) { $output = array(); foreach ($listNode->children() as $listItem) { $output[] = $this->getRelevantNodeText($listItem); } return $output; }
[ "protected", "function", "getListTextArray", "(", "$", "listNode", ")", "{", "$", "output", "=", "array", "(", ")", ";", "foreach", "(", "$", "listNode", "->", "children", "(", ")", "as", "$", "listItem", ")", "{", "$", "output", "[", "]", "=", "$", ...
@param \simple_html_dom_node $listNode @return array
[ "@param", "\\", "simple_html_dom_node", "$listNode" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/ListDiffLines.php#L176-L184
caxy/php-htmldiff
lib/Caxy/HtmlDiff/ListDiffLines.php
ListDiffLines.getRelevantNodeText
protected function getRelevantNodeText($node) { if (!$node->hasChildNodes()) { return $node->innertext(); } $output = ''; foreach ($node->nodes as $child) { /* @var $child \simple_html_dom_node */ if (!$child->hasChildNodes()) { $o...
php
protected function getRelevantNodeText($node) { if (!$node->hasChildNodes()) { return $node->innertext(); } $output = ''; foreach ($node->nodes as $child) { /* @var $child \simple_html_dom_node */ if (!$child->hasChildNodes()) { $o...
[ "protected", "function", "getRelevantNodeText", "(", "$", "node", ")", "{", "if", "(", "!", "$", "node", "->", "hasChildNodes", "(", ")", ")", "{", "return", "$", "node", "->", "innertext", "(", ")", ";", "}", "$", "output", "=", "''", ";", "foreach"...
@param \simple_html_dom_node $node @return string
[ "@param", "\\", "simple_html_dom_node", "$node" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/ListDiffLines.php#L191-L208
caxy/php-htmldiff
lib/Caxy/HtmlDiff/ListDiffLines.php
ListDiffLines.deleteListItem
protected function deleteListItem($li) { $this->addClassToNode($li, self::CLASS_LIST_ITEM_DELETED); $li->innertext = sprintf('<del>%s</del>', $li->innertext); return $li->outertext; }
php
protected function deleteListItem($li) { $this->addClassToNode($li, self::CLASS_LIST_ITEM_DELETED); $li->innertext = sprintf('<del>%s</del>', $li->innertext); return $li->outertext; }
[ "protected", "function", "deleteListItem", "(", "$", "li", ")", "{", "$", "this", "->", "addClassToNode", "(", "$", "li", ",", "self", "::", "CLASS_LIST_ITEM_DELETED", ")", ";", "$", "li", "->", "innertext", "=", "sprintf", "(", "'<del>%s</del>'", ",", "$"...
@param \simple_html_dom_node $li @return string
[ "@param", "\\", "simple_html_dom_node", "$li" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/ListDiffLines.php#L215-L221
caxy/php-htmldiff
lib/Caxy/HtmlDiff/ListDiffLines.php
ListDiffLines.addListItem
protected function addListItem($li, $replacement = false) { $this->addClassToNode($li, $replacement ? self::CLASS_LIST_ITEM_CHANGED : self::CLASS_LIST_ITEM_ADDED); $li->innertext = sprintf('<ins>%s</ins>', $li->innertext); return $li->outertext; }
php
protected function addListItem($li, $replacement = false) { $this->addClassToNode($li, $replacement ? self::CLASS_LIST_ITEM_CHANGED : self::CLASS_LIST_ITEM_ADDED); $li->innertext = sprintf('<ins>%s</ins>', $li->innertext); return $li->outertext; }
[ "protected", "function", "addListItem", "(", "$", "li", ",", "$", "replacement", "=", "false", ")", "{", "$", "this", "->", "addClassToNode", "(", "$", "li", ",", "$", "replacement", "?", "self", "::", "CLASS_LIST_ITEM_CHANGED", ":", "self", "::", "CLASS_L...
@param \simple_html_dom_node $li @param bool $replacement @return string
[ "@param", "\\", "simple_html_dom_node", "$li", "@param", "bool", "$replacement" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/ListDiffLines.php#L229-L235
caxy/php-htmldiff
lib/Caxy/HtmlDiff/ListDiffLines.php
ListDiffLines.processOperations
protected function processOperations($operations, $oldListNode, $newListNode) { $output = ''; $indexInOld = 0; $indexInNew = 0; $lastOperation = null; foreach ($operations as $operation) { $replaced = false; while ($operation->startInOld > ($operatio...
php
protected function processOperations($operations, $oldListNode, $newListNode) { $output = ''; $indexInOld = 0; $indexInNew = 0; $lastOperation = null; foreach ($operations as $operation) { $replaced = false; while ($operation->startInOld > ($operatio...
[ "protected", "function", "processOperations", "(", "$", "operations", ",", "$", "oldListNode", ",", "$", "newListNode", ")", "{", "$", "output", "=", "''", ";", "$", "indexInOld", "=", "0", ";", "$", "indexInNew", "=", "0", ";", "$", "lastOperation", "="...
@param Operation[]|array $operations @param \simple_html_dom_node $oldListNode @param \simple_html_dom_node $newListNode @return string
[ "@param", "Operation", "[]", "|array", "$operations", "@param", "\\", "simple_html_dom_node", "$oldListNode", "@param", "\\", "simple_html_dom_node", "$newListNode" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/ListDiffLines.php#L244-L340
caxy/php-htmldiff
lib/Caxy/HtmlDiff/Strategy/ListItemMatchStrategy.php
ListItemMatchStrategy.isMatch
public function isMatch($a, $b) { $percentage = null; // Strip tags and check similarity $aStripped = strip_tags($a); $bStripped = strip_tags($b); similar_text($aStripped, $bStripped, $percentage); if ($percentage >= $this->similarityThreshold) { return ...
php
public function isMatch($a, $b) { $percentage = null; // Strip tags and check similarity $aStripped = strip_tags($a); $bStripped = strip_tags($b); similar_text($aStripped, $bStripped, $percentage); if ($percentage >= $this->similarityThreshold) { return ...
[ "public", "function", "isMatch", "(", "$", "a", ",", "$", "b", ")", "{", "$", "percentage", "=", "null", ";", "// Strip tags and check similarity", "$", "aStripped", "=", "strip_tags", "(", "$", "a", ")", ";", "$", "bStripped", "=", "strip_tags", "(", "$...
@param string $a @param string $b @return bool
[ "@param", "string", "$a", "@param", "string", "$b" ]
train
https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Strategy/ListItemMatchStrategy.php#L52-L100
PUGX/badge-poser
src/PUGX/BadgeBundle/Controller/Badge/ComposerlockController.php
ComposerlockController.composerlockAction
public function composerlockAction(Request $request, $repository, $format='svg') { if ($request->query->get('format') == 'plastic') { $format = 'plastic'; } $this->useCase = $this->container->get('use_case_badge_composerlock'); $this->imageFactory = $this->container->get...
php
public function composerlockAction(Request $request, $repository, $format='svg') { if ($request->query->get('format') == 'plastic') { $format = 'plastic'; } $this->useCase = $this->container->get('use_case_badge_composerlock'); $this->imageFactory = $this->container->get...
[ "public", "function", "composerlockAction", "(", "Request", "$", "request", ",", "$", "repository", ",", "$", "format", "=", "'svg'", ")", "{", "if", "(", "$", "request", "->", "query", "->", "get", "(", "'format'", ")", "==", "'plastic'", ")", "{", "$...
Version action. @param string $repository repository @Route("/{repository}/composerlock", name="pugx_badge_composerlock", requirements={"repository" = "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?"} ) @Method({"GET"}) @Cache(maxage="3600", smaxage="3600", public=true) @return Response
[ "Version", "action", "." ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/PUGX/BadgeBundle/Controller/Badge/ComposerlockController.php#L45-L59
PUGX/badge-poser
src/Badge/src/Model/UseCase/CreateLicenseBadge.php
CreateLicenseBadge.createLicenseBadge
public function createLicenseBadge($repository, $format = 'svg') { return $this->createBadgeFromRepository($repository, self::SUBJECT, self::COLOR, $format); }
php
public function createLicenseBadge($repository, $format = 'svg') { return $this->createBadgeFromRepository($repository, self::SUBJECT, self::COLOR, $format); }
[ "public", "function", "createLicenseBadge", "(", "$", "repository", ",", "$", "format", "=", "'svg'", ")", "{", "return", "$", "this", "->", "createBadgeFromRepository", "(", "$", "repository", ",", "self", "::", "SUBJECT", ",", "self", "::", "COLOR", ",", ...
@param string $repository @param string $format @return \PUGX\Badge\Model\Badge
[ "@param", "string", "$repository", "@param", "string", "$format" ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/Badge/src/Model/UseCase/CreateLicenseBadge.php#L29-L32
PUGX/badge-poser
src/PUGX/BadgeBundle/Controller/Badge/GitattributesController.php
GitattributesController.gitattributesAction
public function gitattributesAction(Request $request, $repository, $format='svg') { if ($request->query->get('format') == 'plastic') { $format = 'plastic'; } $this->useCase = $this->container->get('use_case_badge_gitattributes'); $this->imageFactory = $this->container->g...
php
public function gitattributesAction(Request $request, $repository, $format='svg') { if ($request->query->get('format') == 'plastic') { $format = 'plastic'; } $this->useCase = $this->container->get('use_case_badge_gitattributes'); $this->imageFactory = $this->container->g...
[ "public", "function", "gitattributesAction", "(", "Request", "$", "request", ",", "$", "repository", ",", "$", "format", "=", "'svg'", ")", "{", "if", "(", "$", "request", "->", "query", "->", "get", "(", "'format'", ")", "==", "'plastic'", ")", "{", "...
.gitattributes action. @param string $repository repository @Route("/{repository}/gitattributes", name="pugx_badge_gitattributes", requirements={"repository" = "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?"} ) @Method({"GET"}) @Cache(maxage="3600", smaxage="3600", public=true) @return Response
[ ".", "gitattributes", "action", "." ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/PUGX/BadgeBundle/Controller/Badge/GitattributesController.php#L44-L58
PUGX/badge-poser
src/Badge/src/Model/UseCase/CreateComposerLockBadge.php
CreateComposerLockBadge.createComposerLockBadge
public function createComposerLockBadge($repository, $format = 'svg') { $repo = str_replace('.git', '', $this->packageRepository ->fetchByRepository($repository) ->getOriginalObject() ->getRepository() ); $request = $this->client->head( $repo ...
php
public function createComposerLockBadge($repository, $format = 'svg') { $repo = str_replace('.git', '', $this->packageRepository ->fetchByRepository($repository) ->getOriginalObject() ->getRepository() ); $request = $this->client->head( $repo ...
[ "public", "function", "createComposerLockBadge", "(", "$", "repository", ",", "$", "format", "=", "'svg'", ")", "{", "$", "repo", "=", "str_replace", "(", "'.git'", ",", "''", ",", "$", "this", "->", "packageRepository", "->", "fetchByRepository", "(", "$", ...
@param string $repository @param string $format @return \PUGX\Badge\Model\Badge
[ "@param", "string", "$repository", "@param", "string", "$format" ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/Badge/src/Model/UseCase/CreateComposerLockBadge.php#L51-L89
PUGX/badge-poser
src/PUGX/BadgeBundle/Controller/Badge/DownloadsController.php
DownloadsController.downloadsAction
public function downloadsAction(Request $request, $repository, $type, $format = 'svg') { $this->useCase = $this->container->get('use_case_badge_downloads'); $this->imageFactory = $this->container->get('image_factory'); if (in_array($request->query->get('format'), $this->container->get('pose...
php
public function downloadsAction(Request $request, $repository, $type, $format = 'svg') { $this->useCase = $this->container->get('use_case_badge_downloads'); $this->imageFactory = $this->container->get('image_factory'); if (in_array($request->query->get('format'), $this->container->get('pose...
[ "public", "function", "downloadsAction", "(", "Request", "$", "request", ",", "$", "repository", ",", "$", "type", ",", "$", "format", "=", "'svg'", ")", "{", "$", "this", "->", "useCase", "=", "$", "this", "->", "container", "->", "get", "(", "'use_ca...
Downloads action. @param string $repository repository @param string $type badge type @param string $format @Route("/{repository}/downloads", name = "pugx_badge_download", defaults = {"type" = "total"}, requirements = { "repository" = "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?" } ) @Route("/{repository}/d/{t...
[ "Downloads", "action", "." ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/PUGX/BadgeBundle/Controller/Badge/DownloadsController.php#L60-L74
PUGX/badge-poser
src/Badge/src/Infrastructure/Package/PackageRepository.php
PackageRepository.fetchByRepository
public function fetchByRepository($repository) { $apiPackage = $this->client->get($repository); if ($apiPackage && $apiPackage instanceof ApiPackage) { // create a new Package from the ApiPackage $class = self::$packageClass; return $class::createFromApi($apiPack...
php
public function fetchByRepository($repository) { $apiPackage = $this->client->get($repository); if ($apiPackage && $apiPackage instanceof ApiPackage) { // create a new Package from the ApiPackage $class = self::$packageClass; return $class::createFromApi($apiPack...
[ "public", "function", "fetchByRepository", "(", "$", "repository", ")", "{", "$", "apiPackage", "=", "$", "this", "->", "client", "->", "get", "(", "$", "repository", ")", ";", "if", "(", "$", "apiPackage", "&&", "$", "apiPackage", "instanceof", "ApiPackag...
Returns package if founded. @param string $repository @return Package @throws UnexpectedValueException
[ "Returns", "package", "if", "founded", "." ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/Badge/src/Infrastructure/Package/PackageRepository.php#L45-L56
PUGX/badge-poser
src/PUGX/BadgeBundle/Controller/SnippetController.php
SnippetController.allAction
public function allAction() { $repository = $this->container->get('request')->get('repository'); $response = new JsonResponse(); if (!$this->isValidRepositoryName($repository)) { $response->setData(array('msg' => 'Package not found. Please check the package name. eg. (symfony/sy...
php
public function allAction() { $repository = $this->container->get('request')->get('repository'); $response = new JsonResponse(); if (!$this->isValidRepositoryName($repository)) { $response->setData(array('msg' => 'Package not found. Please check the package name. eg. (symfony/sy...
[ "public", "function", "allAction", "(", ")", "{", "$", "repository", "=", "$", "this", "->", "container", "->", "get", "(", "'request'", ")", "->", "get", "(", "'repository'", ")", ";", "$", "response", "=", "new", "JsonResponse", "(", ")", ";", "if", ...
@Route("/snippet/all/", name="pugx_snippet_all" ) @Method({"GET"}) @Cache(smaxage="3600", maxage="3600", public=true) @return JsonResponse
[ "@Route", "(", "/", "snippet", "/", "all", "/", "name", "=", "pugx_snippet_all", ")", "@Method", "(", "{", "GET", "}", ")", "@Cache", "(", "smaxage", "=", "3600", "maxage", "=", "3600", "public", "=", "true", ")" ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/PUGX/BadgeBundle/Controller/SnippetController.php#L38-L62
PUGX/badge-poser
src/Badge/src/Model/UseCase/CreateGitattributesBadge.php
CreateGitattributesBadge.createGitattributesBadge
public function createGitattributesBadge($repository, $format = 'svg') { $repo = str_replace('.git', '', $this->packageRepository ->fetchByRepository($repository) ->getOriginalObject() ->getRepository() ); $request = $this->client->head( $repo...
php
public function createGitattributesBadge($repository, $format = 'svg') { $repo = str_replace('.git', '', $this->packageRepository ->fetchByRepository($repository) ->getOriginalObject() ->getRepository() ); $request = $this->client->head( $repo...
[ "public", "function", "createGitattributesBadge", "(", "$", "repository", ",", "$", "format", "=", "'svg'", ")", "{", "$", "repo", "=", "str_replace", "(", "'.git'", ",", "''", ",", "$", "this", "->", "packageRepository", "->", "fetchByRepository", "(", "$",...
@param string $repository @param string $format @return \PUGX\Badge\Model\Badge
[ "@param", "string", "$repository", "@param", "string", "$format" ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/Badge/src/Model/UseCase/CreateGitattributesBadge.php#L50-L93
PUGX/badge-poser
src/Badge/src/Model/Package.php
Package.getPackageDownloads
public function getPackageDownloads($type) { $statsType = 'get' . ucfirst($type); if (($download = $this->getDownloads()) && $download instanceof \Packagist\Api\Result\Package\Downloads) { return $download->{$statsType}(); } }
php
public function getPackageDownloads($type) { $statsType = 'get' . ucfirst($type); if (($download = $this->getDownloads()) && $download instanceof \Packagist\Api\Result\Package\Downloads) { return $download->{$statsType}(); } }
[ "public", "function", "getPackageDownloads", "(", "$", "type", ")", "{", "$", "statsType", "=", "'get'", ".", "ucfirst", "(", "$", "type", ")", ";", "if", "(", "(", "$", "download", "=", "$", "this", "->", "getDownloads", "(", ")", ")", "&&", "$", ...
Take the Type of the Downloads (total, monthly or daily). @param string $type @return string
[ "Take", "the", "Type", "of", "the", "Downloads", "(", "total", "monthly", "or", "daily", ")", "." ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/Badge/src/Model/Package.php#L58-L64
PUGX/badge-poser
src/Badge/src/Model/Package.php
Package.getBranchAliases
private function getBranchAliases(ApiPackage\Version $version) { $extra = $version->getExtra(); if (null !== $extra && isset($extra["branch-alias"]) && is_array($extra["branch-alias"]) ) { return $extra["branch-alias"]; } return null; ...
php
private function getBranchAliases(ApiPackage\Version $version) { $extra = $version->getExtra(); if (null !== $extra && isset($extra["branch-alias"]) && is_array($extra["branch-alias"]) ) { return $extra["branch-alias"]; } return null; ...
[ "private", "function", "getBranchAliases", "(", "ApiPackage", "\\", "Version", "$", "version", ")", "{", "$", "extra", "=", "$", "version", "->", "getExtra", "(", ")", ";", "if", "(", "null", "!==", "$", "extra", "&&", "isset", "(", "$", "extra", "[", ...
Get all the branch aliases. @param ApiPackage\Version $version @return null|array
[ "Get", "all", "the", "branch", "aliases", "." ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/Badge/src/Model/Package.php#L112-L123
PUGX/badge-poser
src/PUGX/BadgeBundle/Controller/Badge/LicenseController.php
LicenseController.licenseAction
public function licenseAction(Request $request, $repository, $format='svg') { $this->useCase = $this->container->get('use_case_badge_license'); $this->imageFactory = $this->container->get('image_factory'); if (in_array($request->query->get('format'), $this->container->get('poser')->validFor...
php
public function licenseAction(Request $request, $repository, $format='svg') { $this->useCase = $this->container->get('use_case_badge_license'); $this->imageFactory = $this->container->get('image_factory'); if (in_array($request->query->get('format'), $this->container->get('poser')->validFor...
[ "public", "function", "licenseAction", "(", "Request", "$", "request", ",", "$", "repository", ",", "$", "format", "=", "'svg'", ")", "{", "$", "this", "->", "useCase", "=", "$", "this", "->", "container", "->", "get", "(", "'use_case_badge_license'", ")",...
License action. @param string $repository repository @Route("/{repository}/license", name="pugx_badge_license", requirements={"repository" = "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?"} ) @Method({"GET"}) @Cache(maxage="3600", smaxage="3600", public=true) @return Response
[ "License", "action", "." ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/PUGX/BadgeBundle/Controller/Badge/LicenseController.php#L48-L61
PUGX/badge-poser
src/PUGX/BadgeBundle/Controller/Badge/VersionController.php
VersionController.versionAction
public function versionAction(Request $request, $repository, $latest, $format='svg') { if (in_array($request->query->get('format'), $this->container->get('poser')->validFormats())) { $format = $request->query->get('format'); } $this->useCase = $this->container->get('use_case_bad...
php
public function versionAction(Request $request, $repository, $latest, $format='svg') { if (in_array($request->query->get('format'), $this->container->get('poser')->validFormats())) { $format = $request->query->get('format'); } $this->useCase = $this->container->get('use_case_bad...
[ "public", "function", "versionAction", "(", "Request", "$", "request", ",", "$", "repository", ",", "$", "latest", ",", "$", "format", "=", "'svg'", ")", "{", "if", "(", "in_array", "(", "$", "request", "->", "query", "->", "get", "(", "'format'", ")",...
Version action. @param string $repository repository @param string $latest latest @Route("/{repository}/version", name="pugx_badge_version", defaults = {"latest" = "stable"}, requirements={"repository" = "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?"} ) @Route("/{repository}/v/{latest}", name = "pugx_badge_versio...
[ "Version", "action", "." ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/PUGX/BadgeBundle/Controller/Badge/VersionController.php#L56-L71
PUGX/badge-poser
src/Badge/src/Model/UseCase/CreateDownloadsBadge.php
CreateDownloadsBadge.createDownloadsBadge
public function createDownloadsBadge($repository, $type, $format) { return $this->createBadgeFromRepository($repository, self::SUBJECT, self::COLOR, $format, $type); }
php
public function createDownloadsBadge($repository, $type, $format) { return $this->createBadgeFromRepository($repository, self::SUBJECT, self::COLOR, $format, $type); }
[ "public", "function", "createDownloadsBadge", "(", "$", "repository", ",", "$", "type", ",", "$", "format", ")", "{", "return", "$", "this", "->", "createBadgeFromRepository", "(", "$", "repository", ",", "self", "::", "SUBJECT", ",", "self", "::", "COLOR", ...
@param $repository @param $type @param $format @return \PUGX\Badge\Model\Badge
[ "@param", "$repository", "@param", "$type", "@param", "$format" ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/Badge/src/Model/UseCase/CreateDownloadsBadge.php#L50-L53
PUGX/badge-poser
src/Badge/src/Service/TextNormalizer.php
TextNormalizer.normalizeNumber
private function normalizeNumber($number) { if (!is_numeric($number)) { throw new InvalidArgumentException('Number expected'); } $number = floatval($number); if ($number < 0) { throw new InvalidArgumentException('The number expected was >= 0'); } ...
php
private function normalizeNumber($number) { if (!is_numeric($number)) { throw new InvalidArgumentException('Number expected'); } $number = floatval($number); if ($number < 0) { throw new InvalidArgumentException('The number expected was >= 0'); } ...
[ "private", "function", "normalizeNumber", "(", "$", "number", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "number", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Number expected'", ")", ";", "}", "$", "number", "=", "floatval", "(...
This function transform a number to a float value or raise an Exception. @param mixed $number number to be normalized @return int @throws InvalidArgumentException
[ "This", "function", "transform", "a", "number", "to", "a", "float", "value", "or", "raise", "an", "Exception", "." ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/Badge/src/Service/TextNormalizer.php#L38-L51
PUGX/badge-poser
src/PUGX/StatsBundle/Service/RedisPersister.php
RedisPersister.incrementTotalAccess
public function incrementTotalAccess() { $this->redis->incr($this->keyTotal); $key = $this->createDailyKey($this->keyTotal); $this->redis->incr($key); $key = $this->createMonthlyKey($this->keyTotal); $this->redis->incr($key); $key = $this->createYearlyKey($this->ke...
php
public function incrementTotalAccess() { $this->redis->incr($this->keyTotal); $key = $this->createDailyKey($this->keyTotal); $this->redis->incr($key); $key = $this->createMonthlyKey($this->keyTotal); $this->redis->incr($key); $key = $this->createYearlyKey($this->ke...
[ "public", "function", "incrementTotalAccess", "(", ")", "{", "$", "this", "->", "redis", "->", "incr", "(", "$", "this", "->", "keyTotal", ")", ";", "$", "key", "=", "$", "this", "->", "createDailyKey", "(", "$", "this", "->", "keyTotal", ")", ";", "...
Increment by one the total accesses. @return PersisterInterface
[ "Increment", "by", "one", "the", "total", "accesses", "." ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/PUGX/StatsBundle/Service/RedisPersister.php#L60-L74
PUGX/badge-poser
src/PUGX/StatsBundle/Service/RedisPersister.php
RedisPersister.incrementRepositoryAccess
public function incrementRepositoryAccess($repository) { $this->redis->hincrby($this->concatenateKeys($this->keyHash, $repository), self::KEY_TOTAL, 1); $key = $this->createDailyKey(self::KEY_TOTAL); $this->redis->hincrby($this->concatenateKeys($this->keyHash, $repository), $key, 1); ...
php
public function incrementRepositoryAccess($repository) { $this->redis->hincrby($this->concatenateKeys($this->keyHash, $repository), self::KEY_TOTAL, 1); $key = $this->createDailyKey(self::KEY_TOTAL); $this->redis->hincrby($this->concatenateKeys($this->keyHash, $repository), $key, 1); ...
[ "public", "function", "incrementRepositoryAccess", "(", "$", "repository", ")", "{", "$", "this", "->", "redis", "->", "hincrby", "(", "$", "this", "->", "concatenateKeys", "(", "$", "this", "->", "keyHash", ",", "$", "repository", ")", ",", "self", "::", ...
Increment by one the repository accesses. @param string $repository @return PersisterInterface
[ "Increment", "by", "one", "the", "repository", "accesses", "." ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/PUGX/StatsBundle/Service/RedisPersister.php#L83-L97
PUGX/badge-poser
src/PUGX/StatsBundle/Service/RedisPersister.php
RedisPersister.incrementRepositoryAccessType
public function incrementRepositoryAccessType($repository, $type) { $this->redis->hincrby($this->concatenateKeys($this->keyHash, $repository), $type, 1); return $this; }
php
public function incrementRepositoryAccessType($repository, $type) { $this->redis->hincrby($this->concatenateKeys($this->keyHash, $repository), $type, 1); return $this; }
[ "public", "function", "incrementRepositoryAccessType", "(", "$", "repository", ",", "$", "type", ")", "{", "$", "this", "->", "redis", "->", "hincrby", "(", "$", "this", "->", "concatenateKeys", "(", "$", "this", "->", "keyHash", ",", "$", "repository", ")...
Increment by one the repository accesses type. @param string $repository @param string $type @return PersisterInterface
[ "Increment", "by", "one", "the", "repository", "accesses", "type", "." ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/PUGX/StatsBundle/Service/RedisPersister.php#L107-L112
PUGX/badge-poser
src/PUGX/StatsBundle/Service/RedisPersister.php
RedisPersister.addReferer
public function addReferer($url) { $this->redis->zadd($this->concatenateKeys($this->keyList, self::KEY_REFERER_SUFFIX), time() ,$url); return $this; }
php
public function addReferer($url) { $this->redis->zadd($this->concatenateKeys($this->keyList, self::KEY_REFERER_SUFFIX), time() ,$url); return $this; }
[ "public", "function", "addReferer", "(", "$", "url", ")", "{", "$", "this", "->", "redis", "->", "zadd", "(", "$", "this", "->", "concatenateKeys", "(", "$", "this", "->", "keyList", ",", "self", "::", "KEY_REFERER_SUFFIX", ")", ",", "time", "(", ")", ...
Add the referrer to a subset. @param string $url @return PersisterInterface
[ "Add", "the", "referrer", "to", "a", "subset", "." ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/PUGX/StatsBundle/Service/RedisPersister.php#L136-L141
PUGX/badge-poser
src/PUGX/StatsBundle/Service/RedisPersister.php
RedisPersister.createYearlyKey
private function createYearlyKey($prefix, \DateTime $datetime = null) { return sprintf("%s_%s", $prefix, $this->formatDate($datetime, 'Y')); }
php
private function createYearlyKey($prefix, \DateTime $datetime = null) { return sprintf("%s_%s", $prefix, $this->formatDate($datetime, 'Y')); }
[ "private", "function", "createYearlyKey", "(", "$", "prefix", ",", "\\", "DateTime", "$", "datetime", "=", "null", ")", "{", "return", "sprintf", "(", "\"%s_%s\"", ",", "$", "prefix", ",", "$", "this", "->", "formatDate", "(", "$", "datetime", ",", "'Y'"...
Create the yearly key with prefix eg. 'total_2003' @param string $prefix @param \DateTime $datetime @return string
[ "Create", "the", "yearly", "key", "with", "prefix", "eg", ".", "total_2003" ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/PUGX/StatsBundle/Service/RedisPersister.php#L151-L154
PUGX/badge-poser
src/PUGX/StatsBundle/Service/RedisPersister.php
RedisPersister.createMonthlyKey
private function createMonthlyKey($prefix, \DateTime $datetime = null) { return sprintf("%s_%s", $prefix, $this->formatDate($datetime, 'Y_m')); }
php
private function createMonthlyKey($prefix, \DateTime $datetime = null) { return sprintf("%s_%s", $prefix, $this->formatDate($datetime, 'Y_m')); }
[ "private", "function", "createMonthlyKey", "(", "$", "prefix", ",", "\\", "DateTime", "$", "datetime", "=", "null", ")", "{", "return", "sprintf", "(", "\"%s_%s\"", ",", "$", "prefix", ",", "$", "this", "->", "formatDate", "(", "$", "datetime", ",", "'Y_...
Create the monthly key with prefix eg. 'total_2003_11' @param string $prefix @param \DateTime $datetime @return string
[ "Create", "the", "monthly", "key", "with", "prefix", "eg", ".", "total_2003_11" ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/PUGX/StatsBundle/Service/RedisPersister.php#L164-L167
PUGX/badge-poser
src/PUGX/StatsBundle/Service/RedisPersister.php
RedisPersister.createDailyKey
private function createDailyKey($prefix, \DateTime $datetime = null) { return sprintf("%s_%s", $prefix, $this->formatDate($datetime, 'Y_m_d')); }
php
private function createDailyKey($prefix, \DateTime $datetime = null) { return sprintf("%s_%s", $prefix, $this->formatDate($datetime, 'Y_m_d')); }
[ "private", "function", "createDailyKey", "(", "$", "prefix", ",", "\\", "DateTime", "$", "datetime", "=", "null", ")", "{", "return", "sprintf", "(", "\"%s_%s\"", ",", "$", "prefix", ",", "$", "this", "->", "formatDate", "(", "$", "datetime", ",", "'Y_m_...
Create the daily key with prefix eg. 'total_2003_11_29' @param string $prefix @param \DateTime $datetime @return string
[ "Create", "the", "daily", "key", "with", "prefix", "eg", ".", "total_2003_11_29" ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/PUGX/StatsBundle/Service/RedisPersister.php#L177-L180
PUGX/badge-poser
src/PUGX/StatsBundle/Service/RedisPersister.php
RedisPersister.formatDate
private function formatDate(\DateTime $datetime = null, $format = 'Y_m_d') { if (null == $datetime) { $datetime = new \DateTime('now'); } return $datetime->format($format); }
php
private function formatDate(\DateTime $datetime = null, $format = 'Y_m_d') { if (null == $datetime) { $datetime = new \DateTime('now'); } return $datetime->format($format); }
[ "private", "function", "formatDate", "(", "\\", "DateTime", "$", "datetime", "=", "null", ",", "$", "format", "=", "'Y_m_d'", ")", "{", "if", "(", "null", "==", "$", "datetime", ")", "{", "$", "datetime", "=", "new", "\\", "DateTime", "(", "'now'", "...
format a date. @param \DateTime $datetime @param string $format @return string
[ "format", "a", "date", "." ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/PUGX/StatsBundle/Service/RedisPersister.php#L190-L197
PUGX/badge-poser
src/PUGX/BadgeBundle/Controller/PageController.php
PageController.homeAction
public function homeAction($repository) { $redisReader = $this->container->get('stats_reader'); $poser = $this->container->get('poser'); $prefix = sprintf('More than %s', number_format($redisReader->totalAccess())); $text = 'badges served !!'; $formats = array_diff($poser->va...
php
public function homeAction($repository) { $redisReader = $this->container->get('stats_reader'); $poser = $this->container->get('poser'); $prefix = sprintf('More than %s', number_format($redisReader->totalAccess())); $text = 'badges served !!'; $formats = array_diff($poser->va...
[ "public", "function", "homeAction", "(", "$", "repository", ")", "{", "$", "redisReader", "=", "$", "this", "->", "container", "->", "get", "(", "'stats_reader'", ")", ";", "$", "poser", "=", "$", "this", "->", "container", "->", "get", "(", "'poser'", ...
@Route("/", name = "pugx_page_home", defaults = {"repository" = "phpunit/phpunit"} ) @Route("/show/{repository}", name = "pugx_page_home_show", requirements = {"repository" = "[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+?"} ) @Method({"GET"}) @Template @Cache(maxage="3600", smaxage="3600", public=true) @return Response
[ "@Route", "(", "/", "name", "=", "pugx_page_home", "defaults", "=", "{", "repository", "=", "phpunit", "/", "phpunit", "}", ")" ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/PUGX/BadgeBundle/Controller/PageController.php#L45-L58
PUGX/badge-poser
src/PUGX/StatsBundle/Listener/StatsListener.php
StatsListener.persistData
public function persistData(Request $request, $controller) { if (null === ($repository = $request->get('repository', null)) || $this->isRoutedFromHome($request)) { return; } $referer = $request->headers->get('referer'); $this->client->incrementTotalAccess(); $thi...
php
public function persistData(Request $request, $controller) { if (null === ($repository = $request->get('repository', null)) || $this->isRoutedFromHome($request)) { return; } $referer = $request->headers->get('referer'); $this->client->incrementTotalAccess(); $thi...
[ "public", "function", "persistData", "(", "Request", "$", "request", ",", "$", "controller", ")", "{", "if", "(", "null", "===", "(", "$", "repository", "=", "$", "request", "->", "get", "(", "'repository'", ",", "null", ")", ")", "||", "$", "this", ...
Persist data. @param Request $request The request @param string $controller The controller Name @return Boolean
[ "Persist", "data", "." ]
train
https://github.com/PUGX/badge-poser/blob/7815b67791b05cd3b0e101bb977240b639a14143/src/PUGX/StatsBundle/Listener/StatsListener.php#L68-L84
kakserpom/phpdaemon
PHPDaemon/Examples/ExamplePubSubWebSocketRoute.php
ExamplePubSubWebSocketRoute.onFrame
public function onFrame($data, $type) { $ws = $this; $req = json_decode($data, true); if ($req['type'] === 'subscribe') { $eventName = $req['event']; $this->appInstance->pubsub->sub($req['event'], $this, function ($data) use ($ws, $eventName) { $ws->se...
php
public function onFrame($data, $type) { $ws = $this; $req = json_decode($data, true); if ($req['type'] === 'subscribe') { $eventName = $req['event']; $this->appInstance->pubsub->sub($req['event'], $this, function ($data) use ($ws, $eventName) { $ws->se...
[ "public", "function", "onFrame", "(", "$", "data", ",", "$", "type", ")", "{", "$", "ws", "=", "$", "this", ";", "$", "req", "=", "json_decode", "(", "$", "data", ",", "true", ")", ";", "if", "(", "$", "req", "[", "'type'", "]", "===", "'subscr...
Called when new frame received. @param string Frame's contents. @param integer Frame's type. @return void
[ "Called", "when", "new", "frame", "received", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/ExamplePubSubWebSocketRoute.php#L14-L28
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicRecoverFrame.php
BasicRecoverFrame.create
public static function create( $requeue = null ) { $frame = new self(); if (null !== $requeue) { $frame->requeue = $requeue; } return $frame; }
php
public static function create( $requeue = null ) { $frame = new self(); if (null !== $requeue) { $frame->requeue = $requeue; } return $frame; }
[ "public", "static", "function", "create", "(", "$", "requeue", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", "if", "(", "null", "!==", "$", "requeue", ")", "{", "$", "frame", "->", "requeue", "=", "$", "requeue", ";", "}...
bit
[ "bit" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicRecoverFrame.php#L20-L31
kakserpom/phpdaemon
PHPDaemon/SockJS/Methods/Jsonp.php
Jsonp.sendFrame
protected function sendFrame($frame) { $c = &$this->attrs->get['c']; if (!is_string($c)) { $this->header('400 Bad Request'); $this->finish(); return; } $this->outputFrame($c . '(' . json_encode($frame, JSON_UNESCAPED_SLASHES) . ");\r\n"); p...
php
protected function sendFrame($frame) { $c = &$this->attrs->get['c']; if (!is_string($c)) { $this->header('400 Bad Request'); $this->finish(); return; } $this->outputFrame($c . '(' . json_encode($frame, JSON_UNESCAPED_SLASHES) . ");\r\n"); p...
[ "protected", "function", "sendFrame", "(", "$", "frame", ")", "{", "$", "c", "=", "&", "$", "this", "->", "attrs", "->", "get", "[", "'c'", "]", ";", "if", "(", "!", "is_string", "(", "$", "c", ")", ")", "{", "$", "this", "->", "header", "(", ...
Send frame @param string $frame @return void
[ "Send", "frame" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Methods/Jsonp.php#L22-L32
kakserpom/phpdaemon
PHPDaemon/Servers/Ident/Pool.php
Pool.RPCall
public function RPCall($method, $args) { if ($method === 'registerPair') { list($local, $foreign, $user) = $args; $this->pairs[$local . ':' . $foreign] = $user; } elseif ($method === 'unregisterPair') { list($local, $foreign) = $args; unset($this->pair...
php
public function RPCall($method, $args) { if ($method === 'registerPair') { list($local, $foreign, $user) = $args; $this->pairs[$local . ':' . $foreign] = $user; } elseif ($method === 'unregisterPair') { list($local, $foreign) = $args; unset($this->pair...
[ "public", "function", "RPCall", "(", "$", "method", ",", "$", "args", ")", "{", "if", "(", "$", "method", "===", "'registerPair'", ")", "{", "list", "(", "$", "local", ",", "$", "foreign", ",", "$", "user", ")", "=", "$", "args", ";", "$", "this"...
Function handles incoming Remote Procedure Calls You can override it @param string $method Method name. @param array $args Arguments. @return void
[ "Function", "handles", "incoming", "Remote", "Procedure", "Calls", "You", "can", "override", "it" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/Ident/Pool.php#L21-L30
kakserpom/phpdaemon
PHPDaemon/Servers/Ident/Pool.php
Pool.registerPair
public function registerPair($local, $foreign, $user) { $this->appInstance->broadcastCall('registerPair', [ $local, $foreign, is_array($user) ? implode(' : ', $user) : $user ]); }
php
public function registerPair($local, $foreign, $user) { $this->appInstance->broadcastCall('registerPair', [ $local, $foreign, is_array($user) ? implode(' : ', $user) : $user ]); }
[ "public", "function", "registerPair", "(", "$", "local", ",", "$", "foreign", ",", "$", "user", ")", "{", "$", "this", "->", "appInstance", "->", "broadcastCall", "(", "'registerPair'", ",", "[", "$", "local", ",", "$", "foreign", ",", "is_array", "(", ...
Register pair @param integer $local Local @param integer $foreign Foreign @param string $user User @return void
[ "Register", "pair" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/Ident/Pool.php#L40-L47
kakserpom/phpdaemon
PHPDaemon/Servers/Ident/Pool.php
Pool.findPair
public function findPair($local, $foreign) { $k = $local . ':' . $foreign; return isset($this->pairs[$k]) ? $this->pairs[$k] : false; }
php
public function findPair($local, $foreign) { $k = $local . ':' . $foreign; return isset($this->pairs[$k]) ? $this->pairs[$k] : false; }
[ "public", "function", "findPair", "(", "$", "local", ",", "$", "foreign", ")", "{", "$", "k", "=", "$", "local", ".", "':'", ".", "$", "foreign", ";", "return", "isset", "(", "$", "this", "->", "pairs", "[", "$", "k", "]", ")", "?", "$", "this"...
Find pair @param integer $local Local @param integer $foreign Foreign @return string User
[ "Find", "pair" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/Ident/Pool.php#L66-L73
kakserpom/phpdaemon
PHPDaemon/Config/Entry/Number.php
Number.humanToPlain
public static function humanToPlain($value) { if ($value === null) { return null; } $l = substr($value, -1); if (($l === 'k') || ($l === 'K')) { return ((int)substr($value, 0, -1) * 1000); } if (($l === 'm') || ($l === 'M')) { ret...
php
public static function humanToPlain($value) { if ($value === null) { return null; } $l = substr($value, -1); if (($l === 'k') || ($l === 'K')) { return ((int)substr($value, 0, -1) * 1000); } if (($l === 'm') || ($l === 'M')) { ret...
[ "public", "static", "function", "humanToPlain", "(", "$", "value", ")", "{", "if", "(", "$", "value", "===", "null", ")", "{", "return", "null", ";", "}", "$", "l", "=", "substr", "(", "$", "value", ",", "-", "1", ")", ";", "if", "(", "(", "$",...
Converts human-readable value to plain @param $value @return int|null
[ "Converts", "human", "-", "readable", "value", "to", "plain" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Config/Entry/Number.php#L20-L39
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Exchange/ExchangeDeclareFrame.php
ExchangeDeclareFrame.create
public static function create( $exchange = null, $type = null, $passive = null, $durable = null, $autoDelete = null, $internal = null, $nowait = null, $arguments = null ) { $frame = new self(); if (null !== $exchange) { $frame->exchange = $exchange; } if (nul...
php
public static function create( $exchange = null, $type = null, $passive = null, $durable = null, $autoDelete = null, $internal = null, $nowait = null, $arguments = null ) { $frame = new self(); if (null !== $exchange) { $frame->exchange = $exchange; } if (nul...
[ "public", "static", "function", "create", "(", "$", "exchange", "=", "null", ",", "$", "type", "=", "null", ",", "$", "passive", "=", "null", ",", "$", "durable", "=", "null", ",", "$", "autoDelete", "=", "null", ",", "$", "internal", "=", "null", ...
table
[ "table" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Exchange/ExchangeDeclareFrame.php#L28-L60
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Serializer/Table.php
Table.serialize
public function serialize(array $table) { $buffer = ''; foreach ($table as $key => $value) { $buffer .= $this->serializeShortString($key); $buffer .= $this->serializeField($value); } return $this->serializeByteArray($buffer); }
php
public function serialize(array $table) { $buffer = ''; foreach ($table as $key => $value) { $buffer .= $this->serializeShortString($key); $buffer .= $this->serializeField($value); } return $this->serializeByteArray($buffer); }
[ "public", "function", "serialize", "(", "array", "$", "table", ")", "{", "$", "buffer", "=", "''", ";", "foreach", "(", "$", "table", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "buffer", ".=", "$", "this", "->", "serializeShortString", "(",...
Serialize an AMQP table. @param array $table The table. @return string The binary serialized table. @throws InvalidArgumentException if the table contains unserializable values.
[ "Serialize", "an", "AMQP", "table", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Serializer/Table.php#L31-L41
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Serializer/Table.php
Table.serializeField
private function serializeField($value) { if (is_string($value)) { // @todo Could be decimal (D) or byte array (x) // @see https://github.com/recoilphp/amqp/issues/25 return 'S' . $this->serializeLongString($value); } if (is_int($value)) { // @...
php
private function serializeField($value) { if (is_string($value)) { // @todo Could be decimal (D) or byte array (x) // @see https://github.com/recoilphp/amqp/issues/25 return 'S' . $this->serializeLongString($value); } if (is_int($value)) { // @...
[ "private", "function", "serializeField", "(", "$", "value", ")", "{", "if", "(", "is_string", "(", "$", "value", ")", ")", "{", "// @todo Could be decimal (D) or byte array (x)", "// @see https://github.com/recoilphp/amqp/issues/25", "return", "'S'", ".", "$", "this", ...
Serialize a table or array field. @param mixed $value @return string The serialized value. @throws \InvalidArgumentException
[ "Serialize", "a", "table", "or", "array", "field", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Serializer/Table.php#L51-L103
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Serializer/Table.php
Table.serializeArrayOrTable
private function serializeArrayOrTable(array $array) { $assoc = false; $index = 0; $values = []; foreach ($array as $key => $value) { // We already know the array is associative, serialize both the key // and the value ... if ($assoc) { ...
php
private function serializeArrayOrTable(array $array) { $assoc = false; $index = 0; $values = []; foreach ($array as $key => $value) { // We already know the array is associative, serialize both the key // and the value ... if ($assoc) { ...
[ "private", "function", "serializeArrayOrTable", "(", "array", "$", "array", ")", "{", "$", "assoc", "=", "false", ";", "$", "index", "=", "0", ";", "$", "values", "=", "[", "]", ";", "foreach", "(", "$", "array", "as", "$", "key", "=>", "$", "value...
Serialize a PHP array. If the array contains sequential integer keys, it is serialized as an AMQP array, otherwise it is serialized as an AMQP table. @param array $array @return string The binary serialized table. @throws \InvalidArgumentException
[ "Serialize", "a", "PHP", "array", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Serializer/Table.php#L116-L151
kakserpom/phpdaemon
PHPDaemon/Servers/Socks/Connection.php
Connection.onRead
public function onRead() { if ($this->state === self::STATE_DATAFLOW) { // Data exchange if ($this->slave) { do { $this->slave->writeFromBuffer($this->bev->input, $this->bev->input->length); } while ($this->bev->input->length > 0); ...
php
public function onRead() { if ($this->state === self::STATE_DATAFLOW) { // Data exchange if ($this->slave) { do { $this->slave->writeFromBuffer($this->bev->input, $this->bev->input->length); } while ($this->bev->input->length > 0); ...
[ "public", "function", "onRead", "(", ")", "{", "if", "(", "$", "this", "->", "state", "===", "self", "::", "STATE_DATAFLOW", ")", "{", "// Data exchange", "if", "(", "$", "this", "->", "slave", ")", "{", "do", "{", "$", "this", "->", "slave", "->", ...
Called when new data received. @return void
[ "Called", "when", "new", "data", "received", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/Socks/Connection.php#L43-L189
kakserpom/phpdaemon
PHPDaemon/SockJS/Methods/Generic.php
Generic.init
public function init() { $this->sessId = $this->attrs->sessId; $this->serverId = $this->attrs->serverId; $this->path = $this->attrs->path; // @TODO: revert timeout after request $this->upstream->setTimeouts($this->appInstance->config->networktimeoutread->value, $...
php
public function init() { $this->sessId = $this->attrs->sessId; $this->serverId = $this->attrs->serverId; $this->path = $this->attrs->path; // @TODO: revert timeout after request $this->upstream->setTimeouts($this->appInstance->config->networktimeoutread->value, $...
[ "public", "function", "init", "(", ")", "{", "$", "this", "->", "sessId", "=", "$", "this", "->", "attrs", "->", "sessId", ";", "$", "this", "->", "serverId", "=", "$", "this", "->", "attrs", "->", "serverId", ";", "$", "this", "->", "path", "=", ...
Constructor @return void
[ "Constructor" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Methods/Generic.php#L51-L109
kakserpom/phpdaemon
PHPDaemon/SockJS/Methods/Generic.php
Generic.CORS
protected function CORS() { if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) { $this->header('Access-Control-Allow-Headers: ' . $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']); } if (isset($_SERVER['HTTP_ORIGIN']) && $_SERVER['HTTP_ORIGIN'] !== 'null') { $...
php
protected function CORS() { if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) { $this->header('Access-Control-Allow-Headers: ' . $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']); } if (isset($_SERVER['HTTP_ORIGIN']) && $_SERVER['HTTP_ORIGIN'] !== 'null') { $...
[ "protected", "function", "CORS", "(", ")", "{", "if", "(", "isset", "(", "$", "_SERVER", "[", "'HTTP_ACCESS_CONTROL_REQUEST_HEADERS'", "]", ")", ")", "{", "$", "this", "->", "header", "(", "'Access-Control-Allow-Headers: '", ".", "$", "_SERVER", "[", "'HTTP_AC...
CORS @return void
[ "CORS" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Methods/Generic.php#L115-L137
kakserpom/phpdaemon
PHPDaemon/SockJS/Methods/Generic.php
Generic.out
public function out($s, $flush = true) { if ($this->heartbeatTimer !== null) { Timer::setTimeout($this->heartbeatTimer); } return parent::out($s, $flush);; }
php
public function out($s, $flush = true) { if ($this->heartbeatTimer !== null) { Timer::setTimeout($this->heartbeatTimer); } return parent::out($s, $flush);; }
[ "public", "function", "out", "(", "$", "s", ",", "$", "flush", "=", "true", ")", "{", "if", "(", "$", "this", "->", "heartbeatTimer", "!==", "null", ")", "{", "Timer", "::", "setTimeout", "(", "$", "this", "->", "heartbeatTimer", ")", ";", "}", "re...
Output some data @param string $s String to out @param boolean $flush @return boolean Success
[ "Output", "some", "data" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Methods/Generic.php#L165-L171
kakserpom/phpdaemon
PHPDaemon/SockJS/Methods/Generic.php
Generic.stop
public function stop() { if ($this->stopped) { return; } $this->stopped = true; if (in_array('one-by-one', $this->pollMode)) { $this->finish(); return; } $this->appInstance->unsubscribeReal('s2c:' . $this->sessId, function ($redis) ...
php
public function stop() { if ($this->stopped) { return; } $this->stopped = true; if (in_array('one-by-one', $this->pollMode)) { $this->finish(); return; } $this->appInstance->unsubscribeReal('s2c:' . $this->sessId, function ($redis) ...
[ "public", "function", "stop", "(", ")", "{", "if", "(", "$", "this", "->", "stopped", ")", "{", "return", ";", "}", "$", "this", "->", "stopped", "=", "true", ";", "if", "(", "in_array", "(", "'one-by-one'", ",", "$", "this", "->", "pollMode", ")",...
Stop @return void
[ "Stop" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Methods/Generic.php#L177-L190
kakserpom/phpdaemon
PHPDaemon/SockJS/Methods/Generic.php
Generic.gcCheck
public function gcCheck() { if ($this->stopped) { return; } $max = $this->appInstance->config->gcmaxresponsesize->value; if ($max > 0 && $this->bytesSent > $max) { $this->stop(); } }
php
public function gcCheck() { if ($this->stopped) { return; } $max = $this->appInstance->config->gcmaxresponsesize->value; if ($max > 0 && $this->bytesSent > $max) { $this->stop(); } }
[ "public", "function", "gcCheck", "(", ")", "{", "if", "(", "$", "this", "->", "stopped", ")", "{", "return", ";", "}", "$", "max", "=", "$", "this", "->", "appInstance", "->", "config", "->", "gcmaxresponsesize", "->", "value", ";", "if", "(", "$", ...
gcCheck @return void
[ "gcCheck" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Methods/Generic.php#L208-L217
kakserpom/phpdaemon
PHPDaemon/SockJS/Methods/Generic.php
Generic.acquire
protected function acquire($cb) { $this->appInstance->getkey('error:' . $this->sessId, function ($redis) use ($cb) { if (!$redis) { $this->internalServerError(); return; } if ($redis->result !== null) { $this->error((int)$re...
php
protected function acquire($cb) { $this->appInstance->getkey('error:' . $this->sessId, function ($redis) use ($cb) { if (!$redis) { $this->internalServerError(); return; } if ($redis->result !== null) { $this->error((int)$re...
[ "protected", "function", "acquire", "(", "$", "cb", ")", "{", "$", "this", "->", "appInstance", "->", "getkey", "(", "'error:'", ".", "$", "this", "->", "sessId", ",", "function", "(", "$", "redis", ")", "use", "(", "$", "cb", ")", "{", "if", "(", ...
acquire @param callable $cb @callback $cb ( ) @return void
[ "acquire" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Methods/Generic.php#L233-L284
kakserpom/phpdaemon
PHPDaemon/SockJS/Methods/Generic.php
Generic.error
protected function error($code) { $this->sendFrame('c' . json_encode([$code, isset($this->errors[$code]) ? $this->errors[$code] : null])); }
php
protected function error($code) { $this->sendFrame('c' . json_encode([$code, isset($this->errors[$code]) ? $this->errors[$code] : null])); }
[ "protected", "function", "error", "(", "$", "code", ")", "{", "$", "this", "->", "sendFrame", "(", "'c'", ".", "json_encode", "(", "[", "$", "code", ",", "isset", "(", "$", "this", "->", "errors", "[", "$", "code", "]", ")", "?", "$", "this", "->...
error @param integer $code @return void
[ "error" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Methods/Generic.php#L302-L305
kakserpom/phpdaemon
PHPDaemon/SockJS/Methods/Generic.php
Generic.anotherConnectionStillOpen
protected function anotherConnectionStillOpen() { $this->appInstance->setkey('error:' . $this->sessId, 1002, function () { $this->appInstance->expire('error:' . $this->sessId, $this->appInstance->config->deadsessiontimeout->value, function () { $this->error(20...
php
protected function anotherConnectionStillOpen() { $this->appInstance->setkey('error:' . $this->sessId, 1002, function () { $this->appInstance->expire('error:' . $this->sessId, $this->appInstance->config->deadsessiontimeout->value, function () { $this->error(20...
[ "protected", "function", "anotherConnectionStillOpen", "(", ")", "{", "$", "this", "->", "appInstance", "->", "setkey", "(", "'error:'", ".", "$", "this", "->", "sessId", ",", "1002", ",", "function", "(", ")", "{", "$", "this", "->", "appInstance", "->", ...
anotherConnectionStillOpen @return void
[ "anotherConnectionStillOpen" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Methods/Generic.php#L311-L319
kakserpom/phpdaemon
PHPDaemon/SockJS/Methods/Generic.php
Generic.poll
protected function poll($cb = null) { $this->appInstance->subscribe('s2c:' . $this->sessId, [$this, 's2c'], function ($redis) use ($cb) { $this->appInstance->publish('poll:' . $this->sessId, json_encode($this->pollMode), function ($redis) use ($cb) { if (!$red...
php
protected function poll($cb = null) { $this->appInstance->subscribe('s2c:' . $this->sessId, [$this, 's2c'], function ($redis) use ($cb) { $this->appInstance->publish('poll:' . $this->sessId, json_encode($this->pollMode), function ($redis) use ($cb) { if (!$red...
[ "protected", "function", "poll", "(", "$", "cb", "=", "null", ")", "{", "$", "this", "->", "appInstance", "->", "subscribe", "(", "'s2c:'", ".", "$", "this", "->", "sessId", ",", "[", "$", "this", ",", "'s2c'", "]", ",", "function", "(", "$", "redi...
Poll @param callable $cb @callback $cb ( ) @return void
[ "Poll" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Methods/Generic.php#L327-L390
kakserpom/phpdaemon
PHPDaemon/SockJS/Methods/Generic.php
Generic.outputFrame
public function outputFrame($s, $flush = true) { $this->bytesSent += mb_orig_strlen($s); return parent::out($s, $flush); }
php
public function outputFrame($s, $flush = true) { $this->bytesSent += mb_orig_strlen($s); return parent::out($s, $flush); }
[ "public", "function", "outputFrame", "(", "$", "s", ",", "$", "flush", "=", "true", ")", "{", "$", "this", "->", "bytesSent", "+=", "mb_orig_strlen", "(", "$", "s", ")", ";", "return", "parent", "::", "out", "(", "$", "s", ",", "$", "flush", ")", ...
Output some data @param string $s String to out @param boolean $flush @return boolean Success
[ "Output", "some", "data" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Methods/Generic.php#L398-L402
kakserpom/phpdaemon
PHPDaemon/SockJS/Methods/Generic.php
Generic.s2c
public function s2c($redis) { if (!$redis) { return; } list(, $chan, $msg) = $redis->result; $frames = json_decode($msg, true); if (!is_array($frames) || !sizeof($frames)) { return; } foreach ($frames as $frame) { $this->sen...
php
public function s2c($redis) { if (!$redis) { return; } list(, $chan, $msg) = $redis->result; $frames = json_decode($msg, true); if (!is_array($frames) || !sizeof($frames)) { return; } foreach ($frames as $frame) { $this->sen...
[ "public", "function", "s2c", "(", "$", "redis", ")", "{", "if", "(", "!", "$", "redis", ")", "{", "return", ";", "}", "list", "(", ",", "$", "chan", ",", "$", "msg", ")", "=", "$", "redis", "->", "result", ";", "$", "frames", "=", "json_decode"...
s2c @param object $redis @return void
[ "s2c" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Methods/Generic.php#L426-L447
kakserpom/phpdaemon
PHPDaemon/SockJS/Methods/Generic.php
Generic.onFinish
public function onFinish() { $this->appInstance->unsubscribe('s2c:' . $this->sessId, [$this, 's2c']); $this->appInstance->unsubscribe('w8in:' . $this->sessId, [$this, 'w8in']); Timer::remove($this->heartbeatTimer); if ($this->heartbeatOnFinish) { $this->sendFrame('h'); ...
php
public function onFinish() { $this->appInstance->unsubscribe('s2c:' . $this->sessId, [$this, 's2c']); $this->appInstance->unsubscribe('w8in:' . $this->sessId, [$this, 'w8in']); Timer::remove($this->heartbeatTimer); if ($this->heartbeatOnFinish) { $this->sendFrame('h'); ...
[ "public", "function", "onFinish", "(", ")", "{", "$", "this", "->", "appInstance", "->", "unsubscribe", "(", "'s2c:'", ".", "$", "this", "->", "sessId", ",", "[", "$", "this", ",", "'s2c'", "]", ")", ";", "$", "this", "->", "appInstance", "->", "unsu...
On finish @return void
[ "On", "finish" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Methods/Generic.php#L453-L462
kakserpom/phpdaemon
PHPDaemon/Clients/HTTP/Connection.php
Connection.sendRequestHeaders
protected function sendRequestHeaders($type, $url, &$params) { if (!is_array($params)) { $params = ['resultcb' => $params]; } if (!isset($params['uri']) || !isset($params['host'])) { $prepared = Pool::parseUrl($url); if (!$prepared) { if (i...
php
protected function sendRequestHeaders($type, $url, &$params) { if (!is_array($params)) { $params = ['resultcb' => $params]; } if (!isset($params['uri']) || !isset($params['host'])) { $prepared = Pool::parseUrl($url); if (!$prepared) { if (i...
[ "protected", "function", "sendRequestHeaders", "(", "$", "type", ",", "$", "url", ",", "&", "$", "params", ")", "{", "if", "(", "!", "is_array", "(", "$", "params", ")", ")", "{", "$", "params", "=", "[", "'resultcb'", "=>", "$", "params", "]", ";"...
Send request headers @param $type @param $url @param &$params @return void
[ "Send", "request", "headers" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/HTTP/Connection.php#L122-L176
kakserpom/phpdaemon
PHPDaemon/Clients/HTTP/Connection.php
Connection.post
public function post($url, $data = [], $params = null) { foreach ($data as $val) { if ($val instanceof UploadFile) { $params['contentType'] = 'multipart/form-data'; } } if (!isset($params['contentType'])) { $params['contentType'] = 'applica...
php
public function post($url, $data = [], $params = null) { foreach ($data as $val) { if ($val instanceof UploadFile) { $params['contentType'] = 'multipart/form-data'; } } if (!isset($params['contentType'])) { $params['contentType'] = 'applica...
[ "public", "function", "post", "(", "$", "url", ",", "$", "data", "=", "[", "]", ",", "$", "params", "=", "null", ")", "{", "foreach", "(", "$", "data", "as", "$", "val", ")", "{", "if", "(", "$", "val", "instanceof", "UploadFile", ")", "{", "$"...
Perform a POST request @param string $url @param array $data @param array $params
[ "Perform", "a", "POST", "request" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/HTTP/Connection.php#L222-L246
kakserpom/phpdaemon
PHPDaemon/Clients/HTTP/Connection.php
Connection.getHeader
public function getHeader($name) { $k = 'HTTP_' . strtoupper(strtr($name, Generic::$htr)); return isset($this->headers[$k]) ? $this->headers[$k] : null; }
php
public function getHeader($name) { $k = 'HTTP_' . strtoupper(strtr($name, Generic::$htr)); return isset($this->headers[$k]) ? $this->headers[$k] : null; }
[ "public", "function", "getHeader", "(", "$", "name", ")", "{", "$", "k", "=", "'HTTP_'", ".", "strtoupper", "(", "strtr", "(", "$", "name", ",", "Generic", "::", "$", "htr", ")", ")", ";", "return", "isset", "(", "$", "this", "->", "headers", "[", ...
Get header @param string $name Header name @return string
[ "Get", "header" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/HTTP/Connection.php#L271-L275
kakserpom/phpdaemon
PHPDaemon/Clients/HTTP/Connection.php
Connection.onRead
public function onRead() { if ($this->state === self::STATE_BODY) { goto body; } if ($this->reqType === null) { if ($this->requests->isEmpty()) { $this->finish(); return; } $this->reqType = $this->requests->shift...
php
public function onRead() { if ($this->state === self::STATE_BODY) { goto body; } if ($this->reqType === null) { if ($this->requests->isEmpty()) { $this->finish(); return; } $this->reqType = $this->requests->shift...
[ "public", "function", "onRead", "(", ")", "{", "if", "(", "$", "this", "->", "state", "===", "self", "::", "STATE_BODY", ")", "{", "goto", "body", ";", "}", "if", "(", "$", "this", "->", "reqType", "===", "null", ")", "{", "if", "(", "$", "this",...
Called when new data received
[ "Called", "when", "new", "data", "received" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/HTTP/Connection.php#L280-L425
kakserpom/phpdaemon
PHPDaemon/Clients/HTTP/Connection.php
Connection.onFinish
public function onFinish() { if ($this->eofTerminated) { $this->requestFinished(); $this->onResponse->executeAll($this, false); parent::onFinish(); return; } if ($this->protocolError) { $this->onResponse->executeAll($this, false); ...
php
public function onFinish() { if ($this->eofTerminated) { $this->requestFinished(); $this->onResponse->executeAll($this, false); parent::onFinish(); return; } if ($this->protocolError) { $this->onResponse->executeAll($this, false); ...
[ "public", "function", "onFinish", "(", ")", "{", "if", "(", "$", "this", "->", "eofTerminated", ")", "{", "$", "this", "->", "requestFinished", "(", ")", ";", "$", "this", "->", "onResponse", "->", "executeAll", "(", "$", "this", ",", "false", ")", "...
Called when connection finishes
[ "Called", "when", "connection", "finishes" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/HTTP/Connection.php#L430-L446
kakserpom/phpdaemon
PHPDaemon/Clients/HTTP/Connection.php
Connection.requestFinished
protected function requestFinished() { $this->onResponse->executeOne($this, true); $this->state = self::STATE_ROOT; $this->contentLength = -1; $this->curChunkSize = null; $this->chunked = false; $this->eofTerminated = false; $this->headers = []; $this-...
php
protected function requestFinished() { $this->onResponse->executeOne($this, true); $this->state = self::STATE_ROOT; $this->contentLength = -1; $this->curChunkSize = null; $this->chunked = false; $this->eofTerminated = false; $this->headers = []; $this-...
[ "protected", "function", "requestFinished", "(", ")", "{", "$", "this", "->", "onResponse", "->", "executeOne", "(", "$", "this", ",", "true", ")", ";", "$", "this", "->", "state", "=", "self", "::", "STATE_ROOT", ";", "$", "this", "->", "contentLength",...
Called when request is finished
[ "Called", "when", "request", "is", "finished" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/HTTP/Connection.php#L451-L470
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Exception/AMQPConnectionException.php
AMQPConnectionException.couldNotConnect
public static function couldNotConnect( ConnectionOptions $options, $description, \Exception $previous = null ) { return new self( sprintf( 'Unable to connect to AMQP broker [%s:%d], check connection options and network connectivity (%s).', ...
php
public static function couldNotConnect( ConnectionOptions $options, $description, \Exception $previous = null ) { return new self( sprintf( 'Unable to connect to AMQP broker [%s:%d], check connection options and network connectivity (%s).', ...
[ "public", "static", "function", "couldNotConnect", "(", "ConnectionOptions", "$", "options", ",", "$", "description", ",", "\\", "Exception", "$", "previous", "=", "null", ")", "{", "return", "new", "self", "(", "sprintf", "(", "'Unable to connect to AMQP broker [...
Create an exception that indicates a failure to establish a connection to an AMQP broker. @param ConnectionOptions $options The options used when establishing the connection. @param string $description A description of the problem. @param \Exception|null $previous The exception that caused this exception, if any. @ret...
[ "Create", "an", "exception", "that", "indicates", "a", "failure", "to", "establish", "a", "connection", "to", "an", "AMQP", "broker", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Exception/AMQPConnectionException.php#L25-L41
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Exception/AMQPConnectionException.php
AMQPConnectionException.notOpen
public static function notOpen( ConnectionOptions $options, \Exception $previous = null ) { return new self( sprintf( 'Unable to use connection to AMQP broker [%s:%d] because it is closed.', $options->getHost(), $options->getPor...
php
public static function notOpen( ConnectionOptions $options, \Exception $previous = null ) { return new self( sprintf( 'Unable to use connection to AMQP broker [%s:%d] because it is closed.', $options->getHost(), $options->getPor...
[ "public", "static", "function", "notOpen", "(", "ConnectionOptions", "$", "options", ",", "\\", "Exception", "$", "previous", "=", "null", ")", "{", "return", "new", "self", "(", "sprintf", "(", "'Unable to use connection to AMQP broker [%s:%d] because it is closed.'", ...
Create an exception that indicates an attempt to use a connection that has already been closed. @param ConnectionOptions $options The options used when establishing the connection. @param \Exception|null $previous The exception that caused this exception, if any. @return AMQPConnectionException
[ "Create", "an", "exception", "that", "indicates", "an", "attempt", "to", "use", "a", "connection", "that", "has", "already", "been", "closed", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Exception/AMQPConnectionException.php#L51-L65
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Exception/AMQPConnectionException.php
AMQPConnectionException.authenticationFailed
public static function authenticationFailed( ConnectionOptions $options, \Exception $previous = null ) { return new self( sprintf( 'Unable to authenticate as "%s" on AMQP broker [%s:%d], check authentication credentials.', $options->getUsername...
php
public static function authenticationFailed( ConnectionOptions $options, \Exception $previous = null ) { return new self( sprintf( 'Unable to authenticate as "%s" on AMQP broker [%s:%d], check authentication credentials.', $options->getUsername...
[ "public", "static", "function", "authenticationFailed", "(", "ConnectionOptions", "$", "options", ",", "\\", "Exception", "$", "previous", "=", "null", ")", "{", "return", "new", "self", "(", "sprintf", "(", "'Unable to authenticate as \"%s\" on AMQP broker [%s:%d], che...
Create an exception that indicates that the credentials specified in the connection options are incorrect. @param ConnectionOptions $options The options used when establishing the connection. @param \Exception|null $previous The exception that caused this exception, if any. @return AMQPConnectionException
[ "Create", "an", "exception", "that", "indicates", "that", "the", "credentials", "specified", "in", "the", "connection", "options", "are", "incorrect", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Exception/AMQPConnectionException.php#L75-L90
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Exception/AMQPConnectionException.php
AMQPConnectionException.authorizationFailed
public static function authorizationFailed( ConnectionOptions $options, \Exception $previous = null ) { return new self( sprintf( 'Unable to access vhost "%s" as "%s" on AMQP broker [%s:%d], check permissions.', $options->getVhost(), ...
php
public static function authorizationFailed( ConnectionOptions $options, \Exception $previous = null ) { return new self( sprintf( 'Unable to access vhost "%s" as "%s" on AMQP broker [%s:%d], check permissions.', $options->getVhost(), ...
[ "public", "static", "function", "authorizationFailed", "(", "ConnectionOptions", "$", "options", ",", "\\", "Exception", "$", "previous", "=", "null", ")", "{", "return", "new", "self", "(", "sprintf", "(", "'Unable to access vhost \"%s\" as \"%s\" on AMQP broker [%s:%d...
Create an exception that indicates that the credentials specified in the connection options do not grant access to the requested AMQP virtual host. @param ConnectionOptions $options The options used when establishing the connection. @param \Exception|null $previous The exception that caused this exception, if any. @re...
[ "Create", "an", "exception", "that", "indicates", "that", "the", "credentials", "specified", "in", "the", "connection", "options", "do", "not", "grant", "access", "to", "the", "requested", "AMQP", "virtual", "host", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Exception/AMQPConnectionException.php#L126-L142
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Exception/AMQPConnectionException.php
AMQPConnectionException.heartbeatTimedOut
public static function heartbeatTimedOut( ConnectionOptions $options, $heartbeatInterval, \Exception $previous = null ) { return new self( sprintf( 'The AMQP connection with broker [%s:%d] has timed out, ' . 'the last heartbeat was rece...
php
public static function heartbeatTimedOut( ConnectionOptions $options, $heartbeatInterval, \Exception $previous = null ) { return new self( sprintf( 'The AMQP connection with broker [%s:%d] has timed out, ' . 'the last heartbeat was rece...
[ "public", "static", "function", "heartbeatTimedOut", "(", "ConnectionOptions", "$", "options", ",", "$", "heartbeatInterval", ",", "\\", "Exception", "$", "previous", "=", "null", ")", "{", "return", "new", "self", "(", "sprintf", "(", "'The AMQP connection with b...
Create an exception that indicates that the broker has failed to send any data for a period longer than the heartbeat interval. @param ConnectionOptions $options The options used when establishing the connection. @param int $heartbeatInterval The heartbeat interval negotiated during the AMQP handshake. @param \Excepti...
[ "Create", "an", "exception", "that", "indicates", "that", "the", "broker", "has", "failed", "to", "send", "any", "data", "for", "a", "period", "longer", "than", "the", "heartbeat", "interval", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Exception/AMQPConnectionException.php#L153-L170
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Connection/ConnectionBlockedFrame.php
ConnectionBlockedFrame.create
public static function create( $reason = null ) { $frame = new self(); if (null !== $reason) { $frame->reason = $reason; } return $frame; }
php
public static function create( $reason = null ) { $frame = new self(); if (null !== $reason) { $frame->reason = $reason; } return $frame; }
[ "public", "static", "function", "create", "(", "$", "reason", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", "if", "(", "null", "!==", "$", "reason", ")", "{", "$", "frame", "->", "reason", "=", "$", "reason", ";", "}", ...
shortstr
[ "shortstr" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Connection/ConnectionBlockedFrame.php#L20-L31
kakserpom/phpdaemon
PHPDaemon/Clients/IMAP/Connection.php
Connection.escapeList
protected function escapeList($list) { $result = []; foreach ($list as $v) { if (!is_array($v)) { $result[] = $v; continue; } $result[] = $this->escapeList($v); } return '(' . implode(' ', $result) . ')'; }
php
protected function escapeList($list) { $result = []; foreach ($list as $v) { if (!is_array($v)) { $result[] = $v; continue; } $result[] = $this->escapeList($v); } return '(' . implode(' ', $result) . ')'; }
[ "protected", "function", "escapeList", "(", "$", "list", ")", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "list", "as", "$", "v", ")", "{", "if", "(", "!", "is_array", "(", "$", "v", ")", ")", "{", "$", "result", "[", "]", "=...
escape a list with literals or lists @param array $list list with literals or lists as PHP array @return string escaped list for imap
[ "escape", "a", "list", "with", "literals", "or", "lists" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/IMAP/Connection.php#L85-L96
kakserpom/phpdaemon
PHPDaemon/Clients/IMAP/Connection.php
Connection.decodeLine
protected function decodeLine($line) { $tokens = []; $stack = []; /* We start to decode the response here. The understood tokens are: literal "literal" or also "lit\\er\"al" (literals*) All tokens are returned in an arra...
php
protected function decodeLine($line) { $tokens = []; $stack = []; /* We start to decode the response here. The understood tokens are: literal "literal" or also "lit\\er\"al" (literals*) All tokens are returned in an arra...
[ "protected", "function", "decodeLine", "(", "$", "line", ")", "{", "$", "tokens", "=", "[", "]", ";", "$", "stack", "=", "[", "]", ";", "/*\n We start to decode the response here. The understood tokens are:\n literal\n \"literal\" or a...
split a given line in tokens. a token is literal of any form or a list @param string $line line to decode @return array tokens, literals are returned as string, lists as array
[ "split", "a", "given", "line", "in", "tokens", ".", "a", "token", "is", "literal", "of", "any", "form", "or", "a", "list" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/IMAP/Connection.php#L104-L167
kakserpom/phpdaemon
PHPDaemon/Clients/IMAP/Connection.php
Connection.decodeSize
protected function decodeSize($lines) { $sizes = []; foreach (array_map([$this, 'decodeLine'], $lines) as $tokens) { if (!isset($tokens[1]) || $tokens[1] !== 'FETCH') { continue; } if (!isset($tokens[2][0]) || $tokens[2][0] !== 'UID') { ...
php
protected function decodeSize($lines) { $sizes = []; foreach (array_map([$this, 'decodeLine'], $lines) as $tokens) { if (!isset($tokens[1]) || $tokens[1] !== 'FETCH') { continue; } if (!isset($tokens[2][0]) || $tokens[2][0] !== 'UID') { ...
[ "protected", "function", "decodeSize", "(", "$", "lines", ")", "{", "$", "sizes", "=", "[", "]", ";", "foreach", "(", "array_map", "(", "[", "$", "this", ",", "'decodeLine'", "]", ",", "$", "lines", ")", "as", "$", "tokens", ")", "{", "if", "(", ...
/* @param array $lines
[ "/", "*" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/IMAP/Connection.php#L336-L355
kakserpom/phpdaemon
PHPDaemon/Clients/IMAP/Connection.php
Connection.countMessages
public function countMessages($cb, $flags = null) { $this->onResponse->push($cb); if ($flags === null) { $this->searchMessages(['ALL'], self::TAG_COUNT); return; } $params = []; foreach ((array) $flags as $flag) { if (isset($this->searchFla...
php
public function countMessages($cb, $flags = null) { $this->onResponse->push($cb); if ($flags === null) { $this->searchMessages(['ALL'], self::TAG_COUNT); return; } $params = []; foreach ((array) $flags as $flag) { if (isset($this->searchFla...
[ "public", "function", "countMessages", "(", "$", "cb", ",", "$", "flags", "=", "null", ")", "{", "$", "this", "->", "onResponse", "->", "push", "(", "$", "cb", ")", ";", "if", "(", "$", "flags", "===", "null", ")", "{", "$", "this", "->", "search...
Count messages all messages in current box @param null $flags
[ "Count", "messages", "all", "messages", "in", "current", "box" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/IMAP/Connection.php#L475-L492
kakserpom/phpdaemon
PHPDaemon/Clients/IMAP/Connection.php
Connection.getSize
public function getSize($cb, $uid = null) { $this->onResponse->push($cb); if ($uid) { $this->fetch('RFC822.SIZE', $uid, null, true, self::TAG_SIZE); } else { $this->fetch('RFC822.SIZE', 1, INF, true, self::TAG_SIZE); } }
php
public function getSize($cb, $uid = null) { $this->onResponse->push($cb); if ($uid) { $this->fetch('RFC822.SIZE', $uid, null, true, self::TAG_SIZE); } else { $this->fetch('RFC822.SIZE', 1, INF, true, self::TAG_SIZE); } }
[ "public", "function", "getSize", "(", "$", "cb", ",", "$", "uid", "=", "null", ")", "{", "$", "this", "->", "onResponse", "->", "push", "(", "$", "cb", ")", ";", "if", "(", "$", "uid", ")", "{", "$", "this", "->", "fetch", "(", "'RFC822.SIZE'", ...
get a list of messages with number and size @param int $uid number of message
[ "get", "a", "list", "of", "messages", "with", "number", "and", "size" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/IMAP/Connection.php#L498-L506
kakserpom/phpdaemon
PHPDaemon/Clients/IMAP/Connection.php
Connection.getRawMessage
public function getRawMessage($cb, $uid, $byUid = true) { $this->onResponse->push($cb); $this->fetch(['FLAGS', 'BODY[]'], $uid, null, $byUid, self::TAG_GETRAWMESSAGE); }
php
public function getRawMessage($cb, $uid, $byUid = true) { $this->onResponse->push($cb); $this->fetch(['FLAGS', 'BODY[]'], $uid, null, $byUid, self::TAG_GETRAWMESSAGE); }
[ "public", "function", "getRawMessage", "(", "$", "cb", ",", "$", "uid", ",", "$", "byUid", "=", "true", ")", "{", "$", "this", "->", "onResponse", "->", "push", "(", "$", "cb", ")", ";", "$", "this", "->", "fetch", "(", "[", "'FLAGS'", ",", "'BOD...
Fetch a message @param int $uid unique number of message
[ "Fetch", "a", "message" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/IMAP/Connection.php#L512-L516
kakserpom/phpdaemon
PHPDaemon/Clients/IMAP/Connection.php
Connection.getRawHeader
public function getRawHeader($cb, $uid, $byUid = true) { $this->onResponse->push($cb); $this->fetch(['FLAGS', 'RFC822.HEADER'], $uid, null, $byUid, self::TAG_GETRAWHEADER); }
php
public function getRawHeader($cb, $uid, $byUid = true) { $this->onResponse->push($cb); $this->fetch(['FLAGS', 'RFC822.HEADER'], $uid, null, $byUid, self::TAG_GETRAWHEADER); }
[ "public", "function", "getRawHeader", "(", "$", "cb", ",", "$", "uid", ",", "$", "byUid", "=", "true", ")", "{", "$", "this", "->", "onResponse", "->", "push", "(", "$", "cb", ")", ";", "$", "this", "->", "fetch", "(", "[", "'FLAGS'", ",", "'RFC8...
/* Get raw header of message or part @param int $uid unique number of message
[ "/", "*", "Get", "raw", "header", "of", "message", "or", "part" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/IMAP/Connection.php#L522-L526
kakserpom/phpdaemon
PHPDaemon/Clients/IMAP/Connection.php
Connection.getRawContent
public function getRawContent($cb, $uid, $byUid = true) { $this->onResponse->push($cb); $this->fetch(['FLAGS', 'RFC822.TEXT'], $uid, null, $byUid, self::TAG_GETRAWCONTENT); }
php
public function getRawContent($cb, $uid, $byUid = true) { $this->onResponse->push($cb); $this->fetch(['FLAGS', 'RFC822.TEXT'], $uid, null, $byUid, self::TAG_GETRAWCONTENT); }
[ "public", "function", "getRawContent", "(", "$", "cb", ",", "$", "uid", ",", "$", "byUid", "=", "true", ")", "{", "$", "this", "->", "onResponse", "->", "push", "(", "$", "cb", ")", ";", "$", "this", "->", "fetch", "(", "[", "'FLAGS'", ",", "'RFC...
/* Get raw content of message or part @param int $uid number of message
[ "/", "*", "Get", "raw", "content", "of", "message", "or", "part" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/IMAP/Connection.php#L533-L537
kakserpom/phpdaemon
PHPDaemon/Clients/IMAP/Connection.php
Connection.getUniqueId
public function getUniqueId($cb, $id = null) { $this->onResponse->push($cb); if ($id) { $this->fetch('UID', $id, null, false, self::TAG_GETUID); } else { $this->fetch('UID', 1, INF, false, self::TAG_GETUID); } }
php
public function getUniqueId($cb, $id = null) { $this->onResponse->push($cb); if ($id) { $this->fetch('UID', $id, null, false, self::TAG_GETUID); } else { $this->fetch('UID', 1, INF, false, self::TAG_GETUID); } }
[ "public", "function", "getUniqueId", "(", "$", "cb", ",", "$", "id", "=", "null", ")", "{", "$", "this", "->", "onResponse", "->", "push", "(", "$", "cb", ")", ";", "if", "(", "$", "id", ")", "{", "$", "this", "->", "fetch", "(", "'UID'", ",", ...
get unique id for one or all messages @param int|null $id message number
[ "get", "unique", "id", "for", "one", "or", "all", "messages" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/IMAP/Connection.php#L544-L552
kakserpom/phpdaemon
PHPDaemon/Clients/IMAP/Connection.php
Connection.createFolder
public function createFolder($cb, $folder, $parentFolder = null) { $this->onResponse->push($cb); if ($parentFolder) { $folder = $parentFolder . '/' . $folder ; } $this->writeln(self::TAG_CREATEFOLDER . " CREATE ".$this->escapeString($folder)); }
php
public function createFolder($cb, $folder, $parentFolder = null) { $this->onResponse->push($cb); if ($parentFolder) { $folder = $parentFolder . '/' . $folder ; } $this->writeln(self::TAG_CREATEFOLDER . " CREATE ".$this->escapeString($folder)); }
[ "public", "function", "createFolder", "(", "$", "cb", ",", "$", "folder", ",", "$", "parentFolder", "=", "null", ")", "{", "$", "this", "->", "onResponse", "->", "push", "(", "$", "cb", ")", ";", "if", "(", "$", "parentFolder", ")", "{", "$", "fold...
create a new folder (and parent folders if needed) @param string $folder folder name @return bool success
[ "create", "a", "new", "folder", "(", "and", "parent", "folders", "if", "needed", ")" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/IMAP/Connection.php#L560-L567
kakserpom/phpdaemon
PHPDaemon/Clients/IMAP/Connection.php
Connection.removeFolder
public function removeFolder($cb, $folder) { $this->onResponse->push($cb); $this->writeln(self::TAG_DELETEFOLDER . " DELETE ".$this->escapeString($folder)); }
php
public function removeFolder($cb, $folder) { $this->onResponse->push($cb); $this->writeln(self::TAG_DELETEFOLDER . " DELETE ".$this->escapeString($folder)); }
[ "public", "function", "removeFolder", "(", "$", "cb", ",", "$", "folder", ")", "{", "$", "this", "->", "onResponse", "->", "push", "(", "$", "cb", ")", ";", "$", "this", "->", "writeln", "(", "self", "::", "TAG_DELETEFOLDER", ".", "\" DELETE \"", ".", ...
remove a folder @param string $name name or instance of folder
[ "remove", "a", "folder" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/IMAP/Connection.php#L574-L578