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 |
|---|---|---|---|---|---|---|---|---|---|---|
sstalle/php7cc | src/NodeVisitor/ListVisitor.php | ListVisitor.enterNode | public function enterNode(Node $node)
{
if ($node instanceof Node\Expr\List_) {
$hasNonNullVar = false;
foreach ($node->vars as $var) {
if ($var !== null) {
$hasNonNullVar = true;
break;
}
}
... | php | public function enterNode(Node $node)
{
if ($node instanceof Node\Expr\List_) {
$hasNonNullVar = false;
foreach ($node->vars as $var) {
if ($var !== null) {
$hasNonNullVar = true;
break;
}
}
... | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"instanceof",
"Node",
"\\",
"Expr",
"\\",
"List_",
")",
"{",
"$",
"hasNonNullVar",
"=",
"false",
";",
"foreach",
"(",
"$",
"node",
"->",
"vars",
"as",
"$",... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/ListVisitor.php#L15-L42 |
sstalle/php7cc | src/Reflection/Internal/Reflector/ClassReflector.php | ClassReflector.supports | public function supports($identifier)
{
if (!class_exists($identifier)) {
return false;
}
$internalReflection = $this->getInternalReflection($identifier);
return !$internalReflection->isUserDefined();
} | php | public function supports($identifier)
{
if (!class_exists($identifier)) {
return false;
}
$internalReflection = $this->getInternalReflection($identifier);
return !$internalReflection->isUserDefined();
} | [
"public",
"function",
"supports",
"(",
"$",
"identifier",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"identifier",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"internalReflection",
"=",
"$",
"this",
"->",
"getInternalReflection",
"(",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/Reflection/Internal/Reflector/ClassReflector.php#L21-L30 |
sstalle/php7cc | src/NodeVisitor/PregReplaceEvalVisitor.php | PregReplaceEvalVisitor.enterNode | public function enterNode(Node $node)
{
if (!$this->functionAnalyzer->isFunctionCallByStaticName($node, 'preg_replace')) {
return;
}
/** @var Node\Expr\FuncCall $node */
$regExpPatternArgument = $node->args[0];
if (!$regExpPatternArgument->value instanceof Node\S... | php | public function enterNode(Node $node)
{
if (!$this->functionAnalyzer->isFunctionCallByStaticName($node, 'preg_replace')) {
return;
}
/** @var Node\Expr\FuncCall $node */
$regExpPatternArgument = $node->args[0];
if (!$regExpPatternArgument->value instanceof Node\S... | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"functionAnalyzer",
"->",
"isFunctionCallByStaticName",
"(",
"$",
"node",
",",
"'preg_replace'",
")",
")",
"{",
"return",
";",
"}",
"/** @var Node\\Expr... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/PregReplaceEvalVisitor.php#L38-L57 |
sstalle/php7cc | src/NodeAnalyzer/Reflection/FunctionLike/FunctionLikeCalleeReflector.php | FunctionLikeCalleeReflector.getSupportedReflector | private function getSupportedReflector($node)
{
foreach ($this->delegateReflectors as $reflector) {
if ($reflector->supports($node)) {
return $reflector;
}
}
return;
} | php | private function getSupportedReflector($node)
{
foreach ($this->delegateReflectors as $reflector) {
if ($reflector->supports($node)) {
return $reflector;
}
}
return;
} | [
"private",
"function",
"getSupportedReflector",
"(",
"$",
"node",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"delegateReflectors",
"as",
"$",
"reflector",
")",
"{",
"if",
"(",
"$",
"reflector",
"->",
"supports",
"(",
"$",
"node",
")",
")",
"{",
"return... | @param Expr\StaticCall|Expr\FuncCall|Expr\MethodCall $node
@return CalleeReflectorInterface|null | [
"@param",
"Expr",
"\\",
"StaticCall|Expr",
"\\",
"FuncCall|Expr",
"\\",
"MethodCall",
"$node"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeAnalyzer/Reflection/FunctionLike/FunctionLikeCalleeReflector.php#L43-L52 |
sstalle/php7cc | src/NodeVisitor/NewAssignmentByReferenceVisitor.php | NewAssignmentByReferenceVisitor.enterNode | public function enterNode(Node $node)
{
if ($node instanceof Node\Expr\AssignRef && $node->expr instanceof Node\Expr\New_) {
$this->addContextMessage(
'Result of new is assigned by reference',
$node
);
}
} | php | public function enterNode(Node $node)
{
if ($node instanceof Node\Expr\AssignRef && $node->expr instanceof Node\Expr\New_) {
$this->addContextMessage(
'Result of new is assigned by reference',
$node
);
}
} | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"instanceof",
"Node",
"\\",
"Expr",
"\\",
"AssignRef",
"&&",
"$",
"node",
"->",
"expr",
"instanceof",
"Node",
"\\",
"Expr",
"\\",
"New_",
")",
"{",
"$",
"t... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/NewAssignmentByReferenceVisitor.php#L15-L23 |
sstalle/php7cc | src/Iterator/ExtensionFilteringRecursiveIterator.php | ExtensionFilteringRecursiveIterator.accept | public function accept()
{
$currentKey = $this->key();
$isFile = $currentKey && is_file($currentKey);
if ($isFile && isset($this->alwaysAllowedFiles[realpath($currentKey)])) {
return true;
}
return !$isFile || in_array(pathinfo($currentKey, PATHINFO_EXTENSION), ... | php | public function accept()
{
$currentKey = $this->key();
$isFile = $currentKey && is_file($currentKey);
if ($isFile && isset($this->alwaysAllowedFiles[realpath($currentKey)])) {
return true;
}
return !$isFile || in_array(pathinfo($currentKey, PATHINFO_EXTENSION), ... | [
"public",
"function",
"accept",
"(",
")",
"{",
"$",
"currentKey",
"=",
"$",
"this",
"->",
"key",
"(",
")",
";",
"$",
"isFile",
"=",
"$",
"currentKey",
"&&",
"is_file",
"(",
"$",
"currentKey",
")",
";",
"if",
"(",
"$",
"isFile",
"&&",
"isset",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/Iterator/ExtensionFilteringRecursiveIterator.php#L35-L45 |
sstalle/php7cc | src/ExcludedPathCanonicalizer.php | ExcludedPathCanonicalizer.canonicalize | public function canonicalize(array $checkedPaths, array $excludedPaths)
{
$checkedDirectories = array_filter($checkedPaths, function ($path) {
return is_dir($path);
});
$canonicalizedPaths = array();
foreach ($excludedPaths as $path) {
if (!$this->pathHelper-... | php | public function canonicalize(array $checkedPaths, array $excludedPaths)
{
$checkedDirectories = array_filter($checkedPaths, function ($path) {
return is_dir($path);
});
$canonicalizedPaths = array();
foreach ($excludedPaths as $path) {
if (!$this->pathHelper-... | [
"public",
"function",
"canonicalize",
"(",
"array",
"$",
"checkedPaths",
",",
"array",
"$",
"excludedPaths",
")",
"{",
"$",
"checkedDirectories",
"=",
"array_filter",
"(",
"$",
"checkedPaths",
",",
"function",
"(",
"$",
"path",
")",
"{",
"return",
"is_dir",
... | Makes all excluded paths absolute. Non-existent paths are removed.
@param string[] $checkedPaths
@param string[] $excludedPaths
@return \string[] | [
"Makes",
"all",
"excluded",
"paths",
"absolute",
".",
"Non",
"-",
"existent",
"paths",
"are",
"removed",
"."
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/ExcludedPathCanonicalizer.php#L30-L49 |
sstalle/php7cc | src/NodeVisitor/PHP4ConstructorVisitor.php | PHP4ConstructorVisitor.enterNode | public function enterNode(Node $node)
{
if ($node instanceof Node\Stmt\Class_) {
$currentClassName = $node->name;
$hasPhp4Constructor = false;
$hasPhp5Constructor = false;
$php4ConstructorNode = null;
// Anonymous class can't use php4 constructor ... | php | public function enterNode(Node $node)
{
if ($node instanceof Node\Stmt\Class_) {
$currentClassName = $node->name;
$hasPhp4Constructor = false;
$hasPhp5Constructor = false;
$php4ConstructorNode = null;
// Anonymous class can't use php4 constructor ... | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"instanceof",
"Node",
"\\",
"Stmt",
"\\",
"Class_",
")",
"{",
"$",
"currentClassName",
"=",
"$",
"node",
"->",
"name",
";",
"$",
"hasPhp4Constructor",
"=",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/PHP4ConstructorVisitor.php#L15-L54 |
sstalle/php7cc | src/NodeVisitor/MultipleSwitchDefaultsVisitor.php | MultipleSwitchDefaultsVisitor.enterNode | public function enterNode(Node $node)
{
if (!$node instanceof Node\Stmt\Switch_) {
return;
}
$defaultCaseCount = 0;
foreach ($node->cases as $case) {
if ($case->cond === null) {
++$defaultCaseCount;
}
}
if ($defaul... | php | public function enterNode(Node $node)
{
if (!$node instanceof Node\Stmt\Switch_) {
return;
}
$defaultCaseCount = 0;
foreach ($node->cases as $case) {
if ($case->cond === null) {
++$defaultCaseCount;
}
}
if ($defaul... | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"$",
"node",
"instanceof",
"Node",
"\\",
"Stmt",
"\\",
"Switch_",
")",
"{",
"return",
";",
"}",
"$",
"defaultCaseCount",
"=",
"0",
";",
"foreach",
"(",
"$",
"node"... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/MultipleSwitchDefaultsVisitor.php#L15-L34 |
sstalle/php7cc | src/NodeVisitor/SessionSetSaveHandlerVisitor.php | SessionSetSaveHandlerVisitor.enterNode | public function enterNode(Node $node)
{
if ($this->functionAnalyzer->isFunctionCallByStaticName($node, array('session_set_save_handler' => true))) {
$this->addContextMessage(
'Check that callbacks that are passed to "session_set_save_handler" '
. 'and return false... | php | public function enterNode(Node $node)
{
if ($this->functionAnalyzer->isFunctionCallByStaticName($node, array('session_set_save_handler' => true))) {
$this->addContextMessage(
'Check that callbacks that are passed to "session_set_save_handler" '
. 'and return false... | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"functionAnalyzer",
"->",
"isFunctionCallByStaticName",
"(",
"$",
"node",
",",
"array",
"(",
"'session_set_save_handler'",
"=>",
"true",
")",
")",
")",
"{",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/SessionSetSaveHandlerVisitor.php#L29-L38 |
sstalle/php7cc | src/NodeVisitor/FuncGetArgsVisitor.php | FuncGetArgsVisitor.enterNode | public function enterNode(Node $node)
{
if ($node instanceof Node\FunctionLike) {
$parameterNames = $this->extractParametersNames($node->getParams());
$this->scopes->push(new FunctionLikeScope($parameterNames));
return;
}
$scope = $this->getCurrentScope(... | php | public function enterNode(Node $node)
{
if ($node instanceof Node\FunctionLike) {
$parameterNames = $this->extractParametersNames($node->getParams());
$this->scopes->push(new FunctionLikeScope($parameterNames));
return;
}
$scope = $this->getCurrentScope(... | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"instanceof",
"Node",
"\\",
"FunctionLike",
")",
"{",
"$",
"parameterNames",
"=",
"$",
"this",
"->",
"extractParametersNames",
"(",
"$",
"node",
"->",
"getParams... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/FuncGetArgsVisitor.php#L63-L88 |
sstalle/php7cc | src/NodeVisitor/FuncGetArgsVisitor.php | FuncGetArgsVisitor.leaveNode | public function leaveNode(Node $node)
{
$scope = $this->getCurrentScope();
if (!$scope) {
return;
}
if ($node instanceof Node\FunctionLike) {
$this->scopes->pop();
return;
}
foreach ($this->argumentModifyingClasses as $class) {
... | php | public function leaveNode(Node $node)
{
$scope = $this->getCurrentScope();
if (!$scope) {
return;
}
if ($node instanceof Node\FunctionLike) {
$this->scopes->pop();
return;
}
foreach ($this->argumentModifyingClasses as $class) {
... | [
"public",
"function",
"leaveNode",
"(",
"Node",
"$",
"node",
")",
"{",
"$",
"scope",
"=",
"$",
"this",
"->",
"getCurrentScope",
"(",
")",
";",
"if",
"(",
"!",
"$",
"scope",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"node",
"instanceof",
"Node",... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/FuncGetArgsVisitor.php#L93-L114 |
sstalle/php7cc | src/NodeVisitor/FuncGetArgsVisitor.php | FuncGetArgsVisitor.getModifiedVariableNames | private function getModifiedVariableNames(Node $node)
{
switch (true) {
case $node instanceof Node\Stmt\Foreach_:
return $this->extractModifiedVariableNames(array($node->keyVar, $node->valueVar));
case $node instanceof Node\Stmt\Unset_:
$modifiedNames... | php | private function getModifiedVariableNames(Node $node)
{
switch (true) {
case $node instanceof Node\Stmt\Foreach_:
return $this->extractModifiedVariableNames(array($node->keyVar, $node->valueVar));
case $node instanceof Node\Stmt\Unset_:
$modifiedNames... | [
"private",
"function",
"getModifiedVariableNames",
"(",
"Node",
"$",
"node",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"$",
"node",
"instanceof",
"Node",
"\\",
"Stmt",
"\\",
"Foreach_",
":",
"return",
"$",
"this",
"->",
"extractModifiedVariableNames",... | @param Node $node
@return string[] | [
"@param",
"Node",
"$node"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/FuncGetArgsVisitor.php#L121-L161 |
sstalle/php7cc | src/NodeVisitor/FuncGetArgsVisitor.php | FuncGetArgsVisitor.getParameterNamesReturnedBy | private function getParameterNamesReturnedBy(Node\Expr\FuncCall $getArgsCall)
{
$scope = $this->getCurrentScope();
if (!$scope) {
return array();
}
$allParameterNames = $scope->getParameterNames();
$argumentNumber = isset($getArgsCall->args[0]) ? $getArgsCall->ar... | php | private function getParameterNamesReturnedBy(Node\Expr\FuncCall $getArgsCall)
{
$scope = $this->getCurrentScope();
if (!$scope) {
return array();
}
$allParameterNames = $scope->getParameterNames();
$argumentNumber = isset($getArgsCall->args[0]) ? $getArgsCall->ar... | [
"private",
"function",
"getParameterNamesReturnedBy",
"(",
"Node",
"\\",
"Expr",
"\\",
"FuncCall",
"$",
"getArgsCall",
")",
"{",
"$",
"scope",
"=",
"$",
"this",
"->",
"getCurrentScope",
"(",
")",
";",
"if",
"(",
"!",
"$",
"scope",
")",
"{",
"return",
"ar... | Returns current function's parameter names that could be returned
from a func_get_args/func_get_arg call.
@param Node\Expr\FuncCall $getArgsCall
@return string[] | [
"Returns",
"current",
"function",
"s",
"parameter",
"names",
"that",
"could",
"be",
"returned",
"from",
"a",
"func_get_args",
"/",
"func_get_arg",
"call",
"."
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/FuncGetArgsVisitor.php#L171-L193 |
sstalle/php7cc | src/NodeVisitor/FuncGetArgsVisitor.php | FuncGetArgsVisitor.addVariableReference | private function addVariableReference(Node\Expr\AssignRef $node)
{
$scope = $this->getCurrentScope();
/**
* If the reference is assigned to an object property, the warning is not relevant,
* because the user probably expects the assigned property to be modified.
*/
... | php | private function addVariableReference(Node\Expr\AssignRef $node)
{
$scope = $this->getCurrentScope();
/**
* If the reference is assigned to an object property, the warning is not relevant,
* because the user probably expects the assigned property to be modified.
*/
... | [
"private",
"function",
"addVariableReference",
"(",
"Node",
"\\",
"Expr",
"\\",
"AssignRef",
"$",
"node",
")",
"{",
"$",
"scope",
"=",
"$",
"this",
"->",
"getCurrentScope",
"(",
")",
";",
"/**\n * If the reference is assigned to an object property, the warning i... | @param Node\Expr\AssignRef $node
@return string[] | [
"@param",
"Node",
"\\",
"Expr",
"\\",
"AssignRef",
"$node"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/FuncGetArgsVisitor.php#L200-L220 |
sstalle/php7cc | src/NodeVisitor/FuncGetArgsVisitor.php | FuncGetArgsVisitor.extractModifiedVariableNames | private function extractModifiedVariableNames(array $nodes)
{
$modifiedNames = array();
foreach ($nodes as $node) {
if (!$node) {
continue;
}
$variableNameNode = $node;
if ($node instanceof Node\Arg) {
$variableNameNode... | php | private function extractModifiedVariableNames(array $nodes)
{
$modifiedNames = array();
foreach ($nodes as $node) {
if (!$node) {
continue;
}
$variableNameNode = $node;
if ($node instanceof Node\Arg) {
$variableNameNode... | [
"private",
"function",
"extractModifiedVariableNames",
"(",
"array",
"$",
"nodes",
")",
"{",
"$",
"modifiedNames",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"nodes",
"as",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"$",
"node",
")",
"{",
"continue"... | @param Node[] $nodes
@return string[] | [
"@param",
"Node",
"[]",
"$nodes"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/FuncGetArgsVisitor.php#L251-L277 |
sstalle/php7cc | src/NodeVisitor/FuncGetArgsVisitor.php | FuncGetArgsVisitor.convertVariableNameToString | private function convertVariableNameToString(Node $variableNode)
{
return $variableNode instanceof Node\Expr\Variable && is_string($variableNode->name)
? $variableNode->name
: FunctionLikeScope::VARIABLE_VARIABLE_NAME;
} | php | private function convertVariableNameToString(Node $variableNode)
{
return $variableNode instanceof Node\Expr\Variable && is_string($variableNode->name)
? $variableNode->name
: FunctionLikeScope::VARIABLE_VARIABLE_NAME;
} | [
"private",
"function",
"convertVariableNameToString",
"(",
"Node",
"$",
"variableNode",
")",
"{",
"return",
"$",
"variableNode",
"instanceof",
"Node",
"\\",
"Expr",
"\\",
"Variable",
"&&",
"is_string",
"(",
"$",
"variableNode",
"->",
"name",
")",
"?",
"$",
"va... | @param Node $variableNode
@return string | [
"@param",
"Node",
"$variableNode"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/FuncGetArgsVisitor.php#L284-L289 |
sstalle/php7cc | src/NodeVisitor/AbstractNewFunctionVisitor.php | AbstractNewFunctionVisitor.enterNode | public function enterNode(Node $node)
{
if ($node instanceof Node\Stmt\If_) {
$this->ifStatementStack->push($node);
return;
}
if ($this->isNewFunctionCall($node)
&& !$this->isFunctionExistenceChecked($node)
&& $this->accepts($node)
) ... | php | public function enterNode(Node $node)
{
if ($node instanceof Node\Stmt\If_) {
$this->ifStatementStack->push($node);
return;
}
if ($this->isNewFunctionCall($node)
&& !$this->isFunctionExistenceChecked($node)
&& $this->accepts($node)
) ... | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"instanceof",
"Node",
"\\",
"Stmt",
"\\",
"If_",
")",
"{",
"$",
"this",
"->",
"ifStatementStack",
"->",
"push",
"(",
"$",
"node",
")",
";",
"return",
";",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/AbstractNewFunctionVisitor.php#L66-L81 |
sstalle/php7cc | src/NodeVisitor/AbstractNewFunctionVisitor.php | AbstractNewFunctionVisitor.leaveNode | public function leaveNode(Node $node)
{
if (!$this->ifStatementStack->isEmpty() && $this->ifStatementStack->top() === $node) {
$this->ifStatementStack->pop();
}
} | php | public function leaveNode(Node $node)
{
if (!$this->ifStatementStack->isEmpty() && $this->ifStatementStack->top() === $node) {
$this->ifStatementStack->pop();
}
} | [
"public",
"function",
"leaveNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"ifStatementStack",
"->",
"isEmpty",
"(",
")",
"&&",
"$",
"this",
"->",
"ifStatementStack",
"->",
"top",
"(",
")",
"===",
"$",
"node",
")",
"{",... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/AbstractNewFunctionVisitor.php#L86-L91 |
sstalle/php7cc | src/NodeVisitor/AbstractNewFunctionVisitor.php | AbstractNewFunctionVisitor.isNewFunctionCall | private function isNewFunctionCall(Node $node)
{
return $node instanceof Node\Stmt\Function_
&& ($lowerCasedFunction = $this->extractNormalizedFunctionName($node))
&& array_key_exists($lowerCasedFunction, self::$lowerCasedNewFunctions);
} | php | private function isNewFunctionCall(Node $node)
{
return $node instanceof Node\Stmt\Function_
&& ($lowerCasedFunction = $this->extractNormalizedFunctionName($node))
&& array_key_exists($lowerCasedFunction, self::$lowerCasedNewFunctions);
} | [
"private",
"function",
"isNewFunctionCall",
"(",
"Node",
"$",
"node",
")",
"{",
"return",
"$",
"node",
"instanceof",
"Node",
"\\",
"Stmt",
"\\",
"Function_",
"&&",
"(",
"$",
"lowerCasedFunction",
"=",
"$",
"this",
"->",
"extractNormalizedFunctionName",
"(",
"$... | @param Node $node
@return bool | [
"@param",
"Node",
"$node"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/AbstractNewFunctionVisitor.php#L112-L117 |
sstalle/php7cc | src/NodeVisitor/AbstractNewFunctionVisitor.php | AbstractNewFunctionVisitor.isFunctionExistenceChecked | private function isFunctionExistenceChecked(Node\Stmt\Function_ $declaredFunction)
{
/** @var Node\Stmt\If_ $ifStatement */
foreach ($this->ifStatementStack as $ifStatement) {
$condition = $ifStatement->cond;
$isConditionNegatedFunctionExistsCall = $condition
... | php | private function isFunctionExistenceChecked(Node\Stmt\Function_ $declaredFunction)
{
/** @var Node\Stmt\If_ $ifStatement */
foreach ($this->ifStatementStack as $ifStatement) {
$condition = $ifStatement->cond;
$isConditionNegatedFunctionExistsCall = $condition
... | [
"private",
"function",
"isFunctionExistenceChecked",
"(",
"Node",
"\\",
"Stmt",
"\\",
"Function_",
"$",
"declaredFunction",
")",
"{",
"/** @var Node\\Stmt\\If_ $ifStatement */",
"foreach",
"(",
"$",
"this",
"->",
"ifStatementStack",
"as",
"$",
"ifStatement",
")",
"{",... | @param Node\Stmt\Function_ $declaredFunction
@return bool | [
"@param",
"Node",
"\\",
"Stmt",
"\\",
"Function_",
"$declaredFunction"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/AbstractNewFunctionVisitor.php#L124-L159 |
sstalle/php7cc | src/CompatibilityViolation/FileContext.php | FileContext.getCheckedResourceName | public function getCheckedResourceName()
{
$file = $this->getFile();
return $this->useRelativePaths ? $file->getRelativePathname() : $file->getRealPath();
} | php | public function getCheckedResourceName()
{
$file = $this->getFile();
return $this->useRelativePaths ? $file->getRelativePathname() : $file->getRealPath();
} | [
"public",
"function",
"getCheckedResourceName",
"(",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"getFile",
"(",
")",
";",
"return",
"$",
"this",
"->",
"useRelativePaths",
"?",
"$",
"file",
"->",
"getRelativePathname",
"(",
")",
":",
"$",
"file",
"->"... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/CompatibilityViolation/FileContext.php#L40-L45 |
sstalle/php7cc | src/NodeVisitor/DivisionModuloByZeroVisitor.php | DivisionModuloByZeroVisitor.enterNode | public function enterNode(Node $node)
{
$isDivision = $node instanceof Node\Expr\BinaryOp\Div || $node instanceof Node\Expr\AssignOp\Div;
$isModulo = $node instanceof Node\Expr\BinaryOp\Mod || $node instanceof Node\Expr\AssignOp\Mod;
if (!($isDivision || $isModulo)) {
return;
... | php | public function enterNode(Node $node)
{
$isDivision = $node instanceof Node\Expr\BinaryOp\Div || $node instanceof Node\Expr\AssignOp\Div;
$isModulo = $node instanceof Node\Expr\BinaryOp\Mod || $node instanceof Node\Expr\AssignOp\Mod;
if (!($isDivision || $isModulo)) {
return;
... | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"$",
"isDivision",
"=",
"$",
"node",
"instanceof",
"Node",
"\\",
"Expr",
"\\",
"BinaryOp",
"\\",
"Div",
"||",
"$",
"node",
"instanceof",
"Node",
"\\",
"Expr",
"\\",
"AssignOp",
"\\",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/DivisionModuloByZeroVisitor.php#L15-L31 |
sstalle/php7cc | src/NodeVisitor/HexadecimalNumberStringVisitor.php | HexadecimalNumberStringVisitor.enterNode | public function enterNode(Node $node)
{
if (!$node instanceof Node\Scalar\String_) {
return;
}
if (preg_match('/^0x[a-fA-F0-9]+$/', $node->value)) {
$this->addContextMessage(
'String containing number in hexadecimal notation',
$node
... | php | public function enterNode(Node $node)
{
if (!$node instanceof Node\Scalar\String_) {
return;
}
if (preg_match('/^0x[a-fA-F0-9]+$/', $node->value)) {
$this->addContextMessage(
'String containing number in hexadecimal notation',
$node
... | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"$",
"node",
"instanceof",
"Node",
"\\",
"Scalar",
"\\",
"String_",
")",
"{",
"return",
";",
"}",
"if",
"(",
"preg_match",
"(",
"'/^0x[a-fA-F0-9]+$/'",
",",
"$",
"no... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/HexadecimalNumberStringVisitor.php#L15-L27 |
sstalle/php7cc | src/NodeVisitor/ContinueBreakOutsideLoopVisitor.php | ContinueBreakOutsideLoopVisitor.enterNode | public function enterNode(Node $node)
{
parent::enterNode($node);
if (($node instanceof Node\Stmt\Break_ || $node instanceof Node\Stmt\Continue_)
&& $this->getCurrentLoopStack()->isEmpty()
) {
$messageText = sprintf(
'%s not in the loop or switch cont... | php | public function enterNode(Node $node)
{
parent::enterNode($node);
if (($node instanceof Node\Stmt\Break_ || $node instanceof Node\Stmt\Continue_)
&& $this->getCurrentLoopStack()->isEmpty()
) {
$messageText = sprintf(
'%s not in the loop or switch cont... | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"parent",
"::",
"enterNode",
"(",
"$",
"node",
")",
";",
"if",
"(",
"(",
"$",
"node",
"instanceof",
"Node",
"\\",
"Stmt",
"\\",
"Break_",
"||",
"$",
"node",
"instanceof",
"Node",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/ContinueBreakOutsideLoopVisitor.php#L15-L28 |
sstalle/php7cc | src/NodeVisitor/ContinueBreakOutsideLoopVisitor.php | ContinueBreakOutsideLoopVisitor.isTargetLoopNode | protected function isTargetLoopNode(Node $node)
{
return $node instanceof Node\Stmt\While_ || $node instanceof Node\Stmt\Do_
|| $node instanceof Node\Stmt\Foreach_ || $node instanceof Node\Stmt\For_
|| $node instanceof Node\Stmt\Switch_;
} | php | protected function isTargetLoopNode(Node $node)
{
return $node instanceof Node\Stmt\While_ || $node instanceof Node\Stmt\Do_
|| $node instanceof Node\Stmt\Foreach_ || $node instanceof Node\Stmt\For_
|| $node instanceof Node\Stmt\Switch_;
} | [
"protected",
"function",
"isTargetLoopNode",
"(",
"Node",
"$",
"node",
")",
"{",
"return",
"$",
"node",
"instanceof",
"Node",
"\\",
"Stmt",
"\\",
"While_",
"||",
"$",
"node",
"instanceof",
"Node",
"\\",
"Stmt",
"\\",
"Do_",
"||",
"$",
"node",
"instanceof",... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/ContinueBreakOutsideLoopVisitor.php#L33-L38 |
sstalle/php7cc | src/NodeStatementsRemover.php | NodeStatementsRemover.removeInnerStatements | public function removeInnerStatements($nodes, $cloneNodes = true)
{
$resultNodes = array();
foreach ($nodes as $node) {
if ($cloneNodes) {
$node = clone $node;
}
if (property_exists($node, 'stmts')) {
$node->stmts = array();
... | php | public function removeInnerStatements($nodes, $cloneNodes = true)
{
$resultNodes = array();
foreach ($nodes as $node) {
if ($cloneNodes) {
$node = clone $node;
}
if (property_exists($node, 'stmts')) {
$node->stmts = array();
... | [
"public",
"function",
"removeInnerStatements",
"(",
"$",
"nodes",
",",
"$",
"cloneNodes",
"=",
"true",
")",
"{",
"$",
"resultNodes",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"nodes",
"as",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"cloneNodes",
... | @param Node[] $nodes
@param bool $cloneNodes
@return \PhpParser\Node[] | [
"@param",
"Node",
"[]",
"$nodes",
"@param",
"bool",
"$cloneNodes"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeStatementsRemover.php#L15-L36 |
sstalle/php7cc | src/Iterator/FileDirectoryListRecursiveIterator.php | FileDirectoryListRecursiveIterator.current | public function current()
{
$fileName = realpath($this->data[$this->position]);
return new SplFileInfo($fileName, '', basename($fileName));
} | php | public function current()
{
$fileName = realpath($this->data[$this->position]);
return new SplFileInfo($fileName, '', basename($fileName));
} | [
"public",
"function",
"current",
"(",
")",
"{",
"$",
"fileName",
"=",
"realpath",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"this",
"->",
"position",
"]",
")",
";",
"return",
"new",
"SplFileInfo",
"(",
"$",
"fileName",
",",
"''",
",",
"basename",
"("... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/Iterator/FileDirectoryListRecursiveIterator.php#L37-L42 |
sstalle/php7cc | src/Iterator/FileDirectoryListRecursiveIterator.php | FileDirectoryListRecursiveIterator.getChildren | public function getChildren()
{
return new RecursiveDirectoryIterator(
$this->data[$this->position],
\RecursiveDirectoryIterator::KEY_AS_PATHNAME
| \RecursiveDirectoryIterator::CURRENT_AS_FILEINFO
| \RecursiveDirectoryIterator::SKIP_DOTS
);
} | php | public function getChildren()
{
return new RecursiveDirectoryIterator(
$this->data[$this->position],
\RecursiveDirectoryIterator::KEY_AS_PATHNAME
| \RecursiveDirectoryIterator::CURRENT_AS_FILEINFO
| \RecursiveDirectoryIterator::SKIP_DOTS
);
} | [
"public",
"function",
"getChildren",
"(",
")",
"{",
"return",
"new",
"RecursiveDirectoryIterator",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"this",
"->",
"position",
"]",
",",
"\\",
"RecursiveDirectoryIterator",
"::",
"KEY_AS_PATHNAME",
"|",
"\\",
"RecursiveDir... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/Iterator/FileDirectoryListRecursiveIterator.php#L87-L95 |
sstalle/php7cc | src/NodeVisitor/YieldExpressionVisitor.php | YieldExpressionVisitor.enterNode | public function enterNode(Node $node)
{
if (!($node instanceof Node\Expr\Yield_ && $node->value && $node->value instanceof Node\Expr)) {
return;
}
$valueClass = get_class($node->value);
if (isset($this->lowerPrecedenceExpressionClasses[$valueClass])) {
$this-... | php | public function enterNode(Node $node)
{
if (!($node instanceof Node\Expr\Yield_ && $node->value && $node->value instanceof Node\Expr)) {
return;
}
$valueClass = get_class($node->value);
if (isset($this->lowerPrecedenceExpressionClasses[$valueClass])) {
$this-... | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"node",
"instanceof",
"Node",
"\\",
"Expr",
"\\",
"Yield_",
"&&",
"$",
"node",
"->",
"value",
"&&",
"$",
"node",
"->",
"value",
"instanceof",
"Node",
"\\... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/YieldExpressionVisitor.php#L29-L42 |
sstalle/php7cc | src/Lexer/ExtendedLexer.php | ExtendedLexer.getNextToken | public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null)
{
$tokenId = parent::getNextToken($value, $startAttributes, $endAttributes);
if ($tokenId == Parser::T_CONSTANT_ENCAPSED_STRING // non-interpolated string
|| $tokenId == Parser::T_LNUMBER ... | php | public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null)
{
$tokenId = parent::getNextToken($value, $startAttributes, $endAttributes);
if ($tokenId == Parser::T_CONSTANT_ENCAPSED_STRING // non-interpolated string
|| $tokenId == Parser::T_LNUMBER ... | [
"public",
"function",
"getNextToken",
"(",
"&",
"$",
"value",
"=",
"null",
",",
"&",
"$",
"startAttributes",
"=",
"null",
",",
"&",
"$",
"endAttributes",
"=",
"null",
")",
"{",
"$",
"tokenId",
"=",
"parent",
"::",
"getNextToken",
"(",
"$",
"value",
","... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/Lexer/ExtendedLexer.php#L13-L34 |
sstalle/php7cc | src/NodeVisitor/IndirectVariableOrMethodAccessVisitor.php | IndirectVariableOrMethodAccessVisitor.enterNode | public function enterNode(Node $node)
{
if (!($node instanceof Node\Expr\PropertyFetch
|| $node instanceof Node\Expr\MethodCall
|| $node instanceof Node\Expr\StaticCall
|| $node instanceof Node\Expr\Variable
) || !$node->name instanceof Node\Expr\A... | php | public function enterNode(Node $node)
{
if (!($node instanceof Node\Expr\PropertyFetch
|| $node instanceof Node\Expr\MethodCall
|| $node instanceof Node\Expr\StaticCall
|| $node instanceof Node\Expr\Variable
) || !$node->name instanceof Node\Expr\A... | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"node",
"instanceof",
"Node",
"\\",
"Expr",
"\\",
"PropertyFetch",
"||",
"$",
"node",
"instanceof",
"Node",
"\\",
"Expr",
"\\",
"MethodCall",
"||",
"$",
"n... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/IndirectVariableOrMethodAccessVisitor.php#L15-L37 |
sstalle/php7cc | src/Reflection/Internal/ReflectionClass.php | ReflectionClass.getMethods | public function getMethods()
{
$methods = array();
foreach ($this->internalReflectionClass->getMethods() as $method) {
$methods[] = new ReflectionMethod($method);
}
return $methods;
} | php | public function getMethods()
{
$methods = array();
foreach ($this->internalReflectionClass->getMethods() as $method) {
$methods[] = new ReflectionMethod($method);
}
return $methods;
} | [
"public",
"function",
"getMethods",
"(",
")",
"{",
"$",
"methods",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"internalReflectionClass",
"->",
"getMethods",
"(",
")",
"as",
"$",
"method",
")",
"{",
"$",
"methods",
"[",
"]",
"=",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/Reflection/Internal/ReflectionClass.php#L25-L33 |
sstalle/php7cc | src/Reflection/Internal/ReflectionFunctionAbstract.php | ReflectionFunctionAbstract.getParameters | public function getParameters()
{
$parameters = array();
foreach ($this->internalReflectionFunction->getParameters() as $parameter) {
$parameters[] = new ReflectionParameter($parameter);
}
return $parameters;
} | php | public function getParameters()
{
$parameters = array();
foreach ($this->internalReflectionFunction->getParameters() as $parameter) {
$parameters[] = new ReflectionParameter($parameter);
}
return $parameters;
} | [
"public",
"function",
"getParameters",
"(",
")",
"{",
"$",
"parameters",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"internalReflectionFunction",
"->",
"getParameters",
"(",
")",
"as",
"$",
"parameter",
")",
"{",
"$",
"parameters",
"["... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/Reflection/Internal/ReflectionFunctionAbstract.php#L33-L41 |
sstalle/php7cc | src/Reflection/Internal/ReflectionFunctionAbstract.php | ReflectionFunctionAbstract.getParameter | public function getParameter($parameterIndex)
{
$parameters = $this->getParameters();
return isset($parameters[$parameterIndex]) ? $parameters[$parameterIndex] : null;
} | php | public function getParameter($parameterIndex)
{
$parameters = $this->getParameters();
return isset($parameters[$parameterIndex]) ? $parameters[$parameterIndex] : null;
} | [
"public",
"function",
"getParameter",
"(",
"$",
"parameterIndex",
")",
"{",
"$",
"parameters",
"=",
"$",
"this",
"->",
"getParameters",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"parameters",
"[",
"$",
"parameterIndex",
"]",
")",
"?",
"$",
"parameters",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/Reflection/Internal/ReflectionFunctionAbstract.php#L46-L51 |
sstalle/php7cc | src/NodeVisitor/NewClassVisitor.php | NewClassVisitor.enterNode | public function enterNode(Node $node)
{
if ($node instanceof Node\Stmt\ClassLike
&& isset($node->namespacedName) // Property set by the NameResolver visitor
&& count($node->namespacedName->parts) === 1
&& ($lowerCasedClassName = strtolower($node->name))
&& arr... | php | public function enterNode(Node $node)
{
if ($node instanceof Node\Stmt\ClassLike
&& isset($node->namespacedName) // Property set by the NameResolver visitor
&& count($node->namespacedName->parts) === 1
&& ($lowerCasedClassName = strtolower($node->name))
&& arr... | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"instanceof",
"Node",
"\\",
"Stmt",
"\\",
"ClassLike",
"&&",
"isset",
"(",
"$",
"node",
"->",
"namespacedName",
")",
"// Property set by the NameResolver visitor",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/NewClassVisitor.php#L47-L62 |
sstalle/php7cc | src/NodeTraverser/Traverser.php | Traverser.traverse | public function traverse(array $nodes, ContextInterface $context = null, array $tokens = array())
{
if ($context) {
$tokenCollection = new TokenCollection($tokens);
foreach ($this->visitors as $visitor) {
if ($visitor instanceof VisitorInterface) {
... | php | public function traverse(array $nodes, ContextInterface $context = null, array $tokens = array())
{
if ($context) {
$tokenCollection = new TokenCollection($tokens);
foreach ($this->visitors as $visitor) {
if ($visitor instanceof VisitorInterface) {
... | [
"public",
"function",
"traverse",
"(",
"array",
"$",
"nodes",
",",
"ContextInterface",
"$",
"context",
"=",
"null",
",",
"array",
"$",
"tokens",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"context",
")",
"{",
"$",
"tokenCollection",
"=",
"new",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeTraverser/Traverser.php#L15-L29 |
sstalle/php7cc | src/NodeVisitor/ArrayOrObjectValueAssignmentByReferenceVisitor.php | ArrayOrObjectValueAssignmentByReferenceVisitor.enterNode | public function enterNode(Node $node)
{
if (!$node instanceof Node\Expr\AssignRef) {
return;
}
$this->checkArrayValueByReferenceCreation($node) || $this->checkObjectPropertyByReferenceCreation($node);
} | php | public function enterNode(Node $node)
{
if (!$node instanceof Node\Expr\AssignRef) {
return;
}
$this->checkArrayValueByReferenceCreation($node) || $this->checkObjectPropertyByReferenceCreation($node);
} | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"$",
"node",
"instanceof",
"Node",
"\\",
"Expr",
"\\",
"AssignRef",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"checkArrayValueByReferenceCreation",
"(",
"$",
"n... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/ArrayOrObjectValueAssignmentByReferenceVisitor.php#L15-L22 |
sstalle/php7cc | src/NodeVisitor/ArrayOrObjectValueAssignmentByReferenceVisitor.php | ArrayOrObjectValueAssignmentByReferenceVisitor.checkArrayValueByReferenceCreation | protected function checkArrayValueByReferenceCreation(Node\Expr\AssignRef $node)
{
if ($node->var instanceof Node\Expr\ArrayDimFetch && $node->var->dim
&& $node->expr instanceof Node\Expr\ArrayDimFetch && $node->expr->dim
) {
$this->addContextMessage(
'Possibl... | php | protected function checkArrayValueByReferenceCreation(Node\Expr\AssignRef $node)
{
if ($node->var instanceof Node\Expr\ArrayDimFetch && $node->var->dim
&& $node->expr instanceof Node\Expr\ArrayDimFetch && $node->expr->dim
) {
$this->addContextMessage(
'Possibl... | [
"protected",
"function",
"checkArrayValueByReferenceCreation",
"(",
"Node",
"\\",
"Expr",
"\\",
"AssignRef",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"->",
"var",
"instanceof",
"Node",
"\\",
"Expr",
"\\",
"ArrayDimFetch",
"&&",
"$",
"node",
"->",
"var"... | @param Node\Expr\AssignRef $node
@return bool | [
"@param",
"Node",
"\\",
"Expr",
"\\",
"AssignRef",
"$node"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/ArrayOrObjectValueAssignmentByReferenceVisitor.php#L29-L43 |
sstalle/php7cc | src/NodeVisitor/ArrayOrObjectValueAssignmentByReferenceVisitor.php | ArrayOrObjectValueAssignmentByReferenceVisitor.checkObjectPropertyByReferenceCreation | protected function checkObjectPropertyByReferenceCreation(Node\Expr\AssignRef $node)
{
if ($node->var instanceof Node\Expr\PropertyFetch && $node->expr instanceof Node\Expr\PropertyFetch) {
$this->addContextMessage(
'Possible object property creation during by-reference assignmen... | php | protected function checkObjectPropertyByReferenceCreation(Node\Expr\AssignRef $node)
{
if ($node->var instanceof Node\Expr\PropertyFetch && $node->expr instanceof Node\Expr\PropertyFetch) {
$this->addContextMessage(
'Possible object property creation during by-reference assignmen... | [
"protected",
"function",
"checkObjectPropertyByReferenceCreation",
"(",
"Node",
"\\",
"Expr",
"\\",
"AssignRef",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"->",
"var",
"instanceof",
"Node",
"\\",
"Expr",
"\\",
"PropertyFetch",
"&&",
"$",
"node",
"->",
"... | @param Node\Expr\AssignRef $node
@return bool | [
"@param",
"Node",
"\\",
"Expr",
"\\",
"AssignRef",
"$node"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/ArrayOrObjectValueAssignmentByReferenceVisitor.php#L50-L62 |
sstalle/php7cc | src/NodeVisitor/HTTPRawPostDataVisitor.php | HTTPRawPostDataVisitor.enterNode | public function enterNode(Node $node)
{
$isVariableAccessedByName = $node instanceof Node\Expr\Variable
&& $node->name === static::HTTP_RAW_POST_DATA_VARIABLE_NAME;
$isVariableAccessedThroughGlobals = $node instanceof Node\Expr\ArrayDimFetch
&& $node->var instanceof Node\Expr... | php | public function enterNode(Node $node)
{
$isVariableAccessedByName = $node instanceof Node\Expr\Variable
&& $node->name === static::HTTP_RAW_POST_DATA_VARIABLE_NAME;
$isVariableAccessedThroughGlobals = $node instanceof Node\Expr\ArrayDimFetch
&& $node->var instanceof Node\Expr... | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"$",
"isVariableAccessedByName",
"=",
"$",
"node",
"instanceof",
"Node",
"\\",
"Expr",
"\\",
"Variable",
"&&",
"$",
"node",
"->",
"name",
"===",
"static",
"::",
"HTTP_RAW_POST_DATA_VARIABLE... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/HTTPRawPostDataVisitor.php#L16-L35 |
sstalle/php7cc | src/Analysis/Scope/FunctionLikeScope.php | FunctionLikeScope.createReference | public function createReference($toName, $fromName)
{
$this->addModifiedVariable($toName);
if (!isset($this->referencingVariableNames[$toName])) {
$this->referencingVariableNames[$toName] = array();
}
$this->referencingVariableNames[$toName][] = $fromName;
} | php | public function createReference($toName, $fromName)
{
$this->addModifiedVariable($toName);
if (!isset($this->referencingVariableNames[$toName])) {
$this->referencingVariableNames[$toName] = array();
}
$this->referencingVariableNames[$toName][] = $fromName;
} | [
"public",
"function",
"createReference",
"(",
"$",
"toName",
",",
"$",
"fromName",
")",
"{",
"$",
"this",
"->",
"addModifiedVariable",
"(",
"$",
"toName",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"referencingVariableNames",
"[",
"$",
"t... | $toName = &$fromName;.
@param string $toName
@param string $fromName | [
"$toName",
"=",
"&$fromName",
";",
"."
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/Analysis/Scope/FunctionLikeScope.php#L81-L90 |
sstalle/php7cc | src/Analysis/Scope/FunctionLikeScope.php | FunctionLikeScope.filterModifiedVariables | public function filterModifiedVariables(array $names)
{
$modifiedVariables = array();
foreach ($names as $name) {
if ($this->hasVariableBeenModified($name)) {
$modifiedVariables[] = $name;
}
}
return array_unique($modifiedVariables);
} | php | public function filterModifiedVariables(array $names)
{
$modifiedVariables = array();
foreach ($names as $name) {
if ($this->hasVariableBeenModified($name)) {
$modifiedVariables[] = $name;
}
}
return array_unique($modifiedVariables);
} | [
"public",
"function",
"filterModifiedVariables",
"(",
"array",
"$",
"names",
")",
"{",
"$",
"modifiedVariables",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"names",
"as",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasVariableBeenModified"... | @param string[] $names
@return string[] | [
"@param",
"string",
"[]",
"$names"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/Analysis/Scope/FunctionLikeScope.php#L97-L107 |
sstalle/php7cc | src/Analysis/Scope/FunctionLikeScope.php | FunctionLikeScope.getVariableNamesReferencedBy | private function getVariableNamesReferencedBy($referencingName, array $processedNames = array())
{
if (!isset($this->referencingVariableNames[$referencingName])) {
return array();
}
$referencedVariableNames = $this->referencingVariableNames[$referencingName];
if (isset($... | php | private function getVariableNamesReferencedBy($referencingName, array $processedNames = array())
{
if (!isset($this->referencingVariableNames[$referencingName])) {
return array();
}
$referencedVariableNames = $this->referencingVariableNames[$referencingName];
if (isset($... | [
"private",
"function",
"getVariableNamesReferencedBy",
"(",
"$",
"referencingName",
",",
"array",
"$",
"processedNames",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"referencingVariableNames",
"[",
"$",
"referencingName",
... | @param string $referencingName
@param string[] $processedNames
@return string[] | [
"@param",
"string",
"$referencingName",
"@param",
"string",
"[]",
"$processedNames"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/Analysis/Scope/FunctionLikeScope.php#L152-L182 |
sstalle/php7cc | src/ContextChecker.php | ContextChecker.checkContext | public function checkContext(ContextInterface $context)
{
try {
$checkedCode = $this->preprocessor->preprocess($context->getCheckedCode());
$parsedStatements = $this->parser->parse($checkedCode);
$this->traverser->traverse($parsedStatements, $context, $this->lexer->getTok... | php | public function checkContext(ContextInterface $context)
{
try {
$checkedCode = $this->preprocessor->preprocess($context->getCheckedCode());
$parsedStatements = $this->parser->parse($checkedCode);
$this->traverser->traverse($parsedStatements, $context, $this->lexer->getTok... | [
"public",
"function",
"checkContext",
"(",
"ContextInterface",
"$",
"context",
")",
"{",
"try",
"{",
"$",
"checkedCode",
"=",
"$",
"this",
"->",
"preprocessor",
"->",
"preprocess",
"(",
"$",
"context",
"->",
"getCheckedCode",
"(",
")",
")",
";",
"$",
"pars... | @param ContextInterface $context
@return FileContext | [
"@param",
"ContextInterface",
"$context"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/ContextChecker.php#L58-L69 |
sstalle/php7cc | src/NodeVisitor/DuplicateFunctionParameterVisitor.php | DuplicateFunctionParameterVisitor.enterNode | public function enterNode(Node $node)
{
if (!$node instanceof Node\FunctionLike) {
return;
}
$parametersNames = array();
foreach ($node->getParams() as $parameter) {
$currentParameterName = $parameter->name;
if (!isset($parametersNames[$currentPar... | php | public function enterNode(Node $node)
{
if (!$node instanceof Node\FunctionLike) {
return;
}
$parametersNames = array();
foreach ($node->getParams() as $parameter) {
$currentParameterName = $parameter->name;
if (!isset($parametersNames[$currentPar... | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"$",
"node",
"instanceof",
"Node",
"\\",
"FunctionLike",
")",
"{",
"return",
";",
"}",
"$",
"parametersNames",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"n... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/DuplicateFunctionParameterVisitor.php#L15-L35 |
sstalle/php7cc | src/NodeVisitor/GlobalNewFunctionVisitor.php | GlobalNewFunctionVisitor.accepts | protected function accepts(Node\Stmt\Function_ $node)
{
return isset($node->namespacedName) && count($node->namespacedName->parts) == 1;
} | php | protected function accepts(Node\Stmt\Function_ $node)
{
return isset($node->namespacedName) && count($node->namespacedName->parts) == 1;
} | [
"protected",
"function",
"accepts",
"(",
"Node",
"\\",
"Stmt",
"\\",
"Function_",
"$",
"node",
")",
"{",
"return",
"isset",
"(",
"$",
"node",
"->",
"namespacedName",
")",
"&&",
"count",
"(",
"$",
"node",
"->",
"namespacedName",
"->",
"parts",
")",
"==",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/GlobalNewFunctionVisitor.php#L15-L18 |
sstalle/php7cc | src/Token/TokenCollection.php | TokenCollection.getTokenStringValueAt | public function getTokenStringValueAt($tokenPosition)
{
if (!isset($this->tokens[$tokenPosition])) {
throw new \OutOfBoundsException(sprintf('Token at offset %d does not exist', $tokenPosition));
}
$originalToken = $this->tokens[$tokenPosition];
return is_string($origin... | php | public function getTokenStringValueAt($tokenPosition)
{
if (!isset($this->tokens[$tokenPosition])) {
throw new \OutOfBoundsException(sprintf('Token at offset %d does not exist', $tokenPosition));
}
$originalToken = $this->tokens[$tokenPosition];
return is_string($origin... | [
"public",
"function",
"getTokenStringValueAt",
"(",
"$",
"tokenPosition",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"tokens",
"[",
"$",
"tokenPosition",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"OutOfBoundsException",
"(",
"sprintf",
"(",... | @param int $tokenPosition
@return string | [
"@param",
"int",
"$tokenPosition"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/Token/TokenCollection.php#L33-L42 |
sstalle/php7cc | src/Token/TokenCollection.php | TokenCollection.isTokenEqualToOrPrecededBy | public function isTokenEqualToOrPrecededBy($tokenPosition, $stringValue)
{
return $this->isTokenEqualTo($tokenPosition, $stringValue)
|| $this->isTokenPrecededBy($tokenPosition, $stringValue);
} | php | public function isTokenEqualToOrPrecededBy($tokenPosition, $stringValue)
{
return $this->isTokenEqualTo($tokenPosition, $stringValue)
|| $this->isTokenPrecededBy($tokenPosition, $stringValue);
} | [
"public",
"function",
"isTokenEqualToOrPrecededBy",
"(",
"$",
"tokenPosition",
",",
"$",
"stringValue",
")",
"{",
"return",
"$",
"this",
"->",
"isTokenEqualTo",
"(",
"$",
"tokenPosition",
",",
"$",
"stringValue",
")",
"||",
"$",
"this",
"->",
"isTokenPrecededBy"... | @param int $tokenPosition
@param string $stringValue
@return bool | [
"@param",
"int",
"$tokenPosition",
"@param",
"string",
"$stringValue"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/Token/TokenCollection.php#L83-L87 |
sstalle/php7cc | src/Token/TokenCollection.php | TokenCollection.isTokenEqualToOrFollowedBy | public function isTokenEqualToOrFollowedBy($tokenPosition, $stringValue)
{
return $this->isTokenEqualTo($tokenPosition, $stringValue)
|| $this->isTokenFollowedBy($tokenPosition, $stringValue);
} | php | public function isTokenEqualToOrFollowedBy($tokenPosition, $stringValue)
{
return $this->isTokenEqualTo($tokenPosition, $stringValue)
|| $this->isTokenFollowedBy($tokenPosition, $stringValue);
} | [
"public",
"function",
"isTokenEqualToOrFollowedBy",
"(",
"$",
"tokenPosition",
",",
"$",
"stringValue",
")",
"{",
"return",
"$",
"this",
"->",
"isTokenEqualTo",
"(",
"$",
"tokenPosition",
",",
"$",
"stringValue",
")",
"||",
"$",
"this",
"->",
"isTokenFollowedBy"... | @param int $tokenPosition
@param int $stringValue
@return bool | [
"@param",
"int",
"$tokenPosition",
"@param",
"int",
"$stringValue"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/Token/TokenCollection.php#L95-L99 |
sstalle/php7cc | src/Token/TokenCollection.php | TokenCollection.isNextNonWhitespaceTokenEqualTo | protected function isNextNonWhitespaceTokenEqualTo($tokenPosition, $stringValue, $scanForward)
{
$ignoreWhitespace = !ctype_space($stringValue);
while (isset($this->tokens[$scanForward ? ++$tokenPosition : --$tokenPosition])) {
$currentTokenString = $this->getTokenStringValueAt($tokenPo... | php | protected function isNextNonWhitespaceTokenEqualTo($tokenPosition, $stringValue, $scanForward)
{
$ignoreWhitespace = !ctype_space($stringValue);
while (isset($this->tokens[$scanForward ? ++$tokenPosition : --$tokenPosition])) {
$currentTokenString = $this->getTokenStringValueAt($tokenPo... | [
"protected",
"function",
"isNextNonWhitespaceTokenEqualTo",
"(",
"$",
"tokenPosition",
",",
"$",
"stringValue",
",",
"$",
"scanForward",
")",
"{",
"$",
"ignoreWhitespace",
"=",
"!",
"ctype_space",
"(",
"$",
"stringValue",
")",
";",
"while",
"(",
"isset",
"(",
... | Whitespace tokens are ignored when $stringValue is not whitespace.
@param int $tokenPosition
@param string $stringValue
@param bool $scanForward Scan forward if true, otherwise backward
@return bool | [
"Whitespace",
"tokens",
"are",
"ignored",
"when",
"$stringValue",
"is",
"not",
"whitespace",
"."
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/Token/TokenCollection.php#L110-L124 |
sstalle/php7cc | src/Helper/RegExp/RegExpParser.php | RegExpParser.parse | public function parse($regExp)
{
if (!$regExp) {
throw new \InvalidArgumentException('RegExp is empty');
}
$startDelimiter = $regExp[0];
$delimiterPairs = RegExp::getDelimiterPairs();
$endDelimiter = isset($delimiterPairs[$startDelimiter])
? $delimite... | php | public function parse($regExp)
{
if (!$regExp) {
throw new \InvalidArgumentException('RegExp is empty');
}
$startDelimiter = $regExp[0];
$delimiterPairs = RegExp::getDelimiterPairs();
$endDelimiter = isset($delimiterPairs[$startDelimiter])
? $delimite... | [
"public",
"function",
"parse",
"(",
"$",
"regExp",
")",
"{",
"if",
"(",
"!",
"$",
"regExp",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'RegExp is empty'",
")",
";",
"}",
"$",
"startDelimiter",
"=",
"$",
"regExp",
"[",
"0",
"]",
"... | @param string $regExp
@return RegExp | [
"@param",
"string",
"$regExp"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/Helper/RegExp/RegExpParser.php#L12-L34 |
sstalle/php7cc | src/NodeVisitor/PasswordHashSaltVisitor.php | PasswordHashSaltVisitor.enterNode | public function enterNode(Node $node)
{
if (!$this->functionAnalyzer->isFunctionCallByStaticName($node, array('password_hash' => true))
|| !isset($node->args[static::PASSWORD_HASH_OPTIONS_ARGUMENT_INDEX])
|| !($node->args[static::PASSWORD_HASH_OPTIONS_ARGUMENT_INDEX]->value instanceo... | php | public function enterNode(Node $node)
{
if (!$this->functionAnalyzer->isFunctionCallByStaticName($node, array('password_hash' => true))
|| !isset($node->args[static::PASSWORD_HASH_OPTIONS_ARGUMENT_INDEX])
|| !($node->args[static::PASSWORD_HASH_OPTIONS_ARGUMENT_INDEX]->value instanceo... | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"functionAnalyzer",
"->",
"isFunctionCallByStaticName",
"(",
"$",
"node",
",",
"array",
"(",
"'password_hash'",
"=>",
"true",
")",
")",
"||",
"!",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/PasswordHashSaltVisitor.php#L30-L52 |
sstalle/php7cc | src/NodeVisitor/EscapedUnicodeCodepointVisitor.php | EscapedUnicodeCodepointVisitor.enterNode | public function enterNode(Node $node)
{
if (!$node instanceof Node\Scalar\String_) {
return;
}
$unquotedStringValue = null;
if ($node->getAttribute('isDoubleQuoted')) {
$unquotedStringValue = substr($node->getAttribute('originalValue'), 1, -1);
} else... | php | public function enterNode(Node $node)
{
if (!$node instanceof Node\Scalar\String_) {
return;
}
$unquotedStringValue = null;
if ($node->getAttribute('isDoubleQuoted')) {
$unquotedStringValue = substr($node->getAttribute('originalValue'), 1, -1);
} else... | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"$",
"node",
"instanceof",
"Node",
"\\",
"Scalar",
"\\",
"String_",
")",
"{",
"return",
";",
"}",
"$",
"unquotedStringValue",
"=",
"null",
";",
"if",
"(",
"$",
"no... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/EscapedUnicodeCodepointVisitor.php#L15-L43 |
sstalle/php7cc | src/NodeVisitor/MktimeVisitor.php | MktimeVisitor.enterNode | public function enterNode(Node $node)
{
if (!$this->functionAnalyzer->isFunctionCallByStaticName($node, $this->mktimeFamilyFunctions)
|| count($node->args) < 7
) {
return;
}
$this->addContextMessage(
sprintf('Removed argument $is_dst used for func... | php | public function enterNode(Node $node)
{
if (!$this->functionAnalyzer->isFunctionCallByStaticName($node, $this->mktimeFamilyFunctions)
|| count($node->args) < 7
) {
return;
}
$this->addContextMessage(
sprintf('Removed argument $is_dst used for func... | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"functionAnalyzer",
"->",
"isFunctionCallByStaticName",
"(",
"$",
"node",
",",
"$",
"this",
"->",
"mktimeFamilyFunctions",
")",
"||",
"count",
"(",
"$... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/MktimeVisitor.php#L35-L47 |
sstalle/php7cc | src/PathTraversableFactory.php | PathTraversableFactory.createTraversable | public function createTraversable(array $paths, array $checkedExtensions, array $excludedPaths)
{
$directlyPassedFiles = array();
$excludedPaths = $this->excludedPathCanonicalizer->canonicalize($paths, $excludedPaths);
foreach ($paths as $path) {
if (is_dir($path) && !$checkedExt... | php | public function createTraversable(array $paths, array $checkedExtensions, array $excludedPaths)
{
$directlyPassedFiles = array();
$excludedPaths = $this->excludedPathCanonicalizer->canonicalize($paths, $excludedPaths);
foreach ($paths as $path) {
if (is_dir($path) && !$checkedExt... | [
"public",
"function",
"createTraversable",
"(",
"array",
"$",
"paths",
",",
"array",
"$",
"checkedExtensions",
",",
"array",
"$",
"excludedPaths",
")",
"{",
"$",
"directlyPassedFiles",
"=",
"array",
"(",
")",
";",
"$",
"excludedPaths",
"=",
"$",
"this",
"->"... | @param string[] $paths Files and/or directories to check
@param string[] $checkedExtensions Only files having these extensions will be checked
@param string[] $excludedPaths
@return \Traversable | [
"@param",
"string",
"[]",
"$paths",
"Files",
"and",
"/",
"or",
"directories",
"to",
"check",
"@param",
"string",
"[]",
"$checkedExtensions",
"Only",
"files",
"having",
"these",
"extensions",
"will",
"be",
"checked",
"@param",
"string",
"[]",
"$excludedPaths"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/PathTraversableFactory.php#L31-L58 |
sstalle/php7cc | src/Reflection/Internal/Reflector/FunctionReflector.php | FunctionReflector.supports | public function supports($identifier)
{
if (!function_exists($identifier)) {
return false;
}
$internalReflection = $this->getInternalReflection($identifier);
return !$internalReflection->isUserDefined();
} | php | public function supports($identifier)
{
if (!function_exists($identifier)) {
return false;
}
$internalReflection = $this->getInternalReflection($identifier);
return !$internalReflection->isUserDefined();
} | [
"public",
"function",
"supports",
"(",
"$",
"identifier",
")",
"{",
"if",
"(",
"!",
"function_exists",
"(",
"$",
"identifier",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"internalReflection",
"=",
"$",
"this",
"->",
"getInternalReflection",
"(",
"$",... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/Reflection/Internal/Reflector/FunctionReflector.php#L21-L30 |
sstalle/php7cc | src/NodeAnalyzer/Reflection/FunctionLike/MethodCalleeReflector.php | MethodCalleeReflector.doGetCalleeReflection | public function doGetCalleeReflection($node)
{
$reflectionClass = $this->classReflector->reflect($node->class->toString());
return $reflectionClass->getMethod($node->name);
} | php | public function doGetCalleeReflection($node)
{
$reflectionClass = $this->classReflector->reflect($node->class->toString());
return $reflectionClass->getMethod($node->name);
} | [
"public",
"function",
"doGetCalleeReflection",
"(",
"$",
"node",
")",
"{",
"$",
"reflectionClass",
"=",
"$",
"this",
"->",
"classReflector",
"->",
"reflect",
"(",
"$",
"node",
"->",
"class",
"->",
"toString",
"(",
")",
")",
";",
"return",
"$",
"reflectionC... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeAnalyzer/Reflection/FunctionLike/MethodCalleeReflector.php#L27-L32 |
sstalle/php7cc | src/NodeAnalyzer/Reflection/FunctionLike/MethodCalleeReflector.php | MethodCalleeReflector.supports | public function supports($node)
{
if (!($node instanceof Expr\StaticCall)) {
return false;
}
if (!is_string($node->name) || !($node->class instanceof Name)) {
return false;
}
return $this->classReflector->supports($node->class->toString());
} | php | public function supports($node)
{
if (!($node instanceof Expr\StaticCall)) {
return false;
}
if (!is_string($node->name) || !($node->class instanceof Name)) {
return false;
}
return $this->classReflector->supports($node->class->toString());
} | [
"public",
"function",
"supports",
"(",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"node",
"instanceof",
"Expr",
"\\",
"StaticCall",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"is_string",
"(",
"$",
"node",
"->",
"name",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeAnalyzer/Reflection/FunctionLike/MethodCalleeReflector.php#L37-L48 |
sstalle/php7cc | src/NodeVisitor/Resolver.php | Resolver.resolve | public function resolve()
{
$level = $this->level;
return array_values(array_filter($this->visitors, function (VisitorInterface $visitor) use ($level) {
return $visitor->getLevel() >= $level;
}));
} | php | public function resolve()
{
$level = $this->level;
return array_values(array_filter($this->visitors, function (VisitorInterface $visitor) use ($level) {
return $visitor->getLevel() >= $level;
}));
} | [
"public",
"function",
"resolve",
"(",
")",
"{",
"$",
"level",
"=",
"$",
"this",
"->",
"level",
";",
"return",
"array_values",
"(",
"array_filter",
"(",
"$",
"this",
"->",
"visitors",
",",
"function",
"(",
"VisitorInterface",
"$",
"visitor",
")",
"use",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/Resolver.php#L34-L41 |
sstalle/php7cc | src/NodeVisitor/AbstractNestedLoopVisitor.php | AbstractNestedLoopVisitor.enterNode | public function enterNode(Node $node)
{
if ($node instanceof Node\FunctionLike) {
$this->loopStacks->push(new \SplStack());
} elseif ($this->isTargetLoopNode($node)) {
$this->getCurrentLoopStack()->push($node);
}
} | php | public function enterNode(Node $node)
{
if ($node instanceof Node\FunctionLike) {
$this->loopStacks->push(new \SplStack());
} elseif ($this->isTargetLoopNode($node)) {
$this->getCurrentLoopStack()->push($node);
}
} | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"instanceof",
"Node",
"\\",
"FunctionLike",
")",
"{",
"$",
"this",
"->",
"loopStacks",
"->",
"push",
"(",
"new",
"\\",
"SplStack",
"(",
")",
")",
";",
"}",... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/AbstractNestedLoopVisitor.php#L26-L33 |
sstalle/php7cc | src/NodeVisitor/AbstractNestedLoopVisitor.php | AbstractNestedLoopVisitor.leaveNode | public function leaveNode(Node $node)
{
if ($node instanceof Node\FunctionLike) {
$this->loopStacks->pop();
} elseif ($this->isTargetLoopNode($node)) {
$this->getCurrentLoopStack()->pop();
}
} | php | public function leaveNode(Node $node)
{
if ($node instanceof Node\FunctionLike) {
$this->loopStacks->pop();
} elseif ($this->isTargetLoopNode($node)) {
$this->getCurrentLoopStack()->pop();
}
} | [
"public",
"function",
"leaveNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"instanceof",
"Node",
"\\",
"FunctionLike",
")",
"{",
"$",
"this",
"->",
"loopStacks",
"->",
"pop",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/NodeVisitor/AbstractNestedLoopVisitor.php#L38-L45 |
sstalle/php7cc | src/Infrastructure/ContainerBuilder.php | ContainerBuilder.buildContainer | public function buildContainer(OutputInterface $output, $intSize)
{
$this->checkerVisitors[static::BITWISE_SHIFT_VISITOR_ID]['arguments'][] = $intSize;
$container = new Container();
$container['lexer'] = function () {
return new ExtendedLexer(array(
'usedAttribu... | php | public function buildContainer(OutputInterface $output, $intSize)
{
$this->checkerVisitors[static::BITWISE_SHIFT_VISITOR_ID]['arguments'][] = $intSize;
$container = new Container();
$container['lexer'] = function () {
return new ExtendedLexer(array(
'usedAttribu... | [
"public",
"function",
"buildContainer",
"(",
"OutputInterface",
"$",
"output",
",",
"$",
"intSize",
")",
"{",
"$",
"this",
"->",
"checkerVisitors",
"[",
"static",
"::",
"BITWISE_SHIFT_VISITOR_ID",
"]",
"[",
"'arguments'",
"]",
"[",
"]",
"=",
"$",
"intSize",
... | @param OutputInterface $output
@param int $intSize
@return Container | [
"@param",
"OutputInterface",
"$output",
"@param",
"int",
"$intSize"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/Infrastructure/ContainerBuilder.php#L153-L274 |
sstalle/php7cc | src/CLIResultPrinter.php | CLIResultPrinter.printContext | public function printContext(ContextInterface $context)
{
$this->output->writeln('');
$this->output->writeln(sprintf('File: <fg=cyan>%s</fg=cyan>', $context->getCheckedResourceName()));
foreach ($context->getMessages() as $message) {
$this->output->writeln(
$this... | php | public function printContext(ContextInterface $context)
{
$this->output->writeln('');
$this->output->writeln(sprintf('File: <fg=cyan>%s</fg=cyan>', $context->getCheckedResourceName()));
foreach ($context->getMessages() as $message) {
$this->output->writeln(
$this... | [
"public",
"function",
"printContext",
"(",
"ContextInterface",
"$",
"context",
")",
"{",
"$",
"this",
"->",
"output",
"->",
"writeln",
"(",
"''",
")",
";",
"$",
"this",
"->",
"output",
"->",
"writeln",
"(",
"sprintf",
"(",
"'File: <fg=cyan>%s</fg=cyan>'",
",... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/CLIResultPrinter.php#L63-L84 |
sstalle/php7cc | src/CLIResultPrinter.php | CLIResultPrinter.printMetadata | public function printMetadata(CheckMetadata $metadata)
{
$checkedFileCount = $metadata->getCheckedFileCount();
$elapsedTime = $metadata->getElapsedTime();
$this->output->writeln(
sprintf(
'Checked <fg=green>%d</fg=green> file%s in <fg=green>%.3f</fg=green> second... | php | public function printMetadata(CheckMetadata $metadata)
{
$checkedFileCount = $metadata->getCheckedFileCount();
$elapsedTime = $metadata->getElapsedTime();
$this->output->writeln(
sprintf(
'Checked <fg=green>%d</fg=green> file%s in <fg=green>%.3f</fg=green> second... | [
"public",
"function",
"printMetadata",
"(",
"CheckMetadata",
"$",
"metadata",
")",
"{",
"$",
"checkedFileCount",
"=",
"$",
"metadata",
"->",
"getCheckedFileCount",
"(",
")",
";",
"$",
"elapsedTime",
"=",
"$",
"metadata",
"->",
"getElapsedTime",
"(",
")",
";",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/CLIResultPrinter.php#L89-L103 |
sstalle/php7cc | src/CLIResultPrinter.php | CLIResultPrinter.formatMessage | private function formatMessage(Message $message)
{
$nodes = $this->nodeStatementsRemover->removeInnerStatements($message->getNodes());
$prettyPrintedNodes = str_replace("\n", "\n ", $this->prettyPrinter->prettyPrint($nodes));
$text = $message->getRawText();
$color = self::$colors... | php | private function formatMessage(Message $message)
{
$nodes = $this->nodeStatementsRemover->removeInnerStatements($message->getNodes());
$prettyPrintedNodes = str_replace("\n", "\n ", $this->prettyPrinter->prettyPrint($nodes));
$text = $message->getRawText();
$color = self::$colors... | [
"private",
"function",
"formatMessage",
"(",
"Message",
"$",
"message",
")",
"{",
"$",
"nodes",
"=",
"$",
"this",
"->",
"nodeStatementsRemover",
"->",
"removeInnerStatements",
"(",
"$",
"message",
"->",
"getNodes",
"(",
")",
")",
";",
"$",
"prettyPrintedNodes"... | @param Message $message
@return string | [
"@param",
"Message",
"$message"
] | train | https://github.com/sstalle/php7cc/blob/d20fa7d7d381fed050b5d18a094103fc41fa2911/src/CLIResultPrinter.php#L110-L135 |
picqer/exact-php-client | src/Picqer/Financials/Exact/SalesInvoice.php | SalesInvoice.getSalesInvoiceLines | public function getSalesInvoiceLines()
{
if (array_key_exists('__deferred', $this->attributes['SalesInvoiceLines'])) {
$this->attributes['SalesInvoiceLines'] = (new SalesInvoiceLine($this->connection()))->filter("InvoiceID eq guid'{$this->InvoiceID}'");
}
return $this->attribute... | php | public function getSalesInvoiceLines()
{
if (array_key_exists('__deferred', $this->attributes['SalesInvoiceLines'])) {
$this->attributes['SalesInvoiceLines'] = (new SalesInvoiceLine($this->connection()))->filter("InvoiceID eq guid'{$this->InvoiceID}'");
}
return $this->attribute... | [
"public",
"function",
"getSalesInvoiceLines",
"(",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'__deferred'",
",",
"$",
"this",
"->",
"attributes",
"[",
"'SalesInvoiceLines'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"attributes",
"[",
"'SalesInvoiceLines'",
... | Updates the SalesInvoiceLines collection on a SalesInvoice if it's been detected as a deferred collection.
Fetches results and stores them on this object.
@return mixed | [
"Updates",
"the",
"SalesInvoiceLines",
"collection",
"on",
"a",
"SalesInvoice",
"if",
"it",
"s",
"been",
"detected",
"as",
"a",
"deferred",
"collection",
".",
"Fetches",
"results",
"and",
"stores",
"them",
"on",
"this",
"object",
"."
] | train | https://github.com/picqer/exact-php-client/blob/1cb39d53fb183cc1fb35483d3638b578a8dabb12/src/Picqer/Financials/Exact/SalesInvoice.php#L157-L164 |
picqer/exact-php-client | src/Picqer/Financials/Exact/Model.php | Model.lazyLoad | protected function lazyLoad($key)
{
// Check previously resolved or manualy set.
if (isset($this->deferred[$key])) {
return true;
}
try {
if (array_key_exists($key, $this->attributes) && is_array($this->attributes[$key]) && array_key_exists('__deferred', $thi... | php | protected function lazyLoad($key)
{
// Check previously resolved or manualy set.
if (isset($this->deferred[$key])) {
return true;
}
try {
if (array_key_exists($key, $this->attributes) && is_array($this->attributes[$key]) && array_key_exists('__deferred', $thi... | [
"protected",
"function",
"lazyLoad",
"(",
"$",
"key",
")",
"{",
"// Check previously resolved or manualy set.",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"deferred",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"try",
"{",
"if",
"("... | Resolve deferred values.
@param string $key
@return bool Returns true when collection is found | [
"Resolve",
"deferred",
"values",
"."
] | train | https://github.com/picqer/exact-php-client/blob/1cb39d53fb183cc1fb35483d3638b578a8dabb12/src/Picqer/Financials/Exact/Model.php#L143-L166 |
picqer/exact-php-client | src/Picqer/Financials/Exact/Model.php | Model.exists | public function exists()
{
if (! array_key_exists($this->primaryKey, $this->attributes)) {
return false;
}
return ! empty($this->attributes[$this->primaryKey]);
} | php | public function exists()
{
if (! array_key_exists($this->primaryKey, $this->attributes)) {
return false;
}
return ! empty($this->attributes[$this->primaryKey]);
} | [
"public",
"function",
"exists",
"(",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"this",
"->",
"primaryKey",
",",
"$",
"this",
"->",
"attributes",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"!",
"empty",
"(",
"$",
"this",
"->",... | Checks if primaryKey holds a value.
@return bool | [
"Checks",
"if",
"primaryKey",
"holds",
"a",
"value",
"."
] | train | https://github.com/picqer/exact-php-client/blob/1cb39d53fb183cc1fb35483d3638b578a8dabb12/src/Picqer/Financials/Exact/Model.php#L207-L214 |
picqer/exact-php-client | src/Picqer/Financials/Exact/Model.php | Model.json | public function json($options = 0, $withDeferred = false)
{
$attributes = $this->attributes;
if ($withDeferred) {
foreach ($this->deferred as $attribute => $collection) {
if (empty($collection)) {
continue; // Leave orriginal array with __deferred key
... | php | public function json($options = 0, $withDeferred = false)
{
$attributes = $this->attributes;
if ($withDeferred) {
foreach ($this->deferred as $attribute => $collection) {
if (empty($collection)) {
continue; // Leave orriginal array with __deferred key
... | [
"public",
"function",
"json",
"(",
"$",
"options",
"=",
"0",
",",
"$",
"withDeferred",
"=",
"false",
")",
"{",
"$",
"attributes",
"=",
"$",
"this",
"->",
"attributes",
";",
"if",
"(",
"$",
"withDeferred",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
... | Return the JSON representation of the data.
@param int $options http://php.net/manual/en/json.constants.php
@return string | [
"Return",
"the",
"JSON",
"representation",
"of",
"the",
"data",
"."
] | train | https://github.com/picqer/exact-php-client/blob/1cb39d53fb183cc1fb35483d3638b578a8dabb12/src/Picqer/Financials/Exact/Model.php#L223-L248 |
picqer/exact-php-client | src/Picqer/Financials/Exact/Model.php | Model.userHasRights | public function userHasRights($action = 'GET')
{
$action = preg_match('/^GET|POST|PUT|DELETE$/i', $action) ? strtoupper($action) : 'GET';
$result = $this->connection()->get('users/UserHasRights', [
'endpoint' => "'{$this->url}'",
'action' => "'{$action}'",
]);
... | php | public function userHasRights($action = 'GET')
{
$action = preg_match('/^GET|POST|PUT|DELETE$/i', $action) ? strtoupper($action) : 'GET';
$result = $this->connection()->get('users/UserHasRights', [
'endpoint' => "'{$this->url}'",
'action' => "'{$action}'",
]);
... | [
"public",
"function",
"userHasRights",
"(",
"$",
"action",
"=",
"'GET'",
")",
"{",
"$",
"action",
"=",
"preg_match",
"(",
"'/^GET|POST|PUT|DELETE$/i'",
",",
"$",
"action",
")",
"?",
"strtoupper",
"(",
"$",
"action",
")",
":",
"'GET'",
";",
"$",
"result",
... | Check whether the current user has rights for an action on this endpoint
https://start.exactonline.nl/docs/HlpRestAPIResources.aspx?SourceAction=10.
@param string $action
@return bool | [
"Check",
"whether",
"the",
"current",
"user",
"has",
"rights",
"for",
"an",
"action",
"on",
"this",
"endpoint",
"https",
":",
"//",
"start",
".",
"exactonline",
".",
"nl",
"/",
"docs",
"/",
"HlpRestAPIResources",
".",
"aspx?SourceAction",
"=",
"10",
"."
] | train | https://github.com/picqer/exact-php-client/blob/1cb39d53fb183cc1fb35483d3638b578a8dabb12/src/Picqer/Financials/Exact/Model.php#L268-L277 |
picqer/exact-php-client | src/Picqer/Financials/Exact/Query/Findable.php | Findable.findId | public function findId($code, $key = 'Code')
{
if ($this->isFillable($key)) {
$format = ($this->url() == 'crm/Accounts' && $key === 'Code') ? '%18s' : '%s';
if (preg_match('/^[\w]{8}-([\w]{4}-){3}[\w]{12}$/', $code)) {
$format = "guid'$format'";
} elseif (... | php | public function findId($code, $key = 'Code')
{
if ($this->isFillable($key)) {
$format = ($this->url() == 'crm/Accounts' && $key === 'Code') ? '%18s' : '%s';
if (preg_match('/^[\w]{8}-([\w]{4}-){3}[\w]{12}$/', $code)) {
$format = "guid'$format'";
} elseif (... | [
"public",
"function",
"findId",
"(",
"$",
"code",
",",
"$",
"key",
"=",
"'Code'",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isFillable",
"(",
"$",
"key",
")",
")",
"{",
"$",
"format",
"=",
"(",
"$",
"this",
"->",
"url",
"(",
")",
"==",
"'crm/Acc... | Return the value of the primary key.
@param string $code the value to search for
@param string $key the key being searched (defaults to 'Code')
@return string (guid) | [
"Return",
"the",
"value",
"of",
"the",
"primary",
"key",
"."
] | train | https://github.com/picqer/exact-php-client/blob/1cb39d53fb183cc1fb35483d3638b578a8dabb12/src/Picqer/Financials/Exact/Query/Findable.php#L63-L84 |
picqer/exact-php-client | src/Picqer/Financials/Exact/Query/Findable.php | Findable.first | public function first()
{
$results = $this->filter('', '', '', ['$top'=> 1]);
$result = is_array($results) && count($results) > 0 ? $results[0] : null;
return $result;
} | php | public function first()
{
$results = $this->filter('', '', '', ['$top'=> 1]);
$result = is_array($results) && count($results) > 0 ? $results[0] : null;
return $result;
} | [
"public",
"function",
"first",
"(",
")",
"{",
"$",
"results",
"=",
"$",
"this",
"->",
"filter",
"(",
"''",
",",
"''",
",",
"''",
",",
"[",
"'$top'",
"=>",
"1",
"]",
")",
";",
"$",
"result",
"=",
"is_array",
"(",
"$",
"results",
")",
"&&",
"coun... | Returns the first Financial model in by applying $top=1 to the query string.
@return \Picqer\Financials\Exact\Model|null | [
"Returns",
"the",
"first",
"Financial",
"model",
"in",
"by",
"applying",
"$top",
"=",
"1",
"to",
"the",
"query",
"string",
"."
] | train | https://github.com/picqer/exact-php-client/blob/1cb39d53fb183cc1fb35483d3638b578a8dabb12/src/Picqer/Financials/Exact/Query/Findable.php#L123-L129 |
picqer/exact-php-client | src/Picqer/Financials/Exact/Query/Resultset.php | Resultset.collectionFromResult | protected function collectionFromResult($result)
{
// If we have one result which is not an assoc array, make it the first element of an array for the
// collectionFromResult function so we always return a collection from filter
if ((bool) count(array_filter(array_keys($result), 'is_string')... | php | protected function collectionFromResult($result)
{
// If we have one result which is not an assoc array, make it the first element of an array for the
// collectionFromResult function so we always return a collection from filter
if ((bool) count(array_filter(array_keys($result), 'is_string')... | [
"protected",
"function",
"collectionFromResult",
"(",
"$",
"result",
")",
"{",
"// If we have one result which is not an assoc array, make it the first element of an array for the",
"// collectionFromResult function so we always return a collection from filter",
"if",
"(",
"(",
"bool",
"... | @param array $result
@return array | [
"@param",
"array",
"$result"
] | train | https://github.com/picqer/exact-php-client/blob/1cb39d53fb183cc1fb35483d3638b578a8dabb12/src/Picqer/Financials/Exact/Query/Resultset.php#L73-L89 |
picqer/exact-php-client | src/Picqer/Financials/Exact/Connection.php | Connection.get | public function get($url, array $params = [], array $headers = [])
{
$url = $this->formatUrl($url, $url !== 'current/Me', $url == $this->nextUrl);
try {
$request = $this->createRequest('GET', $url, null, $params, $headers);
$response = $this->client()->send($request);
... | php | public function get($url, array $params = [], array $headers = [])
{
$url = $this->formatUrl($url, $url !== 'current/Me', $url == $this->nextUrl);
try {
$request = $this->createRequest('GET', $url, null, $params, $headers);
$response = $this->client()->send($request);
... | [
"public",
"function",
"get",
"(",
"$",
"url",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"formatUrl",
"(",
"$",
"url",
",",
"$",
"url",
"!==",
"'current... | @param string $url
@param array $params
@param array $headers
@throws ApiException
@return mixed | [
"@param",
"string",
"$url",
"@param",
"array",
"$params",
"@param",
"array",
"$headers"
] | train | https://github.com/picqer/exact-php-client/blob/1cb39d53fb183cc1fb35483d3638b578a8dabb12/src/Picqer/Financials/Exact/Connection.php#L226-L238 |
picqer/exact-php-client | src/Picqer/Financials/Exact/Connection.php | Connection.parseResponse | private function parseResponse(Response $response, $returnSingleIfPossible = true)
{
try {
if ($response->getStatusCode() === 204) {
return [];
}
$this->extractRateLimits($response);
Psr7\rewind_body($response);
$json = json_decod... | php | private function parseResponse(Response $response, $returnSingleIfPossible = true)
{
try {
if ($response->getStatusCode() === 204) {
return [];
}
$this->extractRateLimits($response);
Psr7\rewind_body($response);
$json = json_decod... | [
"private",
"function",
"parseResponse",
"(",
"Response",
"$",
"response",
",",
"$",
"returnSingleIfPossible",
"=",
"true",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"response",
"->",
"getStatusCode",
"(",
")",
"===",
"204",
")",
"{",
"return",
"[",
"]",
";",... | @param Response $response
@param bool $returnSingleIfPossible
@throws ApiException
@return mixed | [
"@param",
"Response",
"$response",
"@param",
"bool",
"$returnSingleIfPossible"
] | train | https://github.com/picqer/exact-php-client/blob/1cb39d53fb183cc1fb35483d3638b578a8dabb12/src/Picqer/Financials/Exact/Connection.php#L388-L421 |
picqer/exact-php-client | src/Picqer/Financials/Exact/Connection.php | Connection.parseExceptionForErrorMessages | private function parseExceptionForErrorMessages(Exception $e)
{
if (! $e instanceof BadResponseException) {
throw new ApiException($e->getMessage());
}
$response = $e->getResponse();
Psr7\rewind_body($response);
$responseBody = $response->getBody()->getContents()... | php | private function parseExceptionForErrorMessages(Exception $e)
{
if (! $e instanceof BadResponseException) {
throw new ApiException($e->getMessage());
}
$response = $e->getResponse();
Psr7\rewind_body($response);
$responseBody = $response->getBody()->getContents()... | [
"private",
"function",
"parseExceptionForErrorMessages",
"(",
"Exception",
"$",
"e",
")",
"{",
"if",
"(",
"!",
"$",
"e",
"instanceof",
"BadResponseException",
")",
"{",
"throw",
"new",
"ApiException",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
... | Parse the reponse in the Exception to return the Exact error messages.
@param Exception $e
@throws ApiException | [
"Parse",
"the",
"reponse",
"in",
"the",
"Exception",
"to",
"return",
"the",
"Exact",
"error",
"messages",
"."
] | train | https://github.com/picqer/exact-php-client/blob/1cb39d53fb183cc1fb35483d3638b578a8dabb12/src/Picqer/Financials/Exact/Connection.php#L614-L632 |
picqer/exact-php-client | src/Picqer/Financials/Exact/PurchaseInvoice.php | PurchaseInvoice.getPurchaseInvoiceLines | public function getPurchaseInvoiceLines($statement = '')
{
if (array_key_exists('__deferred', $this->attributes['PurchaseInvoiceLines'])) {
$this->attributes['PurchaseInvoiceLines'] = (new PurchaseInvoiceLine($this->connection()))->filter("InvoiceID eq guid'{$this->ID}'", '', '', $statement);
... | php | public function getPurchaseInvoiceLines($statement = '')
{
if (array_key_exists('__deferred', $this->attributes['PurchaseInvoiceLines'])) {
$this->attributes['PurchaseInvoiceLines'] = (new PurchaseInvoiceLine($this->connection()))->filter("InvoiceID eq guid'{$this->ID}'", '', '', $statement);
... | [
"public",
"function",
"getPurchaseInvoiceLines",
"(",
"$",
"statement",
"=",
"''",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'__deferred'",
",",
"$",
"this",
"->",
"attributes",
"[",
"'PurchaseInvoiceLines'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"attr... | Updates the PurchaseInvoiceLines collection on a PurchaseInvoice if it's been detected as a deferred collection.
Fetches results and stores them on this object.
@return mixed | [
"Updates",
"the",
"PurchaseInvoiceLines",
"collection",
"on",
"a",
"PurchaseInvoice",
"if",
"it",
"s",
"been",
"detected",
"as",
"a",
"deferred",
"collection",
".",
"Fetches",
"results",
"and",
"stores",
"them",
"on",
"this",
"object",
"."
] | train | https://github.com/picqer/exact-php-client/blob/1cb39d53fb183cc1fb35483d3638b578a8dabb12/src/Picqer/Financials/Exact/PurchaseInvoice.php#L77-L84 |
humbug/php-scoper | src/Scoper/Symfony/YamlScoper.php | YamlScoper.scope | public function scope(string $filePath, string $contents, string $prefix, array $patchers, Whitelist $whitelist): string
{
if (1 !== preg_match(self::FILE_PATH_PATTERN, $filePath)) {
return $this->decoratedScoper->scope(...func_get_args());
}
if (1 > preg_match_all('/(?:(?<singl... | php | public function scope(string $filePath, string $contents, string $prefix, array $patchers, Whitelist $whitelist): string
{
if (1 !== preg_match(self::FILE_PATH_PATTERN, $filePath)) {
return $this->decoratedScoper->scope(...func_get_args());
}
if (1 > preg_match_all('/(?:(?<singl... | [
"public",
"function",
"scope",
"(",
"string",
"$",
"filePath",
",",
"string",
"$",
"contents",
",",
"string",
"$",
"prefix",
",",
"array",
"$",
"patchers",
",",
"Whitelist",
"$",
"whitelist",
")",
":",
"string",
"{",
"if",
"(",
"1",
"!==",
"preg_match",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/Scoper/Symfony/YamlScoper.php#L45-L72 |
humbug/php-scoper | src/Configuration.php | Configuration.load | public static function load(string $path = null, array $paths = []): self
{
if (null === $path) {
$config = [];
} else {
if (false === (new Filesystem())->isAbsolutePath($path)) {
throw new InvalidArgumentException(
sprintf(
... | php | public static function load(string $path = null, array $paths = []): self
{
if (null === $path) {
$config = [];
} else {
if (false === (new Filesystem())->isAbsolutePath($path)) {
throw new InvalidArgumentException(
sprintf(
... | [
"public",
"static",
"function",
"load",
"(",
"string",
"$",
"path",
"=",
"null",
",",
"array",
"$",
"paths",
"=",
"[",
"]",
")",
":",
"self",
"{",
"if",
"(",
"null",
"===",
"$",
"path",
")",
"{",
"$",
"config",
"=",
"[",
"]",
";",
"}",
"else",
... | @param string|null $path Absolute path to the configuration file.
@param string[] $paths List of paths to append besides the one configured
@return self | [
"@param",
"string|null",
"$path",
"Absolute",
"path",
"to",
"the",
"configuration",
"file",
".",
"@param",
"string",
"[]",
"$paths",
"List",
"of",
"paths",
"to",
"append",
"besides",
"the",
"one",
"configured"
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/Configuration.php#L79-L143 |
humbug/php-scoper | src/Configuration.php | Configuration.retrievePrefix | private static function retrievePrefix(array $config): ?string
{
$prefix = $config[self::PREFIX_KEYWORD] ?? null;
if (null === $prefix) {
return null;
}
$prefix = trim($prefix);
return '' === $prefix ? null : $prefix;
} | php | private static function retrievePrefix(array $config): ?string
{
$prefix = $config[self::PREFIX_KEYWORD] ?? null;
if (null === $prefix) {
return null;
}
$prefix = trim($prefix);
return '' === $prefix ? null : $prefix;
} | [
"private",
"static",
"function",
"retrievePrefix",
"(",
"array",
"$",
"config",
")",
":",
"?",
"string",
"{",
"$",
"prefix",
"=",
"$",
"config",
"[",
"self",
"::",
"PREFIX_KEYWORD",
"]",
"??",
"null",
";",
"if",
"(",
"null",
"===",
"$",
"prefix",
")",
... | If the prefix is set to null in the config file/argument then a random prefix is being used. However if set to
empty, the configuration will use a null prefix.
TL:DR; setting the prefix is a big confusing because it is not properly split in "set prefix" & prefix strategy". | [
"If",
"the",
"prefix",
"is",
"set",
"to",
"null",
"in",
"the",
"config",
"file",
"/",
"argument",
"then",
"a",
"random",
"prefix",
"is",
"being",
"used",
".",
"However",
"if",
"set",
"to",
"empty",
"the",
"configuration",
"will",
"use",
"a",
"null",
"p... | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/Configuration.php#L268-L279 |
humbug/php-scoper | src/Configuration.php | Configuration.retrieveFilesFromPaths | private static function retrieveFilesFromPaths(array $paths): iterable
{
if ([] === $paths) {
return [];
}
$pathsToSearch = [];
$filesToAppend = [];
foreach ($paths as $path) {
if (false === file_exists($path)) {
throw new RuntimeExce... | php | private static function retrieveFilesFromPaths(array $paths): iterable
{
if ([] === $paths) {
return [];
}
$pathsToSearch = [];
$filesToAppend = [];
foreach ($paths as $path) {
if (false === file_exists($path)) {
throw new RuntimeExce... | [
"private",
"static",
"function",
"retrieveFilesFromPaths",
"(",
"array",
"$",
"paths",
")",
":",
"iterable",
"{",
"if",
"(",
"[",
"]",
"===",
"$",
"paths",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"pathsToSearch",
"=",
"[",
"]",
";",
"$",
"filesT... | @param string[] $paths
@return iterable | [
"@param",
"string",
"[]",
"$paths"
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/Configuration.php#L475-L517 |
humbug/php-scoper | src/Configuration.php | Configuration.retrieveFilesWithContents | private static function retrieveFilesWithContents(Iterator $files): array
{
return array_reduce(
iterator_to_array($files),
static function (array $files, SplFileInfo $fileInfo): array {
$file = $fileInfo->getRealPath();
if (false === $file) {
... | php | private static function retrieveFilesWithContents(Iterator $files): array
{
return array_reduce(
iterator_to_array($files),
static function (array $files, SplFileInfo $fileInfo): array {
$file = $fileInfo->getRealPath();
if (false === $file) {
... | [
"private",
"static",
"function",
"retrieveFilesWithContents",
"(",
"Iterator",
"$",
"files",
")",
":",
"array",
"{",
"return",
"array_reduce",
"(",
"iterator_to_array",
"(",
"$",
"files",
")",
",",
"static",
"function",
"(",
"array",
"$",
"files",
",",
"SplFil... | @param Iterator $files
@return string[][] Array of tuple with the first argument being the file path and the second its contents | [
"@param",
"Iterator",
"$files"
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/Configuration.php#L524-L555 |
humbug/php-scoper | src/Scoper/Composer/InstalledPackagesScoper.php | InstalledPackagesScoper.scope | public function scope(string $filePath, string $contents, string $prefix, array $patchers, Whitelist $whitelist): string
{
if (1 !== preg_match(self::$filePattern, $filePath)) {
return $this->decoratedScoper->scope($filePath, $contents, $prefix, $patchers, $whitelist);
}
$decode... | php | public function scope(string $filePath, string $contents, string $prefix, array $patchers, Whitelist $whitelist): string
{
if (1 !== preg_match(self::$filePattern, $filePath)) {
return $this->decoratedScoper->scope($filePath, $contents, $prefix, $patchers, $whitelist);
}
$decode... | [
"public",
"function",
"scope",
"(",
"string",
"$",
"filePath",
",",
"string",
"$",
"contents",
",",
"string",
"$",
"prefix",
",",
"array",
"$",
"patchers",
",",
"Whitelist",
"$",
"whitelist",
")",
":",
"string",
"{",
"if",
"(",
"1",
"!==",
"preg_match",
... | Scopes PHP and JSON files related to Composer.
{@inheritdoc} | [
"Scopes",
"PHP",
"and",
"JSON",
"files",
"related",
"to",
"Composer",
"."
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/Scoper/Composer/InstalledPackagesScoper.php#L38-L52 |
humbug/php-scoper | src/PhpParser/NodeVisitor/Collection/UseStmtCollection.php | UseStmtCollection.findStatementForNode | public function findStatementForNode(?Name $namespaceName, Name $node): ?Name
{
$name = strtolower($node->getFirst());
$parentNode = ParentNodeAppender::findParent($node);
if ($parentNode instanceof ClassLike
&& $node instanceof NamedIdentifier
&& $node->getOriginal... | php | public function findStatementForNode(?Name $namespaceName, Name $node): ?Name
{
$name = strtolower($node->getFirst());
$parentNode = ParentNodeAppender::findParent($node);
if ($parentNode instanceof ClassLike
&& $node instanceof NamedIdentifier
&& $node->getOriginal... | [
"public",
"function",
"findStatementForNode",
"(",
"?",
"Name",
"$",
"namespaceName",
",",
"Name",
"$",
"node",
")",
":",
"?",
"Name",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"$",
"node",
"->",
"getFirst",
"(",
")",
")",
";",
"$",
"parentNode",
"=",
... | Finds the statements matching the given name.
$name = 'Foo';
use X;
use Bar\Foo;
use Y;
will return the use statement for `Bar\Foo`.
@param Name|null $namespaceName
@param Name $node
@return null|Name | [
"Finds",
"the",
"statements",
"matching",
"the",
"given",
"name",
"."
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/PhpParser/NodeVisitor/Collection/UseStmtCollection.php#L68-L120 |
humbug/php-scoper | src/Scoper/Composer/AutoloadPrefixer.php | AutoloadPrefixer.prefixPackageAutoloadStatements | public static function prefixPackageAutoloadStatements(stdClass $contents, string $prefix, Whitelist $whitelist): stdClass
{
if (isset($contents->autoload)) {
$contents->autoload = self::prefixAutoloadStatements($contents->autoload, $prefix, $whitelist);
}
if (isset($contents->{... | php | public static function prefixPackageAutoloadStatements(stdClass $contents, string $prefix, Whitelist $whitelist): stdClass
{
if (isset($contents->autoload)) {
$contents->autoload = self::prefixAutoloadStatements($contents->autoload, $prefix, $whitelist);
}
if (isset($contents->{... | [
"public",
"static",
"function",
"prefixPackageAutoloadStatements",
"(",
"stdClass",
"$",
"contents",
",",
"string",
"$",
"prefix",
",",
"Whitelist",
"$",
"whitelist",
")",
":",
"stdClass",
"{",
"if",
"(",
"isset",
"(",
"$",
"contents",
"->",
"autoload",
")",
... | @param stdClass $contents Decoded JSON
@param string $prefix
@return stdClass Prefixed decoded JSON | [
"@param",
"stdClass",
"$contents",
"Decoded",
"JSON",
"@param",
"string",
"$prefix"
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/Scoper/Composer/AutoloadPrefixer.php#L37-L52 |
humbug/php-scoper | src/Scoper/Composer/AutoloadPrefixer.php | AutoloadPrefixer.updatePSR0Path | private static function updatePSR0Path($path, string $namespace)
{
$namespaceForPsr = rtrim(
str_replace('\\', '/', $namespace),
'/'
);
if (false === is_array($path)) {
if ('/' !== substr($path, -1)) {
$path .= '/';
}
... | php | private static function updatePSR0Path($path, string $namespace)
{
$namespaceForPsr = rtrim(
str_replace('\\', '/', $namespace),
'/'
);
if (false === is_array($path)) {
if ('/' !== substr($path, -1)) {
$path .= '/';
}
... | [
"private",
"static",
"function",
"updatePSR0Path",
"(",
"$",
"path",
",",
"string",
"$",
"namespace",
")",
"{",
"$",
"namespaceForPsr",
"=",
"rtrim",
"(",
"str_replace",
"(",
"'\\\\'",
",",
"'/'",
",",
"$",
"namespace",
")",
",",
"'/'",
")",
";",
"if",
... | @param string|string[] $path
@return string|string[] | [
"@param",
"string|string",
"[]",
"$path"
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/Scoper/Composer/AutoloadPrefixer.php#L142-L169 |
humbug/php-scoper | src/Scoper/Composer/AutoloadPrefixer.php | AutoloadPrefixer.mergeNamespaces | private static function mergeNamespaces(string $psr0Namespace, $psr0Path, array $psr4)
{
// Both strings
if (is_string($psr4[$psr0Namespace]) && is_string($psr0Path)) {
return [$psr4[$psr0Namespace], $psr0Path];
}
// PSR-4 is string, and PSR-0 is array
if (is_str... | php | private static function mergeNamespaces(string $psr0Namespace, $psr0Path, array $psr4)
{
// Both strings
if (is_string($psr4[$psr0Namespace]) && is_string($psr0Path)) {
return [$psr4[$psr0Namespace], $psr0Path];
}
// PSR-4 is string, and PSR-0 is array
if (is_str... | [
"private",
"static",
"function",
"mergeNamespaces",
"(",
"string",
"$",
"psr0Namespace",
",",
"$",
"psr0Path",
",",
"array",
"$",
"psr4",
")",
"{",
"// Both strings",
"if",
"(",
"is_string",
"(",
"$",
"psr4",
"[",
"$",
"psr0Namespace",
"]",
")",
"&&",
"is_... | Deals with the 4 possible scenarios:
PSR0 | PSR4
array |
string |
or simply the namespace not existing as a psr-4 entry.
@param string $psr0Namespace
@param string|string[] $psr0Path
@param (string|string[])[] $psr4
@return string|string[] | [
"Deals",
"with",
"the",
"4",
"possible",
"scenarios",
":",
"PSR0",
"|",
"PSR4",
"array",
"|",
"string",
"|",
"or",
"simply",
"the",
"namespace",
"not",
"existing",
"as",
"a",
"psr",
"-",
"4",
"entry",
"."
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/Scoper/Composer/AutoloadPrefixer.php#L184-L210 |
humbug/php-scoper | src/Logger/ConsoleLogger.php | ConsoleLogger.outputFileCount | public function outputFileCount(int $count): void
{
if (OutputInterface::VERBOSITY_NORMAL === $this->io->getVerbosity()) {
$this->progressBar = $this->io->createProgressBar($count);
$this->progressBar->start();
} elseif ($this->io->getVerbosity() >= OutputInterface::VERBOSITY... | php | public function outputFileCount(int $count): void
{
if (OutputInterface::VERBOSITY_NORMAL === $this->io->getVerbosity()) {
$this->progressBar = $this->io->createProgressBar($count);
$this->progressBar->start();
} elseif ($this->io->getVerbosity() >= OutputInterface::VERBOSITY... | [
"public",
"function",
"outputFileCount",
"(",
"int",
"$",
"count",
")",
":",
"void",
"{",
"if",
"(",
"OutputInterface",
"::",
"VERBOSITY_NORMAL",
"===",
"$",
"this",
"->",
"io",
"->",
"getVerbosity",
"(",
")",
")",
"{",
"$",
"this",
"->",
"progressBar",
... | Output file count message if relevant.
@param int $count | [
"Output",
"file",
"count",
"message",
"if",
"relevant",
"."
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/Logger/ConsoleLogger.php#L84-L92 |
humbug/php-scoper | src/Logger/ConsoleLogger.php | ConsoleLogger.outputSuccess | public function outputSuccess(string $path): void
{
if ($this->io->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
$this->io->writeln(
sprintf(
' * [<info>OK</info>] %s',
$path
)
);
}
$th... | php | public function outputSuccess(string $path): void
{
if ($this->io->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
$this->io->writeln(
sprintf(
' * [<info>OK</info>] %s',
$path
)
);
}
$th... | [
"public",
"function",
"outputSuccess",
"(",
"string",
"$",
"path",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"io",
"->",
"getVerbosity",
"(",
")",
">=",
"OutputInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"{",
"$",
"this",
"->",
"io",
"->",
"... | Output scoping success message.
@param string $path | [
"Output",
"scoping",
"success",
"message",
"."
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/Logger/ConsoleLogger.php#L99-L111 |
humbug/php-scoper | src/Scoper/PhpScoper.php | PhpScoper.scope | public function scope(string $filePath, string $contents, string $prefix, array $patchers, Whitelist $whitelist): string
{
if (false === $this->isPhpFile($filePath, $contents)) {
return $this->decoratedScoper->scope(...func_get_args());
}
return $this->scopePhp($contents, $prefi... | php | public function scope(string $filePath, string $contents, string $prefix, array $patchers, Whitelist $whitelist): string
{
if (false === $this->isPhpFile($filePath, $contents)) {
return $this->decoratedScoper->scope(...func_get_args());
}
return $this->scopePhp($contents, $prefi... | [
"public",
"function",
"scope",
"(",
"string",
"$",
"filePath",
",",
"string",
"$",
"contents",
",",
"string",
"$",
"prefix",
",",
"array",
"$",
"patchers",
",",
"Whitelist",
"$",
"whitelist",
")",
":",
"string",
"{",
"if",
"(",
"false",
"===",
"$",
"th... | Scopes PHP files.
{@inheritdoc}
@throws PhpParserError | [
"Scopes",
"PHP",
"files",
"."
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/Scoper/PhpScoper.php#L50-L57 |
humbug/php-scoper | src/Whitelist.php | Whitelist.isSymbolWhitelisted | public function isSymbolWhitelisted(string $name, bool $constant = false): bool
{
if (false === $constant && array_key_exists(strtolower($name), $this->symbols)) {
return true;
}
if ($constant && array_key_exists(self::lowerConstantName($name), $this->constants)) {
r... | php | public function isSymbolWhitelisted(string $name, bool $constant = false): bool
{
if (false === $constant && array_key_exists(strtolower($name), $this->symbols)) {
return true;
}
if ($constant && array_key_exists(self::lowerConstantName($name), $this->constants)) {
r... | [
"public",
"function",
"isSymbolWhitelisted",
"(",
"string",
"$",
"name",
",",
"bool",
"$",
"constant",
"=",
"false",
")",
":",
"bool",
"{",
"if",
"(",
"false",
"===",
"$",
"constant",
"&&",
"array_key_exists",
"(",
"strtolower",
"(",
"$",
"name",
")",
",... | Tells if a given symbol is whitelisted. Note however that it does not account for when:.
- The symbol belongs to the global namespace and the symbols of the global namespace of this type are whitelisted
- Belongs to a whitelisted namespace
@param bool $constant Unlike other symbols, constants _can_ be case insensitiv... | [
"Tells",
"if",
"a",
"given",
"symbol",
"is",
"whitelisted",
".",
"Note",
"however",
"that",
"it",
"does",
"not",
"account",
"for",
"when",
":",
"."
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/Whitelist.php#L267-L286 |
humbug/php-scoper | src/Whitelist.php | Whitelist.getClassWhitelistArray | public function getClassWhitelistArray(): array
{
return array_filter(
$this->original,
static function (string $name): bool {
return '*' !== $name && '\*' !== substr($name, -2);
}
);
} | php | public function getClassWhitelistArray(): array
{
return array_filter(
$this->original,
static function (string $name): bool {
return '*' !== $name && '\*' !== substr($name, -2);
}
);
} | [
"public",
"function",
"getClassWhitelistArray",
"(",
")",
":",
"array",
"{",
"return",
"array_filter",
"(",
"$",
"this",
"->",
"original",
",",
"static",
"function",
"(",
"string",
"$",
"name",
")",
":",
"bool",
"{",
"return",
"'*'",
"!==",
"$",
"name",
... | @return string[]
@deprecated To be replaced by getWhitelistedClasses | [
"@return",
"string",
"[]"
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/Whitelist.php#L293-L301 |
humbug/php-scoper | src/Whitelist.php | Whitelist.lowerConstantName | private static function lowerConstantName(string $name): string
{
$parts = explode('\\', $name);
$lastPart = array_pop($parts);
$parts = array_map('strtolower', $parts);
$parts[] = $lastPart;
return implode('\\', $parts);
} | php | private static function lowerConstantName(string $name): string
{
$parts = explode('\\', $name);
$lastPart = array_pop($parts);
$parts = array_map('strtolower', $parts);
$parts[] = $lastPart;
return implode('\\', $parts);
} | [
"private",
"static",
"function",
"lowerConstantName",
"(",
"string",
"$",
"name",
")",
":",
"string",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'\\\\'",
",",
"$",
"name",
")",
";",
"$",
"lastPart",
"=",
"array_pop",
"(",
"$",
"parts",
")",
";",
"$",
"... | Transforms the constant FQ name "Acme\Foo\X" to "acme\foo\X" since the namespace remains case insensitive for
constants regardless of whether or not constants actually are case insensitive. | [
"Transforms",
"the",
"constant",
"FQ",
"name",
"Acme",
"\\",
"Foo",
"\\",
"X",
"to",
"acme",
"\\",
"foo",
"\\",
"X",
"since",
"the",
"namespace",
"remains",
"case",
"insensitive",
"for",
"constants",
"regardless",
"of",
"whether",
"or",
"not",
"constants",
... | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/Whitelist.php#L320-L331 |
humbug/php-scoper | src/PhpParser/NodeVisitor/UseStmt/UseStmtPrefixer.php | UseStmtPrefixer.findUseType | private function findUseType(UseUse $use): int
{
if (Use_::TYPE_UNKNOWN === $use->type) {
/** @var Use_ $parentNode */
$parentNode = ParentNodeAppender::getParent($use);
return $parentNode->type;
}
return $use->type;
} | php | private function findUseType(UseUse $use): int
{
if (Use_::TYPE_UNKNOWN === $use->type) {
/** @var Use_ $parentNode */
$parentNode = ParentNodeAppender::getParent($use);
return $parentNode->type;
}
return $use->type;
} | [
"private",
"function",
"findUseType",
"(",
"UseUse",
"$",
"use",
")",
":",
"int",
"{",
"if",
"(",
"Use_",
"::",
"TYPE_UNKNOWN",
"===",
"$",
"use",
"->",
"type",
")",
"{",
"/** @var Use_ $parentNode */",
"$",
"parentNode",
"=",
"ParentNodeAppender",
"::",
"ge... | Finds the type of the use statement.
@param UseUse $use
@return int See \PhpParser\Node\Stmt\Use_ type constants. | [
"Finds",
"the",
"type",
"of",
"the",
"use",
"statement",
"."
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/PhpParser/NodeVisitor/UseStmt/UseStmtPrefixer.php#L91-L101 |
humbug/php-scoper | fixtures/set011/src/DirectionaryLocator.php | DirectionaryLocator.locateDictionaries | public static function locateDictionaries(string $dir): array
{
$dictionaryFiles = array_values(
array_filter(
array_map(
function (string $filePath) use ($dir) {
return realpath($dir.DIRECTORY_SEPARATOR.$filePath);
... | php | public static function locateDictionaries(string $dir): array
{
$dictionaryFiles = array_values(
array_filter(
array_map(
function (string $filePath) use ($dir) {
return realpath($dir.DIRECTORY_SEPARATOR.$filePath);
... | [
"public",
"static",
"function",
"locateDictionaries",
"(",
"string",
"$",
"dir",
")",
":",
"array",
"{",
"$",
"dictionaryFiles",
"=",
"array_values",
"(",
"array_filter",
"(",
"array_map",
"(",
"function",
"(",
"string",
"$",
"filePath",
")",
"use",
"(",
"$"... | @param string $dir
@return Dictionary[] | [
"@param",
"string",
"$dir"
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/fixtures/set011/src/DirectionaryLocator.php#L16-L59 |
humbug/php-scoper | src/PhpParser/NodeTraverser.php | NodeTraverser.wrapInNamespace | private function wrapInNamespace(array $nodes): array
{
if ([] === $nodes) {
return $nodes;
}
$nodes = array_values($nodes);
$firstRealStatementIndex = 0;
$realStatements = [];
foreach ($nodes as $i => $node) {
if ($node instanceof Declare_ ... | php | private function wrapInNamespace(array $nodes): array
{
if ([] === $nodes) {
return $nodes;
}
$nodes = array_values($nodes);
$firstRealStatementIndex = 0;
$realStatements = [];
foreach ($nodes as $i => $node) {
if ($node instanceof Declare_ ... | [
"private",
"function",
"wrapInNamespace",
"(",
"array",
"$",
"nodes",
")",
":",
"array",
"{",
"if",
"(",
"[",
"]",
"===",
"$",
"nodes",
")",
"{",
"return",
"$",
"nodes",
";",
"}",
"$",
"nodes",
"=",
"array_values",
"(",
"$",
"nodes",
")",
";",
"$",... | Wrap the statements in a namespace when necessary:.
```php
#!/usr/bin/env php
<?php declare(strict_types=1);
// A small comment
if (\true) {
echo "yo";
}
```
Will result in:
```php
#!/usr/bin/env php
<?php declare(strict_types=1);
// A small comment
namespace {
if (\true) {
echo "yo";
}
}
```
@param Node[] $nod... | [
"Wrap",
"the",
"statements",
"in",
"a",
"namespace",
"when",
"necessary",
":",
"."
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/PhpParser/NodeTraverser.php#L88-L119 |
humbug/php-scoper | src/PhpParser/NodeTraverser.php | NodeTraverser.replaceGroupUseStatements | private function replaceGroupUseStatements(array $nodes): array
{
foreach ($nodes as $node) {
if (false === ($node instanceof Namespace_)) {
continue;
}
/** @var Namespace_ $node */
$statements = $node->stmts;
$newStatements = [];... | php | private function replaceGroupUseStatements(array $nodes): array
{
foreach ($nodes as $node) {
if (false === ($node instanceof Namespace_)) {
continue;
}
/** @var Namespace_ $node */
$statements = $node->stmts;
$newStatements = [];... | [
"private",
"function",
"replaceGroupUseStatements",
"(",
"array",
"$",
"nodes",
")",
":",
"array",
"{",
"foreach",
"(",
"$",
"nodes",
"as",
"$",
"node",
")",
"{",
"if",
"(",
"false",
"===",
"(",
"$",
"node",
"instanceof",
"Namespace_",
")",
")",
"{",
"... | @param Node[] $nodes
@return Node[] | [
"@param",
"Node",
"[]",
"$nodes"
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/PhpParser/NodeTraverser.php#L126-L152 |
humbug/php-scoper | src/PhpParser/NodeTraverser.php | NodeTraverser.createUses_ | private function createUses_(GroupUse $node): array
{
return array_map(
static function (UseUse $use) use ($node): Use_ {
$newUse = new UseUse(
Name::concat($node->prefix, $use->name, $use->name->getAttributes()),
$use->alias,
... | php | private function createUses_(GroupUse $node): array
{
return array_map(
static function (UseUse $use) use ($node): Use_ {
$newUse = new UseUse(
Name::concat($node->prefix, $use->name, $use->name->getAttributes()),
$use->alias,
... | [
"private",
"function",
"createUses_",
"(",
"GroupUse",
"$",
"node",
")",
":",
"array",
"{",
"return",
"array_map",
"(",
"static",
"function",
"(",
"UseUse",
"$",
"use",
")",
"use",
"(",
"$",
"node",
")",
":",
"Use_",
"{",
"$",
"newUse",
"=",
"new",
"... | @param GroupUse $node
@return Use_[] | [
"@param",
"GroupUse",
"$node"
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/PhpParser/NodeTraverser.php#L159-L178 |
humbug/php-scoper | src/Scoper/Composer/JsonFileScoper.php | JsonFileScoper.scope | public function scope(string $filePath, string $contents, string $prefix, array $patchers, Whitelist $whitelist): string
{
if (1 !== preg_match('/composer\.json$/', $filePath)) {
return $this->decoratedScoper->scope($filePath, $contents, $prefix, $patchers, $whitelist);
}
$decod... | php | public function scope(string $filePath, string $contents, string $prefix, array $patchers, Whitelist $whitelist): string
{
if (1 !== preg_match('/composer\.json$/', $filePath)) {
return $this->decoratedScoper->scope($filePath, $contents, $prefix, $patchers, $whitelist);
}
$decod... | [
"public",
"function",
"scope",
"(",
"string",
"$",
"filePath",
",",
"string",
"$",
"contents",
",",
"string",
"$",
"prefix",
",",
"array",
"$",
"patchers",
",",
"Whitelist",
"$",
"whitelist",
")",
":",
"string",
"{",
"if",
"(",
"1",
"!==",
"preg_match",
... | Scopes PHP and JSON files related to Composer.
{@inheritdoc} | [
"Scopes",
"PHP",
"and",
"JSON",
"files",
"related",
"to",
"Composer",
"."
] | train | https://github.com/humbug/php-scoper/blob/5e099a8346db2f14473ed884670d6ff34886ca9e/src/Scoper/Composer/JsonFileScoper.php#L40-L63 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.