repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
grom358/pharborist | src/Parser.php | Parser.dimOffset | private function dimOffset(ArrayLookupNode $node) {
$this->mustMatch('[', $node);
if ($this->currentType !== ']') {
$node->addChild($this->expr(), 'key');
}
$this->mustMatch(']', $node, NULL, TRUE);
} | php | private function dimOffset(ArrayLookupNode $node) {
$this->mustMatch('[', $node);
if ($this->currentType !== ']') {
$node->addChild($this->expr(), 'key');
}
$this->mustMatch(']', $node, NULL, TRUE);
} | [
"private",
"function",
"dimOffset",
"(",
"ArrayLookupNode",
"$",
"node",
")",
"{",
"$",
"this",
"->",
"mustMatch",
"(",
"'['",
",",
"$",
"node",
")",
";",
"if",
"(",
"$",
"this",
"->",
"currentType",
"!==",
"']'",
")",
"{",
"$",
"node",
"->",
"addChi... | Parse dimensional offset.
@param ArrayLookupNode $node Node to append to | [
"Parse",
"dimensional",
"offset",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2090-L2096 | train |
grom358/pharborist | src/Parser.php | Parser.functionCallParameterList | private function functionCallParameterList($node) {
$arguments = new CommaListNode();
$this->mustMatch('(', $node, 'openParen');
$node->addChild($arguments, 'arguments');
if ($this->tryMatch(')', $node, 'closeParen', TRUE)) {
return;
}
if ($this->currentType === T_YIELD) {
$arguments->addChild($this->_yield());
} else {
do {
$arguments->addChild($this->functionCallParameter());
} while ($this->tryMatch(',', $arguments));
}
$this->mustMatch(')', $node, 'closeParen', TRUE);
} | php | private function functionCallParameterList($node) {
$arguments = new CommaListNode();
$this->mustMatch('(', $node, 'openParen');
$node->addChild($arguments, 'arguments');
if ($this->tryMatch(')', $node, 'closeParen', TRUE)) {
return;
}
if ($this->currentType === T_YIELD) {
$arguments->addChild($this->_yield());
} else {
do {
$arguments->addChild($this->functionCallParameter());
} while ($this->tryMatch(',', $arguments));
}
$this->mustMatch(')', $node, 'closeParen', TRUE);
} | [
"private",
"function",
"functionCallParameterList",
"(",
"$",
"node",
")",
"{",
"$",
"arguments",
"=",
"new",
"CommaListNode",
"(",
")",
";",
"$",
"this",
"->",
"mustMatch",
"(",
"'('",
",",
"$",
"node",
",",
"'openParen'",
")",
";",
"$",
"node",
"->",
... | Parse function call parameter list.
@param NewNode|CallNode $node | [
"Parse",
"function",
"call",
"parameter",
"list",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2102-L2117 | train |
grom358/pharborist | src/Parser.php | Parser.functionCallParameter | private function functionCallParameter() {
switch ($this->currentType) {
case '&':
return $this->writeVariable();
case T_ELLIPSIS:
$node = new SplatNode();
$this->mustMatch(T_ELLIPSIS, $node);
$node->addChild($this->expr(), 'expression');
return $node;
default:
return $this->expr();
}
} | php | private function functionCallParameter() {
switch ($this->currentType) {
case '&':
return $this->writeVariable();
case T_ELLIPSIS:
$node = new SplatNode();
$this->mustMatch(T_ELLIPSIS, $node);
$node->addChild($this->expr(), 'expression');
return $node;
default:
return $this->expr();
}
} | [
"private",
"function",
"functionCallParameter",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"currentType",
")",
"{",
"case",
"'&'",
":",
"return",
"$",
"this",
"->",
"writeVariable",
"(",
")",
";",
"case",
"T_ELLIPSIS",
":",
"$",
"node",
"=",
"new",... | Parse function call parameter.
@return Node | [
"Parse",
"function",
"call",
"parameter",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2123-L2135 | train |
grom358/pharborist | src/Parser.php | Parser.arrayDeference | private function arrayDeference(Node $node) {
while ($this->currentType === '[') {
$n = $node;
$node = new ArrayLookupNode();
$node->addChild($n, 'array');
$this->dimOffset($node);
}
return $node;
} | php | private function arrayDeference(Node $node) {
while ($this->currentType === '[') {
$n = $node;
$node = new ArrayLookupNode();
$node->addChild($n, 'array');
$this->dimOffset($node);
}
return $node;
} | [
"private",
"function",
"arrayDeference",
"(",
"Node",
"$",
"node",
")",
"{",
"while",
"(",
"$",
"this",
"->",
"currentType",
"===",
"'['",
")",
"{",
"$",
"n",
"=",
"$",
"node",
";",
"$",
"node",
"=",
"new",
"ArrayLookupNode",
"(",
")",
";",
"$",
"n... | Apply any array deference to operand.
@param Node $node
@return Node | [
"Apply",
"any",
"array",
"deference",
"to",
"operand",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2142-L2150 | train |
grom358/pharborist | src/Parser.php | Parser.functionDeclaration | private function functionDeclaration() {
$node = new FunctionDeclarationNode();
$this->matchDocComment($node);
$this->mustMatch(T_FUNCTION, $node);
$this->tryMatch('&', $node, 'reference');
$name_node = new NameNode();
$this->mustMatch(T_STRING, $name_node, NULL, TRUE);
$node->addChild($name_node, 'name');
$this->parameterList($node);
$this->matchHidden($node);
$this->body($node);
return $node;
} | php | private function functionDeclaration() {
$node = new FunctionDeclarationNode();
$this->matchDocComment($node);
$this->mustMatch(T_FUNCTION, $node);
$this->tryMatch('&', $node, 'reference');
$name_node = new NameNode();
$this->mustMatch(T_STRING, $name_node, NULL, TRUE);
$node->addChild($name_node, 'name');
$this->parameterList($node);
$this->matchHidden($node);
$this->body($node);
return $node;
} | [
"private",
"function",
"functionDeclaration",
"(",
")",
"{",
"$",
"node",
"=",
"new",
"FunctionDeclarationNode",
"(",
")",
";",
"$",
"this",
"->",
"matchDocComment",
"(",
"$",
"node",
")",
";",
"$",
"this",
"->",
"mustMatch",
"(",
"T_FUNCTION",
",",
"$",
... | Parse function declaration.
@return FunctionDeclarationNode | [
"Parse",
"function",
"declaration",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2156-L2168 | train |
grom358/pharborist | src/Parser.php | Parser.parameterList | private function parameterList(ParentNode $parent) {
$node = new CommaListNode();
$this->mustMatch('(', $parent, 'openParen');
$parent->addChild($node, 'parameters');
if ($this->tryMatch(')', $parent, 'closeParen', TRUE)) {
return;
}
do {
$node->addChild($this->parameter());
} while ($this->tryMatch(',', $node));
$this->mustMatch(')', $parent, 'closeParen', TRUE);
} | php | private function parameterList(ParentNode $parent) {
$node = new CommaListNode();
$this->mustMatch('(', $parent, 'openParen');
$parent->addChild($node, 'parameters');
if ($this->tryMatch(')', $parent, 'closeParen', TRUE)) {
return;
}
do {
$node->addChild($this->parameter());
} while ($this->tryMatch(',', $node));
$this->mustMatch(')', $parent, 'closeParen', TRUE);
} | [
"private",
"function",
"parameterList",
"(",
"ParentNode",
"$",
"parent",
")",
"{",
"$",
"node",
"=",
"new",
"CommaListNode",
"(",
")",
";",
"$",
"this",
"->",
"mustMatch",
"(",
"'('",
",",
"$",
"parent",
",",
"'openParen'",
")",
";",
"$",
"parent",
"-... | Parse parameter list.
@param ParentNode $parent | [
"Parse",
"parameter",
"list",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2174-L2185 | train |
grom358/pharborist | src/Parser.php | Parser.parameter | private function parameter() {
$node = new ParameterNode();
if ($type = $this->optionalTypeHint()) {
$node->addChild($type, 'typeHint');
}
$this->tryMatch('&', $node, 'reference');
$this->tryMatch(T_ELLIPSIS, $node, 'variadic');
$this->mustMatch(T_VARIABLE, $node, 'name', TRUE);
if ($this->tryMatch('=', $node)) {
$node->addChild($this->staticScalar(), 'value');
}
return $node;
} | php | private function parameter() {
$node = new ParameterNode();
if ($type = $this->optionalTypeHint()) {
$node->addChild($type, 'typeHint');
}
$this->tryMatch('&', $node, 'reference');
$this->tryMatch(T_ELLIPSIS, $node, 'variadic');
$this->mustMatch(T_VARIABLE, $node, 'name', TRUE);
if ($this->tryMatch('=', $node)) {
$node->addChild($this->staticScalar(), 'value');
}
return $node;
} | [
"private",
"function",
"parameter",
"(",
")",
"{",
"$",
"node",
"=",
"new",
"ParameterNode",
"(",
")",
";",
"if",
"(",
"$",
"type",
"=",
"$",
"this",
"->",
"optionalTypeHint",
"(",
")",
")",
"{",
"$",
"node",
"->",
"addChild",
"(",
"$",
"type",
","... | Parse parameter.
@return ParameterNode | [
"Parse",
"parameter",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2191-L2203 | train |
grom358/pharborist | src/Parser.php | Parser.optionalTypeHint | private function optionalTypeHint() {
static $array_callable_types = [T_ARRAY, T_CALLABLE];
$node = NULL;
if ($node = $this->tryMatchToken($array_callable_types)) {
return $node;
}
elseif (in_array($this->currentType, self::$namespacePathTypes)) {
return $this->name();
}
return NULL;
} | php | private function optionalTypeHint() {
static $array_callable_types = [T_ARRAY, T_CALLABLE];
$node = NULL;
if ($node = $this->tryMatchToken($array_callable_types)) {
return $node;
}
elseif (in_array($this->currentType, self::$namespacePathTypes)) {
return $this->name();
}
return NULL;
} | [
"private",
"function",
"optionalTypeHint",
"(",
")",
"{",
"static",
"$",
"array_callable_types",
"=",
"[",
"T_ARRAY",
",",
"T_CALLABLE",
"]",
";",
"$",
"node",
"=",
"NULL",
";",
"if",
"(",
"$",
"node",
"=",
"$",
"this",
"->",
"tryMatchToken",
"(",
"$",
... | Parse optional class type for parameter.
@return Node | [
"Parse",
"optional",
"class",
"type",
"for",
"parameter",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2209-L2219 | train |
grom358/pharborist | src/Parser.php | Parser.innerStatementList | private function innerStatementList(StatementBlockNode $parent, $terminator) {
while ($this->currentType !== NULL && $this->currentType !== $terminator) {
$this->matchHidden($parent);
$parent->addChild($this->innerStatement());
}
} | php | private function innerStatementList(StatementBlockNode $parent, $terminator) {
while ($this->currentType !== NULL && $this->currentType !== $terminator) {
$this->matchHidden($parent);
$parent->addChild($this->innerStatement());
}
} | [
"private",
"function",
"innerStatementList",
"(",
"StatementBlockNode",
"$",
"parent",
",",
"$",
"terminator",
")",
"{",
"while",
"(",
"$",
"this",
"->",
"currentType",
"!==",
"NULL",
"&&",
"$",
"this",
"->",
"currentType",
"!==",
"$",
"terminator",
")",
"{"... | Parse inner statement list.
@param StatementBlockNode $parent Node to append statements to
@param int|string $terminator Token type that terminates the statement list | [
"Parse",
"inner",
"statement",
"list",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2236-L2241 | train |
grom358/pharborist | src/Parser.php | Parser.innerStatementBlock | private function innerStatementBlock() {
$node = new StatementBlockNode();
$this->mustMatch('{', $node, NULL, FALSE, TRUE);
$this->innerStatementList($node, '}');
$this->mustMatch('}', $node, NULL, TRUE, TRUE);
return $node;
} | php | private function innerStatementBlock() {
$node = new StatementBlockNode();
$this->mustMatch('{', $node, NULL, FALSE, TRUE);
$this->innerStatementList($node, '}');
$this->mustMatch('}', $node, NULL, TRUE, TRUE);
return $node;
} | [
"private",
"function",
"innerStatementBlock",
"(",
")",
"{",
"$",
"node",
"=",
"new",
"StatementBlockNode",
"(",
")",
";",
"$",
"this",
"->",
"mustMatch",
"(",
"'{'",
",",
"$",
"node",
",",
"NULL",
",",
"FALSE",
",",
"TRUE",
")",
";",
"$",
"this",
"-... | Parse inner statement block.
@return Node | [
"Parse",
"inner",
"statement",
"block",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2247-L2253 | train |
grom358/pharborist | src/Parser.php | Parser.innerStatement | private function innerStatement() {
switch ($this->currentType) {
case T_HALT_COMPILER:
throw new ParserException(
$this->filename,
$this->iterator->getLineNumber(),
$this->iterator->getColumnNumber(),
"__halt_compiler can only be used from the outermost scope");
case T_ABSTRACT:
case T_FINAL:
case T_CLASS:
return $this->classDeclaration();
case T_INTERFACE:
return $this->interfaceDeclaration();
case T_TRAIT:
return $this->traitDeclaration();
default:
if ($this->currentType === T_FUNCTION && $this->isLookAhead(T_STRING, '&')) {
return $this->functionDeclaration();
}
return $this->statement();
}
} | php | private function innerStatement() {
switch ($this->currentType) {
case T_HALT_COMPILER:
throw new ParserException(
$this->filename,
$this->iterator->getLineNumber(),
$this->iterator->getColumnNumber(),
"__halt_compiler can only be used from the outermost scope");
case T_ABSTRACT:
case T_FINAL:
case T_CLASS:
return $this->classDeclaration();
case T_INTERFACE:
return $this->interfaceDeclaration();
case T_TRAIT:
return $this->traitDeclaration();
default:
if ($this->currentType === T_FUNCTION && $this->isLookAhead(T_STRING, '&')) {
return $this->functionDeclaration();
}
return $this->statement();
}
} | [
"private",
"function",
"innerStatement",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"currentType",
")",
"{",
"case",
"T_HALT_COMPILER",
":",
"throw",
"new",
"ParserException",
"(",
"$",
"this",
"->",
"filename",
",",
"$",
"this",
"->",
"iterator",
"-... | Parse an inner statement.
@return Node
@throws ParserException | [
"Parse",
"an",
"inner",
"statement",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2271-L2293 | train |
grom358/pharborist | src/Parser.php | Parser.name | private function name() {
$node = new NameNode();
if ($this->tryMatch(T_NAMESPACE, $node)) {
$this->mustMatch(T_NS_SEPARATOR, $node);
}
elseif ($this->tryMatch(T_NS_SEPARATOR, $node)) {
// Absolute path
}
$this->mustMatch(T_STRING, $node, NULL, TRUE);
while ($this->tryMatch(T_NS_SEPARATOR, $node)) {
$this->mustMatch(T_STRING, $node, NULL, TRUE);
}
return $node;
} | php | private function name() {
$node = new NameNode();
if ($this->tryMatch(T_NAMESPACE, $node)) {
$this->mustMatch(T_NS_SEPARATOR, $node);
}
elseif ($this->tryMatch(T_NS_SEPARATOR, $node)) {
// Absolute path
}
$this->mustMatch(T_STRING, $node, NULL, TRUE);
while ($this->tryMatch(T_NS_SEPARATOR, $node)) {
$this->mustMatch(T_STRING, $node, NULL, TRUE);
}
return $node;
} | [
"private",
"function",
"name",
"(",
")",
"{",
"$",
"node",
"=",
"new",
"NameNode",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"tryMatch",
"(",
"T_NAMESPACE",
",",
"$",
"node",
")",
")",
"{",
"$",
"this",
"->",
"mustMatch",
"(",
"T_NS_SEPARATOR",
... | Parse a namespace path.
@return NameNode | [
"Parse",
"a",
"namespace",
"path",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2299-L2312 | train |
grom358/pharborist | src/Parser.php | Parser._namespace | private function _namespace() {
$node = new NamespaceNode();
$this->matchDocComment($node);
$this->mustMatch(T_NAMESPACE, $node);
if ($this->currentType === T_STRING) {
$name = $this->namespaceName();
$node->addChild($name, 'name');
}
$this->matchHidden($node);
$body = new StatementBlockNode();
if ($this->tryMatch('{', $body)) {
$this->topStatementList($body, '}');
$this->mustMatch('}', $body);
$node->addChild($body, 'body');
}
else {
$this->endStatement($node);
$this->matchHidden($node);
$node->addChild($this->namespaceBlock(), 'body');
}
return $node;
} | php | private function _namespace() {
$node = new NamespaceNode();
$this->matchDocComment($node);
$this->mustMatch(T_NAMESPACE, $node);
if ($this->currentType === T_STRING) {
$name = $this->namespaceName();
$node->addChild($name, 'name');
}
$this->matchHidden($node);
$body = new StatementBlockNode();
if ($this->tryMatch('{', $body)) {
$this->topStatementList($body, '}');
$this->mustMatch('}', $body);
$node->addChild($body, 'body');
}
else {
$this->endStatement($node);
$this->matchHidden($node);
$node->addChild($this->namespaceBlock(), 'body');
}
return $node;
} | [
"private",
"function",
"_namespace",
"(",
")",
"{",
"$",
"node",
"=",
"new",
"NamespaceNode",
"(",
")",
";",
"$",
"this",
"->",
"matchDocComment",
"(",
"$",
"node",
")",
";",
"$",
"this",
"->",
"mustMatch",
"(",
"T_NAMESPACE",
",",
"$",
"node",
")",
... | Parse a namespace declaration.
@return NamespaceNode | [
"Parse",
"a",
"namespace",
"declaration",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2318-L2339 | train |
grom358/pharborist | src/Parser.php | Parser.namespaceBlock | private function namespaceBlock() {
$node = new StatementBlockNode();
$this->matchHidden($node);
while ($this->currentType !== NULL) {
if ($this->currentType === T_NAMESPACE && !$this->isLookAhead(T_NS_SEPARATOR)) {
break;
}
$node->addChild($this->topStatement());
$this->matchHidden($node);
}
$this->matchHidden($node);
return $node;
} | php | private function namespaceBlock() {
$node = new StatementBlockNode();
$this->matchHidden($node);
while ($this->currentType !== NULL) {
if ($this->currentType === T_NAMESPACE && !$this->isLookAhead(T_NS_SEPARATOR)) {
break;
}
$node->addChild($this->topStatement());
$this->matchHidden($node);
}
$this->matchHidden($node);
return $node;
} | [
"private",
"function",
"namespaceBlock",
"(",
")",
"{",
"$",
"node",
"=",
"new",
"StatementBlockNode",
"(",
")",
";",
"$",
"this",
"->",
"matchHidden",
"(",
"$",
"node",
")",
";",
"while",
"(",
"$",
"this",
"->",
"currentType",
"!==",
"NULL",
")",
"{",... | Parse a list of top level namespace statements.
@return StatementBlockNode | [
"Parse",
"a",
"list",
"of",
"top",
"level",
"namespace",
"statements",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2345-L2357 | train |
grom358/pharborist | src/Parser.php | Parser.namespaceName | private function namespaceName() {
$node = new NameNode();
$this->mustMatch(T_STRING, $node, NULL, TRUE);
while ($this->tryMatch(T_NS_SEPARATOR, $node)) {
$this->mustMatch(T_STRING, $node, NULL, TRUE);
}
return $node;
} | php | private function namespaceName() {
$node = new NameNode();
$this->mustMatch(T_STRING, $node, NULL, TRUE);
while ($this->tryMatch(T_NS_SEPARATOR, $node)) {
$this->mustMatch(T_STRING, $node, NULL, TRUE);
}
return $node;
} | [
"private",
"function",
"namespaceName",
"(",
")",
"{",
"$",
"node",
"=",
"new",
"NameNode",
"(",
")",
";",
"$",
"this",
"->",
"mustMatch",
"(",
"T_STRING",
",",
"$",
"node",
",",
"NULL",
",",
"TRUE",
")",
";",
"while",
"(",
"$",
"this",
"->",
"tryM... | Parse a namespace name.
@return NameNode | [
"Parse",
"a",
"namespace",
"name",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2363-L2370 | train |
grom358/pharborist | src/Parser.php | Parser.useBlock | private function useBlock() {
$node = new UseDeclarationBlockNode();
$node->addChild($this->_use());
while ($this->currentType === T_USE) {
$this->matchHidden($node);
$node->addChild($this->_use());
}
return $node;
} | php | private function useBlock() {
$node = new UseDeclarationBlockNode();
$node->addChild($this->_use());
while ($this->currentType === T_USE) {
$this->matchHidden($node);
$node->addChild($this->_use());
}
return $node;
} | [
"private",
"function",
"useBlock",
"(",
")",
"{",
"$",
"node",
"=",
"new",
"UseDeclarationBlockNode",
"(",
")",
";",
"$",
"node",
"->",
"addChild",
"(",
"$",
"this",
"->",
"_use",
"(",
")",
")",
";",
"while",
"(",
"$",
"this",
"->",
"currentType",
"=... | Parse a block of use declaration statements.
@return UseDeclarationBlockNode | [
"Parse",
"a",
"block",
"of",
"use",
"declaration",
"statements",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2376-L2384 | train |
grom358/pharborist | src/Parser.php | Parser._use | private function _use() {
$node = new UseDeclarationStatementNode();
$this->mustMatch(T_USE, $node);
$this->tryMatch(T_FUNCTION, $node, 'useFunction') || $this->tryMatch(T_CONST, $node, 'useConst');
$declarations = new CommaListNode();
do {
$declarations->addChild($this->useDeclaration());
} while ($this->tryMatch(',', $declarations));
$node->addChild($declarations, 'declarations');
$this->endStatement($node);
return $node;
} | php | private function _use() {
$node = new UseDeclarationStatementNode();
$this->mustMatch(T_USE, $node);
$this->tryMatch(T_FUNCTION, $node, 'useFunction') || $this->tryMatch(T_CONST, $node, 'useConst');
$declarations = new CommaListNode();
do {
$declarations->addChild($this->useDeclaration());
} while ($this->tryMatch(',', $declarations));
$node->addChild($declarations, 'declarations');
$this->endStatement($node);
return $node;
} | [
"private",
"function",
"_use",
"(",
")",
"{",
"$",
"node",
"=",
"new",
"UseDeclarationStatementNode",
"(",
")",
";",
"$",
"this",
"->",
"mustMatch",
"(",
"T_USE",
",",
"$",
"node",
")",
";",
"$",
"this",
"->",
"tryMatch",
"(",
"T_FUNCTION",
",",
"$",
... | Parse a use declaration list.
@return UseDeclarationStatementNode | [
"Parse",
"a",
"use",
"declaration",
"list",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2390-L2401 | train |
grom358/pharborist | src/Parser.php | Parser.useDeclaration | private function useDeclaration() {
$declaration = new UseDeclarationNode();
$node = new NameNode();
$this->tryMatch(T_NS_SEPARATOR, $node);
$this->mustMatch(T_STRING, $node, NULL, TRUE)->getText();
while ($this->tryMatch(T_NS_SEPARATOR, $node)) {
$this->mustMatch(T_STRING, $node, NULL, TRUE)->getText();
}
$declaration->addChild($node, 'name');
if ($this->tryMatch(T_AS, $declaration)) {
$this->mustMatch(T_STRING, $declaration, 'alias', TRUE)->getText();
}
return $declaration;
} | php | private function useDeclaration() {
$declaration = new UseDeclarationNode();
$node = new NameNode();
$this->tryMatch(T_NS_SEPARATOR, $node);
$this->mustMatch(T_STRING, $node, NULL, TRUE)->getText();
while ($this->tryMatch(T_NS_SEPARATOR, $node)) {
$this->mustMatch(T_STRING, $node, NULL, TRUE)->getText();
}
$declaration->addChild($node, 'name');
if ($this->tryMatch(T_AS, $declaration)) {
$this->mustMatch(T_STRING, $declaration, 'alias', TRUE)->getText();
}
return $declaration;
} | [
"private",
"function",
"useDeclaration",
"(",
")",
"{",
"$",
"declaration",
"=",
"new",
"UseDeclarationNode",
"(",
")",
";",
"$",
"node",
"=",
"new",
"NameNode",
"(",
")",
";",
"$",
"this",
"->",
"tryMatch",
"(",
"T_NS_SEPARATOR",
",",
"$",
"node",
")",
... | Parse a use declaration.
@return UseDeclarationNode | [
"Parse",
"a",
"use",
"declaration",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2407-L2420 | train |
grom358/pharborist | src/Parser.php | Parser.classDeclaration | private function classDeclaration() {
$node = new ClassNode();
$this->matchDocComment($node);
$this->tryMatch(T_ABSTRACT, $node, 'abstract') || $this->tryMatch(T_FINAL, $node, 'final');
$this->mustMatch(T_CLASS, $node);
$name_node = new NameNode();
$this->mustMatch(T_STRING, $name_node, NULL, TRUE);
$node->addChild($name_node, 'name');
if ($this->tryMatch(T_EXTENDS, $node)) {
$node->addChild($this->name(), 'extends');
}
if ($this->tryMatch(T_IMPLEMENTS, $node)) {
$implements = new CommaListNode();
do {
$implements->addChild($this->name());
} while ($this->tryMatch(',', $implements));
$node->addChild($implements, 'implements');
}
$this->matchHidden($node);
$statement_block = new StatementBlockNode();
$this->mustMatch('{', $statement_block, NULL, FALSE, TRUE);
$is_abstract = $node->getAbstract() !== NULL;
while ($this->currentType !== NULL && $this->currentType !== '}') {
$this->matchHidden($statement_block);
$statement_block->addChild($this->classStatement($is_abstract));
}
$this->mustMatch('}', $statement_block, NULL, TRUE, TRUE);
$node->addChild($statement_block, 'statements');
return $node;
} | php | private function classDeclaration() {
$node = new ClassNode();
$this->matchDocComment($node);
$this->tryMatch(T_ABSTRACT, $node, 'abstract') || $this->tryMatch(T_FINAL, $node, 'final');
$this->mustMatch(T_CLASS, $node);
$name_node = new NameNode();
$this->mustMatch(T_STRING, $name_node, NULL, TRUE);
$node->addChild($name_node, 'name');
if ($this->tryMatch(T_EXTENDS, $node)) {
$node->addChild($this->name(), 'extends');
}
if ($this->tryMatch(T_IMPLEMENTS, $node)) {
$implements = new CommaListNode();
do {
$implements->addChild($this->name());
} while ($this->tryMatch(',', $implements));
$node->addChild($implements, 'implements');
}
$this->matchHidden($node);
$statement_block = new StatementBlockNode();
$this->mustMatch('{', $statement_block, NULL, FALSE, TRUE);
$is_abstract = $node->getAbstract() !== NULL;
while ($this->currentType !== NULL && $this->currentType !== '}') {
$this->matchHidden($statement_block);
$statement_block->addChild($this->classStatement($is_abstract));
}
$this->mustMatch('}', $statement_block, NULL, TRUE, TRUE);
$node->addChild($statement_block, 'statements');
return $node;
} | [
"private",
"function",
"classDeclaration",
"(",
")",
"{",
"$",
"node",
"=",
"new",
"ClassNode",
"(",
")",
";",
"$",
"this",
"->",
"matchDocComment",
"(",
"$",
"node",
")",
";",
"$",
"this",
"->",
"tryMatch",
"(",
"T_ABSTRACT",
",",
"$",
"node",
",",
... | Parse a class declaration.
@return ClassNode | [
"Parse",
"a",
"class",
"declaration",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2426-L2455 | train |
grom358/pharborist | src/Parser.php | Parser.classMemberList | private function classMemberList($doc_comment, ModifiersNode $modifiers) {
// Modifier checks
if ($modifiers->getAbstract()) {
throw new ParserException(
$this->filename,
$this->iterator->getLineNumber(),
$this->iterator->getColumnNumber(),
"members can not be declared abstract");
}
if ($modifiers->getFinal()) {
throw new ParserException(
$this->filename,
$this->iterator->getLineNumber(),
$this->iterator->getColumnNumber(),
"members can not be declared final");
}
$node = new ClassMemberListNode();
$node->mergeNode($doc_comment);
$node->mergeNode($modifiers);
$members = new CommaListNode();
do {
$members->addChild($this->classMember());
} while ($this->tryMatch(',', $members));
$node->addChild($members, 'members');
$this->endStatement($node);
return $node;
} | php | private function classMemberList($doc_comment, ModifiersNode $modifiers) {
// Modifier checks
if ($modifiers->getAbstract()) {
throw new ParserException(
$this->filename,
$this->iterator->getLineNumber(),
$this->iterator->getColumnNumber(),
"members can not be declared abstract");
}
if ($modifiers->getFinal()) {
throw new ParserException(
$this->filename,
$this->iterator->getLineNumber(),
$this->iterator->getColumnNumber(),
"members can not be declared final");
}
$node = new ClassMemberListNode();
$node->mergeNode($doc_comment);
$node->mergeNode($modifiers);
$members = new CommaListNode();
do {
$members->addChild($this->classMember());
} while ($this->tryMatch(',', $members));
$node->addChild($members, 'members');
$this->endStatement($node);
return $node;
} | [
"private",
"function",
"classMemberList",
"(",
"$",
"doc_comment",
",",
"ModifiersNode",
"$",
"modifiers",
")",
"{",
"// Modifier checks",
"if",
"(",
"$",
"modifiers",
"->",
"getAbstract",
"(",
")",
")",
"{",
"throw",
"new",
"ParserException",
"(",
"$",
"this"... | Parse a class member list.
@param PartialNode|null $doc_comment DocBlock associated with method
@param ModifiersNode $modifiers Member modifiers
@return ClassMemberListNode
@throws ParserException | [
"Parse",
"a",
"class",
"member",
"list",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2579-L2605 | train |
grom358/pharborist | src/Parser.php | Parser.classMember | private function classMember() {
$node = new ClassMemberNode();
$this->mustMatch(T_VARIABLE, $node, 'name', TRUE);
if ($this->tryMatch('=', $node)) {
$node->addChild($this->staticScalar(), 'value');
}
return $node;
} | php | private function classMember() {
$node = new ClassMemberNode();
$this->mustMatch(T_VARIABLE, $node, 'name', TRUE);
if ($this->tryMatch('=', $node)) {
$node->addChild($this->staticScalar(), 'value');
}
return $node;
} | [
"private",
"function",
"classMember",
"(",
")",
"{",
"$",
"node",
"=",
"new",
"ClassMemberNode",
"(",
")",
";",
"$",
"this",
"->",
"mustMatch",
"(",
"T_VARIABLE",
",",
"$",
"node",
",",
"'name'",
",",
"TRUE",
")",
";",
"if",
"(",
"$",
"this",
"->",
... | Parse a class member.
@return ClassMemberNode | [
"Parse",
"a",
"class",
"member",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2611-L2618 | train |
grom358/pharborist | src/Parser.php | Parser.classMethod | private function classMethod($doc_comment, ModifiersNode $modifiers) {
$node = new ClassMethodNode();
$node->mergeNode($doc_comment);
$node->mergeNode($modifiers);
$this->mustMatch(T_FUNCTION, $node);
$this->tryMatch('&', $node, 'reference');
$this->mustMatch(T_STRING, $node, 'name');
$this->parameterList($node);
if ($modifiers->getAbstract()) {
$this->endStatement($node);
return $node;
}
$this->matchHidden($node);
$this->body($node);
return $node;
} | php | private function classMethod($doc_comment, ModifiersNode $modifiers) {
$node = new ClassMethodNode();
$node->mergeNode($doc_comment);
$node->mergeNode($modifiers);
$this->mustMatch(T_FUNCTION, $node);
$this->tryMatch('&', $node, 'reference');
$this->mustMatch(T_STRING, $node, 'name');
$this->parameterList($node);
if ($modifiers->getAbstract()) {
$this->endStatement($node);
return $node;
}
$this->matchHidden($node);
$this->body($node);
return $node;
} | [
"private",
"function",
"classMethod",
"(",
"$",
"doc_comment",
",",
"ModifiersNode",
"$",
"modifiers",
")",
"{",
"$",
"node",
"=",
"new",
"ClassMethodNode",
"(",
")",
";",
"$",
"node",
"->",
"mergeNode",
"(",
"$",
"doc_comment",
")",
";",
"$",
"node",
"-... | Parse a class method
@param PartialNode|null $doc_comment DocBlock associated with method
@param ModifiersNode $modifiers Method modifiers
@return ClassMethodNode | [
"Parse",
"a",
"class",
"method"
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2626-L2641 | train |
grom358/pharborist | src/Parser.php | Parser.traitUse | private function traitUse() {
$node = new TraitUseNode();
$this->mustMatch(T_USE, $node);
// trait_list
$traits = new CommaListNode();
do {
$traits->addChild($this->name());
} while ($this->tryMatch(',', $traits));
$node->addChild($traits, 'traits');
// trait_adaptations
if ($this->tryMatch('{', $node)) {
$adaptations = new StatementBlockNode();
while ($this->currentType !== NULL && $this->currentType !== '}') {
$adaptations->addChild($this->traitAdaptation());
$this->matchHidden($adaptations);
}
$node->addChild($adaptations, 'adaptations');
$this->mustMatch('}', $node, NULL, TRUE, TRUE);
return $node;
}
$this->endStatement($node);
return $node;
} | php | private function traitUse() {
$node = new TraitUseNode();
$this->mustMatch(T_USE, $node);
// trait_list
$traits = new CommaListNode();
do {
$traits->addChild($this->name());
} while ($this->tryMatch(',', $traits));
$node->addChild($traits, 'traits');
// trait_adaptations
if ($this->tryMatch('{', $node)) {
$adaptations = new StatementBlockNode();
while ($this->currentType !== NULL && $this->currentType !== '}') {
$adaptations->addChild($this->traitAdaptation());
$this->matchHidden($adaptations);
}
$node->addChild($adaptations, 'adaptations');
$this->mustMatch('}', $node, NULL, TRUE, TRUE);
return $node;
}
$this->endStatement($node);
return $node;
} | [
"private",
"function",
"traitUse",
"(",
")",
"{",
"$",
"node",
"=",
"new",
"TraitUseNode",
"(",
")",
";",
"$",
"this",
"->",
"mustMatch",
"(",
"T_USE",
",",
"$",
"node",
")",
";",
"// trait_list",
"$",
"traits",
"=",
"new",
"CommaListNode",
"(",
")",
... | Parse a trait use statement.
@return TraitUseNode | [
"Parse",
"a",
"trait",
"use",
"statement",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2647-L2669 | train |
grom358/pharborist | src/Parser.php | Parser.traitAdaptation | private function traitAdaptation() {
/** @var NameNode $qualified_name */
$qualified_name = $this->name();
if ($qualified_name->childCount() === 1 && $this->currentType !== T_DOUBLE_COLON) {
return $this->traitAlias($qualified_name);
}
$node = new TraitMethodReferenceNode();
$node->addChild($qualified_name, 'traitName');
$this->mustMatch(T_DOUBLE_COLON, $node);
$this->mustMatch(T_STRING, $node, 'methodReference', TRUE);
if ($this->currentType === T_AS) {
return $this->traitAlias($node);
}
$method_reference_node = $node;
$node = new TraitPrecedenceNode();
$node->addChild($method_reference_node, 'traitMethodReference');
$this->mustMatch(T_INSTEADOF, $node);
$trait_names = new CommaListNode();
do {
$trait_names->addChild($this->name());
} while ($this->tryMatch(',', $trait_names));
$node->addChild($trait_names, 'traitNames');
$this->endStatement($node);
return $node;
} | php | private function traitAdaptation() {
/** @var NameNode $qualified_name */
$qualified_name = $this->name();
if ($qualified_name->childCount() === 1 && $this->currentType !== T_DOUBLE_COLON) {
return $this->traitAlias($qualified_name);
}
$node = new TraitMethodReferenceNode();
$node->addChild($qualified_name, 'traitName');
$this->mustMatch(T_DOUBLE_COLON, $node);
$this->mustMatch(T_STRING, $node, 'methodReference', TRUE);
if ($this->currentType === T_AS) {
return $this->traitAlias($node);
}
$method_reference_node = $node;
$node = new TraitPrecedenceNode();
$node->addChild($method_reference_node, 'traitMethodReference');
$this->mustMatch(T_INSTEADOF, $node);
$trait_names = new CommaListNode();
do {
$trait_names->addChild($this->name());
} while ($this->tryMatch(',', $trait_names));
$node->addChild($trait_names, 'traitNames');
$this->endStatement($node);
return $node;
} | [
"private",
"function",
"traitAdaptation",
"(",
")",
"{",
"/** @var NameNode $qualified_name */",
"$",
"qualified_name",
"=",
"$",
"this",
"->",
"name",
"(",
")",
";",
"if",
"(",
"$",
"qualified_name",
"->",
"childCount",
"(",
")",
"===",
"1",
"&&",
"$",
"thi... | Parse a trait adaptation statement.
@return Node | [
"Parse",
"a",
"trait",
"adaptation",
"statement",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2675-L2699 | train |
grom358/pharborist | src/Parser.php | Parser.traitAlias | private function traitAlias($trait_method_reference) {
$node = new TraitAliasNode();
$node->addChild($trait_method_reference, 'traitMethodReference');
$this->mustMatch(T_AS, $node);
if ($trait_modifier = $this->tryMatchToken(self::$visibilityTypes)) {
$node->addChild($trait_modifier, 'visibility');
$this->tryMatch(T_STRING, $node, 'alias');
$this->endStatement($node);
return $node;
}
$this->mustMatch(T_STRING, $node, 'alias');
$this->endStatement($node);
return $node;
} | php | private function traitAlias($trait_method_reference) {
$node = new TraitAliasNode();
$node->addChild($trait_method_reference, 'traitMethodReference');
$this->mustMatch(T_AS, $node);
if ($trait_modifier = $this->tryMatchToken(self::$visibilityTypes)) {
$node->addChild($trait_modifier, 'visibility');
$this->tryMatch(T_STRING, $node, 'alias');
$this->endStatement($node);
return $node;
}
$this->mustMatch(T_STRING, $node, 'alias');
$this->endStatement($node);
return $node;
} | [
"private",
"function",
"traitAlias",
"(",
"$",
"trait_method_reference",
")",
"{",
"$",
"node",
"=",
"new",
"TraitAliasNode",
"(",
")",
";",
"$",
"node",
"->",
"addChild",
"(",
"$",
"trait_method_reference",
",",
"'traitMethodReference'",
")",
";",
"$",
"this"... | Parse a trait alias.
@param TraitMethodReferenceNode|NameNode $trait_method_reference
@return TraitAliasNode | [
"Parse",
"a",
"trait",
"alias",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2706-L2719 | train |
grom358/pharborist | src/Parser.php | Parser.interfaceDeclaration | private function interfaceDeclaration() {
$node = new InterfaceNode();
$this->matchDocComment($node);
$this->mustMatch(T_INTERFACE, $node);
$name_node = new NameNode();
$this->mustMatch(T_STRING, $name_node, NULL, TRUE);
$node->addChild($name_node, 'name');
if ($this->tryMatch(T_EXTENDS, $node)) {
$extends = new CommaListNode();
do {
$extends->addChild($this->name());
} while ($this->tryMatch(',', $extends));
$node->addChild($extends, 'extends');
}
$this->matchHidden($node);
$statement_block = new StatementBlockNode();
$this->mustMatch('{', $statement_block, NULL, FALSE, TRUE);
while ($this->currentType !== NULL && $this->currentType !== '}') {
$this->matchHidden($statement_block);
if ($this->currentType === T_CONST) {
$statement_block->addChild($this->_const());
}
else {
$statement_block->addChild($this->interfaceMethod());
}
}
$this->mustMatch('}', $statement_block, NULL, TRUE, TRUE);
$node->addChild($statement_block, 'statements');
return $node;
} | php | private function interfaceDeclaration() {
$node = new InterfaceNode();
$this->matchDocComment($node);
$this->mustMatch(T_INTERFACE, $node);
$name_node = new NameNode();
$this->mustMatch(T_STRING, $name_node, NULL, TRUE);
$node->addChild($name_node, 'name');
if ($this->tryMatch(T_EXTENDS, $node)) {
$extends = new CommaListNode();
do {
$extends->addChild($this->name());
} while ($this->tryMatch(',', $extends));
$node->addChild($extends, 'extends');
}
$this->matchHidden($node);
$statement_block = new StatementBlockNode();
$this->mustMatch('{', $statement_block, NULL, FALSE, TRUE);
while ($this->currentType !== NULL && $this->currentType !== '}') {
$this->matchHidden($statement_block);
if ($this->currentType === T_CONST) {
$statement_block->addChild($this->_const());
}
else {
$statement_block->addChild($this->interfaceMethod());
}
}
$this->mustMatch('}', $statement_block, NULL, TRUE, TRUE);
$node->addChild($statement_block, 'statements');
return $node;
} | [
"private",
"function",
"interfaceDeclaration",
"(",
")",
"{",
"$",
"node",
"=",
"new",
"InterfaceNode",
"(",
")",
";",
"$",
"this",
"->",
"matchDocComment",
"(",
"$",
"node",
")",
";",
"$",
"this",
"->",
"mustMatch",
"(",
"T_INTERFACE",
",",
"$",
"node",... | Parse an interface declaration.
@return Node | [
"Parse",
"an",
"interface",
"declaration",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2725-L2754 | train |
grom358/pharborist | src/Parser.php | Parser.interfaceMethod | private function interfaceMethod() {
static $visibility_keyword_types = [T_PUBLIC, T_PROTECTED, T_PRIVATE];
$node = new InterfaceMethodNode();
$this->matchDocComment($node);
$is_static = $this->tryMatch(T_STATIC, $node, 'static');
while (in_array($this->currentType, $visibility_keyword_types)) {
if ($node->getVisibility()) {
throw new ParserException(
$this->filename,
$this->iterator->getLineNumber(),
$this->iterator->getColumnNumber(),
"can only have one visibility modifier on interface method."
);
}
$this->mustMatch($this->currentType, $node, 'visibility');
}
!$is_static && $this->tryMatch(T_STATIC, $node, 'static');
$this->mustMatch(T_FUNCTION, $node);
$this->tryMatch('&', $node, 'reference');
$this->mustMatch(T_STRING, $node, 'name');
$this->parameterList($node);
$this->endStatement($node);
return $node;
} | php | private function interfaceMethod() {
static $visibility_keyword_types = [T_PUBLIC, T_PROTECTED, T_PRIVATE];
$node = new InterfaceMethodNode();
$this->matchDocComment($node);
$is_static = $this->tryMatch(T_STATIC, $node, 'static');
while (in_array($this->currentType, $visibility_keyword_types)) {
if ($node->getVisibility()) {
throw new ParserException(
$this->filename,
$this->iterator->getLineNumber(),
$this->iterator->getColumnNumber(),
"can only have one visibility modifier on interface method."
);
}
$this->mustMatch($this->currentType, $node, 'visibility');
}
!$is_static && $this->tryMatch(T_STATIC, $node, 'static');
$this->mustMatch(T_FUNCTION, $node);
$this->tryMatch('&', $node, 'reference');
$this->mustMatch(T_STRING, $node, 'name');
$this->parameterList($node);
$this->endStatement($node);
return $node;
} | [
"private",
"function",
"interfaceMethod",
"(",
")",
"{",
"static",
"$",
"visibility_keyword_types",
"=",
"[",
"T_PUBLIC",
",",
"T_PROTECTED",
",",
"T_PRIVATE",
"]",
";",
"$",
"node",
"=",
"new",
"InterfaceMethodNode",
"(",
")",
";",
"$",
"this",
"->",
"match... | Parse an interface method declaration.
@return InterfaceMethodNode
@throws ParserException | [
"Parse",
"an",
"interface",
"method",
"declaration",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2761-L2784 | train |
grom358/pharborist | src/Parser.php | Parser.traitDeclaration | private function traitDeclaration() {
$node = new TraitNode();
$this->matchDocComment($node);
$this->mustMatch(T_TRAIT, $node);
$name_node = new NameNode();
$this->mustMatch(T_STRING, $name_node, NULL, TRUE);
$node->addChild($name_node, 'name');
if ($this->currentType === T_EXTENDS) {
throw new ParserException(
$this->filename,
$this->iterator->getLineNumber(),
$this->iterator->getColumnNumber(),
'Traits can only be composed from other traits with the \'use\' keyword.'
);
}
if ($this->currentType === T_IMPLEMENTS) {
throw new ParserException(
$this->filename,
$this->iterator->getLineNumber(),
$this->iterator->getColumnNumber(),
'Traits can not implement interfaces.'
);
}
$this->matchHidden($node);
$statement_block = new StatementBlockNode();
$this->mustMatch('{', $statement_block, NULL, FALSE, TRUE);
while ($this->currentType !== NULL && $this->currentType !== '}') {
$this->matchHidden($statement_block);
$statement_block->addChild($this->classStatement(TRUE));
}
$this->mustMatch('}', $statement_block, NULL, TRUE, TRUE);
$node->addChild($statement_block, 'statements');
return $node;
} | php | private function traitDeclaration() {
$node = new TraitNode();
$this->matchDocComment($node);
$this->mustMatch(T_TRAIT, $node);
$name_node = new NameNode();
$this->mustMatch(T_STRING, $name_node, NULL, TRUE);
$node->addChild($name_node, 'name');
if ($this->currentType === T_EXTENDS) {
throw new ParserException(
$this->filename,
$this->iterator->getLineNumber(),
$this->iterator->getColumnNumber(),
'Traits can only be composed from other traits with the \'use\' keyword.'
);
}
if ($this->currentType === T_IMPLEMENTS) {
throw new ParserException(
$this->filename,
$this->iterator->getLineNumber(),
$this->iterator->getColumnNumber(),
'Traits can not implement interfaces.'
);
}
$this->matchHidden($node);
$statement_block = new StatementBlockNode();
$this->mustMatch('{', $statement_block, NULL, FALSE, TRUE);
while ($this->currentType !== NULL && $this->currentType !== '}') {
$this->matchHidden($statement_block);
$statement_block->addChild($this->classStatement(TRUE));
}
$this->mustMatch('}', $statement_block, NULL, TRUE, TRUE);
$node->addChild($statement_block, 'statements');
return $node;
} | [
"private",
"function",
"traitDeclaration",
"(",
")",
"{",
"$",
"node",
"=",
"new",
"TraitNode",
"(",
")",
";",
"$",
"this",
"->",
"matchDocComment",
"(",
"$",
"node",
")",
";",
"$",
"this",
"->",
"mustMatch",
"(",
"T_TRAIT",
",",
"$",
"node",
")",
";... | Parse a trait declaration.
@return TraitNode
@throws ParserException | [
"Parse",
"a",
"trait",
"declaration",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L2791-L2824 | train |
grom358/pharborist | src/Parser.php | Parser.nextToken | private function nextToken($capture_doc_comment = FALSE) {
$this->iterator->next();
$capture_doc_comment ? $this->skipHiddenCaptureDocComment() : $this->skipHidden();
$this->current = $this->iterator->current();
if ($this->current) {
$this->currentType = $this->current->getType();
}
else {
$this->currentType = NULL;
}
} | php | private function nextToken($capture_doc_comment = FALSE) {
$this->iterator->next();
$capture_doc_comment ? $this->skipHiddenCaptureDocComment() : $this->skipHidden();
$this->current = $this->iterator->current();
if ($this->current) {
$this->currentType = $this->current->getType();
}
else {
$this->currentType = NULL;
}
} | [
"private",
"function",
"nextToken",
"(",
"$",
"capture_doc_comment",
"=",
"FALSE",
")",
"{",
"$",
"this",
"->",
"iterator",
"->",
"next",
"(",
")",
";",
"$",
"capture_doc_comment",
"?",
"$",
"this",
"->",
"skipHiddenCaptureDocComment",
"(",
")",
":",
"$",
... | Move iterator to next non hidden token.
@param bool $capture_doc_comment | [
"Move",
"iterator",
"to",
"next",
"non",
"hidden",
"token",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L3039-L3049 | train |
grom358/pharborist | src/Parser.php | Parser.isLookAhead | private function isLookAhead($expected_type, $skip_type = NULL) {
$token = NULL;
for ($offset = 1; ; $offset++) {
$token = $this->iterator->peek($offset);
if ($token === NULL) {
return FALSE;
}
if (!($token instanceof HiddenNode) && $token->getType() !== $skip_type) {
return $expected_type === $token->getType();
}
}
return FALSE;
} | php | private function isLookAhead($expected_type, $skip_type = NULL) {
$token = NULL;
for ($offset = 1; ; $offset++) {
$token = $this->iterator->peek($offset);
if ($token === NULL) {
return FALSE;
}
if (!($token instanceof HiddenNode) && $token->getType() !== $skip_type) {
return $expected_type === $token->getType();
}
}
return FALSE;
} | [
"private",
"function",
"isLookAhead",
"(",
"$",
"expected_type",
",",
"$",
"skip_type",
"=",
"NULL",
")",
"{",
"$",
"token",
"=",
"NULL",
";",
"for",
"(",
"$",
"offset",
"=",
"1",
";",
";",
"$",
"offset",
"++",
")",
"{",
"$",
"token",
"=",
"$",
"... | Look ahead from current position at tokens and check if the token at
offset is of an expected type, where the offset ignores hidden tokens.
@param int|string $expected_type Expected token type
@param int|string $skip_type (Optional) Additional token type to ignore
@return bool | [
"Look",
"ahead",
"from",
"current",
"position",
"at",
"tokens",
"and",
"check",
"if",
"the",
"token",
"at",
"offset",
"is",
"of",
"an",
"expected",
"type",
"where",
"the",
"offset",
"ignores",
"hidden",
"tokens",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Parser.php#L3058-L3070 | train |
thelia/core | lib/Thelia/Action/Content.php | Content.update | public function update(ContentUpdateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
{
if (null !== $content = ContentQuery::create()->findPk($event->getContentId())) {
$con = Propel::getWriteConnection(ContentTableMap::DATABASE_NAME);
$con->beginTransaction();
$content->setDispatcher($dispatcher);
try {
$content
->setVisible($event->getVisible())
->setLocale($event->getLocale())
->setTitle($event->getTitle())
->setDescription($event->getDescription())
->setChapo($event->getChapo())
->setPostscriptum($event->getPostscriptum())
->save($con)
;
$content->setDefaultFolder($event->getDefaultFolder());
$event->setContent($content);
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} | php | public function update(ContentUpdateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
{
if (null !== $content = ContentQuery::create()->findPk($event->getContentId())) {
$con = Propel::getWriteConnection(ContentTableMap::DATABASE_NAME);
$con->beginTransaction();
$content->setDispatcher($dispatcher);
try {
$content
->setVisible($event->getVisible())
->setLocale($event->getLocale())
->setTitle($event->getTitle())
->setDescription($event->getDescription())
->setChapo($event->getChapo())
->setPostscriptum($event->getPostscriptum())
->save($con)
;
$content->setDefaultFolder($event->getDefaultFolder());
$event->setContent($content);
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} | [
"public",
"function",
"update",
"(",
"ContentUpdateEvent",
"$",
"event",
",",
"$",
"eventName",
",",
"EventDispatcherInterface",
"$",
"dispatcher",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"content",
"=",
"ContentQuery",
"::",
"create",
"(",
")",
"->",
"find... | process update content
@param ContentUpdateEvent $event
@param $eventName
@param EventDispatcherInterface $dispatcher
@throws PropelException
@throws \Exception | [
"process",
"update",
"content"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Action/Content.php#L68-L95 | train |
thelia/core | lib/Thelia/Action/Content.php | Content.updateSeo | public function updateSeo(UpdateSeoEvent $event, $eventName, EventDispatcherInterface $dispatcher)
{
return $this->genericUpdateSeo(ContentQuery::create(), $event, $dispatcher);
} | php | public function updateSeo(UpdateSeoEvent $event, $eventName, EventDispatcherInterface $dispatcher)
{
return $this->genericUpdateSeo(ContentQuery::create(), $event, $dispatcher);
} | [
"public",
"function",
"updateSeo",
"(",
"UpdateSeoEvent",
"$",
"event",
",",
"$",
"eventName",
",",
"EventDispatcherInterface",
"$",
"dispatcher",
")",
"{",
"return",
"$",
"this",
"->",
"genericUpdateSeo",
"(",
"ContentQuery",
"::",
"create",
"(",
")",
",",
"$... | Change Content SEO
@param UpdateSeoEvent $event
@param $eventName
@param EventDispatcherInterface $dispatcher
@return Object | [
"Change",
"Content",
"SEO"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Action/Content.php#L105-L108 | train |
thelia/core | lib/Thelia/Action/Content.php | Content.viewCheck | public function viewCheck(ViewCheckEvent $event, $eventName, EventDispatcherInterface $dispatcher)
{
if ($event->getView() == 'content') {
$content = ContentQuery::create()
->filterById($event->getViewId())
->filterByVisible(1)
->count();
if ($content == 0) {
$dispatcher->dispatch(TheliaEvents::VIEW_CONTENT_ID_NOT_VISIBLE, $event);
}
}
} | php | public function viewCheck(ViewCheckEvent $event, $eventName, EventDispatcherInterface $dispatcher)
{
if ($event->getView() == 'content') {
$content = ContentQuery::create()
->filterById($event->getViewId())
->filterByVisible(1)
->count();
if ($content == 0) {
$dispatcher->dispatch(TheliaEvents::VIEW_CONTENT_ID_NOT_VISIBLE, $event);
}
}
} | [
"public",
"function",
"viewCheck",
"(",
"ViewCheckEvent",
"$",
"event",
",",
"$",
"eventName",
",",
"EventDispatcherInterface",
"$",
"dispatcher",
")",
"{",
"if",
"(",
"$",
"event",
"->",
"getView",
"(",
")",
"==",
"'content'",
")",
"{",
"$",
"content",
"=... | Check if is a content view and if content_id is visible
@param ViewCheckEvent $event
@param string $eventName
@param EventDispatcherInterface $dispatcher | [
"Check",
"if",
"is",
"a",
"content",
"view",
"and",
"if",
"content_id",
"is",
"visible"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Action/Content.php#L219-L231 | train |
thelia/core | lib/Thelia/Command/GenerateSQLCommand.php | GenerateSQLCommand.initParser | protected function initParser()
{
$this->parser->unregisterPlugin('function', 'intl');
$this->parser->registerPlugin('function', 'intl', [$this, 'translate']);
$this->parser->assign("locales", $this->locales);
} | php | protected function initParser()
{
$this->parser->unregisterPlugin('function', 'intl');
$this->parser->registerPlugin('function', 'intl', [$this, 'translate']);
$this->parser->assign("locales", $this->locales);
} | [
"protected",
"function",
"initParser",
"(",
")",
"{",
"$",
"this",
"->",
"parser",
"->",
"unregisterPlugin",
"(",
"'function'",
",",
"'intl'",
")",
";",
"$",
"this",
"->",
"parser",
"->",
"registerPlugin",
"(",
"'function'",
",",
"'intl'",
",",
"[",
"$",
... | Initialize the smarty parser.
The intl function is replaced, and locales are assigned.
@throws \SmartyException | [
"Initialize",
"the",
"smarty",
"parser",
"."
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Command/GenerateSQLCommand.php#L168-L173 | train |
thelia/core | lib/Thelia/Command/GenerateSQLCommand.php | GenerateSQLCommand.translate | public function translate($params, $smarty)
{
$translation = '';
if (empty($params["l"])) {
throw new RuntimeException('Translation Error. Key is empty.');
} elseif (empty($params["locale"])) {
throw new RuntimeException('Translation Error. Locale is empty.');
} else {
$inString = (0 !== \intval($params["in_string"]));
$useDefault = (0 !== \intval($params["use_default"]));
$translation = $this->translator->trans(
$params["l"],
[],
'install',
$params["locale"],
$useDefault
);
if (empty($translation)) {
$translation = ($inString) ? '' : "NULL";
} else {
$translation = $this->con->quote($translation);
// remove quote
if ($inString) {
$translation = substr($translation, 1, -1);
}
}
}
return $translation;
} | php | public function translate($params, $smarty)
{
$translation = '';
if (empty($params["l"])) {
throw new RuntimeException('Translation Error. Key is empty.');
} elseif (empty($params["locale"])) {
throw new RuntimeException('Translation Error. Locale is empty.');
} else {
$inString = (0 !== \intval($params["in_string"]));
$useDefault = (0 !== \intval($params["use_default"]));
$translation = $this->translator->trans(
$params["l"],
[],
'install',
$params["locale"],
$useDefault
);
if (empty($translation)) {
$translation = ($inString) ? '' : "NULL";
} else {
$translation = $this->con->quote($translation);
// remove quote
if ($inString) {
$translation = substr($translation, 1, -1);
}
}
}
return $translation;
} | [
"public",
"function",
"translate",
"(",
"$",
"params",
",",
"$",
"smarty",
")",
"{",
"$",
"translation",
"=",
"''",
";",
"if",
"(",
"empty",
"(",
"$",
"params",
"[",
"\"l\"",
"]",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Translation Er... | Smarty function that replace the classic `intl` function.
The attributes of the function are:
- `l`: the key
- `locale`: the locale. eg.: fr_FR
- `in_string`: set to 1 not add simple quote around the string. (default = 0)
- `use_default`: set to 1 to use the `l` string as a fallback. (default = 0)
@param $params
@param $smarty
@return string | [
"Smarty",
"function",
"that",
"replace",
"the",
"classic",
"intl",
"function",
"."
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Command/GenerateSQLCommand.php#L188-L220 | train |
thelia/core | lib/Thelia/Action/Import.php | Import.importChangePosition | public function importChangePosition(UpdatePositionEvent $updatePositionEvent, $eventName, EventDispatcherInterface $dispatcher)
{
$this->handler->getImport($updatePositionEvent->getObjectId(), true);
$this->genericUpdatePosition(new ImportQuery, $updatePositionEvent, $dispatcher);
} | php | public function importChangePosition(UpdatePositionEvent $updatePositionEvent, $eventName, EventDispatcherInterface $dispatcher)
{
$this->handler->getImport($updatePositionEvent->getObjectId(), true);
$this->genericUpdatePosition(new ImportQuery, $updatePositionEvent, $dispatcher);
} | [
"public",
"function",
"importChangePosition",
"(",
"UpdatePositionEvent",
"$",
"updatePositionEvent",
",",
"$",
"eventName",
",",
"EventDispatcherInterface",
"$",
"dispatcher",
")",
"{",
"$",
"this",
"->",
"handler",
"->",
"getImport",
"(",
"$",
"updatePositionEvent",... | Handle import change position event
@param UpdatePositionEvent $updatePositionEvent
@param $eventName
@param EventDispatcherInterface $dispatcher | [
"Handle",
"import",
"change",
"position",
"event"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Action/Import.php#L61-L65 | train |
thelia/core | lib/Thelia/Action/Import.php | Import.importCategoryChangePosition | public function importCategoryChangePosition(UpdatePositionEvent $updatePositionEvent, $eventName, EventDispatcherInterface $dispatcher)
{
$this->handler->getCategory($updatePositionEvent->getObjectId(), true);
$this->genericUpdatePosition(new ImportCategoryQuery, $updatePositionEvent, $dispatcher);
} | php | public function importCategoryChangePosition(UpdatePositionEvent $updatePositionEvent, $eventName, EventDispatcherInterface $dispatcher)
{
$this->handler->getCategory($updatePositionEvent->getObjectId(), true);
$this->genericUpdatePosition(new ImportCategoryQuery, $updatePositionEvent, $dispatcher);
} | [
"public",
"function",
"importCategoryChangePosition",
"(",
"UpdatePositionEvent",
"$",
"updatePositionEvent",
",",
"$",
"eventName",
",",
"EventDispatcherInterface",
"$",
"dispatcher",
")",
"{",
"$",
"this",
"->",
"handler",
"->",
"getCategory",
"(",
"$",
"updatePosit... | Handle import category change position event
@param UpdatePositionEvent $updatePositionEvent
@param $eventName
@param EventDispatcherInterface $dispatcher | [
"Handle",
"import",
"category",
"change",
"position",
"event"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Action/Import.php#L74-L78 | train |
thelia/core | lib/Thelia/Command/ModulePositionCommand.php | ModulePositionCommand.checkModuleArgument | protected function checkModuleArgument($paramValue)
{
if (!preg_match('#^([a-z0-9]+):([\+-]?[0-9]+|up|down)$#i', $paramValue, $matches)) {
throw new \InvalidArgumentException(
'Arguments must be in format moduleName:[+|-]position where position is an integer or up or down.'
);
}
$this->moduleQuery->clear();
$module = $this->moduleQuery->findOneByCode($matches[1]);
if ($module === null) {
throw new \RuntimeException(sprintf('%s module does not exists. Try to refresh first.', $matches[1]));
}
$this->modulesList[] = $matches[1];
$this->positionsList[] = $matches[2];
} | php | protected function checkModuleArgument($paramValue)
{
if (!preg_match('#^([a-z0-9]+):([\+-]?[0-9]+|up|down)$#i', $paramValue, $matches)) {
throw new \InvalidArgumentException(
'Arguments must be in format moduleName:[+|-]position where position is an integer or up or down.'
);
}
$this->moduleQuery->clear();
$module = $this->moduleQuery->findOneByCode($matches[1]);
if ($module === null) {
throw new \RuntimeException(sprintf('%s module does not exists. Try to refresh first.', $matches[1]));
}
$this->modulesList[] = $matches[1];
$this->positionsList[] = $matches[2];
} | [
"protected",
"function",
"checkModuleArgument",
"(",
"$",
"paramValue",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"'#^([a-z0-9]+):([\\+-]?[0-9]+|up|down)$#i'",
",",
"$",
"paramValue",
",",
"$",
"matches",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentExc... | Check a module argument format
@param string $paramValue
@throws \InvalidArgumentException
@throws \RuntimeException | [
"Check",
"a",
"module",
"argument",
"format"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Command/ModulePositionCommand.php#L128-L144 | train |
thelia/core | lib/Thelia/Command/ModulePositionCommand.php | ModulePositionCommand.checkPositions | protected function checkPositions(InputInterface $input, OutputInterface $output, &$isAbsolute = false)
{
$isRelative = false;
foreach (array_count_values($this->positionsList) as $value => $count) {
if (\is_int($value) && $value[0] !== '+' && $value[0] !== '-') {
$isAbsolute = true;
if ($count > 1) {
throw new \InvalidArgumentException('Two (or more) absolute positions are identical.');
}
} else {
$isRelative = true;
}
}
if ($isAbsolute && $isRelative) {
/** @var FormatterHelper $formatter */
$formatter = $this->getHelper('formatter');
$formattedBlock = $formatter->formatBlock(
'Mix absolute and relative positions may produce unexpected results !',
'bg=yellow;fg=black',
true
);
$output->writeln($formattedBlock);
/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('<question>Do you want to continue ? y/[n]<question>', false);
return $helper->ask($input, $output, $question);
}
return true;
} | php | protected function checkPositions(InputInterface $input, OutputInterface $output, &$isAbsolute = false)
{
$isRelative = false;
foreach (array_count_values($this->positionsList) as $value => $count) {
if (\is_int($value) && $value[0] !== '+' && $value[0] !== '-') {
$isAbsolute = true;
if ($count > 1) {
throw new \InvalidArgumentException('Two (or more) absolute positions are identical.');
}
} else {
$isRelative = true;
}
}
if ($isAbsolute && $isRelative) {
/** @var FormatterHelper $formatter */
$formatter = $this->getHelper('formatter');
$formattedBlock = $formatter->formatBlock(
'Mix absolute and relative positions may produce unexpected results !',
'bg=yellow;fg=black',
true
);
$output->writeln($formattedBlock);
/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('<question>Do you want to continue ? y/[n]<question>', false);
return $helper->ask($input, $output, $question);
}
return true;
} | [
"protected",
"function",
"checkPositions",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
",",
"&",
"$",
"isAbsolute",
"=",
"false",
")",
"{",
"$",
"isRelative",
"=",
"false",
";",
"foreach",
"(",
"array_count_values",
"(",
"$",
... | Check positions consistency
@param InputInterface $input An InputInterface instance
@param OutputInterface $output An OutputInterface instance
@param bool $isAbsolute Set to true or false according to position values
@throws \InvalidArgumentException
@return bool Continue or stop command | [
"Check",
"positions",
"consistency"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Command/ModulePositionCommand.php#L184-L218 | train |
grom358/pharborist | src/Namespaces/UseDeclarationStatementNode.php | UseDeclarationStatementNode.importsClass | public function importsClass($class_name = NULL) {
if ($this->useFunction || $this->useConst) {
return FALSE;
}
if ($class_name) {
foreach ($this->getDeclarations() as $declaration) {
if ($declaration->getName()->getPath() === $class_name) {
return TRUE;
}
}
return FALSE;
}
else {
return TRUE;
}
} | php | public function importsClass($class_name = NULL) {
if ($this->useFunction || $this->useConst) {
return FALSE;
}
if ($class_name) {
foreach ($this->getDeclarations() as $declaration) {
if ($declaration->getName()->getPath() === $class_name) {
return TRUE;
}
}
return FALSE;
}
else {
return TRUE;
}
} | [
"public",
"function",
"importsClass",
"(",
"$",
"class_name",
"=",
"NULL",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"useFunction",
"||",
"$",
"this",
"->",
"useConst",
")",
"{",
"return",
"FALSE",
";",
"}",
"if",
"(",
"$",
"class_name",
")",
"{",
"for... | Test whether use declaration imports a class.
@param string|NULL $class_name
(Optional) Class name to check if being imported by use statement.
@return bool
TRUE if this use declaration imports class. | [
"Test",
"whether",
"use",
"declaration",
"imports",
"a",
"class",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Namespaces/UseDeclarationStatementNode.php#L48-L63 | train |
grom358/pharborist | src/Namespaces/UseDeclarationStatementNode.php | UseDeclarationStatementNode.importsFunction | public function importsFunction($function_name = NULL) {
if (!$this->useFunction) {
return FALSE;
}
if ($function_name) {
foreach ($this->getDeclarations() as $declaration) {
if ($declaration->getName()->getPath() === $function_name) {
return TRUE;
}
}
return FALSE;
}
else {
return TRUE;
}
} | php | public function importsFunction($function_name = NULL) {
if (!$this->useFunction) {
return FALSE;
}
if ($function_name) {
foreach ($this->getDeclarations() as $declaration) {
if ($declaration->getName()->getPath() === $function_name) {
return TRUE;
}
}
return FALSE;
}
else {
return TRUE;
}
} | [
"public",
"function",
"importsFunction",
"(",
"$",
"function_name",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"useFunction",
")",
"{",
"return",
"FALSE",
";",
"}",
"if",
"(",
"$",
"function_name",
")",
"{",
"foreach",
"(",
"$",
"this",
... | Test whether use declaration imports a function.
@param string|NULL $function_name
(Optional) Function name to check if being imported by use statement.
@return bool
TRUE if this use declaration imports function. | [
"Test",
"whether",
"use",
"declaration",
"imports",
"a",
"function",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Namespaces/UseDeclarationStatementNode.php#L74-L89 | train |
grom358/pharborist | src/Namespaces/UseDeclarationStatementNode.php | UseDeclarationStatementNode.importsConst | public function importsConst($const_name = NULL) {
if (!$this->useConst) {
return FALSE;
}
if ($const_name) {
foreach ($this->getDeclarations() as $declaration) {
if ($declaration->getName()->getPath() === $const_name) {
return TRUE;
}
}
return FALSE;
}
else {
return TRUE;
}
} | php | public function importsConst($const_name = NULL) {
if (!$this->useConst) {
return FALSE;
}
if ($const_name) {
foreach ($this->getDeclarations() as $declaration) {
if ($declaration->getName()->getPath() === $const_name) {
return TRUE;
}
}
return FALSE;
}
else {
return TRUE;
}
} | [
"public",
"function",
"importsConst",
"(",
"$",
"const_name",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"useConst",
")",
"{",
"return",
"FALSE",
";",
"}",
"if",
"(",
"$",
"const_name",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"g... | Test whether use declaration imports a constant.
@param string|NULL $const_name
(Optional) Constant name to check if being imported by use statement.
@return bool
TRUE if this use declaration imports constant. | [
"Test",
"whether",
"use",
"declaration",
"imports",
"a",
"constant",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Namespaces/UseDeclarationStatementNode.php#L100-L115 | train |
thelia/core | lib/Thelia/Coupon/BaseFacade.php | BaseFacade.getDeliveryAddress | public function getDeliveryAddress()
{
try {
return AddressQuery::create()->findPk(
$this->getRequest()->getSession()->getOrder()->getChoosenDeliveryAddress()
);
} catch (\Exception $ex) {
throw new \LogicException("Failed to get delivery address (" . $ex->getMessage() . ")");
}
} | php | public function getDeliveryAddress()
{
try {
return AddressQuery::create()->findPk(
$this->getRequest()->getSession()->getOrder()->getChoosenDeliveryAddress()
);
} catch (\Exception $ex) {
throw new \LogicException("Failed to get delivery address (" . $ex->getMessage() . ")");
}
} | [
"public",
"function",
"getDeliveryAddress",
"(",
")",
"{",
"try",
"{",
"return",
"AddressQuery",
"::",
"create",
"(",
")",
"->",
"findPk",
"(",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getSession",
"(",
")",
"->",
"getOrder",
"(",
")",
"->",
"... | Return an Address a CouponManager can process
@return \Thelia\Model\Address | [
"Return",
"an",
"Address",
"a",
"CouponManager",
"can",
"process"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Coupon/BaseFacade.php#L73-L82 | train |
thelia/core | lib/Thelia/Coupon/BaseFacade.php | BaseFacade.getCartTotalPrice | public function getCartTotalPrice($withItemsInPromo = true)
{
$total = 0;
$cartItems = $this->getRequest()->getSession()->getSessionCart($this->getDispatcher())->getCartItems();
foreach ($cartItems as $cartItem) {
if ($withItemsInPromo || ! $cartItem->getPromo()) {
$total += $cartItem->getRealPrice() * $cartItem->getQuantity();
}
}
return $total;
} | php | public function getCartTotalPrice($withItemsInPromo = true)
{
$total = 0;
$cartItems = $this->getRequest()->getSession()->getSessionCart($this->getDispatcher())->getCartItems();
foreach ($cartItems as $cartItem) {
if ($withItemsInPromo || ! $cartItem->getPromo()) {
$total += $cartItem->getRealPrice() * $cartItem->getQuantity();
}
}
return $total;
} | [
"public",
"function",
"getCartTotalPrice",
"(",
"$",
"withItemsInPromo",
"=",
"true",
")",
"{",
"$",
"total",
"=",
"0",
";",
"$",
"cartItems",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getSession",
"(",
")",
"->",
"getSessionCart",
"(",
"$",... | Return Products total price
@param bool $withItemsInPromo if true, the discounted items are included in the total
@return float | [
"Return",
"Products",
"total",
"price"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Coupon/BaseFacade.php#L121-L134 | train |
thelia/core | lib/Thelia/Coupon/BaseFacade.php | BaseFacade.getCurrentCoupons | public function getCurrentCoupons()
{
$couponCodes = $this->getRequest()->getSession()->getConsumedCoupons();
if (null === $couponCodes) {
return array();
}
/** @var CouponFactory $couponFactory */
$couponFactory = $this->container->get('thelia.coupon.factory');
$coupons = [];
foreach ($couponCodes as $couponCode) {
// Only valid coupons are returned
try {
if (false !== $couponInterface = $couponFactory->buildCouponFromCode($couponCode)) {
$coupons[] = $couponInterface;
}
} catch (\Exception $ex) {
// Just ignore the coupon and log the problem, just in case someone realize it.
Tlog::getInstance()->warning(
sprintf("Coupon %s ignored, exception occurred: %s", $couponCode, $ex->getMessage())
);
}
}
return $coupons;
} | php | public function getCurrentCoupons()
{
$couponCodes = $this->getRequest()->getSession()->getConsumedCoupons();
if (null === $couponCodes) {
return array();
}
/** @var CouponFactory $couponFactory */
$couponFactory = $this->container->get('thelia.coupon.factory');
$coupons = [];
foreach ($couponCodes as $couponCode) {
// Only valid coupons are returned
try {
if (false !== $couponInterface = $couponFactory->buildCouponFromCode($couponCode)) {
$coupons[] = $couponInterface;
}
} catch (\Exception $ex) {
// Just ignore the coupon and log the problem, just in case someone realize it.
Tlog::getInstance()->warning(
sprintf("Coupon %s ignored, exception occurred: %s", $couponCode, $ex->getMessage())
);
}
}
return $coupons;
} | [
"public",
"function",
"getCurrentCoupons",
"(",
")",
"{",
"$",
"couponCodes",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getSession",
"(",
")",
"->",
"getConsumedCoupons",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"couponCodes",
")",
"{",... | Return all Coupon given during the Checkout
@return array Array of CouponInterface | [
"Return",
"all",
"Coupon",
"given",
"during",
"the",
"Checkout"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Coupon/BaseFacade.php#L197-L224 | train |
thelia/core | lib/Thelia/Coupon/BaseFacade.php | BaseFacade.getParser | public function getParser()
{
if ($this->parser == null) {
$this->parser = $this->container->get('thelia.parser');
// Define the current back-office template that should be used
$this->parser->setTemplateDefinition(
$this->parser->getTemplateHelper()->getActiveAdminTemplate()
);
}
return $this->parser;
} | php | public function getParser()
{
if ($this->parser == null) {
$this->parser = $this->container->get('thelia.parser');
// Define the current back-office template that should be used
$this->parser->setTemplateDefinition(
$this->parser->getTemplateHelper()->getActiveAdminTemplate()
);
}
return $this->parser;
} | [
"public",
"function",
"getParser",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"parser",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"parser",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'thelia.parser'",
")",
";",
"// Define the current back... | Return platform Parser
@return ParserInterface | [
"Return",
"platform",
"Parser"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Coupon/BaseFacade.php#L265-L277 | train |
thelia/core | lib/Thelia/Coupon/BaseFacade.php | BaseFacade.pushCouponInSession | public function pushCouponInSession($couponCode)
{
$consumedCoupons = $this->getRequest()->getSession()->getConsumedCoupons();
if (!isset($consumedCoupons) || !$consumedCoupons) {
$consumedCoupons = array();
}
if (!isset($consumedCoupons[$couponCode])) {
// Prevent accumulation of the same Coupon on a Checkout
$consumedCoupons[$couponCode] = $couponCode;
$this->getRequest()->getSession()->setConsumedCoupons($consumedCoupons);
}
} | php | public function pushCouponInSession($couponCode)
{
$consumedCoupons = $this->getRequest()->getSession()->getConsumedCoupons();
if (!isset($consumedCoupons) || !$consumedCoupons) {
$consumedCoupons = array();
}
if (!isset($consumedCoupons[$couponCode])) {
// Prevent accumulation of the same Coupon on a Checkout
$consumedCoupons[$couponCode] = $couponCode;
$this->getRequest()->getSession()->setConsumedCoupons($consumedCoupons);
}
} | [
"public",
"function",
"pushCouponInSession",
"(",
"$",
"couponCode",
")",
"{",
"$",
"consumedCoupons",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getSession",
"(",
")",
"->",
"getConsumedCoupons",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
... | Add a coupon in session
@param $couponCode
@return mixed|void | [
"Add",
"a",
"coupon",
"in",
"session"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Coupon/BaseFacade.php#L337-L351 | train |
thelia/core | lib/Thelia/Coupon/Type/AbstractRemoveOnAttributeValues.php | AbstractRemoveOnAttributeValues.drawBaseBackOfficeInputs | public function drawBaseBackOfficeInputs($templateName, $otherFields)
{
return $this->facade->getParser()->render($templateName, array_merge($otherFields, [
// The attributes list field
'attribute_field_name' => $this->makeCouponFieldName(self::ATTRIBUTE),
'attribute_value' => $this->attribute,
// The attributes list field
'attribute_av_field_name' => $this->makeCouponFieldName(self::ATTRIBUTES_AV_LIST),
'attribute_av_values' => $this->attributeAvList
]));
} | php | public function drawBaseBackOfficeInputs($templateName, $otherFields)
{
return $this->facade->getParser()->render($templateName, array_merge($otherFields, [
// The attributes list field
'attribute_field_name' => $this->makeCouponFieldName(self::ATTRIBUTE),
'attribute_value' => $this->attribute,
// The attributes list field
'attribute_av_field_name' => $this->makeCouponFieldName(self::ATTRIBUTES_AV_LIST),
'attribute_av_values' => $this->attributeAvList
]));
} | [
"public",
"function",
"drawBaseBackOfficeInputs",
"(",
"$",
"templateName",
",",
"$",
"otherFields",
")",
"{",
"return",
"$",
"this",
"->",
"facade",
"->",
"getParser",
"(",
")",
"->",
"render",
"(",
"$",
"templateName",
",",
"array_merge",
"(",
"$",
"otherF... | Renders the template which implements coupon specific user-input,
using the provided template file, and a list of specific input fields.
@param string $templateName the path to the template
@param array $otherFields the list of additional fields fields
@return string the rendered template. | [
"Renders",
"the",
"template",
"which",
"implements",
"coupon",
"specific",
"user",
"-",
"input",
"using",
"the",
"provided",
"template",
"file",
"and",
"a",
"list",
"of",
"specific",
"input",
"fields",
"."
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Coupon/Type/AbstractRemoveOnAttributeValues.php#L142-L154 | train |
thelia/core | lib/Thelia/Form/SeoFieldsTrait.php | SeoFieldsTrait.addSeoFields | protected function addSeoFields($exclude = array())
{
if (! \in_array('url', $exclude)) {
$this->formBuilder->add(
'url',
'text',
[
'required' => false,
'label' => Translator::getInstance()->trans('Rewriten URL'),
'label_attr' => [
'for' => 'rewriten_url_field',
],
'attr' => [
'placeholder' => Translator::getInstance()->trans('Use the keyword phrase in your URL.'),
]
]
);
}
if (! \in_array('meta_title', $exclude)) {
$this->formBuilder->add(
'meta_title',
'text',
[
'required' => false,
'label' => Translator::getInstance()->trans('Page Title'),
'label_attr' => [
'for' => 'meta_title',
'help' => Translator::getInstance()->trans('The HTML TITLE element is the most important element on your web page.'),
],
'attr' => [
'placeholder' => Translator::getInstance()->trans('Make sure that your title is clear, and contains many of the keywords within the page itself.'),
]
]
);
}
if (! \in_array('meta_description', $exclude)) {
$this->formBuilder->add(
'meta_description',
'textarea',
[
'required' => false,
'label' => Translator::getInstance()->trans('Meta Description'),
'label_attr' => [
'for' => 'meta_description',
'help' => Translator::getInstance()->trans('Keep the most important part of your description in the first 150-160 characters.'),
],
'attr' => [
'rows' => 6,
'placeholder' => Translator::getInstance()->trans('Make sure it uses keywords found within the page itself.'),
]
]
);
}
if (! \in_array('meta_keywords', $exclude)) {
$this->formBuilder->add(
'meta_keywords',
'textarea',
[
'required' => false,
'label' => Translator::getInstance()->trans('Meta Keywords'),
'label_attr' => [
'for' => 'meta_keywords',
'help' => Translator::getInstance()->trans('You don\'t need to use commas or other punctuations.'),
],
'attr' => [
'rows' => 3,
'placeholder' => Translator::getInstance()->trans('Don\'t repeat keywords over and over in a row. Rather, put in keyword phrases.'),
]
]
);
}
} | php | protected function addSeoFields($exclude = array())
{
if (! \in_array('url', $exclude)) {
$this->formBuilder->add(
'url',
'text',
[
'required' => false,
'label' => Translator::getInstance()->trans('Rewriten URL'),
'label_attr' => [
'for' => 'rewriten_url_field',
],
'attr' => [
'placeholder' => Translator::getInstance()->trans('Use the keyword phrase in your URL.'),
]
]
);
}
if (! \in_array('meta_title', $exclude)) {
$this->formBuilder->add(
'meta_title',
'text',
[
'required' => false,
'label' => Translator::getInstance()->trans('Page Title'),
'label_attr' => [
'for' => 'meta_title',
'help' => Translator::getInstance()->trans('The HTML TITLE element is the most important element on your web page.'),
],
'attr' => [
'placeholder' => Translator::getInstance()->trans('Make sure that your title is clear, and contains many of the keywords within the page itself.'),
]
]
);
}
if (! \in_array('meta_description', $exclude)) {
$this->formBuilder->add(
'meta_description',
'textarea',
[
'required' => false,
'label' => Translator::getInstance()->trans('Meta Description'),
'label_attr' => [
'for' => 'meta_description',
'help' => Translator::getInstance()->trans('Keep the most important part of your description in the first 150-160 characters.'),
],
'attr' => [
'rows' => 6,
'placeholder' => Translator::getInstance()->trans('Make sure it uses keywords found within the page itself.'),
]
]
);
}
if (! \in_array('meta_keywords', $exclude)) {
$this->formBuilder->add(
'meta_keywords',
'textarea',
[
'required' => false,
'label' => Translator::getInstance()->trans('Meta Keywords'),
'label_attr' => [
'for' => 'meta_keywords',
'help' => Translator::getInstance()->trans('You don\'t need to use commas or other punctuations.'),
],
'attr' => [
'rows' => 3,
'placeholder' => Translator::getInstance()->trans('Don\'t repeat keywords over and over in a row. Rather, put in keyword phrases.'),
]
]
);
}
} | [
"protected",
"function",
"addSeoFields",
"(",
"$",
"exclude",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"\\",
"in_array",
"(",
"'url'",
",",
"$",
"exclude",
")",
")",
"{",
"$",
"this",
"->",
"formBuilder",
"->",
"add",
"(",
"'url'",
",",
"'... | Add seo meta title, meta description and meta keywords fields
@param array $exclude name of the fields that should not be added to the form | [
"Add",
"seo",
"meta",
"title",
"meta",
"description",
"and",
"meta",
"keywords",
"fields"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Form/SeoFieldsTrait.php#L29-L103 | train |
thelia/core | lib/Thelia/Controller/Admin/AbstractCrudController.php | AbstractCrudController.getCurrentListOrder | protected function getCurrentListOrder($update_session = true)
{
return $this->getListOrderFromSession(
$this->objectName,
$this->orderRequestParameterName,
$this->defaultListOrder
);
} | php | protected function getCurrentListOrder($update_session = true)
{
return $this->getListOrderFromSession(
$this->objectName,
$this->orderRequestParameterName,
$this->defaultListOrder
);
} | [
"protected",
"function",
"getCurrentListOrder",
"(",
"$",
"update_session",
"=",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"getListOrderFromSession",
"(",
"$",
"this",
"->",
"objectName",
",",
"$",
"this",
"->",
"orderRequestParameterName",
",",
"$",
"this"... | Return the current list order identifier, updating it in the same time. | [
"Return",
"the",
"current",
"list",
"order",
"identifier",
"updating",
"it",
"in",
"the",
"same",
"time",
"."
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Controller/Admin/AbstractCrudController.php#L257-L264 | train |
melisplatform/melis-cms | src/Controller/ToolStyleController.php | ToolStyleController.renderToolStyleHeaderAction | public function renderToolStyleHeaderAction()
{
// declare the Tool service that we will be using to completely create our tool.
$melisTool = $this->getServiceLocator()->get('MelisCoreTool');
// tell the Tool what configuration in the app.tool.php that will be used.
$melisTool->setMelisToolKey('meliscms', 'meliscms_tool_templates');
$melisKey = $this->params()->fromRoute('melisKey', '');
$zoneConfig = $this->params()->fromRoute('zoneconfig', array());
$view = new ViewModel();
$view->melisKey = $melisKey;
$view->title = $melisTool->getTitle();;
return $view;
} | php | public function renderToolStyleHeaderAction()
{
// declare the Tool service that we will be using to completely create our tool.
$melisTool = $this->getServiceLocator()->get('MelisCoreTool');
// tell the Tool what configuration in the app.tool.php that will be used.
$melisTool->setMelisToolKey('meliscms', 'meliscms_tool_templates');
$melisKey = $this->params()->fromRoute('melisKey', '');
$zoneConfig = $this->params()->fromRoute('zoneconfig', array());
$view = new ViewModel();
$view->melisKey = $melisKey;
$view->title = $melisTool->getTitle();;
return $view;
} | [
"public",
"function",
"renderToolStyleHeaderAction",
"(",
")",
"{",
"// declare the Tool service that we will be using to completely create our tool.",
"$",
"melisTool",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"'MelisCoreTool'",
")",
";",
... | This is where you place your buttons for the tools
@return \Zend\View\Model\ViewModel | [
"This",
"is",
"where",
"you",
"place",
"your",
"buttons",
"for",
"the",
"tools"
] | ed470338f4c7653fd93e530013ab934eb7a52b6f | https://github.com/melisplatform/melis-cms/blob/ed470338f4c7653fd93e530013ab934eb7a52b6f/src/Controller/ToolStyleController.php#L68-L84 | train |
melisplatform/melis-cms | src/Controller/ToolStyleController.php | ToolStyleController.getStyleByPageId | public function getStyleByPageId($pageId)
{
$style = "";
$pageStyle = $this->getServiceLocator()->get('MelisPageStyle');
if($pageStyle){
$dataStyle = $pageStyle->getStyleByPageId($pageId);
$style = $dataStyle;
}
return $style;
} | php | public function getStyleByPageId($pageId)
{
$style = "";
$pageStyle = $this->getServiceLocator()->get('MelisPageStyle');
if($pageStyle){
$dataStyle = $pageStyle->getStyleByPageId($pageId);
$style = $dataStyle;
}
return $style;
} | [
"public",
"function",
"getStyleByPageId",
"(",
"$",
"pageId",
")",
"{",
"$",
"style",
"=",
"\"\"",
";",
"$",
"pageStyle",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"'MelisPageStyle'",
")",
";",
"if",
"(",
"$",
"pageStyle",
... | Return style of a page
return array | [
"Return",
"style",
"of",
"a",
"page"
] | ed470338f4c7653fd93e530013ab934eb7a52b6f | https://github.com/melisplatform/melis-cms/blob/ed470338f4c7653fd93e530013ab934eb7a52b6f/src/Controller/ToolStyleController.php#L595-L607 | train |
thelia/core | lib/Thelia/Core/Hook/BaseHook.php | BaseHook.insertTemplate | public function insertTemplate(HookRenderEvent $event, $code)
{
if (array_key_exists($code, $this->templates)) {
$templates = explode(';', $this->templates[$code]);
// Concatenate arguments and template variables,
// giving the precedence to arguments.
$allArguments = $event->getTemplateVars() + $event->getArguments();
foreach ($templates as $template) {
list($type, $filepath) = $this->getTemplateParams($template);
if ("render" === $type) {
$event->add($this->render($filepath, $allArguments));
continue;
}
if ("dump" === $type) {
$event->add($this->render($filepath));
continue;
}
if ("css" === $type) {
$event->add($this->addCSS($filepath));
continue;
}
if ("js" === $type) {
$event->add($this->addJS($filepath));
continue;
}
if (method_exists($this, $type)) {
$this->{$type}($filepath, $allArguments);
}
}
}
} | php | public function insertTemplate(HookRenderEvent $event, $code)
{
if (array_key_exists($code, $this->templates)) {
$templates = explode(';', $this->templates[$code]);
// Concatenate arguments and template variables,
// giving the precedence to arguments.
$allArguments = $event->getTemplateVars() + $event->getArguments();
foreach ($templates as $template) {
list($type, $filepath) = $this->getTemplateParams($template);
if ("render" === $type) {
$event->add($this->render($filepath, $allArguments));
continue;
}
if ("dump" === $type) {
$event->add($this->render($filepath));
continue;
}
if ("css" === $type) {
$event->add($this->addCSS($filepath));
continue;
}
if ("js" === $type) {
$event->add($this->addJS($filepath));
continue;
}
if (method_exists($this, $type)) {
$this->{$type}($filepath, $allArguments);
}
}
}
} | [
"public",
"function",
"insertTemplate",
"(",
"HookRenderEvent",
"$",
"event",
",",
"$",
"code",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"code",
",",
"$",
"this",
"->",
"templates",
")",
")",
"{",
"$",
"templates",
"=",
"explode",
"(",
"';'",
... | This function is called when hook uses the automatic insert template.
@param HookRenderEvent $event
@param string $code | [
"This",
"function",
"is",
"called",
"when",
"hook",
"uses",
"the",
"automatic",
"insert",
"template",
"."
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/Hook/BaseHook.php#L91-L128 | train |
thelia/core | lib/Thelia/Core/Hook/BaseHook.php | BaseHook.render | public function render($templateName, array $parameters = array())
{
$templateDir = $this->assetsResolver->resolveAssetSourcePath($this->module->getCode(), false, $templateName, $this->parser);
if (null !== $templateDir) {
// retrieve the template
$content = $this->parser->render($templateDir . DS . $templateName, $parameters);
} else {
$content = sprintf("ERR: Unknown template %s for module %s", $templateName, $this->module->getCode());
}
return $content;
} | php | public function render($templateName, array $parameters = array())
{
$templateDir = $this->assetsResolver->resolveAssetSourcePath($this->module->getCode(), false, $templateName, $this->parser);
if (null !== $templateDir) {
// retrieve the template
$content = $this->parser->render($templateDir . DS . $templateName, $parameters);
} else {
$content = sprintf("ERR: Unknown template %s for module %s", $templateName, $this->module->getCode());
}
return $content;
} | [
"public",
"function",
"render",
"(",
"$",
"templateName",
",",
"array",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"$",
"templateDir",
"=",
"$",
"this",
"->",
"assetsResolver",
"->",
"resolveAssetSourcePath",
"(",
"$",
"this",
"->",
"module",
"->... | helper function allowing you to render a template using a template engine
@param string $templateName the template path of the template
@param array $parameters an array of parameters to assign to a template engine
@return string the content generated by a template engine | [
"helper",
"function",
"allowing",
"you",
"to",
"render",
"a",
"template",
"using",
"a",
"template",
"engine"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/Hook/BaseHook.php#L138-L150 | train |
thelia/core | lib/Thelia/Core/Hook/BaseHook.php | BaseHook.dump | public function dump($fileName)
{
$fileDir = $this->assetsResolver->resolveAssetSourcePath($this->module->getCode(), false, $fileName, $this->parser);
if (null !== $fileDir) {
$content = file_get_contents($fileDir . DS . $fileName);
if (false === $content) {
$content = "";
}
} else {
$content = sprintf("ERR: Unknown file %s for module %s", $fileName, $this->module->getCode());
}
return $content;
} | php | public function dump($fileName)
{
$fileDir = $this->assetsResolver->resolveAssetSourcePath($this->module->getCode(), false, $fileName, $this->parser);
if (null !== $fileDir) {
$content = file_get_contents($fileDir . DS . $fileName);
if (false === $content) {
$content = "";
}
} else {
$content = sprintf("ERR: Unknown file %s for module %s", $fileName, $this->module->getCode());
}
return $content;
} | [
"public",
"function",
"dump",
"(",
"$",
"fileName",
")",
"{",
"$",
"fileDir",
"=",
"$",
"this",
"->",
"assetsResolver",
"->",
"resolveAssetSourcePath",
"(",
"$",
"this",
"->",
"module",
"->",
"getCode",
"(",
")",
",",
"false",
",",
"$",
"fileName",
",",
... | helper function allowing you to get the content of a file
@param string $fileName the template path of the template
@return string the content of the file | [
"helper",
"function",
"allowing",
"you",
"to",
"get",
"the",
"content",
"of",
"a",
"file"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/Hook/BaseHook.php#L159-L173 | train |
thelia/core | lib/Thelia/Core/Hook/BaseHook.php | BaseHook.addCSS | public function addCSS($fileName, $attributes = [], $filters = [])
{
$tag = "";
$url = $this->assetsResolver->resolveAssetURL($this->module->getCode(), $fileName, "css", $this->parser, $filters);
if ("" !== $url) {
$tags = array();
$tags[] = '<link rel="stylesheet" type="text/css" ';
$tags[] = ' href="' . $url . '" ';
foreach ($attributes as $name => $val) {
if (\is_string($name) && !\in_array($name, [ "href", "rel", "type" ])) {
$tags[] = $name . '="' . $val . '" ';
}
}
$tags[] = "/>";
$tag = implode($tags);
}
return $tag;
} | php | public function addCSS($fileName, $attributes = [], $filters = [])
{
$tag = "";
$url = $this->assetsResolver->resolveAssetURL($this->module->getCode(), $fileName, "css", $this->parser, $filters);
if ("" !== $url) {
$tags = array();
$tags[] = '<link rel="stylesheet" type="text/css" ';
$tags[] = ' href="' . $url . '" ';
foreach ($attributes as $name => $val) {
if (\is_string($name) && !\in_array($name, [ "href", "rel", "type" ])) {
$tags[] = $name . '="' . $val . '" ';
}
}
$tags[] = "/>";
$tag = implode($tags);
}
return $tag;
} | [
"public",
"function",
"addCSS",
"(",
"$",
"fileName",
",",
"$",
"attributes",
"=",
"[",
"]",
",",
"$",
"filters",
"=",
"[",
"]",
")",
"{",
"$",
"tag",
"=",
"\"\"",
";",
"$",
"url",
"=",
"$",
"this",
"->",
"assetsResolver",
"->",
"resolveAssetURL",
... | helper function allowing you to generate the HTML link tag
@param string $fileName the path to the css file
@param array $attributes the attributes of the tag
@param array $filters an array of assets processing filters (less, sass, etc.)
@return string the link tag | [
"helper",
"function",
"allowing",
"you",
"to",
"generate",
"the",
"HTML",
"link",
"tag"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/Hook/BaseHook.php#L184-L204 | train |
thelia/core | lib/Thelia/Core/Hook/BaseHook.php | BaseHook.getRequest | protected function getRequest()
{
if (null === $this->request) {
$this->request = $this->getParser()->getRequest();
}
return $this->request;
} | php | protected function getRequest()
{
if (null === $this->request) {
$this->request = $this->getParser()->getRequest();
}
return $this->request;
} | [
"protected",
"function",
"getRequest",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"request",
")",
"{",
"$",
"this",
"->",
"request",
"=",
"$",
"this",
"->",
"getParser",
"(",
")",
"->",
"getRequest",
"(",
")",
";",
"}",
"return",
"... | get the request
@return Request | [
"get",
"the",
"request"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/Hook/BaseHook.php#L291-L298 | train |
thelia/core | lib/Thelia/Core/Hook/BaseHook.php | BaseHook.getSession | protected function getSession()
{
if (null === $this->session) {
if (null !== $this->getRequest()) {
$this->session = $this->request->getSession();
}
}
return $this->session;
} | php | protected function getSession()
{
if (null === $this->session) {
if (null !== $this->getRequest()) {
$this->session = $this->request->getSession();
}
}
return $this->session;
} | [
"protected",
"function",
"getSession",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"session",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"getRequest",
"(",
")",
")",
"{",
"$",
"this",
"->",
"session",
"=",
"$",
"this",
... | get the session
@return Session | [
"get",
"the",
"session"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/Hook/BaseHook.php#L305-L314 | train |
thelia/core | lib/Thelia/Core/Hook/BaseHook.php | BaseHook.getView | protected function getView()
{
$ret = "";
if (null !== $this->getRequest()) {
$ret = $this->getRequest()->attributes->get("_view", "");
}
return $ret;
} | php | protected function getView()
{
$ret = "";
if (null !== $this->getRequest()) {
$ret = $this->getRequest()->attributes->get("_view", "");
}
return $ret;
} | [
"protected",
"function",
"getView",
"(",
")",
"{",
"$",
"ret",
"=",
"\"\"",
";",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"getRequest",
"(",
")",
")",
"{",
"$",
"ret",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"attributes",
"->",
... | Get the view argument for the request.
It allows you to identify the page currently displayed. eg: index, category, ...
@return string the current view | [
"Get",
"the",
"view",
"argument",
"for",
"the",
"request",
"."
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/Hook/BaseHook.php#L323-L331 | train |
thelia/core | lib/Thelia/Core/Hook/BaseHook.php | BaseHook.getCart | protected function getCart()
{
if (null === $this->cart) {
$this->cart = $this->getSession() ? $this->getSession()->getSessionCart($this->dispatcher) : null;
}
return $this->cart;
} | php | protected function getCart()
{
if (null === $this->cart) {
$this->cart = $this->getSession() ? $this->getSession()->getSessionCart($this->dispatcher) : null;
}
return $this->cart;
} | [
"protected",
"function",
"getCart",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"cart",
")",
"{",
"$",
"this",
"->",
"cart",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
"?",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"ge... | Get the cart from the session
@return \Thelia\Model\Cart|null | [
"Get",
"the",
"cart",
"from",
"the",
"session"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/Hook/BaseHook.php#L338-L345 | train |
thelia/core | lib/Thelia/Core/Hook/BaseHook.php | BaseHook.getOrder | protected function getOrder()
{
if (null === $this->order) {
$this->order = $this->getSession() ? $this->getSession()->getOrder() : null;
}
return $this->order;
} | php | protected function getOrder()
{
if (null === $this->order) {
$this->order = $this->getSession() ? $this->getSession()->getOrder() : null;
}
return $this->order;
} | [
"protected",
"function",
"getOrder",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"order",
")",
"{",
"$",
"this",
"->",
"order",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
"?",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
... | Get the order from the session
@return \Thelia\Model\Order|null | [
"Get",
"the",
"order",
"from",
"the",
"session"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/Hook/BaseHook.php#L352-L359 | train |
thelia/core | lib/Thelia/Core/Hook/BaseHook.php | BaseHook.getCurrency | protected function getCurrency()
{
if (null === $this->currency) {
$this->currency = $this->getSession() ? $this->getSession()->getCurrency(true) : Currency::getDefaultCurrency();
}
return $this->currency;
} | php | protected function getCurrency()
{
if (null === $this->currency) {
$this->currency = $this->getSession() ? $this->getSession()->getCurrency(true) : Currency::getDefaultCurrency();
}
return $this->currency;
} | [
"protected",
"function",
"getCurrency",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"currency",
")",
"{",
"$",
"this",
"->",
"currency",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
"?",
"$",
"this",
"->",
"getSession",
"(",
")",
... | Get the current currency used or if not present the default currency for the shop
@return \Thelia\Model\Currency | [
"Get",
"the",
"current",
"currency",
"used",
"or",
"if",
"not",
"present",
"the",
"default",
"currency",
"for",
"the",
"shop"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/Hook/BaseHook.php#L366-L373 | train |
thelia/core | lib/Thelia/Core/Hook/BaseHook.php | BaseHook.getCustomer | protected function getCustomer()
{
if (null === $this->customer) {
$this->customer = $this->getSession() ? $this->getSession()->getCustomerUser() : null;
}
return $this->customer;
} | php | protected function getCustomer()
{
if (null === $this->customer) {
$this->customer = $this->getSession() ? $this->getSession()->getCustomerUser() : null;
}
return $this->customer;
} | [
"protected",
"function",
"getCustomer",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"customer",
")",
"{",
"$",
"this",
"->",
"customer",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
"?",
"$",
"this",
"->",
"getSession",
"(",
")",
... | Get the current customer logged in. If no customer is logged return null
@return \Thelia\Model\Customer|null | [
"Get",
"the",
"current",
"customer",
"logged",
"in",
".",
"If",
"no",
"customer",
"is",
"logged",
"return",
"null"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/Hook/BaseHook.php#L380-L387 | train |
thelia/core | lib/Thelia/Core/Hook/BaseHook.php | BaseHook.getLang | protected function getLang()
{
if (null === $this->lang) {
$this->lang = $this->getSession() ? $this->getSession()->getLang(true) : $this->lang = Lang::getDefaultLanguage();
}
return $this->lang;
} | php | protected function getLang()
{
if (null === $this->lang) {
$this->lang = $this->getSession() ? $this->getSession()->getLang(true) : $this->lang = Lang::getDefaultLanguage();
}
return $this->lang;
} | [
"protected",
"function",
"getLang",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"lang",
")",
"{",
"$",
"this",
"->",
"lang",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
"?",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"ge... | Get the current lang used or if not present the default lang for the shop
@return \Thelia\Model\Lang | [
"Get",
"the",
"current",
"lang",
"used",
"or",
"if",
"not",
"present",
"the",
"default",
"lang",
"for",
"the",
"shop"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/Hook/BaseHook.php#L394-L401 | train |
thelia/core | lib/Thelia/Core/Hook/BaseHook.php | BaseHook.addTemplate | public function addTemplate($hookCode, $value)
{
if (array_key_exists($hookCode, $this->templates)) {
throw new \InvalidArgumentException(sprintf("The hook '%s' is already used in this class.", $hookCode));
}
$this->templates[$hookCode] = $value;
} | php | public function addTemplate($hookCode, $value)
{
if (array_key_exists($hookCode, $this->templates)) {
throw new \InvalidArgumentException(sprintf("The hook '%s' is already used in this class.", $hookCode));
}
$this->templates[$hookCode] = $value;
} | [
"public",
"function",
"addTemplate",
"(",
"$",
"hookCode",
",",
"$",
"value",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"hookCode",
",",
"$",
"this",
"->",
"templates",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf... | Add a new template for automatic render
@param string $hookCode the code of the hook (the name of the event used to render) : 'hook.{type}.{hook code}'
@param string $value list of the template to render or add.
eg: 'render:mytemplate.html;css:assets/css/mycss.css;js:assets/js/myjs.js' | [
"Add",
"a",
"new",
"template",
"for",
"automatic",
"render"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/Hook/BaseHook.php#L410-L417 | train |
thelia/core | lib/Thelia/Core/DependencyInjection/Compiler/RegisterHookListenersPass.php | RegisterHookListenersPass.addHooksMethodCall | protected function addHooksMethodCall(ContainerBuilder $container, Definition $definition)
{
$moduleHooks = ModuleHookQuery::create()
->orderByHookId()
->orderByPosition()
->orderById()
->find();
$modulePosition = 0;
$hookId = 0;
/** @var ModuleHook $moduleHook */
foreach ($moduleHooks as $moduleHook) {
// check if class and method exists
if (!$container->hasDefinition($moduleHook->getClassname())) {
continue;
}
$hook = $moduleHook->getHook();
if (!$this->isValidHookMethod(
$container->getDefinition($moduleHook->getClassname())->getClass(),
$moduleHook->getMethod(),
$hook->getBlock(),
true
)
) {
$moduleHook->delete();
continue;
}
// manage module hook position for new hook
if ($hookId !== $moduleHook->getHookId()) {
$hookId = $moduleHook->getHookId();
$modulePosition = 1;
} else {
$modulePosition++;
}
if ($moduleHook->getPosition() === ModuleHook::MAX_POSITION) {
// new module hook, we set it at the end of the queue for this event
$moduleHook->setPosition($modulePosition)->save();
} else {
$modulePosition = $moduleHook->getPosition();
}
// Add the the new listener for active hooks, we have to reverse the priority and the position
if ($moduleHook->getActive() && $moduleHook->getModuleActive() && $moduleHook->getHookActive()) {
$eventName = sprintf('hook.%s.%s', $hook->getType(), $hook->getCode());
// we a register an event which is relative to a specific module
if ($hook->getByModule()) {
$eventName .= '.' . $moduleHook->getModuleId();
}
$definition->addMethodCall(
'addListenerService',
array(
$eventName,
array($moduleHook->getClassname(), $moduleHook->getMethod()),
ModuleHook::MAX_POSITION - $moduleHook->getPosition()
)
);
if ($moduleHook->getTemplates()) {
if ($container->hasDefinition($moduleHook->getClassname())) {
$moduleHookEventName = 'hook.' . $hook->getType() . '.' . $hook->getCode();
if (true === $moduleHook->getHook()->getByModule()) {
$moduleHookEventName .= '.' . $moduleHook->getModuleId();
}
$container
->getDefinition($moduleHook->getClassname())
->addMethodCall(
'addTemplate',
array(
$moduleHookEventName,
$moduleHook->getTemplates()
)
)
;
}
}
}
}
} | php | protected function addHooksMethodCall(ContainerBuilder $container, Definition $definition)
{
$moduleHooks = ModuleHookQuery::create()
->orderByHookId()
->orderByPosition()
->orderById()
->find();
$modulePosition = 0;
$hookId = 0;
/** @var ModuleHook $moduleHook */
foreach ($moduleHooks as $moduleHook) {
// check if class and method exists
if (!$container->hasDefinition($moduleHook->getClassname())) {
continue;
}
$hook = $moduleHook->getHook();
if (!$this->isValidHookMethod(
$container->getDefinition($moduleHook->getClassname())->getClass(),
$moduleHook->getMethod(),
$hook->getBlock(),
true
)
) {
$moduleHook->delete();
continue;
}
// manage module hook position for new hook
if ($hookId !== $moduleHook->getHookId()) {
$hookId = $moduleHook->getHookId();
$modulePosition = 1;
} else {
$modulePosition++;
}
if ($moduleHook->getPosition() === ModuleHook::MAX_POSITION) {
// new module hook, we set it at the end of the queue for this event
$moduleHook->setPosition($modulePosition)->save();
} else {
$modulePosition = $moduleHook->getPosition();
}
// Add the the new listener for active hooks, we have to reverse the priority and the position
if ($moduleHook->getActive() && $moduleHook->getModuleActive() && $moduleHook->getHookActive()) {
$eventName = sprintf('hook.%s.%s', $hook->getType(), $hook->getCode());
// we a register an event which is relative to a specific module
if ($hook->getByModule()) {
$eventName .= '.' . $moduleHook->getModuleId();
}
$definition->addMethodCall(
'addListenerService',
array(
$eventName,
array($moduleHook->getClassname(), $moduleHook->getMethod()),
ModuleHook::MAX_POSITION - $moduleHook->getPosition()
)
);
if ($moduleHook->getTemplates()) {
if ($container->hasDefinition($moduleHook->getClassname())) {
$moduleHookEventName = 'hook.' . $hook->getType() . '.' . $hook->getCode();
if (true === $moduleHook->getHook()->getByModule()) {
$moduleHookEventName .= '.' . $moduleHook->getModuleId();
}
$container
->getDefinition($moduleHook->getClassname())
->addMethodCall(
'addTemplate',
array(
$moduleHookEventName,
$moduleHook->getTemplates()
)
)
;
}
}
}
}
} | [
"protected",
"function",
"addHooksMethodCall",
"(",
"ContainerBuilder",
"$",
"container",
",",
"Definition",
"$",
"definition",
")",
"{",
"$",
"moduleHooks",
"=",
"ModuleHookQuery",
"::",
"create",
"(",
")",
"->",
"orderByHookId",
"(",
")",
"->",
"orderByPosition"... | First the new hooks are positioning next to the last module hook.
Next, if the module, hook and module hook is active, a new listener is
added to the service definition.
@param ContainerBuilder $container
@param Definition $definition The service definition | [
"First",
"the",
"new",
"hooks",
"are",
"positioning",
"next",
"to",
"the",
"last",
"module",
"hook",
".",
"Next",
"if",
"the",
"module",
"hook",
"and",
"module",
"hook",
"is",
"active",
"a",
"new",
"listener",
"is",
"added",
"to",
"the",
"service",
"defi... | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/DependencyInjection/Compiler/RegisterHookListenersPass.php#L216-L299 | train |
thelia/core | lib/Thelia/Core/DependencyInjection/Compiler/RegisterHookListenersPass.php | RegisterHookListenersPass.getHookType | protected function getHookType($name)
{
$type = TemplateDefinition::FRONT_OFFICE;
if (null !== $name && \is_string($name)) {
$name = preg_replace("[^a-z]", "", strtolower(trim($name)));
if (\in_array($name, array('bo', 'back', 'backoffice'))) {
$type = TemplateDefinition::BACK_OFFICE;
} elseif (\in_array($name, array('email'))) {
$type = TemplateDefinition::EMAIL;
} elseif (\in_array($name, array('pdf'))) {
$type = TemplateDefinition::PDF;
}
}
return $type;
} | php | protected function getHookType($name)
{
$type = TemplateDefinition::FRONT_OFFICE;
if (null !== $name && \is_string($name)) {
$name = preg_replace("[^a-z]", "", strtolower(trim($name)));
if (\in_array($name, array('bo', 'back', 'backoffice'))) {
$type = TemplateDefinition::BACK_OFFICE;
} elseif (\in_array($name, array('email'))) {
$type = TemplateDefinition::EMAIL;
} elseif (\in_array($name, array('pdf'))) {
$type = TemplateDefinition::PDF;
}
}
return $type;
} | [
"protected",
"function",
"getHookType",
"(",
"$",
"name",
")",
"{",
"$",
"type",
"=",
"TemplateDefinition",
"::",
"FRONT_OFFICE",
";",
"if",
"(",
"null",
"!==",
"$",
"name",
"&&",
"\\",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"$",
"name",
"=",
... | get the hook type according to the type attribute of the hook tag
@param string $name
@return int the hook type | [
"get",
"the",
"hook",
"type",
"according",
"to",
"the",
"type",
"attribute",
"of",
"the",
"hook",
"tag"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/DependencyInjection/Compiler/RegisterHookListenersPass.php#L309-L325 | train |
thelia/core | lib/Thelia/Core/DependencyInjection/Compiler/RegisterHookListenersPass.php | RegisterHookListenersPass.isValidHookMethod | protected function isValidHookMethod($className, $methodName, $block, $failSafe = false)
{
try {
$method = new ReflectionMethod($className, $methodName);
$parameters = $method->getParameters();
$eventType = ($block) ?
HookDefinition::RENDER_BLOCK_EVENT :
HookDefinition::RENDER_FUNCTION_EVENT;
if (!($parameters[0]->getClass()->getName() == $eventType || is_subclass_of($parameters[0]->getClass()->getName(), $eventType))) {
$this->logAlertMessage(sprintf("Method %s should use an event of type %s. found: %s", $methodName, $eventType, $parameters[0]->getClass()->getName()));
return false;
}
} catch (ReflectionException $ex) {
$this->logAlertMessage(
sprintf("Method %s does not exist in %s : %s", $methodName, $className, $ex),
$failSafe
);
return false;
}
return true;
} | php | protected function isValidHookMethod($className, $methodName, $block, $failSafe = false)
{
try {
$method = new ReflectionMethod($className, $methodName);
$parameters = $method->getParameters();
$eventType = ($block) ?
HookDefinition::RENDER_BLOCK_EVENT :
HookDefinition::RENDER_FUNCTION_EVENT;
if (!($parameters[0]->getClass()->getName() == $eventType || is_subclass_of($parameters[0]->getClass()->getName(), $eventType))) {
$this->logAlertMessage(sprintf("Method %s should use an event of type %s. found: %s", $methodName, $eventType, $parameters[0]->getClass()->getName()));
return false;
}
} catch (ReflectionException $ex) {
$this->logAlertMessage(
sprintf("Method %s does not exist in %s : %s", $methodName, $className, $ex),
$failSafe
);
return false;
}
return true;
} | [
"protected",
"function",
"isValidHookMethod",
"(",
"$",
"className",
",",
"$",
"methodName",
",",
"$",
"block",
",",
"$",
"failSafe",
"=",
"false",
")",
"{",
"try",
"{",
"$",
"method",
"=",
"new",
"ReflectionMethod",
"(",
"$",
"className",
",",
"$",
"met... | Test if the method that will handled the hook is valid
@param string $className the namespace of the class
@param string $methodName the method name
@param bool $block tell if the hook is a block or a function
@return bool | [
"Test",
"if",
"the",
"method",
"that",
"will",
"handled",
"the",
"hook",
"is",
"valid"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/DependencyInjection/Compiler/RegisterHookListenersPass.php#L364-L390 | train |
thelia/core | lib/Thelia/Action/BaseAction.php | BaseAction.genericUpdatePosition | protected function genericUpdatePosition(ModelCriteria $query, UpdatePositionEvent $event, EventDispatcherInterface $dispatcher = null)
{
if (null !== $object = $query->findPk($event->getObjectId())) {
if (!isset(class_uses($object)['Thelia\Model\Tools\PositionManagementTrait'])) {
throw new \InvalidArgumentException("Your model does not implement the PositionManagementTrait trait");
}
$object->setDispatcher($dispatcher !== null ? $dispatcher : $event->getDispatcher());
$mode = $event->getMode();
if ($mode == UpdatePositionEvent::POSITION_ABSOLUTE) {
$object->changeAbsolutePosition($event->getPosition());
} elseif ($mode == UpdatePositionEvent::POSITION_UP) {
$object->movePositionUp();
} elseif ($mode == UpdatePositionEvent::POSITION_DOWN) {
$object->movePositionDown();
}
}
} | php | protected function genericUpdatePosition(ModelCriteria $query, UpdatePositionEvent $event, EventDispatcherInterface $dispatcher = null)
{
if (null !== $object = $query->findPk($event->getObjectId())) {
if (!isset(class_uses($object)['Thelia\Model\Tools\PositionManagementTrait'])) {
throw new \InvalidArgumentException("Your model does not implement the PositionManagementTrait trait");
}
$object->setDispatcher($dispatcher !== null ? $dispatcher : $event->getDispatcher());
$mode = $event->getMode();
if ($mode == UpdatePositionEvent::POSITION_ABSOLUTE) {
$object->changeAbsolutePosition($event->getPosition());
} elseif ($mode == UpdatePositionEvent::POSITION_UP) {
$object->movePositionUp();
} elseif ($mode == UpdatePositionEvent::POSITION_DOWN) {
$object->movePositionDown();
}
}
} | [
"protected",
"function",
"genericUpdatePosition",
"(",
"ModelCriteria",
"$",
"query",
",",
"UpdatePositionEvent",
"$",
"event",
",",
"EventDispatcherInterface",
"$",
"dispatcher",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"object",
"=",
"$",
"query",... | Changes object position, selecting absolute ou relative change.
@param ModelCriteria $query
@param UpdatePositionEvent $event
@param EventDispatcherInterface $dispatcher
@return null | [
"Changes",
"object",
"position",
"selecting",
"absolute",
"ou",
"relative",
"change",
"."
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Action/BaseAction.php#L34-L53 | train |
thelia/core | lib/Thelia/Action/BaseAction.php | BaseAction.genericUpdateSeo | protected function genericUpdateSeo(ModelCriteria $query, UpdateSeoEvent $event, EventDispatcherInterface $dispatcher = null)
{
if (null !== $object = $query->findPk($event->getObjectId())) {
$object
//for backward compatibility
->setDispatcher($dispatcher !== null ? $dispatcher : $event->getDispatcher())
->setLocale($event->getLocale())
->setMetaTitle($event->getMetaTitle())
->setMetaDescription($event->getMetaDescription())
->setMetaKeywords($event->getMetaKeywords())
->save()
;
// Update the rewritten URL, if required
try {
$object->setRewrittenUrl($event->getLocale(), $event->getUrl());
} catch (UrlRewritingException $e) {
throw new FormValidationException($e->getMessage(), $e->getCode());
}
$event->setObject($object);
}
return $object;
} | php | protected function genericUpdateSeo(ModelCriteria $query, UpdateSeoEvent $event, EventDispatcherInterface $dispatcher = null)
{
if (null !== $object = $query->findPk($event->getObjectId())) {
$object
//for backward compatibility
->setDispatcher($dispatcher !== null ? $dispatcher : $event->getDispatcher())
->setLocale($event->getLocale())
->setMetaTitle($event->getMetaTitle())
->setMetaDescription($event->getMetaDescription())
->setMetaKeywords($event->getMetaKeywords())
->save()
;
// Update the rewritten URL, if required
try {
$object->setRewrittenUrl($event->getLocale(), $event->getUrl());
} catch (UrlRewritingException $e) {
throw new FormValidationException($e->getMessage(), $e->getCode());
}
$event->setObject($object);
}
return $object;
} | [
"protected",
"function",
"genericUpdateSeo",
"(",
"ModelCriteria",
"$",
"query",
",",
"UpdateSeoEvent",
"$",
"event",
",",
"EventDispatcherInterface",
"$",
"dispatcher",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"object",
"=",
"$",
"query",
"->",
... | Changes SEO Fields for an object.
@param ModelCriteria $query
@param UpdateSeoEvent $event
@param EventDispatcherInterface $dispatcher
@return mixed an SEOxxx object
@throws FormValidationException if a rewritten URL cannot be created | [
"Changes",
"SEO",
"Fields",
"for",
"an",
"object",
"."
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Action/BaseAction.php#L93-L119 | train |
thelia/core | lib/Thelia/Action/BaseAction.php | BaseAction.genericToggleVisibility | public function genericToggleVisibility(ModelCriteria $query, ToggleVisibilityEvent $event, EventDispatcherInterface $dispatcher = null)
{
if (null !== $object = $query->findPk($event->getObjectId())) {
$newVisibility = !$object->getVisible();
$object
//for backward compatibility
->setDispatcher($dispatcher !== null ? $dispatcher : $event->getDispatcher())
->setVisible($newVisibility)
->save()
;
$event->setObject($object);
}
return $object;
} | php | public function genericToggleVisibility(ModelCriteria $query, ToggleVisibilityEvent $event, EventDispatcherInterface $dispatcher = null)
{
if (null !== $object = $query->findPk($event->getObjectId())) {
$newVisibility = !$object->getVisible();
$object
//for backward compatibility
->setDispatcher($dispatcher !== null ? $dispatcher : $event->getDispatcher())
->setVisible($newVisibility)
->save()
;
$event->setObject($object);
}
return $object;
} | [
"public",
"function",
"genericToggleVisibility",
"(",
"ModelCriteria",
"$",
"query",
",",
"ToggleVisibilityEvent",
"$",
"event",
",",
"EventDispatcherInterface",
"$",
"dispatcher",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"object",
"=",
"$",
"query"... | Toggle visibility for an object
@param ModelCriteria $query
@param ToggleVisibilityEvent $event
@param EventDispatcherInterface $dispatcher
@return mixed | [
"Toggle",
"visibility",
"for",
"an",
"object"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Action/BaseAction.php#L130-L145 | train |
thelia/core | lib/Thelia/Core/Template/Validator/TemplateDescriptorValidator.php | TemplateDescriptorValidator.schemaValidate | protected function schemaValidate(\DOMDocument $dom, \SplFileInfo $xsdFile)
{
$errorMessages = [];
try {
libxml_use_internal_errors(true);
if (!$dom->schemaValidate($xsdFile->getRealPath())) {
$errors = libxml_get_errors();
foreach ($errors as $error) {
$errorMessages[] = sprintf(
'XML error "%s" [%d] (Code %d) in %s on line %d column %d' . "\n",
$error->message,
$error->level,
$error->code,
$error->file,
$error->line,
$error->column
);
}
libxml_clear_errors();
}
libxml_use_internal_errors(false);
} catch (\Exception $ex) {
libxml_use_internal_errors(false);
}
return $errorMessages;
} | php | protected function schemaValidate(\DOMDocument $dom, \SplFileInfo $xsdFile)
{
$errorMessages = [];
try {
libxml_use_internal_errors(true);
if (!$dom->schemaValidate($xsdFile->getRealPath())) {
$errors = libxml_get_errors();
foreach ($errors as $error) {
$errorMessages[] = sprintf(
'XML error "%s" [%d] (Code %d) in %s on line %d column %d' . "\n",
$error->message,
$error->level,
$error->code,
$error->file,
$error->line,
$error->column
);
}
libxml_clear_errors();
}
libxml_use_internal_errors(false);
} catch (\Exception $ex) {
libxml_use_internal_errors(false);
}
return $errorMessages;
} | [
"protected",
"function",
"schemaValidate",
"(",
"\\",
"DOMDocument",
"$",
"dom",
",",
"\\",
"SplFileInfo",
"$",
"xsdFile",
")",
"{",
"$",
"errorMessages",
"=",
"[",
"]",
";",
"try",
"{",
"libxml_use_internal_errors",
"(",
"true",
")",
";",
"if",
"(",
"!",
... | Validate the schema of a XML file with a given xsd file
@param \DOMDocument $dom The XML document
@param \SplFileInfo $xsdFile The XSD file
@return array an array of errors if validation fails, otherwise an empty array | [
"Validate",
"the",
"schema",
"of",
"a",
"XML",
"file",
"with",
"a",
"given",
"xsd",
"file"
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/Template/Validator/TemplateDescriptorValidator.php#L94-L125 | train |
thelia/core | lib/Thelia/Core/EventListener/ViewListener.php | ViewListener.onKernelView | public function onKernelView(GetResponseForControllerResultEvent $event)
{
$parser = $this->container->get('thelia.parser');
$templateHelper = $this->container->get('thelia.template_helper');
$parser->setTemplateDefinition($templateHelper->getActiveFrontTemplate(), true);
$request = $this->container->get('request_stack')->getCurrentRequest();
$response = null;
try {
$view = $request->attributes->get('_view');
$viewId = $request->attributes->get($view . '_id');
$this->eventDispatcher->dispatch(TheliaEvents::VIEW_CHECK, new ViewCheckEvent($view, $viewId));
$content = $parser->render($view . '.html');
if ($content instanceof Response) {
$response = $content;
} else {
$response = new Response($content, $parser->getStatus() ?: 200);
}
} catch (ResourceNotFoundException $e) {
throw new NotFoundHttpException();
} catch (OrderException $e) {
switch ($e->getCode()) {
case OrderException::CART_EMPTY:
// Redirect to the cart template
$response = RedirectResponse::create($this->container->get('router.chainRequest')->generate($e->cartRoute, $e->arguments, Router::ABSOLUTE_URL));
break;
case OrderException::UNDEFINED_DELIVERY:
// Redirect to the delivery choice template
$response = RedirectResponse::create($this->container->get('router.chainRequest')->generate($e->orderDeliveryRoute, $e->arguments, Router::ABSOLUTE_URL));
break;
}
if (null === $response) {
throw $e;
}
}
$event->setResponse($response);
} | php | public function onKernelView(GetResponseForControllerResultEvent $event)
{
$parser = $this->container->get('thelia.parser');
$templateHelper = $this->container->get('thelia.template_helper');
$parser->setTemplateDefinition($templateHelper->getActiveFrontTemplate(), true);
$request = $this->container->get('request_stack')->getCurrentRequest();
$response = null;
try {
$view = $request->attributes->get('_view');
$viewId = $request->attributes->get($view . '_id');
$this->eventDispatcher->dispatch(TheliaEvents::VIEW_CHECK, new ViewCheckEvent($view, $viewId));
$content = $parser->render($view . '.html');
if ($content instanceof Response) {
$response = $content;
} else {
$response = new Response($content, $parser->getStatus() ?: 200);
}
} catch (ResourceNotFoundException $e) {
throw new NotFoundHttpException();
} catch (OrderException $e) {
switch ($e->getCode()) {
case OrderException::CART_EMPTY:
// Redirect to the cart template
$response = RedirectResponse::create($this->container->get('router.chainRequest')->generate($e->cartRoute, $e->arguments, Router::ABSOLUTE_URL));
break;
case OrderException::UNDEFINED_DELIVERY:
// Redirect to the delivery choice template
$response = RedirectResponse::create($this->container->get('router.chainRequest')->generate($e->orderDeliveryRoute, $e->arguments, Router::ABSOLUTE_URL));
break;
}
if (null === $response) {
throw $e;
}
}
$event->setResponse($response);
} | [
"public",
"function",
"onKernelView",
"(",
"GetResponseForControllerResultEvent",
"$",
"event",
")",
"{",
"$",
"parser",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'thelia.parser'",
")",
";",
"$",
"templateHelper",
"=",
"$",
"this",
"->",
"contain... | Launch the parser defined on the constructor and get the result.
The result is transform id needed into a Response object
@param \Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent $event | [
"Launch",
"the",
"parser",
"defined",
"on",
"the",
"constructor",
"and",
"get",
"the",
"result",
"."
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/EventListener/ViewListener.php#L64-L104 | train |
GrahamCampbell/Analyzer | src/NameVisitor.php | NameVisitor.enterNode | public function enterNode(Node $node)
{
if ($node instanceof ConstFetch || $node instanceof FuncCall) {
$node->name = null;
}
if ($node instanceof FullyQualified) {
$this->names[] = $node->toString();
}
return $node;
} | php | public function enterNode(Node $node)
{
if ($node instanceof ConstFetch || $node instanceof FuncCall) {
$node->name = null;
}
if ($node instanceof FullyQualified) {
$this->names[] = $node->toString();
}
return $node;
} | [
"public",
"function",
"enterNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"instanceof",
"ConstFetch",
"||",
"$",
"node",
"instanceof",
"FuncCall",
")",
"{",
"$",
"node",
"->",
"name",
"=",
"null",
";",
"}",
"if",
"(",
"$",
"node"... | Enter the node and record the name.
@param \PhpParser\Node $node
@return \PhpParser\Node | [
"Enter",
"the",
"node",
"and",
"record",
"the",
"name",
"."
] | e918797f052c001362bda65e7364026910608bef | https://github.com/GrahamCampbell/Analyzer/blob/e918797f052c001362bda65e7364026910608bef/src/NameVisitor.php#L55-L66 | train |
grom358/pharborist | src/Objects/SingleInheritanceNode.php | SingleInheritanceNode.getMethodNames | public function getMethodNames() {
return array_map(function (ClassMethodNode $node) {
return $node->getName()->getText();
}, $this->getMethods()->toArray());
} | php | public function getMethodNames() {
return array_map(function (ClassMethodNode $node) {
return $node->getName()->getText();
}, $this->getMethods()->toArray());
} | [
"public",
"function",
"getMethodNames",
"(",
")",
"{",
"return",
"array_map",
"(",
"function",
"(",
"ClassMethodNode",
"$",
"node",
")",
"{",
"return",
"$",
"node",
"->",
"getName",
"(",
")",
"->",
"getText",
"(",
")",
";",
"}",
",",
"$",
"this",
"->",... | Returns the names of all class methods, regardless of visibility.
@return string[] | [
"Returns",
"the",
"names",
"of",
"all",
"class",
"methods",
"regardless",
"of",
"visibility",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Objects/SingleInheritanceNode.php#L119-L123 | train |
grom358/pharborist | src/Objects/SingleInheritanceNode.php | SingleInheritanceNode.getProperty | public function getProperty($name) {
$name = ltrim($name, '$');
$properties = $this
->getProperties()
->filter(function (ClassMemberNode $property) use ($name) {
return ltrim($property->getName(), '$') === $name;
});
return $properties->isEmpty() ? NULL : $properties[0];
} | php | public function getProperty($name) {
$name = ltrim($name, '$');
$properties = $this
->getProperties()
->filter(function (ClassMemberNode $property) use ($name) {
return ltrim($property->getName(), '$') === $name;
});
return $properties->isEmpty() ? NULL : $properties[0];
} | [
"public",
"function",
"getProperty",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"ltrim",
"(",
"$",
"name",
",",
"'$'",
")",
";",
"$",
"properties",
"=",
"$",
"this",
"->",
"getProperties",
"(",
")",
"->",
"filter",
"(",
"function",
"(",
"ClassMemb... | Returns a property by name, if it exists.
@param string $name
The property name, with or without the $.
@return ClassMemberNode|NULL | [
"Returns",
"a",
"property",
"by",
"name",
"if",
"it",
"exists",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Objects/SingleInheritanceNode.php#L159-L168 | train |
grom358/pharborist | src/Objects/SingleInheritanceNode.php | SingleInheritanceNode.createProperty | public function createProperty($name, ExpressionNode $value = NULL, $visibility = 'public') {
return $this->appendProperty(ClassMemberNode::create($name, $value, $visibility));
} | php | public function createProperty($name, ExpressionNode $value = NULL, $visibility = 'public') {
return $this->appendProperty(ClassMemberNode::create($name, $value, $visibility));
} | [
"public",
"function",
"createProperty",
"(",
"$",
"name",
",",
"ExpressionNode",
"$",
"value",
"=",
"NULL",
",",
"$",
"visibility",
"=",
"'public'",
")",
"{",
"return",
"$",
"this",
"->",
"appendProperty",
"(",
"ClassMemberNode",
"::",
"create",
"(",
"$",
... | Creates a new property in this class.
@see ClassMemberNode::create
@param string $name
@param ExpressionNode $value
@param string $visibility
@return $this | [
"Creates",
"a",
"new",
"property",
"in",
"this",
"class",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Objects/SingleInheritanceNode.php#L198-L200 | train |
grom358/pharborist | src/Objects/SingleInheritanceNode.php | SingleInheritanceNode.appendProperty | public function appendProperty($property) {
if (is_string($property)) {
$property = ClassMemberListNode::create($property);
}
$properties = $this->statements->children(Filter::isInstanceOf('\Pharborist\ClassMemberListNode'));
if ($properties->count() === 0) {
$this->statements->firstChild()->after($property);
}
else {
$properties->last()->after($property);
}
FormatterFactory::format($this);
return $this;
} | php | public function appendProperty($property) {
if (is_string($property)) {
$property = ClassMemberListNode::create($property);
}
$properties = $this->statements->children(Filter::isInstanceOf('\Pharborist\ClassMemberListNode'));
if ($properties->count() === 0) {
$this->statements->firstChild()->after($property);
}
else {
$properties->last()->after($property);
}
FormatterFactory::format($this);
return $this;
} | [
"public",
"function",
"appendProperty",
"(",
"$",
"property",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"property",
")",
")",
"{",
"$",
"property",
"=",
"ClassMemberListNode",
"::",
"create",
"(",
"$",
"property",
")",
";",
"}",
"$",
"properties",
"=",... | Add property to class.
@param string|ClassMemberListNode $property
@return $this | [
"Add",
"property",
"to",
"class",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/Objects/SingleInheritanceNode.php#L208-L221 | train |
grom358/pharborist | src/DocCommentNode.php | DocCommentNode.create | public static function create($comment) {
$comment = trim($comment);
$lines = array_map('trim', explode("\n", $comment));
$text = "/**\n";
foreach ($lines as $i => $line) {
$text .= ' * ' . $line . "\n";
}
$text .= ' */';
return new DocCommentNode(T_DOC_COMMENT, $text);
} | php | public static function create($comment) {
$comment = trim($comment);
$lines = array_map('trim', explode("\n", $comment));
$text = "/**\n";
foreach ($lines as $i => $line) {
$text .= ' * ' . $line . "\n";
}
$text .= ' */';
return new DocCommentNode(T_DOC_COMMENT, $text);
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"comment",
")",
"{",
"$",
"comment",
"=",
"trim",
"(",
"$",
"comment",
")",
";",
"$",
"lines",
"=",
"array_map",
"(",
"'trim'",
",",
"explode",
"(",
"\"\\n\"",
",",
"$",
"comment",
")",
")",
";",
... | Creates a PHPDoc comment.
@param string $comment
The comment body without asterisks, but formatted into lines.
@return DocCommentNode | [
"Creates",
"a",
"PHPDoc",
"comment",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/DocCommentNode.php#L26-L35 | train |
grom358/pharborist | src/DocCommentNode.php | DocCommentNode.setIndent | public function setIndent($indent) {
$lines = explode("\n", $this->text);
if (count($lines) === 1) {
return $this;
}
$comment = '';
$last_index = count($lines) - 1;
foreach ($lines as $i => $line) {
if ($i === 0) {
$comment .= trim($line) . "\n";
}
elseif ($i === $last_index) {
$comment .= $indent . ' ' . trim($line);
}
else {
$comment .= $indent . ' ' . trim($line) . "\n";
}
}
$this->setText($comment);
return $this;
} | php | public function setIndent($indent) {
$lines = explode("\n", $this->text);
if (count($lines) === 1) {
return $this;
}
$comment = '';
$last_index = count($lines) - 1;
foreach ($lines as $i => $line) {
if ($i === 0) {
$comment .= trim($line) . "\n";
}
elseif ($i === $last_index) {
$comment .= $indent . ' ' . trim($line);
}
else {
$comment .= $indent . ' ' . trim($line) . "\n";
}
}
$this->setText($comment);
return $this;
} | [
"public",
"function",
"setIndent",
"(",
"$",
"indent",
")",
"{",
"$",
"lines",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"this",
"->",
"text",
")",
";",
"if",
"(",
"count",
"(",
"$",
"lines",
")",
"===",
"1",
")",
"{",
"return",
"$",
"this",
";",... | Set indent for document comment.
@param string $indent
Whitespace to use as indent.
@return $this | [
"Set",
"indent",
"for",
"document",
"comment",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/DocCommentNode.php#L44-L64 | train |
grom358/pharborist | src/DocCommentNode.php | DocCommentNode.getDocBlock | public function getDocBlock() {
if ($this->docBlock === NULL) {
$namespace = '\\';
$aliases = array();
/** @var NamespaceNode $namespace_node */
$namespace_node = $this->closest(Filter::isInstanceOf('\Pharborist\Namespaces\NamespaceNode'));
if ($namespace_node !== NULL) {
$namespace = $namespace_node->getName() ? $namespace_node->getName()->getAbsolutePath() : '';
$aliases = $namespace_node->getClassAliases();
} else {
/** @var RootNode $root_node */
$root_node = $this->closest(Filter::isInstanceOf('\Pharborist\RootNode'));
if ($root_node !== NULL) {
$aliases = $root_node->getClassAliases();
}
}
$context = new DocBlock\Context($namespace, $aliases);
$this->docBlock = new DocBlock($this->text, $context);
}
return $this->docBlock;
} | php | public function getDocBlock() {
if ($this->docBlock === NULL) {
$namespace = '\\';
$aliases = array();
/** @var NamespaceNode $namespace_node */
$namespace_node = $this->closest(Filter::isInstanceOf('\Pharborist\Namespaces\NamespaceNode'));
if ($namespace_node !== NULL) {
$namespace = $namespace_node->getName() ? $namespace_node->getName()->getAbsolutePath() : '';
$aliases = $namespace_node->getClassAliases();
} else {
/** @var RootNode $root_node */
$root_node = $this->closest(Filter::isInstanceOf('\Pharborist\RootNode'));
if ($root_node !== NULL) {
$aliases = $root_node->getClassAliases();
}
}
$context = new DocBlock\Context($namespace, $aliases);
$this->docBlock = new DocBlock($this->text, $context);
}
return $this->docBlock;
} | [
"public",
"function",
"getDocBlock",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"docBlock",
"===",
"NULL",
")",
"{",
"$",
"namespace",
"=",
"'\\\\'",
";",
"$",
"aliases",
"=",
"array",
"(",
")",
";",
"/** @var NamespaceNode $namespace_node */",
"$",
"nam... | Return the parsed doc comment.
@return DocBlock
Parsed doc comment. | [
"Return",
"the",
"parsed",
"doc",
"comment",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/DocCommentNode.php#L77-L97 | train |
grom358/pharborist | src/DocCommentNode.php | DocCommentNode.getParametersByName | public function getParametersByName() {
$param_tags = $this->getDocBlock()->getTagsByName('param');
$parameters = array();
/** @var \phpDocumentor\Reflection\DocBlock\Tag\ParamTag $param_tag */
foreach ($param_tags as $param_tag) {
$name = ltrim($param_tag->getVariableName(), '$');
$parameters[$name] = $param_tag;
}
return $parameters;
} | php | public function getParametersByName() {
$param_tags = $this->getDocBlock()->getTagsByName('param');
$parameters = array();
/** @var \phpDocumentor\Reflection\DocBlock\Tag\ParamTag $param_tag */
foreach ($param_tags as $param_tag) {
$name = ltrim($param_tag->getVariableName(), '$');
$parameters[$name] = $param_tag;
}
return $parameters;
} | [
"public",
"function",
"getParametersByName",
"(",
")",
"{",
"$",
"param_tags",
"=",
"$",
"this",
"->",
"getDocBlock",
"(",
")",
"->",
"getTagsByName",
"(",
"'param'",
")",
";",
"$",
"parameters",
"=",
"array",
"(",
")",
";",
"/** @var \\phpDocumentor\\Reflecti... | Get the parameter tags by name.
@return DocBlock\Tag\ParamTag[]
Associative array of parameter names to parameters. | [
"Get",
"the",
"parameter",
"tags",
"by",
"name",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/DocCommentNode.php#L146-L155 | train |
grom358/pharborist | src/DocCommentNode.php | DocCommentNode.getParameter | public function getParameter($parameterName) {
$parameterName = ltrim($parameterName, '$');
$param_tags = $this->getDocBlock()->getTagsByName('param');
/** @var \phpDocumentor\Reflection\DocBlock\Tag\ParamTag $param_tag */
foreach ($param_tags as $param_tag) {
if (ltrim($param_tag->getVariableName(), '$') === $parameterName) {
return $param_tag;
}
}
return NULL;
} | php | public function getParameter($parameterName) {
$parameterName = ltrim($parameterName, '$');
$param_tags = $this->getDocBlock()->getTagsByName('param');
/** @var \phpDocumentor\Reflection\DocBlock\Tag\ParamTag $param_tag */
foreach ($param_tags as $param_tag) {
if (ltrim($param_tag->getVariableName(), '$') === $parameterName) {
return $param_tag;
}
}
return NULL;
} | [
"public",
"function",
"getParameter",
"(",
"$",
"parameterName",
")",
"{",
"$",
"parameterName",
"=",
"ltrim",
"(",
"$",
"parameterName",
",",
"'$'",
")",
";",
"$",
"param_tags",
"=",
"$",
"this",
"->",
"getDocBlock",
"(",
")",
"->",
"getTagsByName",
"(",
... | Get a parameter tag.
@param $parameterName
Name of parameter to get tag for.
@return null|DocBlock\Tag\ParamTag
The tag for parameter. | [
"Get",
"a",
"parameter",
"tag",
"."
] | 0db9e51299a80e95b06857ed1809f59bbbab1af6 | https://github.com/grom358/pharborist/blob/0db9e51299a80e95b06857ed1809f59bbbab1af6/src/DocCommentNode.php#L166-L176 | train |
NotifyMeHQ/notifyme | src/Adapters/Pagerduty/PagerdutyFactory.php | PagerdutyFactory.make | public function make(array $config)
{
Arr::requires($config, ['token']);
$client = new Client();
return new PagerdutyGateway($client, $config);
} | php | public function make(array $config)
{
Arr::requires($config, ['token']);
$client = new Client();
return new PagerdutyGateway($client, $config);
} | [
"public",
"function",
"make",
"(",
"array",
"$",
"config",
")",
"{",
"Arr",
"::",
"requires",
"(",
"$",
"config",
",",
"[",
"'token'",
"]",
")",
";",
"$",
"client",
"=",
"new",
"Client",
"(",
")",
";",
"return",
"new",
"PagerdutyGateway",
"(",
"$",
... | Create a new pagerduty gateway instance.
@param string[] $config
@return \NotifyMeHQ\Adapters\Pagerduty\PagerdutyGateway | [
"Create",
"a",
"new",
"pagerduty",
"gateway",
"instance",
"."
] | 2af4bdcfe9df6db7ea79e2dce90b106ccb285b06 | https://github.com/NotifyMeHQ/notifyme/blob/2af4bdcfe9df6db7ea79e2dce90b106ccb285b06/src/Adapters/Pagerduty/PagerdutyFactory.php#L27-L34 | train |
elboletaire/less-cake-plugin | src/View/Helper/LessHelper.php | LessHelper.fetch | public function fetch(array $options = [], array $modifyVars = [])
{
if (empty($options['overwrite'])) {
$options['overwrite'] = true;
}
$overwrite = $options['overwrite'];
unset($options['overwrite']);
$matches = $css = $less = [];
preg_match_all('@(<link[^>]+>)@', $this->_View->fetch('css'), $matches);
if (empty($matches)) {
return null;
}
$matches = array_shift($matches);
foreach ($matches as $stylesheet) {
if (strpos($stylesheet, 'rel="stylesheet/less"') !== false) {
$match = [];
preg_match('@href="([^"]+)"@', $stylesheet, $match);
$file = rtrim(array_pop($match), '?');
array_push($less, $this->less($file, $options, $modifyVars));
continue;
}
array_push($css, $stylesheet);
}
if ($overwrite) {
$this->_View->Blocks->set('css', join($css));
}
return join($less);
} | php | public function fetch(array $options = [], array $modifyVars = [])
{
if (empty($options['overwrite'])) {
$options['overwrite'] = true;
}
$overwrite = $options['overwrite'];
unset($options['overwrite']);
$matches = $css = $less = [];
preg_match_all('@(<link[^>]+>)@', $this->_View->fetch('css'), $matches);
if (empty($matches)) {
return null;
}
$matches = array_shift($matches);
foreach ($matches as $stylesheet) {
if (strpos($stylesheet, 'rel="stylesheet/less"') !== false) {
$match = [];
preg_match('@href="([^"]+)"@', $stylesheet, $match);
$file = rtrim(array_pop($match), '?');
array_push($less, $this->less($file, $options, $modifyVars));
continue;
}
array_push($css, $stylesheet);
}
if ($overwrite) {
$this->_View->Blocks->set('css', join($css));
}
return join($less);
} | [
"public",
"function",
"fetch",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"array",
"$",
"modifyVars",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"options",
"[",
"'overwrite'",
"]",
")",
")",
"{",
"$",
"options",
"[",
"'overwrite'... | Fetches less stylesheets added to css block
and compiles them
@param array $options Options passed to less method.
@param array $modifyVars ModifyVars passed to less method.
@return string Resulting parsed files. | [
"Fetches",
"less",
"stylesheets",
"added",
"to",
"css",
"block",
"and",
"compiles",
"them"
] | 0cf60b35db2d53aef7adb050504171bc6bcd313c | https://github.com/elboletaire/less-cake-plugin/blob/0cf60b35db2d53aef7adb050504171bc6bcd313c/src/View/Helper/LessHelper.php#L92-L125 | train |
elboletaire/less-cake-plugin | src/View/Helper/LessHelper.php | LessHelper.less | public function less($less = 'styles.less', array $options = [], array $modifyVars = [])
{
$options = $this->setOptions($options);
$less = (array)$less;
if ($options['js']['env'] == 'development') {
return $this->jsBlock($less, $options);
}
try {
$css = $this->compile($less, $options['cache'], $options['parser'], $modifyVars);
if (isset($options['tag']) && !$options['tag']) {
return $css;
}
if (!$options['cache']) {
return $this->Html->formatTemplate('style', ['content' => $css]);
}
return $this->Html->css($css);
} catch (\Exception $e) {
// env must be development in order to see errors on-screen
if (Configure::read('debug')) {
$options['js']['env'] = 'development';
}
$this->error = $e->getMessage();
Log::write('error', "Error compiling less file: " . $this->error);
return $this->jsBlock($less, $options);
}
} | php | public function less($less = 'styles.less', array $options = [], array $modifyVars = [])
{
$options = $this->setOptions($options);
$less = (array)$less;
if ($options['js']['env'] == 'development') {
return $this->jsBlock($less, $options);
}
try {
$css = $this->compile($less, $options['cache'], $options['parser'], $modifyVars);
if (isset($options['tag']) && !$options['tag']) {
return $css;
}
if (!$options['cache']) {
return $this->Html->formatTemplate('style', ['content' => $css]);
}
return $this->Html->css($css);
} catch (\Exception $e) {
// env must be development in order to see errors on-screen
if (Configure::read('debug')) {
$options['js']['env'] = 'development';
}
$this->error = $e->getMessage();
Log::write('error', "Error compiling less file: " . $this->error);
return $this->jsBlock($less, $options);
}
} | [
"public",
"function",
"less",
"(",
"$",
"less",
"=",
"'styles.less'",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"array",
"$",
"modifyVars",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"setOptions",
"(",
"$",
"options",
... | Compiles any less files passed and returns the compiled css.
In case of error, it will load less with the javascritp parser so you'll be
able to see any errors on screen. If not, check out the error.log file in your
CakePHP's logs folder.
@param mixed $less The input .less file to be compiled or an array
of .less files.
@param array $options Options in 'js' key will be pased to the less.js
parser and options in 'parser' will be passed to the less.php parser.
@param array $modifyVars Array of modify vars.
@return string | [
"Compiles",
"any",
"less",
"files",
"passed",
"and",
"returns",
"the",
"compiled",
"css",
".",
"In",
"case",
"of",
"error",
"it",
"will",
"load",
"less",
"with",
"the",
"javascritp",
"parser",
"so",
"you",
"ll",
"be",
"able",
"to",
"see",
"any",
"errors"... | 0cf60b35db2d53aef7adb050504171bc6bcd313c | https://github.com/elboletaire/less-cake-plugin/blob/0cf60b35db2d53aef7adb050504171bc6bcd313c/src/View/Helper/LessHelper.php#L140-L169 | train |
elboletaire/less-cake-plugin | src/View/Helper/LessHelper.php | LessHelper.jsBlock | protected function jsBlock($less, array $options = [])
{
$return = '';
$less = (array)$less;
// Append the user less files
foreach ($less as $les) {
$return .= $this->Html->meta('link', null, [
'link' => $les,
'rel' => 'stylesheet/less'
]);
}
// Less.js configuration
$return .= $this->Html->scriptBlock(sprintf('less = %s;', json_encode($options['js'], JSON_UNESCAPED_SLASHES)));
// <script> tag for less.js file
$return .= $this->Html->script($options['less']);
return $return;
} | php | protected function jsBlock($less, array $options = [])
{
$return = '';
$less = (array)$less;
// Append the user less files
foreach ($less as $les) {
$return .= $this->Html->meta('link', null, [
'link' => $les,
'rel' => 'stylesheet/less'
]);
}
// Less.js configuration
$return .= $this->Html->scriptBlock(sprintf('less = %s;', json_encode($options['js'], JSON_UNESCAPED_SLASHES)));
// <script> tag for less.js file
$return .= $this->Html->script($options['less']);
return $return;
} | [
"protected",
"function",
"jsBlock",
"(",
"$",
"less",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"return",
"=",
"''",
";",
"$",
"less",
"=",
"(",
"array",
")",
"$",
"less",
";",
"// Append the user less files",
"foreach",
"(",
"$",
"... | Returns the required script and link tags to get less.js working
@param string $less The input .less file to be loaded.
@param array $options An array of options to be passed to the `less` configuration var.
@return string The link + script tags need to launch lesscss. | [
"Returns",
"the",
"required",
"script",
"and",
"link",
"tags",
"to",
"get",
"less",
".",
"js",
"working"
] | 0cf60b35db2d53aef7adb050504171bc6bcd313c | https://github.com/elboletaire/less-cake-plugin/blob/0cf60b35db2d53aef7adb050504171bc6bcd313c/src/View/Helper/LessHelper.php#L178-L196 | train |
elboletaire/less-cake-plugin | src/View/Helper/LessHelper.php | LessHelper.compile | protected function compile(array $input, $cache, array $options = [], array $modifyVars = [])
{
$parse = $this->prepareInputFilesForParsing($input);
if ($cache) {
$options += ['cache_dir' => $this->cssPath];
return \Less_Cache::Get($parse, $options, $modifyVars);
}
$lessc = new \Less_Parser($options);
foreach ($parse as $file => $path) {
$lessc->parseFile($file, $path);
}
// ModifyVars must be called at the bottom of the parsing,
// this way we're ensuring they override their default values.
// http://lesscss.org/usage/#command-line-usage-modify-variable
$lessc->ModifyVars($modifyVars);
return $lessc->getCss();
} | php | protected function compile(array $input, $cache, array $options = [], array $modifyVars = [])
{
$parse = $this->prepareInputFilesForParsing($input);
if ($cache) {
$options += ['cache_dir' => $this->cssPath];
return \Less_Cache::Get($parse, $options, $modifyVars);
}
$lessc = new \Less_Parser($options);
foreach ($parse as $file => $path) {
$lessc->parseFile($file, $path);
}
// ModifyVars must be called at the bottom of the parsing,
// this way we're ensuring they override their default values.
// http://lesscss.org/usage/#command-line-usage-modify-variable
$lessc->ModifyVars($modifyVars);
return $lessc->getCss();
} | [
"protected",
"function",
"compile",
"(",
"array",
"$",
"input",
",",
"$",
"cache",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"array",
"$",
"modifyVars",
"=",
"[",
"]",
")",
"{",
"$",
"parse",
"=",
"$",
"this",
"->",
"prepareInputFilesForParsing... | Compiles an input less file to an output css file using the PHP compiler.
@param array $input The input .less files to be compiled.
@param array $options Options to be passed to the php parser.
@param array $modifyVars Less modifyVars.
@param bool $cache Whether to cache or not.
@return string If cache is not enabled will return the full
CSS compiled. Otherwise it will return the
resulting filename from the compilation. | [
"Compiles",
"an",
"input",
"less",
"file",
"to",
"an",
"output",
"css",
"file",
"using",
"the",
"PHP",
"compiler",
"."
] | 0cf60b35db2d53aef7adb050504171bc6bcd313c | https://github.com/elboletaire/less-cake-plugin/blob/0cf60b35db2d53aef7adb050504171bc6bcd313c/src/View/Helper/LessHelper.php#L209-L229 | train |
elboletaire/less-cake-plugin | src/View/Helper/LessHelper.php | LessHelper.prepareInputFilesForParsing | protected function prepareInputFilesForParsing(array $input = [])
{
$parse = [];
foreach ($input as $in) {
$less = realpath(WWW_ROOT . $in);
// If we have plugin notation (Plugin.less/file.less)
// ensure to properly load the files
list($plugin, $basefile) = $this->_View->pluginSplit($in, false);
if (!empty($plugin)) {
$less = realpath(Plugin::path($plugin) . 'webroot' . DS . $basefile);
if ($less !== false) {
$parse[$less] = $this->assetBaseUrl($plugin, $basefile);
continue;
}
}
if ($less !== false) {
$parse[$less] = '';
continue;
}
// Plugins without plugin notation (/plugin/less/file.less)
list($plugin, $basefile) = $this->assetSplit($in);
if ($file = $this->pluginAssetFile([$plugin, $basefile])) {
$parse[$file] = $this->assetBaseUrl($plugin, $basefile);
continue;
}
// Will probably throw a not found error
$parse[$in] = '';
}
return $parse;
} | php | protected function prepareInputFilesForParsing(array $input = [])
{
$parse = [];
foreach ($input as $in) {
$less = realpath(WWW_ROOT . $in);
// If we have plugin notation (Plugin.less/file.less)
// ensure to properly load the files
list($plugin, $basefile) = $this->_View->pluginSplit($in, false);
if (!empty($plugin)) {
$less = realpath(Plugin::path($plugin) . 'webroot' . DS . $basefile);
if ($less !== false) {
$parse[$less] = $this->assetBaseUrl($plugin, $basefile);
continue;
}
}
if ($less !== false) {
$parse[$less] = '';
continue;
}
// Plugins without plugin notation (/plugin/less/file.less)
list($plugin, $basefile) = $this->assetSplit($in);
if ($file = $this->pluginAssetFile([$plugin, $basefile])) {
$parse[$file] = $this->assetBaseUrl($plugin, $basefile);
continue;
}
// Will probably throw a not found error
$parse[$in] = '';
}
return $parse;
} | [
"protected",
"function",
"prepareInputFilesForParsing",
"(",
"array",
"$",
"input",
"=",
"[",
"]",
")",
"{",
"$",
"parse",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"input",
"as",
"$",
"in",
")",
"{",
"$",
"less",
"=",
"realpath",
"(",
"WWW_ROOT",
"."... | Prepares input files as Less.php parser wants them.
@param array $input An array with all the input files.
@return array | [
"Prepares",
"input",
"files",
"as",
"Less",
".",
"php",
"parser",
"wants",
"them",
"."
] | 0cf60b35db2d53aef7adb050504171bc6bcd313c | https://github.com/elboletaire/less-cake-plugin/blob/0cf60b35db2d53aef7adb050504171bc6bcd313c/src/View/Helper/LessHelper.php#L237-L269 | train |
elboletaire/less-cake-plugin | src/View/Helper/LessHelper.php | LessHelper.setOptions | protected function setOptions(array $options)
{
// @codeCoverageIgnoreStart
$this->parserDefaults = array_merge($this->parserDefaults, [
// The import callback ensures that if a file is not found in the
// app's webroot, it will search for that file in its plugin's
// webroot path
'import_callback' => function ($lessTree) {
if ($pathAndUri = $lessTree->PathAndUri()) {
return $pathAndUri;
}
$file = $lessTree->getPath();
list($plugin, $basefile) = $this->assetSplit($file);
$file = $this->pluginAssetFile([$plugin, $basefile]);
if ($file) {
return [
$file,
$this->assetBaseUrl($plugin, $basefile)
];
}
return null;
}
]);
// @codeCoverageIgnoreEnd
if (empty($options['parser'])) {
$options['parser'] = [];
}
if (Configure::read('debug') && !isset($options['parser']['sourceMap'])) {
$options['parser']['sourceMap'] = true;
}
$options['parser'] = array_merge($this->parserDefaults, $options['parser']);
if (empty($options['js'])) {
$options['js'] = [];
}
$options['js'] = array_merge($this->lessjsDefaults, $options['js']);
if (empty($options['less'])) {
$options['less'] = 'Less.less.min';
}
if (!isset($options['cache'])) {
$options['cache'] = true;
}
return $options;
} | php | protected function setOptions(array $options)
{
// @codeCoverageIgnoreStart
$this->parserDefaults = array_merge($this->parserDefaults, [
// The import callback ensures that if a file is not found in the
// app's webroot, it will search for that file in its plugin's
// webroot path
'import_callback' => function ($lessTree) {
if ($pathAndUri = $lessTree->PathAndUri()) {
return $pathAndUri;
}
$file = $lessTree->getPath();
list($plugin, $basefile) = $this->assetSplit($file);
$file = $this->pluginAssetFile([$plugin, $basefile]);
if ($file) {
return [
$file,
$this->assetBaseUrl($plugin, $basefile)
];
}
return null;
}
]);
// @codeCoverageIgnoreEnd
if (empty($options['parser'])) {
$options['parser'] = [];
}
if (Configure::read('debug') && !isset($options['parser']['sourceMap'])) {
$options['parser']['sourceMap'] = true;
}
$options['parser'] = array_merge($this->parserDefaults, $options['parser']);
if (empty($options['js'])) {
$options['js'] = [];
}
$options['js'] = array_merge($this->lessjsDefaults, $options['js']);
if (empty($options['less'])) {
$options['less'] = 'Less.less.min';
}
if (!isset($options['cache'])) {
$options['cache'] = true;
}
return $options;
} | [
"protected",
"function",
"setOptions",
"(",
"array",
"$",
"options",
")",
"{",
"// @codeCoverageIgnoreStart",
"$",
"this",
"->",
"parserDefaults",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"parserDefaults",
",",
"[",
"// The import callback ensures that if a file is n... | Sets the less configuration var options based on the ones given by the user
and our default ones.
Here's also where we define the import_callback used by less.php parser,
so it can find files successfully even if they're on plugin folders.
@param array $options An array of options containing our options
combined with the ones for the parsers.
@return array $options The resulting $options array. | [
"Sets",
"the",
"less",
"configuration",
"var",
"options",
"based",
"on",
"the",
"ones",
"given",
"by",
"the",
"user",
"and",
"our",
"default",
"ones",
"."
] | 0cf60b35db2d53aef7adb050504171bc6bcd313c | https://github.com/elboletaire/less-cake-plugin/blob/0cf60b35db2d53aef7adb050504171bc6bcd313c/src/View/Helper/LessHelper.php#L282-L332 | train |
elboletaire/less-cake-plugin | src/View/Helper/LessHelper.php | LessHelper.assetBaseUrl | protected function assetBaseUrl($plugin, $asset)
{
$dir = dirname($asset);
$path = !empty($dir) && $dir != '.' ? "/$dir" : null;
return $this->Url->assetUrl($plugin . $path);
} | php | protected function assetBaseUrl($plugin, $asset)
{
$dir = dirname($asset);
$path = !empty($dir) && $dir != '.' ? "/$dir" : null;
return $this->Url->assetUrl($plugin . $path);
} | [
"protected",
"function",
"assetBaseUrl",
"(",
"$",
"plugin",
",",
"$",
"asset",
")",
"{",
"$",
"dir",
"=",
"dirname",
"(",
"$",
"asset",
")",
";",
"$",
"path",
"=",
"!",
"empty",
"(",
"$",
"dir",
")",
"&&",
"$",
"dir",
"!=",
"'.'",
"?",
"\"/$dir\... | Returns tha full base url for the given asset
@param string $plugin Plugin where the asset resides.
@param string $asset The asset path.
@return string | [
"Returns",
"tha",
"full",
"base",
"url",
"for",
"the",
"given",
"asset"
] | 0cf60b35db2d53aef7adb050504171bc6bcd313c | https://github.com/elboletaire/less-cake-plugin/blob/0cf60b35db2d53aef7adb050504171bc6bcd313c/src/View/Helper/LessHelper.php#L341-L347 | train |
elboletaire/less-cake-plugin | src/View/Helper/LessHelper.php | LessHelper.pluginAssetFile | protected function pluginAssetFile(array $url)
{
list($plugin, $basefile) = $url;
if ($plugin && Plugin::loaded($plugin)) {
return realpath(Plugin::path($plugin) . 'webroot' . DS . $basefile);
}
return false;
} | php | protected function pluginAssetFile(array $url)
{
list($plugin, $basefile) = $url;
if ($plugin && Plugin::loaded($plugin)) {
return realpath(Plugin::path($plugin) . 'webroot' . DS . $basefile);
}
return false;
} | [
"protected",
"function",
"pluginAssetFile",
"(",
"array",
"$",
"url",
")",
"{",
"list",
"(",
"$",
"plugin",
",",
"$",
"basefile",
")",
"=",
"$",
"url",
";",
"if",
"(",
"$",
"plugin",
"&&",
"Plugin",
"::",
"loaded",
"(",
"$",
"plugin",
")",
")",
"{"... | Builds asset file path for a plugin based on url.
@param string $url Asset URL.
@return string Absolute path for asset file. | [
"Builds",
"asset",
"file",
"path",
"for",
"a",
"plugin",
"based",
"on",
"url",
"."
] | 0cf60b35db2d53aef7adb050504171bc6bcd313c | https://github.com/elboletaire/less-cake-plugin/blob/0cf60b35db2d53aef7adb050504171bc6bcd313c/src/View/Helper/LessHelper.php#L355-L364 | train |
elboletaire/less-cake-plugin | src/View/Helper/LessHelper.php | LessHelper.assetSplit | protected function assetSplit($url)
{
$basefile = ltrim(ltrim($url, '.'), '/');
$exploded = explode('/', $basefile);
$plugin = Inflector::camelize(array_shift($exploded));
$basefile = implode(DS, $exploded);
return [
$plugin, $basefile
];
} | php | protected function assetSplit($url)
{
$basefile = ltrim(ltrim($url, '.'), '/');
$exploded = explode('/', $basefile);
$plugin = Inflector::camelize(array_shift($exploded));
$basefile = implode(DS, $exploded);
return [
$plugin, $basefile
];
} | [
"protected",
"function",
"assetSplit",
"(",
"$",
"url",
")",
"{",
"$",
"basefile",
"=",
"ltrim",
"(",
"ltrim",
"(",
"$",
"url",
",",
"'.'",
")",
",",
"'/'",
")",
";",
"$",
"exploded",
"=",
"explode",
"(",
"'/'",
",",
"$",
"basefile",
")",
";",
"$... | Splits an asset URL
@param string $url Asset URL.
@return array The plugin as first key and the rest basefile as second key. | [
"Splits",
"an",
"asset",
"URL"
] | 0cf60b35db2d53aef7adb050504171bc6bcd313c | https://github.com/elboletaire/less-cake-plugin/blob/0cf60b35db2d53aef7adb050504171bc6bcd313c/src/View/Helper/LessHelper.php#L372-L382 | train |
NotifyMeHQ/notifyme | src/Adapters/Pushover/PushoverFactory.php | PushoverFactory.make | public function make(array $config)
{
Arr::requires($config, ['token']);
$client = new Client();
return new PushoverGateway($client, $config);
} | php | public function make(array $config)
{
Arr::requires($config, ['token']);
$client = new Client();
return new PushoverGateway($client, $config);
} | [
"public",
"function",
"make",
"(",
"array",
"$",
"config",
")",
"{",
"Arr",
"::",
"requires",
"(",
"$",
"config",
",",
"[",
"'token'",
"]",
")",
";",
"$",
"client",
"=",
"new",
"Client",
"(",
")",
";",
"return",
"new",
"PushoverGateway",
"(",
"$",
... | Create a new pushover gateway instance.
@param string[] $config
@return \NotifyMeHQ\Adapters\Pushover\PushoverGateway | [
"Create",
"a",
"new",
"pushover",
"gateway",
"instance",
"."
] | 2af4bdcfe9df6db7ea79e2dce90b106ccb285b06 | https://github.com/NotifyMeHQ/notifyme/blob/2af4bdcfe9df6db7ea79e2dce90b106ccb285b06/src/Adapters/Pushover/PushoverFactory.php#L27-L34 | train |
thelia/core | lib/Thelia/Core/Template/Element/LoopResult.php | LoopResult.finalizeRows | public function finalizeRows()
{
// Fix rows LOOP_TOTAL if parseResults() did not added all resultsCollection items to the collection array
// see https://github.com/thelia/thelia/issues/2337
if (true === $this->countable && $this->getResultDataCollectionCount() !== $realCount = $this->getCount()) {
foreach ($this->collection as &$item) {
$item->set('LOOP_TOTAL', $realCount);
}
}
} | php | public function finalizeRows()
{
// Fix rows LOOP_TOTAL if parseResults() did not added all resultsCollection items to the collection array
// see https://github.com/thelia/thelia/issues/2337
if (true === $this->countable && $this->getResultDataCollectionCount() !== $realCount = $this->getCount()) {
foreach ($this->collection as &$item) {
$item->set('LOOP_TOTAL', $realCount);
}
}
} | [
"public",
"function",
"finalizeRows",
"(",
")",
"{",
"// Fix rows LOOP_TOTAL if parseResults() did not added all resultsCollection items to the collection array",
"// see https://github.com/thelia/thelia/issues/2337",
"if",
"(",
"true",
"===",
"$",
"this",
"->",
"countable",
"&&",
... | Adjust the collection once all results have been added. | [
"Adjust",
"the",
"collection",
"once",
"all",
"results",
"have",
"been",
"added",
"."
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Core/Template/Element/LoopResult.php#L97-L106 | train |
jomweb/ringgit | src/MYR.php | MYR.parse | public static function parse(string $amount)
{
$parser = new DecimalMoneyParser(new ISOCurrencies());
return static::given(
$parser->parse($amount, new Currency('MYR'))->getAmount()
);
} | php | public static function parse(string $amount)
{
$parser = new DecimalMoneyParser(new ISOCurrencies());
return static::given(
$parser->parse($amount, new Currency('MYR'))->getAmount()
);
} | [
"public",
"static",
"function",
"parse",
"(",
"string",
"$",
"amount",
")",
"{",
"$",
"parser",
"=",
"new",
"DecimalMoneyParser",
"(",
"new",
"ISOCurrencies",
"(",
")",
")",
";",
"return",
"static",
"::",
"given",
"(",
"$",
"parser",
"->",
"parse",
"(",
... | Parse value as ringgit.
@param string $amount
@return static | [
"Parse",
"value",
"as",
"ringgit",
"."
] | d444f994bafabfbfa063cce2017500ebf2aa35f7 | https://github.com/jomweb/ringgit/blob/d444f994bafabfbfa063cce2017500ebf2aa35f7/src/MYR.php#L60-L67 | train |
thelia/core | lib/Thelia/Model/AreaDeliveryModuleQuery.php | AreaDeliveryModuleQuery.findByCountryAndModule | public function findByCountryAndModule(Country $country, Module $module, State $state = null)
{
$response = null;
$countryInAreaList = CountryAreaQuery::findByCountryAndState($country, $state);
/** @var CountryArea $countryInArea */
foreach ($countryInAreaList as $countryInArea) {
$response = self::create()->filterByAreaId($countryInArea->getAreaId())
->filterByModule($module)
->findOne()
;
if ($response !== null) {
break;
}
}
return $response;
} | php | public function findByCountryAndModule(Country $country, Module $module, State $state = null)
{
$response = null;
$countryInAreaList = CountryAreaQuery::findByCountryAndState($country, $state);
/** @var CountryArea $countryInArea */
foreach ($countryInAreaList as $countryInArea) {
$response = self::create()->filterByAreaId($countryInArea->getAreaId())
->filterByModule($module)
->findOne()
;
if ($response !== null) {
break;
}
}
return $response;
} | [
"public",
"function",
"findByCountryAndModule",
"(",
"Country",
"$",
"country",
",",
"Module",
"$",
"module",
",",
"State",
"$",
"state",
"=",
"null",
")",
"{",
"$",
"response",
"=",
"null",
";",
"$",
"countryInAreaList",
"=",
"CountryAreaQuery",
"::",
"find... | Check if a delivery module is suitable for the given country.
@param Country $country
@param Module $module
@param State|null $state
@return null|AreaDeliveryModule
@throws \Propel\Runtime\Exception\PropelException | [
"Check",
"if",
"a",
"delivery",
"module",
"is",
"suitable",
"for",
"the",
"given",
"country",
"."
] | 38fbe7d5046bad6c0af9ea7c686b4655e8d84e67 | https://github.com/thelia/core/blob/38fbe7d5046bad6c0af9ea7c686b4655e8d84e67/lib/Thelia/Model/AreaDeliveryModuleQuery.php#L29-L48 | train |
melisplatform/melis-cms | src/Controller/PageEditionController.php | PageEditionController.renderPagetabEditionAction | public function renderPagetabEditionAction()
{
$idPage = $this->params()->fromRoute('idPage', $this->params()->fromQuery('idPage', ''));
$melisKey = $this->params()->fromRoute('melisKey', '');
/**
* Clearing the session data of the page in every open in page edition
*/
$container = new Container('meliscms');
if (!empty($container['content-pages']))
if (!empty($container['content-pages'][$idPage]))
$container['content-pages'][$idPage] = array();
$melisCoreConf = $this->getServiceLocator()->get('MelisConfig');
$resizeConfig = $melisCoreConf->getItem('meliscms/conf')['pluginResizable'] ?? null;
$melisPage = $this->getServiceLocator()->get('MelisEnginePage');
$datasPage = $melisPage->getDatasPage($idPage, 'saved');
if($datasPage)
{
$datasPageTree = $datasPage->getMelisPageTree();
$datasTemplate = $datasPage->getMelisTemplate();
}
$this->loadPageContentPluginsInSession($idPage);
$view = new ViewModel();
$view->idPage = $idPage;
$view->melisKey = $melisKey;
$view->resizablePlugin = $resizeConfig;
if (empty($datasPageTree->page_tpl_id) || $datasPageTree->page_tpl_id == -1)
$view->noTemplate = true;
else
$view->noTemplate = false;
if(!empty($datasTemplate))
$view->namespace = $datasTemplate->tpl_zf2_website_folder;
else
$view->namespace = '';
return $view;
} | php | public function renderPagetabEditionAction()
{
$idPage = $this->params()->fromRoute('idPage', $this->params()->fromQuery('idPage', ''));
$melisKey = $this->params()->fromRoute('melisKey', '');
/**
* Clearing the session data of the page in every open in page edition
*/
$container = new Container('meliscms');
if (!empty($container['content-pages']))
if (!empty($container['content-pages'][$idPage]))
$container['content-pages'][$idPage] = array();
$melisCoreConf = $this->getServiceLocator()->get('MelisConfig');
$resizeConfig = $melisCoreConf->getItem('meliscms/conf')['pluginResizable'] ?? null;
$melisPage = $this->getServiceLocator()->get('MelisEnginePage');
$datasPage = $melisPage->getDatasPage($idPage, 'saved');
if($datasPage)
{
$datasPageTree = $datasPage->getMelisPageTree();
$datasTemplate = $datasPage->getMelisTemplate();
}
$this->loadPageContentPluginsInSession($idPage);
$view = new ViewModel();
$view->idPage = $idPage;
$view->melisKey = $melisKey;
$view->resizablePlugin = $resizeConfig;
if (empty($datasPageTree->page_tpl_id) || $datasPageTree->page_tpl_id == -1)
$view->noTemplate = true;
else
$view->noTemplate = false;
if(!empty($datasTemplate))
$view->namespace = $datasTemplate->tpl_zf2_website_folder;
else
$view->namespace = '';
return $view;
} | [
"public",
"function",
"renderPagetabEditionAction",
"(",
")",
"{",
"$",
"idPage",
"=",
"$",
"this",
"->",
"params",
"(",
")",
"->",
"fromRoute",
"(",
"'idPage'",
",",
"$",
"this",
"->",
"params",
"(",
")",
"->",
"fromQuery",
"(",
"'idPage'",
",",
"''",
... | Makes the rendering of the Page Edition Tab
@return \Zend\View\Model\ViewModel | [
"Makes",
"the",
"rendering",
"of",
"the",
"Page",
"Edition",
"Tab"
] | ed470338f4c7653fd93e530013ab934eb7a52b6f | https://github.com/melisplatform/melis-cms/blob/ed470338f4c7653fd93e530013ab934eb7a52b6f/src/Controller/PageEditionController.php#L28-L70 | train |
melisplatform/melis-cms | src/Controller/PageEditionController.php | PageEditionController.savePageSessionPluginAction | public function savePageSessionPluginAction()
{
$idPage = $this->params()->fromRoute('idPage', $this->params()->fromQuery('idPage', ''));
$translator = $this->serviceLocator->get('translator');
$postValues = array();
$request = $this->getRequest();
if (!empty($idPage) && $request->isPost())
{
// Get values posted and set them in form
$postValues = get_object_vars($request->getPost());
// Send the event and let listeners do their job to catch and format their plugins values
$eventDatas = array('idPage' => $idPage, 'postValues' => $postValues);
$this->getEventManager()->trigger('meliscms_page_savesession_plugin_start', $this, $eventDatas);
$result = array(
'success' => 1,
'errors' => array()
);
}
else
{
$result = array(
'success' => 0,
'errors' => array(array('empty' => $translator->translate('tr_meliscms_form_common_errors_Empty datas')))
);
}
return new JsonModel($result);
} | php | public function savePageSessionPluginAction()
{
$idPage = $this->params()->fromRoute('idPage', $this->params()->fromQuery('idPage', ''));
$translator = $this->serviceLocator->get('translator');
$postValues = array();
$request = $this->getRequest();
if (!empty($idPage) && $request->isPost())
{
// Get values posted and set them in form
$postValues = get_object_vars($request->getPost());
// Send the event and let listeners do their job to catch and format their plugins values
$eventDatas = array('idPage' => $idPage, 'postValues' => $postValues);
$this->getEventManager()->trigger('meliscms_page_savesession_plugin_start', $this, $eventDatas);
$result = array(
'success' => 1,
'errors' => array()
);
}
else
{
$result = array(
'success' => 0,
'errors' => array(array('empty' => $translator->translate('tr_meliscms_form_common_errors_Empty datas')))
);
}
return new JsonModel($result);
} | [
"public",
"function",
"savePageSessionPluginAction",
"(",
")",
"{",
"$",
"idPage",
"=",
"$",
"this",
"->",
"params",
"(",
")",
"->",
"fromRoute",
"(",
"'idPage'",
",",
"$",
"this",
"->",
"params",
"(",
")",
"->",
"fromQuery",
"(",
"'idPage'",
",",
"''",
... | Saves datas edited in a page and posted to this function
Save is made in SESSION.
@return \Zend\View\Model\JsonModel | [
"Saves",
"datas",
"edited",
"in",
"a",
"page",
"and",
"posted",
"to",
"this",
"function",
"Save",
"is",
"made",
"in",
"SESSION",
"."
] | ed470338f4c7653fd93e530013ab934eb7a52b6f | https://github.com/melisplatform/melis-cms/blob/ed470338f4c7653fd93e530013ab934eb7a52b6f/src/Controller/PageEditionController.php#L141-L172 | train |
melisplatform/melis-cms | src/Controller/PageEditionController.php | PageEditionController.removePageSessionPluginAction | public function removePageSessionPluginAction()
{
$module = $this->getRequest()->getQuery('module', null);
$pluginName = $this->getRequest()->getQuery('pluginName', '');
$pageId = $this->getRequest()->getQuery('pageId', null);
$pluginId = $this->getRequest()->getQuery('pluginId', null);
$pluginTag = $this->getRequest()->getQuery('pluginTag', null);
$parameters = array(
'module' => $module,
'pluginName' => $pluginName,
'pageId' => $pageId,
'pluginId' => $pluginId,
'pluginTag' => $pluginTag,
);
$translator = $this->serviceLocator->get('translator');
if (empty($module) || empty($pluginName) || empty($pageId) || empty($pluginId))
{
$result = array(
'success' => 0,
'errors' => array(array('empty' => $translator->translate('tr_meliscms_form_common_errors_Empty datas')))
);
}
else
{
$this->getEventManager()->trigger('meliscms_page_removesession_plugin_start', null, $parameters);
// removing plugin from session
$container = new Container('meliscms');
if (!empty($container['content-pages'][$pageId][$pluginTag][$pluginId]))
unset($container['content-pages'][$pageId][$pluginTag][$pluginId]);
$this->getEventManager()->trigger('meliscms_page_removesession_plugin_end', null, $parameters);
$result = array(
'success' => 1,
'errors' => array()
);
}
return new JsonModel($result);
} | php | public function removePageSessionPluginAction()
{
$module = $this->getRequest()->getQuery('module', null);
$pluginName = $this->getRequest()->getQuery('pluginName', '');
$pageId = $this->getRequest()->getQuery('pageId', null);
$pluginId = $this->getRequest()->getQuery('pluginId', null);
$pluginTag = $this->getRequest()->getQuery('pluginTag', null);
$parameters = array(
'module' => $module,
'pluginName' => $pluginName,
'pageId' => $pageId,
'pluginId' => $pluginId,
'pluginTag' => $pluginTag,
);
$translator = $this->serviceLocator->get('translator');
if (empty($module) || empty($pluginName) || empty($pageId) || empty($pluginId))
{
$result = array(
'success' => 0,
'errors' => array(array('empty' => $translator->translate('tr_meliscms_form_common_errors_Empty datas')))
);
}
else
{
$this->getEventManager()->trigger('meliscms_page_removesession_plugin_start', null, $parameters);
// removing plugin from session
$container = new Container('meliscms');
if (!empty($container['content-pages'][$pageId][$pluginTag][$pluginId]))
unset($container['content-pages'][$pageId][$pluginTag][$pluginId]);
$this->getEventManager()->trigger('meliscms_page_removesession_plugin_end', null, $parameters);
$result = array(
'success' => 1,
'errors' => array()
);
}
return new JsonModel($result);
} | [
"public",
"function",
"removePageSessionPluginAction",
"(",
")",
"{",
"$",
"module",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getQuery",
"(",
"'module'",
",",
"null",
")",
";",
"$",
"pluginName",
"=",
"$",
"this",
"->",
"getRequest",
"(",
"... | Remove a specific plugin from a pageId
Save is made in SESSION.
@return \Zend\View\Model\JsonModel | [
"Remove",
"a",
"specific",
"plugin",
"from",
"a",
"pageId",
"Save",
"is",
"made",
"in",
"SESSION",
"."
] | ed470338f4c7653fd93e530013ab934eb7a52b6f | https://github.com/melisplatform/melis-cms/blob/ed470338f4c7653fd93e530013ab934eb7a52b6f/src/Controller/PageEditionController.php#L181-L226 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.