repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
freialib/freia.autoloader | src/SymbolEnvironment.php | SymbolEnvironment.findFirstFileMatchingAfterNext | function findFirstFileMatchingAfterNext($ns, $name, $filename) {
$nextPtr = \strrpos($ns, '\\next\\');
// due to the way the syntax works, the namespace before the keyword
// next is implied from the file namespace so it's always a complete
// namespace rather then a partial one
$skipNamespace = substr($ns, ... | php | function findFirstFileMatchingAfterNext($ns, $name, $filename) {
$nextPtr = \strrpos($ns, '\\next\\');
// due to the way the syntax works, the namespace before the keyword
// next is implied from the file namespace so it's always a complete
// namespace rather then a partial one
$skipNamespace = substr($ns, ... | [
"function",
"findFirstFileMatchingAfterNext",
"(",
"$",
"ns",
",",
"$",
"name",
",",
"$",
"filename",
")",
"{",
"$",
"nextPtr",
"=",
"\\",
"strrpos",
"(",
"$",
"ns",
",",
"'\\\\next\\\\'",
")",
";",
"// due to the way the syntax works, the namespace before the keywo... | Similar to findFirstFileMatching but assumes /next/ in segment and
matches after skipping the everything up to and including the namespace
before the /next/ key segment.
@return array [ $targetfile, $targetns, $target ] | [
"Similar",
"to",
"findFirstFileMatching",
"but",
"assumes",
"/",
"next",
"/",
"in",
"segment",
"and",
"matches",
"after",
"skipping",
"the",
"everything",
"up",
"to",
"and",
"including",
"the",
"namespace",
"before",
"the",
"/",
"next",
"/",
"key",
"segment",
... | train | https://github.com/freialib/freia.autoloader/blob/45e0dfcd56d55cf533f12255db647e8a05fcd494/src/SymbolEnvironment.php#L350-L385 |
freialib/freia.autoloader | src/SymbolEnvironment.php | SymbolEnvironment.loadSymbol | function loadSymbol($symbol, $filepath) {
$this->requirefile($filepath);
$this->state['symbols'][$symbol] = $filepath;
$this->state['loaded'][] = $symbol;
} | php | function loadSymbol($symbol, $filepath) {
$this->requirefile($filepath);
$this->state['symbols'][$symbol] = $filepath;
$this->state['loaded'][] = $symbol;
} | [
"function",
"loadSymbol",
"(",
"$",
"symbol",
",",
"$",
"filepath",
")",
"{",
"$",
"this",
"->",
"requirefile",
"(",
"$",
"filepath",
")",
";",
"$",
"this",
"->",
"state",
"[",
"'symbols'",
"]",
"[",
"$",
"symbol",
"]",
"=",
"$",
"filepath",
";",
"... | ... | [
"..."
] | train | https://github.com/freialib/freia.autoloader/blob/45e0dfcd56d55cf533f12255db647e8a05fcd494/src/SymbolEnvironment.php#L390-L394 |
freialib/freia.autoloader | src/SymbolEnvironment.php | SymbolEnvironment.aliasSymbol | function aliasSymbol($from, $to) {
$this->class_alias($from, $to);
$this->state['aliases'][$to] = $from;
$this->state['loaded'][] = $to;
} | php | function aliasSymbol($from, $to) {
$this->class_alias($from, $to);
$this->state['aliases'][$to] = $from;
$this->state['loaded'][] = $to;
} | [
"function",
"aliasSymbol",
"(",
"$",
"from",
",",
"$",
"to",
")",
"{",
"$",
"this",
"->",
"class_alias",
"(",
"$",
"from",
",",
"$",
"to",
")",
";",
"$",
"this",
"->",
"state",
"[",
"'aliases'",
"]",
"[",
"$",
"to",
"]",
"=",
"$",
"from",
";",
... | ... | [
"..."
] | train | https://github.com/freialib/freia.autoloader/blob/45e0dfcd56d55cf533f12255db647e8a05fcd494/src/SymbolEnvironment.php#L399-L403 |
freialib/freia.autoloader | src/SymbolEnvironment.php | SymbolEnvironment.autoresolve | function autoresolve($symbol) {
// is the symbol an alias?
if (\array_key_exists($symbol, $this->state['aliases'])) {
// then resolve the alias
// you can only alias to know symbols so the following will succeed
$this->autoresolve($this->state['aliases'][$symbol]);
// and afterwards alias the symbol
... | php | function autoresolve($symbol) {
// is the symbol an alias?
if (\array_key_exists($symbol, $this->state['aliases'])) {
// then resolve the alias
// you can only alias to know symbols so the following will succeed
$this->autoresolve($this->state['aliases'][$symbol]);
// and afterwards alias the symbol
... | [
"function",
"autoresolve",
"(",
"$",
"symbol",
")",
"{",
"// is the symbol an alias?",
"if",
"(",
"\\",
"array_key_exists",
"(",
"$",
"symbol",
",",
"$",
"this",
"->",
"state",
"[",
"'aliases'",
"]",
")",
")",
"{",
"// then resolve the alias",
"// you can only a... | Attempt to auto-resolve a symbol based on past state. | [
"Attempt",
"to",
"auto",
"-",
"resolve",
"a",
"symbol",
"based",
"on",
"past",
"state",
"."
] | train | https://github.com/freialib/freia.autoloader/blob/45e0dfcd56d55cf533f12255db647e8a05fcd494/src/SymbolEnvironment.php#L408-L427 |
freialib/freia.autoloader | src/SymbolEnvironment.php | SymbolEnvironment.save | function save() {
if ($this->cacheConf['type'] == 'noop') {
// do nothing
}
else { // non-noop
$stateCopy = $this->state;
$stateCopy['loaded'] = [];
if ($this->cacheConf['type'] == 'file') {
$username = \get_current_user();
$cacheDir = realpath($this->syspath.'/'.\trim($this->cacheConf['pat... | php | function save() {
if ($this->cacheConf['type'] == 'noop') {
// do nothing
}
else { // non-noop
$stateCopy = $this->state;
$stateCopy['loaded'] = [];
if ($this->cacheConf['type'] == 'file') {
$username = \get_current_user();
$cacheDir = realpath($this->syspath.'/'.\trim($this->cacheConf['pat... | [
"function",
"save",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cacheConf",
"[",
"'type'",
"]",
"==",
"'noop'",
")",
"{",
"// do nothing",
"}",
"else",
"{",
"// non-noop",
"$",
"stateCopy",
"=",
"$",
"this",
"->",
"state",
";",
"$",
"stateCopy",
"[... | Save current state to persistent store | [
"Save",
"current",
"state",
"to",
"persistent",
"store"
] | train | https://github.com/freialib/freia.autoloader/blob/45e0dfcd56d55cf533f12255db647e8a05fcd494/src/SymbolEnvironment.php#L467-L504 |
freialib/freia.autoloader | src/SymbolEnvironment.php | SymbolEnvironment.load | function load() {
if ($this->cacheConf['type'] == 'noop') {
return null; // do nothing
}
else { // non-noop
$loadedState = null;
if ($this->cacheConf['type'] == 'file') {
$username = \get_current_user();
$cacheDir = realpath($this->syspath.'/'.\trim($this->cacheConf['path'], '\\/'));
$cach... | php | function load() {
if ($this->cacheConf['type'] == 'noop') {
return null; // do nothing
}
else { // non-noop
$loadedState = null;
if ($this->cacheConf['type'] == 'file') {
$username = \get_current_user();
$cacheDir = realpath($this->syspath.'/'.\trim($this->cacheConf['path'], '\\/'));
$cach... | [
"function",
"load",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cacheConf",
"[",
"'type'",
"]",
"==",
"'noop'",
")",
"{",
"return",
"null",
";",
"// do nothing",
"}",
"else",
"{",
"// non-noop",
"$",
"loadedState",
"=",
"null",
";",
"if",
"(",
"$",... | Load state from persistent store
@return array previously saved state | [
"Load",
"state",
"from",
"persistent",
"store"
] | train | https://github.com/freialib/freia.autoloader/blob/45e0dfcd56d55cf533f12255db647e8a05fcd494/src/SymbolEnvironment.php#L511-L561 |
benjamindulau/AnoDataGrid | src/Ano/DataGrid/Column/ColumnView.php | ColumnView.get | public function get($name, $default = null)
{
if ('value' === $name) {
$dataGrid = $this->get('dataGrid');
$data = $dataGrid->get('data');
if (null !== ($index = $this->get('index', null))) {
$this->set('value', $this->get('column')->getValue($data, $index... | php | public function get($name, $default = null)
{
if ('value' === $name) {
$dataGrid = $this->get('dataGrid');
$data = $dataGrid->get('data');
if (null !== ($index = $this->get('index', null))) {
$this->set('value', $this->get('column')->getValue($data, $index... | [
"public",
"function",
"get",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"'value'",
"===",
"$",
"name",
")",
"{",
"$",
"dataGrid",
"=",
"$",
"this",
"->",
"get",
"(",
"'dataGrid'",
")",
";",
"$",
"data",
"=",
"$",
"... | {@inheritDoc} | [
"{"
] | train | https://github.com/benjamindulau/AnoDataGrid/blob/69b31803929b04e9d6e807bb2213b9b3477d0367/src/Ano/DataGrid/Column/ColumnView.php#L19-L30 |
stubbles/stubbles-streams | src/main/php/file/FileInputStream.php | FileInputStream.castFrom | public static function castFrom($value): InputStream
{
if ($value instanceof InputStream) {
return $value;
}
if (is_string($value)) {
return new self($value);
}
throw new \InvalidArgumentException(
'Given value is neither an instance ... | php | public static function castFrom($value): InputStream
{
if ($value instanceof InputStream) {
return $value;
}
if (is_string($value)) {
return new self($value);
}
throw new \InvalidArgumentException(
'Given value is neither an instance ... | [
"public",
"static",
"function",
"castFrom",
"(",
"$",
"value",
")",
":",
"InputStream",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"InputStream",
")",
"{",
"return",
"$",
"value",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"... | casts given value to an input stream
@param \stubbles\streams\InputStream|string $value
@return \stubbles\streams\InputStream
@throws \InvalidArgumentException
@since 5.2.0 | [
"casts",
"given",
"value",
"to",
"an",
"input",
"stream"
] | train | https://github.com/stubbles/stubbles-streams/blob/99b0dace5fcf71584d1456b4b5408017b896bdf5/src/main/php/file/FileInputStream.php#L81-L95 |
stubbles/stubbles-streams | src/main/php/file/FileInputStream.php | FileInputStream.getResourceLength | protected function getResourceLength(): int
{
if (null === $this->fileName) {
return parent::getResourceLength();
}
if (substr($this->fileName, 0, 16) === 'compress.zlib://') {
return filesize(substr($this->fileName, 16));
} elseif (substr($this->fileName, 0,... | php | protected function getResourceLength(): int
{
if (null === $this->fileName) {
return parent::getResourceLength();
}
if (substr($this->fileName, 0, 16) === 'compress.zlib://') {
return filesize(substr($this->fileName, 16));
} elseif (substr($this->fileName, 0,... | [
"protected",
"function",
"getResourceLength",
"(",
")",
":",
"int",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"fileName",
")",
"{",
"return",
"parent",
"::",
"getResourceLength",
"(",
")",
";",
"}",
"if",
"(",
"substr",
"(",
"$",
"this",
"->",
... | helper method to retrieve the length of the resource
@return int | [
"helper",
"method",
"to",
"retrieve",
"the",
"length",
"of",
"the",
"resource"
] | train | https://github.com/stubbles/stubbles-streams/blob/99b0dace5fcf71584d1456b4b5408017b896bdf5/src/main/php/file/FileInputStream.php#L102-L115 |
stubbles/stubbles-streams | src/main/php/file/FileInputStream.php | FileInputStream.tell | public function tell(): int
{
if (null === $this->handle) {
throw new \LogicException('Can not read from closed input stream.');
}
$position = @ftell($this->handle);
if (false === $position) {
throw new StreamException(
'Can not read curre... | php | public function tell(): int
{
if (null === $this->handle) {
throw new \LogicException('Can not read from closed input stream.');
}
$position = @ftell($this->handle);
if (false === $position) {
throw new StreamException(
'Can not read curre... | [
"public",
"function",
"tell",
"(",
")",
":",
"int",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"handle",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'Can not read from closed input stream.'",
")",
";",
"}",
"$",
"position",
"=",
"@",
"... | return current position
@return int
@throws \LogicException
@throws \stubbles\streams\StreamException | [
"return",
"current",
"position"
] | train | https://github.com/stubbles/stubbles-streams/blob/99b0dace5fcf71584d1456b4b5408017b896bdf5/src/main/php/file/FileInputStream.php#L140-L155 |
afroware/jwtauth | src/Http/Middleware/BaseMiddleware.php | BaseMiddleware.checkForToken | public function checkForToken(Request $request)
{
if (! $this->auth->parser()->setRequest($request)->hasToken()) {
throw new UnauthorizedHttpException('jwTauth', 'Token not provided');
}
} | php | public function checkForToken(Request $request)
{
if (! $this->auth->parser()->setRequest($request)->hasToken()) {
throw new UnauthorizedHttpException('jwTauth', 'Token not provided');
}
} | [
"public",
"function",
"checkForToken",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"auth",
"->",
"parser",
"(",
")",
"->",
"setRequest",
"(",
"$",
"request",
")",
"->",
"hasToken",
"(",
")",
")",
"{",
"throw",
"new",
... | Check the request for the presence of a token.
@param \Illuminate\Http\Request $request
@throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
@return void | [
"Check",
"the",
"request",
"for",
"the",
"presence",
"of",
"a",
"token",
"."
] | train | https://github.com/afroware/jwtauth/blob/54a0aebd811d87bfdd2b3668696fd53f50490cc1/src/Http/Middleware/BaseMiddleware.php#L49-L54 |
afroware/jwtauth | src/Http/Middleware/BaseMiddleware.php | BaseMiddleware.authenticate | public function authenticate(Request $request)
{
$this->checkForToken($request);
try {
if (! $this->auth->parseToken()->authenticate()) {
throw new UnauthorizedHttpException('jwTauth', 'User not found');
}
} catch (JwTException $e) {
throw... | php | public function authenticate(Request $request)
{
$this->checkForToken($request);
try {
if (! $this->auth->parseToken()->authenticate()) {
throw new UnauthorizedHttpException('jwTauth', 'User not found');
}
} catch (JwTException $e) {
throw... | [
"public",
"function",
"authenticate",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"checkForToken",
"(",
"$",
"request",
")",
";",
"try",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"auth",
"->",
"parseToken",
"(",
")",
"->",
"authenticate"... | Attempt to authenticate a user via the token in the request.
@param \Illuminate\Http\Request $request
@throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException
@return void | [
"Attempt",
"to",
"authenticate",
"a",
"user",
"via",
"the",
"token",
"in",
"the",
"request",
"."
] | train | https://github.com/afroware/jwtauth/blob/54a0aebd811d87bfdd2b3668696fd53f50490cc1/src/Http/Middleware/BaseMiddleware.php#L65-L76 |
Danack/Weaver | src/Weaver/ImplementWeaveGenerator.php | ImplementWeaveGenerator.addDecoratedMethod | function addDecoratedMethod(MethodReflection $sourceMethod, MethodReflection $decoratorMethodReflection ) {
$weavedMethod = MethodGenerator::fromReflection($sourceMethod);
$newBody = $decoratorMethodReflection->getBody();
$newBody = trimBody($newBody);
$parameters = $sourceMethod->getP... | php | function addDecoratedMethod(MethodReflection $sourceMethod, MethodReflection $decoratorMethodReflection ) {
$weavedMethod = MethodGenerator::fromReflection($sourceMethod);
$newBody = $decoratorMethodReflection->getBody();
$newBody = trimBody($newBody);
$parameters = $sourceMethod->getP... | [
"function",
"addDecoratedMethod",
"(",
"MethodReflection",
"$",
"sourceMethod",
",",
"MethodReflection",
"$",
"decoratorMethodReflection",
")",
"{",
"$",
"weavedMethod",
"=",
"MethodGenerator",
"::",
"fromReflection",
"(",
"$",
"sourceMethod",
")",
";",
"$",
"newBody"... | Decorate the method and call the instance.
@param MethodReflection $sourceMethod
@param MethodReflection $decoratorMethodReflection | [
"Decorate",
"the",
"method",
"and",
"call",
"the",
"instance",
"."
] | train | https://github.com/Danack/Weaver/blob/414894cd397daff22d2c71e4988784a1f71b702e/src/Weaver/ImplementWeaveGenerator.php#L112-L140 |
Danack/Weaver | src/Weaver/ImplementWeaveGenerator.php | ImplementWeaveGenerator.addPlainMethod | function addPlainMethod(MethodReflection $sourceMethod) {
$parameters = $sourceMethod->getParameters();
$paramArray = [];
foreach ($parameters as $parameter) {
$paramArray[] = '$'.$parameter->getName();
}
$paramList = implode(', ', $paramArray);
$weavedMeth... | php | function addPlainMethod(MethodReflection $sourceMethod) {
$parameters = $sourceMethod->getParameters();
$paramArray = [];
foreach ($parameters as $parameter) {
$paramArray[] = '$'.$parameter->getName();
}
$paramList = implode(', ', $paramArray);
$weavedMeth... | [
"function",
"addPlainMethod",
"(",
"MethodReflection",
"$",
"sourceMethod",
")",
"{",
"$",
"parameters",
"=",
"$",
"sourceMethod",
"->",
"getParameters",
"(",
")",
";",
"$",
"paramArray",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"p... | Add a call to the instance method.
@param MethodReflection $sourceMethod | [
"Add",
"a",
"call",
"to",
"the",
"instance",
"method",
"."
] | train | https://github.com/Danack/Weaver/blob/414894cd397daff22d2c71e4988784a1f71b702e/src/Weaver/ImplementWeaveGenerator.php#L147-L168 |
Danack/Weaver | src/Weaver/ImplementWeaveGenerator.php | ImplementWeaveGenerator.addSourceMethods | function addSourceMethods() {
$methodBindingArray = $this->implementWeaveInfo->getMethodBindingArray();
$methods = $this->sourceClassReflection->getMethods();
foreach ($methods as $sourceMethod) {
if ($sourceMethod->getName() === '__construct') {
continue... | php | function addSourceMethods() {
$methodBindingArray = $this->implementWeaveInfo->getMethodBindingArray();
$methods = $this->sourceClassReflection->getMethods();
foreach ($methods as $sourceMethod) {
if ($sourceMethod->getName() === '__construct') {
continue... | [
"function",
"addSourceMethods",
"(",
")",
"{",
"$",
"methodBindingArray",
"=",
"$",
"this",
"->",
"implementWeaveInfo",
"->",
"getMethodBindingArray",
"(",
")",
";",
"$",
"methods",
"=",
"$",
"this",
"->",
"sourceClassReflection",
"->",
"getMethods",
"(",
")",
... | For all of the methods in that need to be decorated, generate the decorated version
and all the to the generator.
@TODO Shouldn't this only implement the methods in the interface that is being exposed? | [
"For",
"all",
"of",
"the",
"methods",
"in",
"that",
"need",
"to",
"be",
"decorated",
"generate",
"the",
"decorated",
"version",
"and",
"all",
"the",
"to",
"the",
"generator",
"."
] | train | https://github.com/Danack/Weaver/blob/414894cd397daff22d2c71e4988784a1f71b702e/src/Weaver/ImplementWeaveGenerator.php#L175-L201 |
drdplusinfo/drdplus-background | DrdPlus/Background/BackgroundParts/Partials/AbstractBackgroundAdvantage.php | AbstractBackgroundAdvantage.getSpentBackgroundPoints | public function getSpentBackgroundPoints(): PositiveIntegerObject
{
if ($this->spentBackgroundPoints === null) {
$this->spentBackgroundPoints = new PositiveIntegerObject($this->getValue());
}
return $this->spentBackgroundPoints;
} | php | public function getSpentBackgroundPoints(): PositiveIntegerObject
{
if ($this->spentBackgroundPoints === null) {
$this->spentBackgroundPoints = new PositiveIntegerObject($this->getValue());
}
return $this->spentBackgroundPoints;
} | [
"public",
"function",
"getSpentBackgroundPoints",
"(",
")",
":",
"PositiveIntegerObject",
"{",
"if",
"(",
"$",
"this",
"->",
"spentBackgroundPoints",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"spentBackgroundPoints",
"=",
"new",
"PositiveIntegerObject",
"(",
"$"... | Spent background points are the same as advantage level.
@return PositiveIntegerObject | [
"Spent",
"background",
"points",
"are",
"the",
"same",
"as",
"advantage",
"level",
"."
] | train | https://github.com/drdplusinfo/drdplus-background/blob/70aca51902e6c151c4b0e5d9066c6043c777435c/DrdPlus/Background/BackgroundParts/Partials/AbstractBackgroundAdvantage.php#L31-L38 |
Nicklas766/Comment | src/Comment/AdminController.php | AdminController.checkIsAdmin | public function checkIsAdmin()
{
$this->checkIsLogin();
$user = new User($this->di->get("db"));
$user = $user->getUser($this->di->get("session")->get("user"));
if ($user->authority != "admin") {
$views = [
["comment/admin/fail", [], "main"]
]... | php | public function checkIsAdmin()
{
$this->checkIsLogin();
$user = new User($this->di->get("db"));
$user = $user->getUser($this->di->get("session")->get("user"));
if ($user->authority != "admin") {
$views = [
["comment/admin/fail", [], "main"]
]... | [
"public",
"function",
"checkIsAdmin",
"(",
")",
"{",
"$",
"this",
"->",
"checkIsLogin",
"(",
")",
";",
"$",
"user",
"=",
"new",
"User",
"(",
"$",
"this",
"->",
"di",
"->",
"get",
"(",
"\"db\"",
")",
")",
";",
"$",
"user",
"=",
"$",
"user",
"->",
... | check if user is logged in
@return void | [
"check",
"if",
"user",
"is",
"logged",
"in"
] | train | https://github.com/Nicklas766/Comment/blob/1483eaf1ebb120b8bd6c2a1552c084b3a288ff25/src/Comment/AdminController.php#L33-L49 |
Nicklas766/Comment | src/Comment/AdminController.php | AdminController.getPostAdminEditUser | public function getPostAdminEditUser($id)
{
$form = new EditUserForm($this->di, $id);
$form->check();
$views = [
["comment/admin/navbar", [], "main"],
["comment/admin/crud/edit", ["form" => $form->getHTML()], "main"]
];
$this->di->get("pageRenderComm... | php | public function getPostAdminEditUser($id)
{
$form = new EditUserForm($this->di, $id);
$form->check();
$views = [
["comment/admin/navbar", [], "main"],
["comment/admin/crud/edit", ["form" => $form->getHTML()], "main"]
];
$this->di->get("pageRenderComm... | [
"public",
"function",
"getPostAdminEditUser",
"(",
"$",
"id",
")",
"{",
"$",
"form",
"=",
"new",
"EditUserForm",
"(",
"$",
"this",
"->",
"di",
",",
"$",
"id",
")",
";",
"$",
"form",
"->",
"check",
"(",
")",
";",
"$",
"views",
"=",
"[",
"[",
"\"co... | Description.
@param int $id
@return void | [
"Description",
"."
] | train | https://github.com/Nicklas766/Comment/blob/1483eaf1ebb120b8bd6c2a1552c084b3a288ff25/src/Comment/AdminController.php#L78-L92 |
Nicklas766/Comment | src/Comment/AdminController.php | AdminController.getPostAdminCreateUser | public function getPostAdminCreateUser()
{
$form = new CreateUserForm2($this->di);
$form->check();
$views = [
["comment/admin/navbar", [], "main"],
["comment/admin/crud/edit", ["form" => $form->getHTML()], "main"]
];
$this->di->get("pageRenderComment... | php | public function getPostAdminCreateUser()
{
$form = new CreateUserForm2($this->di);
$form->check();
$views = [
["comment/admin/navbar", [], "main"],
["comment/admin/crud/edit", ["form" => $form->getHTML()], "main"]
];
$this->di->get("pageRenderComment... | [
"public",
"function",
"getPostAdminCreateUser",
"(",
")",
"{",
"$",
"form",
"=",
"new",
"CreateUserForm2",
"(",
"$",
"this",
"->",
"di",
")",
";",
"$",
"form",
"->",
"check",
"(",
")",
";",
"$",
"views",
"=",
"[",
"[",
"\"comment/admin/navbar\"",
",",
... | Description.
@return void | [
"Description",
"."
] | train | https://github.com/Nicklas766/Comment/blob/1483eaf1ebb120b8bd6c2a1552c084b3a288ff25/src/Comment/AdminController.php#L99-L113 |
theopera/framework | src/Component/Http/Header/Headers.php | Headers.get | public function get(string $name)
{
return isset($this->headers[$name]) ? $this->headers[$name] : null;
} | php | public function get(string $name)
{
return isset($this->headers[$name]) ? $this->headers[$name] : null;
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"name",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"headers",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this",
"->",
"headers",
"[",
"$",
"name",
"]",
":",
"null",
";",
"}"
] | @param string $name
@return null|Header | [
"@param",
"string",
"$name"
] | train | https://github.com/theopera/framework/blob/fa6165d3891a310faa580c81dee49a63c150c711/src/Component/Http/Header/Headers.php#L44-L47 |
wasinger/adaptimage | src/ResponsiveImages/ResponsiveImageHelper.php | ResponsiveImageHelper.addClass | public function addClass(ResponsiveImageClass $class)
{
$this->classes_added = true;
if (array_key_exists($class->getName(), $this->classes)) {
throw new \Exception(sprintf('A responsive image class with name "%s" is already registered', $class->getName()));
}
if ($this->... | php | public function addClass(ResponsiveImageClass $class)
{
$this->classes_added = true;
if (array_key_exists($class->getName(), $this->classes)) {
throw new \Exception(sprintf('A responsive image class with name "%s" is already registered', $class->getName()));
}
if ($this->... | [
"public",
"function",
"addClass",
"(",
"ResponsiveImageClass",
"$",
"class",
")",
"{",
"$",
"this",
"->",
"classes_added",
"=",
"true",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"class",
"->",
"getName",
"(",
")",
",",
"$",
"this",
"->",
"classes",
"... | Add a ResponsiveImageClass object to the registered responsive image classes
@param ResponsiveImageClass $class The ResponsiveImageClass object
@throws \Exception | [
"Add",
"a",
"ResponsiveImageClass",
"object",
"to",
"the",
"registered",
"responsive",
"image",
"classes"
] | train | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ResponsiveImages/ResponsiveImageHelper.php#L102-L121 |
wasinger/adaptimage | src/ResponsiveImages/ResponsiveImageHelper.php | ResponsiveImageHelper.getClass | public function getClass($classname)
{
if ((string) $classname == '' || !array_key_exists($classname, $this->classes)) {
throw new ImageClassNotRegisteredException($classname);
}
return $this->classes[$classname];
} | php | public function getClass($classname)
{
if ((string) $classname == '' || !array_key_exists($classname, $this->classes)) {
throw new ImageClassNotRegisteredException($classname);
}
return $this->classes[$classname];
} | [
"public",
"function",
"getClass",
"(",
"$",
"classname",
")",
"{",
"if",
"(",
"(",
"string",
")",
"$",
"classname",
"==",
"''",
"||",
"!",
"array_key_exists",
"(",
"$",
"classname",
",",
"$",
"this",
"->",
"classes",
")",
")",
"{",
"throw",
"new",
"I... | Get a ResponsiveImageClass by it's name
@param string $classname
@return ResponsiveImageClass | [
"Get",
"a",
"ResponsiveImageClass",
"by",
"it",
"s",
"name"
] | train | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ResponsiveImages/ResponsiveImageHelper.php#L140-L146 |
wasinger/adaptimage | src/ResponsiveImages/ResponsiveImageHelper.php | ResponsiveImageHelper.makeImgElementResponsive | public function makeImgElementResponsive(
\DOMElement &$img,
$class,
$change_src_attr = false,
$add_default_dimension_attrs = false
)
{
if ($img->tagName != 'img') throw new \InvalidArgumentException('$img must be an "img" element');
if ((string) $class == '' |... | php | public function makeImgElementResponsive(
\DOMElement &$img,
$class,
$change_src_attr = false,
$add_default_dimension_attrs = false
)
{
if ($img->tagName != 'img') throw new \InvalidArgumentException('$img must be an "img" element');
if ((string) $class == '' |... | [
"public",
"function",
"makeImgElementResponsive",
"(",
"\\",
"DOMElement",
"&",
"$",
"img",
",",
"$",
"class",
",",
"$",
"change_src_attr",
"=",
"false",
",",
"$",
"add_default_dimension_attrs",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"img",
"->",
"tagName",... | Add srcset and sizes attributes to an HTML "img" tag
This method reads the image URL from the "src" attribute of an "img" element, calculates the URLs and dimensions of
the various available image sizes according to the given "responsive image class", and adds the "srcset" and
"sizes" attribute value.
Optionally, it ... | [
"Add",
"srcset",
"and",
"sizes",
"attributes",
"to",
"an",
"HTML",
"img",
"tag"
] | train | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ResponsiveImages/ResponsiveImageHelper.php#L170-L200 |
wasinger/adaptimage | src/ResponsiveImages/ResponsiveImageHelper.php | ResponsiveImageHelper.createResizedImageVersions | public function createResizedImageVersions($imageurl, $imageclass)
{
if (!$this->resizer instanceof ImageResizer) {
throw new \LogicException('no ImageResizer available, set it using ResponsiveImageHelper::setResizer()');
}
$image = $this->getResponsiveImage($imageurl, $imageclas... | php | public function createResizedImageVersions($imageurl, $imageclass)
{
if (!$this->resizer instanceof ImageResizer) {
throw new \LogicException('no ImageResizer available, set it using ResponsiveImageHelper::setResizer()');
}
$image = $this->getResponsiveImage($imageurl, $imageclas... | [
"public",
"function",
"createResizedImageVersions",
"(",
"$",
"imageurl",
",",
"$",
"imageclass",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"resizer",
"instanceof",
"ImageResizer",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'no ImageResizer avail... | Create the resized image versions for an image and a given image class
@param string $imageurl
@param string $imageclass
@throws \Exception | [
"Create",
"the",
"resized",
"image",
"versions",
"for",
"an",
"image",
"and",
"a",
"given",
"image",
"class"
] | train | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ResponsiveImages/ResponsiveImageHelper.php#L263-L270 |
wasinger/adaptimage | src/ResponsiveImages/ResponsiveImageHelper.php | ResponsiveImageHelper.addDefaultFilter | public function addDefaultFilter(FilterInterface $default_filter)
{
if ($this->classes_added) {
throw new \LogicException('Defaults must be set before image classes are added.');
}
if (!$this->default_filters instanceof FilterChain) {
$this->default_filters = new Filt... | php | public function addDefaultFilter(FilterInterface $default_filter)
{
if ($this->classes_added) {
throw new \LogicException('Defaults must be set before image classes are added.');
}
if (!$this->default_filters instanceof FilterChain) {
$this->default_filters = new Filt... | [
"public",
"function",
"addDefaultFilter",
"(",
"FilterInterface",
"$",
"default_filter",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"classes_added",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'Defaults must be set before image classes are added.'",
")",
";",... | Add additional default filters to be applied when resizing for all classes.
This setting will be passed to a ResponsiveImageClass object when it is added by the addClass() method
@param FilterInterface $default_filter
@return ResponsiveImageHelper $this | [
"Add",
"additional",
"default",
"filters",
"to",
"be",
"applied",
"when",
"resizing",
"for",
"all",
"classes",
".",
"This",
"setting",
"will",
"be",
"passed",
"to",
"a",
"ResponsiveImageClass",
"object",
"when",
"it",
"is",
"added",
"by",
"the",
"addClass",
... | train | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ResponsiveImages/ResponsiveImageHelper.php#L319-L329 |
wasinger/adaptimage | src/ResponsiveImages/ResponsiveImageHelper.php | ResponsiveImageHelper.addDefaultPostFilter | public function addDefaultPostFilter(FilterInterface $default_post_filter)
{
if ($this->classes_added) {
throw new \LogicException('Defaults must be set before image classes are added.');
}
if (!$this->default_post_filters instanceof FilterChain) {
$this->default_post... | php | public function addDefaultPostFilter(FilterInterface $default_post_filter)
{
if ($this->classes_added) {
throw new \LogicException('Defaults must be set before image classes are added.');
}
if (!$this->default_post_filters instanceof FilterChain) {
$this->default_post... | [
"public",
"function",
"addDefaultPostFilter",
"(",
"FilterInterface",
"$",
"default_post_filter",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"classes_added",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'Defaults must be set before image classes are added.'",
")... | Set default post filters for all image classes.
This setting will be passed to a ResponsiveImageClass object when it is added by the addClass() method
@param \Imagine\Filter\FilterInterface $default_post_filter
@return ResponsiveImageHelper $this | [
"Set",
"default",
"post",
"filters",
"for",
"all",
"image",
"classes",
".",
"This",
"setting",
"will",
"be",
"passed",
"to",
"a",
"ResponsiveImageClass",
"object",
"when",
"it",
"is",
"added",
"by",
"the",
"addClass",
"()",
"method"
] | train | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ResponsiveImages/ResponsiveImageHelper.php#L338-L348 |
wasinger/adaptimage | src/ResponsiveImages/ResponsiveImageHelper.php | ResponsiveImageHelper.setDefaultOutputTypeMap | public function setDefaultOutputTypeMap(OutputTypeMap $default_output_type_map)
{
if ($this->classes_added) {
throw new \LogicException('Defaults must be set before image classes are added.');
}
$this->default_output_type_map = $default_output_type_map;
return $this;
... | php | public function setDefaultOutputTypeMap(OutputTypeMap $default_output_type_map)
{
if ($this->classes_added) {
throw new \LogicException('Defaults must be set before image classes are added.');
}
$this->default_output_type_map = $default_output_type_map;
return $this;
... | [
"public",
"function",
"setDefaultOutputTypeMap",
"(",
"OutputTypeMap",
"$",
"default_output_type_map",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"classes_added",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'Defaults must be set before image classes are added.'",... | Set a default OutputTypeMap for all image classes.
This setting will be passed to a ResponsiveImageClass object when it is added by the addClass() method
@param OutputTypeMap $default_output_type_map
@return ResponsiveImageHelper $this | [
"Set",
"a",
"default",
"OutputTypeMap",
"for",
"all",
"image",
"classes",
".",
"This",
"setting",
"will",
"be",
"passed",
"to",
"a",
"ResponsiveImageClass",
"object",
"when",
"it",
"is",
"added",
"by",
"the",
"addClass",
"()",
"method"
] | train | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ResponsiveImages/ResponsiveImageHelper.php#L357-L364 |
uneak/OAuthClientBundle | OAuth/OAuth2.php | OAuth2.fetch | public static function fetch(AccessTokenInterface $accessToken, array $options) {
switch ($accessToken->getOption('token_type')) {
case AccessToken::ACCESS_TOKEN_URI:
if (is_array($options['parameters'])) {
$options['parameters']['access_token'] = $accessToken->getOption('access_token');
} else {
... | php | public static function fetch(AccessTokenInterface $accessToken, array $options) {
switch ($accessToken->getOption('token_type')) {
case AccessToken::ACCESS_TOKEN_URI:
if (is_array($options['parameters'])) {
$options['parameters']['access_token'] = $accessToken->getOption('access_token');
} else {
... | [
"public",
"static",
"function",
"fetch",
"(",
"AccessTokenInterface",
"$",
"accessToken",
",",
"array",
"$",
"options",
")",
"{",
"switch",
"(",
"$",
"accessToken",
"->",
"getOption",
"(",
"'token_type'",
")",
")",
"{",
"case",
"AccessToken",
"::",
"ACCESS_TOK... | @param \Uneak\OAuthClientBundle\OAuth\Token\AccessTokenInterface $accessToken
@param array $options
@return \Uneak\OAuthClientBundle\OAuth\Curl\CurlResponse
@throws \Uneak\OAuthClientBundle\OAuth\Exception | [
"@param",
"\\",
"Uneak",
"\\",
"OAuthClientBundle",
"\\",
"OAuth",
"\\",
"Token",
"\\",
"AccessTokenInterface",
"$accessToken",
"@param",
"array",
"$options"
] | train | https://github.com/uneak/OAuthClientBundle/blob/e24b7734d63cf0a114167e025aebcae8c04647bb/OAuth/OAuth2.php#L24-L51 |
uneak/OAuthClientBundle | OAuth/OAuth2.php | OAuth2.getAccessToken | public static function getAccessToken(CredentialsConfigurationInterface $credentialsConfiguration, ServerOAuth2ConfigurationInterface $serverConfiguration, AuthenticationOAuth2ConfigurationInterface $authenticationConfiguration, GrantInterface $grant) {
$options = array();
$grant->buildRequestOptions($credentialsCo... | php | public static function getAccessToken(CredentialsConfigurationInterface $credentialsConfiguration, ServerOAuth2ConfigurationInterface $serverConfiguration, AuthenticationOAuth2ConfigurationInterface $authenticationConfiguration, GrantInterface $grant) {
$options = array();
$grant->buildRequestOptions($credentialsCo... | [
"public",
"static",
"function",
"getAccessToken",
"(",
"CredentialsConfigurationInterface",
"$",
"credentialsConfiguration",
",",
"ServerOAuth2ConfigurationInterface",
"$",
"serverConfiguration",
",",
"AuthenticationOAuth2ConfigurationInterface",
"$",
"authenticationConfiguration",
"... | @param \Uneak\OAuthClientBundle\OAuth\Configuration\CredentialsConfigurationInterface $credentialsConfiguration
@param \Uneak\OAuthClientBundle\OAuth\Configuration\ServerConfigurationInterface $serverConfiguration
@param \Uneak\OAuthClientBundle\OAuth\Configuration\AuthenticationConfigurationInterface $authe... | [
"@param",
"\\",
"Uneak",
"\\",
"OAuthClientBundle",
"\\",
"OAuth",
"\\",
"Configuration",
"\\",
"CredentialsConfigurationInterface",
"$credentialsConfiguration",
"@param",
"\\",
"Uneak",
"\\",
"OAuthClientBundle",
"\\",
"OAuth",
"\\",
"Configuration",
"\\",
"ServerConfigu... | train | https://github.com/uneak/OAuthClientBundle/blob/e24b7734d63cf0a114167e025aebcae8c04647bb/OAuth/OAuth2.php#L63-L68 |
uneak/OAuthClientBundle | OAuth/OAuth2.php | OAuth2.getAuthenticationUrl | public static function getAuthenticationUrl(CredentialsConfigurationInterface $credentialsConfiguration, ServerOAuth2ConfigurationInterface $serverConfiguration, AuthenticationOAuth2ConfigurationInterface $authenticationConfiguration) {
return $authenticationConfiguration->getAuthenticationPath($credentialsConfigurat... | php | public static function getAuthenticationUrl(CredentialsConfigurationInterface $credentialsConfiguration, ServerOAuth2ConfigurationInterface $serverConfiguration, AuthenticationOAuth2ConfigurationInterface $authenticationConfiguration) {
return $authenticationConfiguration->getAuthenticationPath($credentialsConfigurat... | [
"public",
"static",
"function",
"getAuthenticationUrl",
"(",
"CredentialsConfigurationInterface",
"$",
"credentialsConfiguration",
",",
"ServerOAuth2ConfigurationInterface",
"$",
"serverConfiguration",
",",
"AuthenticationOAuth2ConfigurationInterface",
"$",
"authenticationConfiguration... | @param \Uneak\OAuthClientBundle\OAuth\Configuration\CredentialsConfigurationInterface $credentialsConfiguration
@param \Uneak\OAuthClientBundle\OAuth\Configuration\ServerConfigurationInterface $serverConfiguration
@param \Uneak\OAuthClientBundle\OAuth\Configuration\AuthenticationConfigurationInterface $authe... | [
"@param",
"\\",
"Uneak",
"\\",
"OAuthClientBundle",
"\\",
"OAuth",
"\\",
"Configuration",
"\\",
"CredentialsConfigurationInterface",
"$credentialsConfiguration",
"@param",
"\\",
"Uneak",
"\\",
"OAuthClientBundle",
"\\",
"OAuth",
"\\",
"Configuration",
"\\",
"ServerConfigu... | train | https://github.com/uneak/OAuthClientBundle/blob/e24b7734d63cf0a114167e025aebcae8c04647bb/OAuth/OAuth2.php#L78-L81 |
Fenzland/php-http-client | libs/Response.php | Response.header | public function header( string$key=null )
{
return ( isset($key) ?
$this->headers[ucwords( strtolower($key), '-' )]
:
$this->getHeaders()
);
} | php | public function header( string$key=null )
{
return ( isset($key) ?
$this->headers[ucwords( strtolower($key), '-' )]
:
$this->getHeaders()
);
} | [
"public",
"function",
"header",
"(",
"string",
"$",
"key",
"=",
"null",
")",
"{",
"return",
"(",
"isset",
"(",
"$",
"key",
")",
"?",
"$",
"this",
"->",
"headers",
"[",
"ucwords",
"(",
"strtolower",
"(",
"$",
"key",
")",
",",
"'-'",
")",
"]",
":",... | Method header
@access public
@param string $key
@return mixed | [
"Method",
"header"
] | train | https://github.com/Fenzland/php-http-client/blob/2f8df0f5f5f81e45453efad02f8926167a029630/libs/Response.php#L164-L171 |
Fenzland/php-http-client | libs/Response.php | Response.getLine | private function getLine():string
{
$line= fgets( $this->handle );
$this->raw.= $line;
return trim( $line );
} | php | private function getLine():string
{
$line= fgets( $this->handle );
$this->raw.= $line;
return trim( $line );
} | [
"private",
"function",
"getLine",
"(",
")",
":",
"string",
"{",
"$",
"line",
"=",
"fgets",
"(",
"$",
"this",
"->",
"handle",
")",
";",
"$",
"this",
"->",
"raw",
".=",
"$",
"line",
";",
"return",
"trim",
"(",
"$",
"line",
")",
";",
"}"
] | Method getLine
@access private
@return string | [
"Method",
"getLine"
] | train | https://github.com/Fenzland/php-http-client/blob/2f8df0f5f5f81e45453efad02f8926167a029630/libs/Response.php#L234-L241 |
Fenzland/php-http-client | libs/Response.php | Response.parsMessageLine | private function parsMessageLine( string$messageLine )
{
preg_replace_callback( '/^HTTP\\/(\\S+) (\\S+) (.+)$/', function( array$matches ){
list( $null, $this->version, $this->statusCode, $this->statusMessage )= $matches;
}, $messageLine );
} | php | private function parsMessageLine( string$messageLine )
{
preg_replace_callback( '/^HTTP\\/(\\S+) (\\S+) (.+)$/', function( array$matches ){
list( $null, $this->version, $this->statusCode, $this->statusMessage )= $matches;
}, $messageLine );
} | [
"private",
"function",
"parsMessageLine",
"(",
"string",
"$",
"messageLine",
")",
"{",
"preg_replace_callback",
"(",
"'/^HTTP\\\\/(\\\\S+) (\\\\S+) (.+)$/'",
",",
"function",
"(",
"array",
"$",
"matches",
")",
"{",
"list",
"(",
"$",
"null",
",",
"$",
"this",
"->... | Method parsMessageLine
@access private
@param string $messageLine
@return void | [
"Method",
"parsMessageLine"
] | train | https://github.com/Fenzland/php-http-client/blob/2f8df0f5f5f81e45453efad02f8926167a029630/libs/Response.php#L252-L257 |
Fenzland/php-http-client | libs/Response.php | Response.parseHeader | private function parseHeader( string$headerLine )
{
list( $key, $value, )= explode(': ', $headerLine);
$this->headers[ucwords( strtolower($key), '-' )]= $value;
} | php | private function parseHeader( string$headerLine )
{
list( $key, $value, )= explode(': ', $headerLine);
$this->headers[ucwords( strtolower($key), '-' )]= $value;
} | [
"private",
"function",
"parseHeader",
"(",
"string",
"$",
"headerLine",
")",
"{",
"list",
"(",
"$",
"key",
",",
"$",
"value",
",",
")",
"=",
"explode",
"(",
"': '",
",",
"$",
"headerLine",
")",
";",
"$",
"this",
"->",
"headers",
"[",
"ucwords",
"(",
... | Method parseHeader
@access private
@param string $headerLine
@return void | [
"Method",
"parseHeader"
] | train | https://github.com/Fenzland/php-http-client/blob/2f8df0f5f5f81e45453efad02f8926167a029630/libs/Response.php#L268-L273 |
Fenzland/php-http-client | libs/Response.php | Response.readBody | private function readBody()
{
$body= '';
while( !feof($this->handle) )
{
$body.= fgets($this->handle);
}
if( isset( $this->headers['Transfer-Encoding'] ) && $this->headers['Transfer-Encoding']==='chunked' )
{
$this->body= $this->unchunk( $body );
}else{
$this->body= $body;
}
} | php | private function readBody()
{
$body= '';
while( !feof($this->handle) )
{
$body.= fgets($this->handle);
}
if( isset( $this->headers['Transfer-Encoding'] ) && $this->headers['Transfer-Encoding']==='chunked' )
{
$this->body= $this->unchunk( $body );
}else{
$this->body= $body;
}
} | [
"private",
"function",
"readBody",
"(",
")",
"{",
"$",
"body",
"=",
"''",
";",
"while",
"(",
"!",
"feof",
"(",
"$",
"this",
"->",
"handle",
")",
")",
"{",
"$",
"body",
".=",
"fgets",
"(",
"$",
"this",
"->",
"handle",
")",
";",
"}",
"if",
"(",
... | Method readBody
@access private
@return void | [
"Method",
"readBody"
] | train | https://github.com/Fenzland/php-http-client/blob/2f8df0f5f5f81e45453efad02f8926167a029630/libs/Response.php#L282-L297 |
Fenzland/php-http-client | libs/Response.php | Response.unchunk | private function unchunk( string$chunked ):string
{
return preg_replace_callback(
'/(?:(?:\r\n|\n)|^)([0-9A-F]+)(?:\r\n|\n){1,2}(.*?)((?:\r\n|\n)(?:[0-9A-F]+(?:\r\n|\n))|$)/si'
,
function( array$matches ){
return hexdec( $matches[1] )==strlen( $matches[2] )? $matches[2] : $matches[0];
}
,
$chunke... | php | private function unchunk( string$chunked ):string
{
return preg_replace_callback(
'/(?:(?:\r\n|\n)|^)([0-9A-F]+)(?:\r\n|\n){1,2}(.*?)((?:\r\n|\n)(?:[0-9A-F]+(?:\r\n|\n))|$)/si'
,
function( array$matches ){
return hexdec( $matches[1] )==strlen( $matches[2] )? $matches[2] : $matches[0];
}
,
$chunke... | [
"private",
"function",
"unchunk",
"(",
"string",
"$",
"chunked",
")",
":",
"string",
"{",
"return",
"preg_replace_callback",
"(",
"'/(?:(?:\\r\\n|\\n)|^)([0-9A-F]+)(?:\\r\\n|\\n){1,2}(.*?)((?:\\r\\n|\\n)(?:[0-9A-F]+(?:\\r\\n|\\n))|$)/si'",
",",
"function",
"(",
"array",
"$",
... | Method unchunk
@access private
@param string $chunked
@return string | [
"Method",
"unchunk"
] | train | https://github.com/Fenzland/php-http-client/blob/2f8df0f5f5f81e45453efad02f8926167a029630/libs/Response.php#L308-L319 |
fridge-project/dbal | src/Fridge/DBAL/Type/BlobType.php | BlobType.convertToPHPValue | public function convertToPHPValue($value, PlatformInterface $platform)
{
if ($value === null) {
return;
}
if (is_string($value)) {
$value = fopen('data://text/plain;base64,'.base64_encode($value), 'r');
}
if (!is_resource($value)) {
throw... | php | public function convertToPHPValue($value, PlatformInterface $platform)
{
if ($value === null) {
return;
}
if (is_string($value)) {
$value = fopen('data://text/plain;base64,'.base64_encode($value), 'r');
}
if (!is_resource($value)) {
throw... | [
"public",
"function",
"convertToPHPValue",
"(",
"$",
"value",
",",
"PlatformInterface",
"$",
"platform",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"$",
"v... | {@inheritdoc}
@throws \Fridge\DBAL\Exception\TypeException If the database value can not be convert to this PHP value. | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Type/BlobType.php#L46-L61 |
Dhii/exception-helper-base | src/CreateExceptionCapableTrait.php | CreateExceptionCapableTrait._createException | protected function _createException($message = null, $code = null, $previous = null)
{
return new Exception($message, $code, $previous);
} | php | protected function _createException($message = null, $code = null, $previous = null)
{
return new Exception($message, $code, $previous);
} | [
"protected",
"function",
"_createException",
"(",
"$",
"message",
"=",
"null",
",",
"$",
"code",
"=",
"null",
",",
"$",
"previous",
"=",
"null",
")",
"{",
"return",
"new",
"Exception",
"(",
"$",
"message",
",",
"$",
"code",
",",
"$",
"previous",
")",
... | Creates a new basic Dhii exception.
@since [*next-version*]
@param string|Stringable|int|float|bool|null $message The message, if any.
@param int|float|string|Stringable|null $code The numeric error code, if any.
@param RootException|null $previous The inner exception, if any.
@return Th... | [
"Creates",
"a",
"new",
"basic",
"Dhii",
"exception",
"."
] | train | https://github.com/Dhii/exception-helper-base/blob/e97bfa6c0f79ea079e36b2f1d8f84d7566a3ccf5/src/CreateExceptionCapableTrait.php#L26-L29 |
Mandarin-Medien/MMCmfContentBundle | EventListeners/PageHookListener.php | PageHookListener.postLoad | public function postLoad(Page $page, LifecycleEventArgs $args)
{
$hookManager = $this->container->get('mm_cmf_content.page_hook_manager');
foreach($hookManager->getHooks() as $hook) {
$hook->process($page, $this->container->get('request_stack')->getCurrentRequest());
};
} | php | public function postLoad(Page $page, LifecycleEventArgs $args)
{
$hookManager = $this->container->get('mm_cmf_content.page_hook_manager');
foreach($hookManager->getHooks() as $hook) {
$hook->process($page, $this->container->get('request_stack')->getCurrentRequest());
};
} | [
"public",
"function",
"postLoad",
"(",
"Page",
"$",
"page",
",",
"LifecycleEventArgs",
"$",
"args",
")",
"{",
"$",
"hookManager",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'mm_cmf_content.page_hook_manager'",
")",
";",
"foreach",
"(",
"$",
"hoo... | postLoad Callback for Page entity, gets all defined PageHooks and calls it
@param Page $page
@param LifecycleEventArgs $args | [
"postLoad",
"Callback",
"for",
"Page",
"entity",
"gets",
"all",
"defined",
"PageHooks",
"and",
"calls",
"it"
] | train | https://github.com/Mandarin-Medien/MMCmfContentBundle/blob/503ab31cef3ce068f767de5b72f833526355b726/EventListeners/PageHookListener.php#L42-L49 |
rougin/blueprint | src/Commands/InitializeCommand.php | InitializeCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$filepath = __DIR__ . '/../Templates/blueprint.yml';
$template = file_get_contents($filepath);
$this->filesystem->write('blueprint.yml', $template);
$text = '"blueprint.yml" has been created successfully!... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$filepath = __DIR__ . '/../Templates/blueprint.yml';
$template = file_get_contents($filepath);
$this->filesystem->write('blueprint.yml', $template);
$text = '"blueprint.yml" has been created successfully!... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"filepath",
"=",
"__DIR__",
".",
"'/../Templates/blueprint.yml'",
";",
"$",
"template",
"=",
"file_get_contents",
"(",
"$",
"filepath",
... | Executes the current command.
@param \Symfony\Component\Console\Input\InputInterface $input
@param \Symfony\Component\Console\Input\OutputInterface $output
@return void | [
"Executes",
"the",
"current",
"command",
"."
] | train | https://github.com/rougin/blueprint/blob/02dab857b0fab60e060632f11f73e24467483e5b/src/Commands/InitializeCommand.php#L47-L58 |
this7/framework | src/kernel.php | kernel.start | public function start() {
#设置DEBUG引导程序
(new This7Debug())->bootstrap();
#设置配置文件
This7Config::defineConst();
#获取驱动列表
$this->drives = $this->getDeviceList(VENDOR_DIR . DS . 'this7');
#自动加载类
spl_autoload_register(array($this, 'autoload'));
#设置静态化
... | php | public function start() {
#设置DEBUG引导程序
(new This7Debug())->bootstrap();
#设置配置文件
This7Config::defineConst();
#获取驱动列表
$this->drives = $this->getDeviceList(VENDOR_DIR . DS . 'this7');
#自动加载类
spl_autoload_register(array($this, 'autoload'));
#设置静态化
... | [
"public",
"function",
"start",
"(",
")",
"{",
"#设置DEBUG引导程序",
"(",
"new",
"This7Debug",
"(",
")",
")",
"->",
"bootstrap",
"(",
")",
";",
"#设置配置文件",
"This7Config",
"::",
"defineConst",
"(",
")",
";",
"#获取驱动列表",
"$",
"this",
"->",
"drives",
"=",
"$",
"th... | 框架启动器
@return [type] [description] | [
"框架启动器"
] | train | https://github.com/this7/framework/blob/1248f4ea79cf2a61da11de0aaf1fbbf25a91ca97/src/kernel.php#L25-L40 |
this7/framework | src/kernel.php | kernel.setConnector | public function setConnector($dir = '', $class) {
$name = $class . md5($class);
$path = ROOT_DIR . DS . $dir . DS . $name . '.php';
$connector = <<<CON
<?php
namespace server\\connector;
use \\this7\\framework\\staticize;
class $name extends staticize{
public static function getAp... | php | public function setConnector($dir = '', $class) {
$name = $class . md5($class);
$path = ROOT_DIR . DS . $dir . DS . $name . '.php';
$connector = <<<CON
<?php
namespace server\\connector;
use \\this7\\framework\\staticize;
class $name extends staticize{
public static function getAp... | [
"public",
"function",
"setConnector",
"(",
"$",
"dir",
"=",
"''",
",",
"$",
"class",
")",
"{",
"$",
"name",
"=",
"$",
"class",
".",
"md5",
"(",
"$",
"class",
")",
";",
"$",
"path",
"=",
"ROOT_DIR",
".",
"DS",
".",
"$",
"dir",
".",
"DS",
".",
... | 创建链接文件
@param string $value [description] | [
"创建链接文件"
] | train | https://github.com/this7/framework/blob/1248f4ea79cf2a61da11de0aaf1fbbf25a91ca97/src/kernel.php#L57-L75 |
this7/framework | src/kernel.php | kernel.getDeviceList | public function getDeviceList($dir) {
$path = array('.', '..', '.htaccess', '.DS_Store', 'controllers', 'config', 'debug', 'framework');
$ext = array("php", "html", "htm");
$list = array();
if (is_dir($dir)) {
if ($handle = opendir($dir)) {
while (($file = re... | php | public function getDeviceList($dir) {
$path = array('.', '..', '.htaccess', '.DS_Store', 'controllers', 'config', 'debug', 'framework');
$ext = array("php", "html", "htm");
$list = array();
if (is_dir($dir)) {
if ($handle = opendir($dir)) {
while (($file = re... | [
"public",
"function",
"getDeviceList",
"(",
"$",
"dir",
")",
"{",
"$",
"path",
"=",
"array",
"(",
"'.'",
",",
"'..'",
",",
"'.htaccess'",
",",
"'.DS_Store'",
",",
"'controllers'",
",",
"'config'",
",",
"'debug'",
",",
"'framework'",
")",
";",
"$",
"ext",... | 获取驱动列表.
@param string $dir 驱动目录
@return array 驱动列表 | [
"获取驱动列表",
"."
] | train | https://github.com/this7/framework/blob/1248f4ea79cf2a61da11de0aaf1fbbf25a91ca97/src/kernel.php#L84-L99 |
Nicofuma/phpbb-ext-webprofiler | phpbb/template/timed.php | timed.display | public function display($handle)
{
$e = $this->stopwatch->start(sprintf('template (%s)', $this->get_source_file_for_handle($handle)), 'template');
$this->template->display($handle);
$e->stop();
return $this;
} | php | public function display($handle)
{
$e = $this->stopwatch->start(sprintf('template (%s)', $this->get_source_file_for_handle($handle)), 'template');
$this->template->display($handle);
$e->stop();
return $this;
} | [
"public",
"function",
"display",
"(",
"$",
"handle",
")",
"{",
"$",
"e",
"=",
"$",
"this",
"->",
"stopwatch",
"->",
"start",
"(",
"sprintf",
"(",
"'template (%s)'",
",",
"$",
"this",
"->",
"get_source_file_for_handle",
"(",
"$",
"handle",
")",
")",
",",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/Nicofuma/phpbb-ext-webprofiler/blob/5f52e2b67f5b8278af18907615f30ffe20f4802c/phpbb/template/timed.php#L109-L118 |
Nicofuma/phpbb-ext-webprofiler | phpbb/template/timed.php | timed.assign_display | public function assign_display($handle, $template_var = '', $return_content = true)
{
$e = $this->stopwatch->start(sprintf('template (%s)', $this->get_source_file_for_handle($handle)), 'template');
$result = $this->template->assign_display($handle, $template_var, $return_content);
$e->stop();
if ($return_co... | php | public function assign_display($handle, $template_var = '', $return_content = true)
{
$e = $this->stopwatch->start(sprintf('template (%s)', $this->get_source_file_for_handle($handle)), 'template');
$result = $this->template->assign_display($handle, $template_var, $return_content);
$e->stop();
if ($return_co... | [
"public",
"function",
"assign_display",
"(",
"$",
"handle",
",",
"$",
"template_var",
"=",
"''",
",",
"$",
"return_content",
"=",
"true",
")",
"{",
"$",
"e",
"=",
"$",
"this",
"->",
"stopwatch",
"->",
"start",
"(",
"sprintf",
"(",
"'template (%s)'",
",",... | {@inheritdoc} | [
"{"
] | train | https://github.com/Nicofuma/phpbb-ext-webprofiler/blob/5f52e2b67f5b8278af18907615f30ffe20f4802c/phpbb/template/timed.php#L123-L137 |
Nicofuma/phpbb-ext-webprofiler | phpbb/template/timed.php | timed.alter_block_array | public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert')
{
return $this->template->alter_block_array($blockname, $vararray, $key, $mode);
} | php | public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert')
{
return $this->template->alter_block_array($blockname, $vararray, $key, $mode);
} | [
"public",
"function",
"alter_block_array",
"(",
"$",
"blockname",
",",
"array",
"$",
"vararray",
",",
"$",
"key",
"=",
"false",
",",
"$",
"mode",
"=",
"'insert'",
")",
"{",
"return",
"$",
"this",
"->",
"template",
"->",
"alter_block_array",
"(",
"$",
"bl... | {@inheritdoc} | [
"{"
] | train | https://github.com/Nicofuma/phpbb-ext-webprofiler/blob/5f52e2b67f5b8278af18907615f30ffe20f4802c/phpbb/template/timed.php#L192-L195 |
loevgaard/dandomain-foundation-entities | src/Repository/ProductRepository.php | ProductRepository.updateParentChildRelationships | public function updateParentChildRelationships(array $productIds = [])
{
$variantMasterIdCache = [];
$innerQb = $this->createQueryBuilder('p');
$innerQb->where('p.isVariantMaster = 1')
->andWhere('p.number = :number');
$qb = $this->createQueryBuilder('p');
$qb
... | php | public function updateParentChildRelationships(array $productIds = [])
{
$variantMasterIdCache = [];
$innerQb = $this->createQueryBuilder('p');
$innerQb->where('p.isVariantMaster = 1')
->andWhere('p.number = :number');
$qb = $this->createQueryBuilder('p');
$qb
... | [
"public",
"function",
"updateParentChildRelationships",
"(",
"array",
"$",
"productIds",
"=",
"[",
"]",
")",
"{",
"$",
"variantMasterIdCache",
"=",
"[",
"]",
";",
"$",
"innerQb",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
"'p'",
")",
";",
"$",
"inn... | @param array $productIds
@throws \Doctrine\ORM\OptimisticLockException | [
"@param",
"array",
"$productIds"
] | train | https://github.com/loevgaard/dandomain-foundation-entities/blob/256f7aa8b40d2bd9488046c3c2b1e04e982d78ad/src/Repository/ProductRepository.php#L55-L117 |
eureka-framework/component-notification | src/Notification/NotificationBootstrap.php | NotificationBootstrap.getCss | public function getCss()
{
switch ($this->type) {
case self::TYPE_ERROR:
$css = 'danger';
break;
case self::TYPE_WARNING:
$css = 'warning';
break;
case self::TYPE_INFO:
$css = 'info';
... | php | public function getCss()
{
switch ($this->type) {
case self::TYPE_ERROR:
$css = 'danger';
break;
case self::TYPE_WARNING:
$css = 'warning';
break;
case self::TYPE_INFO:
$css = 'info';
... | [
"public",
"function",
"getCss",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"type",
")",
"{",
"case",
"self",
"::",
"TYPE_ERROR",
":",
"$",
"css",
"=",
"'danger'",
";",
"break",
";",
"case",
"self",
"::",
"TYPE_WARNING",
":",
"$",
"css",
"=",
... | Get css used.
@return string | [
"Get",
"css",
"used",
"."
] | train | https://github.com/eureka-framework/component-notification/blob/346c2932cf4ebdbae651aae513ac350df8f8c33a/src/Notification/NotificationBootstrap.php#L24-L45 |
eureka-framework/component-notification | src/Notification/NotificationBootstrap.php | NotificationBootstrap.getHeader | public function getHeader()
{
switch ($this->type) {
case self::TYPE_ERROR:
$header = 'Error!';
break;
case self::TYPE_WARNING:
$header = 'Warning!';
break;
case self::TYPE_INFO:
$header = 'In... | php | public function getHeader()
{
switch ($this->type) {
case self::TYPE_ERROR:
$header = 'Error!';
break;
case self::TYPE_WARNING:
$header = 'Warning!';
break;
case self::TYPE_INFO:
$header = 'In... | [
"public",
"function",
"getHeader",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"type",
")",
"{",
"case",
"self",
"::",
"TYPE_ERROR",
":",
"$",
"header",
"=",
"'Error!'",
";",
"break",
";",
"case",
"self",
"::",
"TYPE_WARNING",
":",
"$",
"header",
... | Get header title.
@return string | [
"Get",
"header",
"title",
"."
] | train | https://github.com/eureka-framework/component-notification/blob/346c2932cf4ebdbae651aae513ac350df8f8c33a/src/Notification/NotificationBootstrap.php#L52-L73 |
nicmart/DomainSpecificQuery | src/Language/Grammar.php | Grammar.unescape | public function unescape($string, $chars, $escapeChar = "\\")
{
if (!$chars)
return $string;
$escapeChar = preg_quote($escapeChar);
$chars = preg_quote($chars);
return preg_replace("/$escapeChar([$chars])/", "$1", $string);
} | php | public function unescape($string, $chars, $escapeChar = "\\")
{
if (!$chars)
return $string;
$escapeChar = preg_quote($escapeChar);
$chars = preg_quote($chars);
return preg_replace("/$escapeChar([$chars])/", "$1", $string);
} | [
"public",
"function",
"unescape",
"(",
"$",
"string",
",",
"$",
"chars",
",",
"$",
"escapeChar",
"=",
"\"\\\\\"",
")",
"{",
"if",
"(",
"!",
"$",
"chars",
")",
"return",
"$",
"string",
";",
"$",
"escapeChar",
"=",
"preg_quote",
"(",
"$",
"escapeChar",
... | Do unescaping
@param string $string
@param string $chars
@param string $escapeChar
@return string | [
"Do",
"unescaping"
] | train | https://github.com/nicmart/DomainSpecificQuery/blob/7c01fe94337afdfae5884809e8b5487127a63ac3/src/Language/Grammar.php#L172-L180 |
MindyPHP/QueryBuilder | Utils/TableNameResolver.php | TableNameResolver.getTableName | public static function getTableName(string $name, string $prefix = null): string
{
if (false !== strpos($name, '{{')) {
$name = preg_replace('/\\{\\{(.*?)\\}\\}/', '\1', $name);
return str_replace('%', $prefix, $name);
}
return $name;
} | php | public static function getTableName(string $name, string $prefix = null): string
{
if (false !== strpos($name, '{{')) {
$name = preg_replace('/\\{\\{(.*?)\\}\\}/', '\1', $name);
return str_replace('%', $prefix, $name);
}
return $name;
} | [
"public",
"static",
"function",
"getTableName",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"prefix",
"=",
"null",
")",
":",
"string",
"{",
"if",
"(",
"false",
"!==",
"strpos",
"(",
"$",
"name",
",",
"'{{'",
")",
")",
"{",
"$",
"name",
"=",
"pr... | Returns the actual name of a given table name.
This method will strip off curly brackets from the given table name
and replace the percentage character '%' with [[Connection::tablePrefix]].
@param string $name the table name to be converted
@param string|null $prefix
@return string the real name of the given t... | [
"Returns",
"the",
"actual",
"name",
"of",
"a",
"given",
"table",
"name",
".",
"This",
"method",
"will",
"strip",
"off",
"curly",
"brackets",
"from",
"the",
"given",
"table",
"name",
"and",
"replace",
"the",
"percentage",
"character",
"%",
"with",
"[[",
"Co... | train | https://github.com/MindyPHP/QueryBuilder/blob/fc486454786f3d38887dd7246802ea11e2954e54/Utils/TableNameResolver.php#L26-L35 |
judus/minimal-collections | src/Collection.php | Collection.add | public function add($obj, $key = null, $overwrite = false): CollectionInterface
{
$this->validateKey($key);
if ($key == null) {
$this->items[] = $obj;
} else {
if (isset($this->items[$key]) && !$overwrite) {
throw new KeyInUseException("Collection key '".$key."' is already in use.... | php | public function add($obj, $key = null, $overwrite = false): CollectionInterface
{
$this->validateKey($key);
if ($key == null) {
$this->items[] = $obj;
} else {
if (isset($this->items[$key]) && !$overwrite) {
throw new KeyInUseException("Collection key '".$key."' is already in use.... | [
"public",
"function",
"add",
"(",
"$",
"obj",
",",
"$",
"key",
"=",
"null",
",",
"$",
"overwrite",
"=",
"false",
")",
":",
"CollectionInterface",
"{",
"$",
"this",
"->",
"validateKey",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"key",
"==",
"null",... | @param $obj
@param null $key
@param bool $overwrite
@return CollectionInterface
@throws InvalidKeyException
@throws KeyInUseException | [
"@param",
"$obj",
"@param",
"null",
"$key"
] | train | https://github.com/judus/minimal-collections/blob/0dd5d1980164f1479358b821937e1b236e0e15d4/src/Collection.php#L34-L49 |
judus/minimal-collections | src/Collection.php | Collection.delete | public function delete($key)
{
$this->validateKey($key);
if (isset($this->items[$key])) {
unset($this->items[$key]);
} else {
throw new InvalidKeyException("Collection key '".$key."' does not exist.");
}
} | php | public function delete($key)
{
$this->validateKey($key);
if (isset($this->items[$key])) {
unset($this->items[$key]);
} else {
throw new InvalidKeyException("Collection key '".$key."' does not exist.");
}
} | [
"public",
"function",
"delete",
"(",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"validateKey",
"(",
"$",
"key",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"items",
"[",
"$",
"key",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
... | @param $key
@throws InvalidKeyException | [
"@param",
"$key"
] | train | https://github.com/judus/minimal-collections/blob/0dd5d1980164f1479358b821937e1b236e0e15d4/src/Collection.php#L56-L65 |
judus/minimal-collections | src/Collection.php | Collection.get | public function get($key)
{
if (isset($this->items[$key])) {
return $this->items[$key];
} else {
throw new InvalidKeyException("Collection key '" . $key . "' does not exist.");
}
} | php | public function get($key)
{
if (isset($this->items[$key])) {
return $this->items[$key];
} else {
throw new InvalidKeyException("Collection key '" . $key . "' does not exist.");
}
} | [
"public",
"function",
"get",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"items",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"items",
"[",
"$",
"key",
"]",
";",
"}",
"else",
"{",
"throw",
"new... | @param $key
@return mixed
@throws InvalidKeyException | [
"@param",
"$key"
] | train | https://github.com/judus/minimal-collections/blob/0dd5d1980164f1479358b821937e1b236e0e15d4/src/Collection.php#L89-L96 |
judus/minimal-collections | src/Collection.php | Collection.count | public function count($key = null)
{
if (!is_null($key) && isset($this->items[$key])) {
return count($this->items[$key]);
} else {
return count($this->items);
}
} | php | public function count($key = null)
{
if (!is_null($key) && isset($this->items[$key])) {
return count($this->items[$key]);
} else {
return count($this->items);
}
} | [
"public",
"function",
"count",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"key",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"items",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"count",
"(",
"$",
"this",
... | @param null $key
@return int | [
"@param",
"null",
"$key"
] | train | https://github.com/judus/minimal-collections/blob/0dd5d1980164f1479358b821937e1b236e0e15d4/src/Collection.php#L103-L110 |
judus/minimal-collections | src/Collection.php | Collection.exists | public function exists(string $name, $else = null)
{
return isset($this->items[$name]) ?
$this->items[$name] : $else;
} | php | public function exists(string $name, $else = null)
{
return isset($this->items[$name]) ?
$this->items[$name] : $else;
} | [
"public",
"function",
"exists",
"(",
"string",
"$",
"name",
",",
"$",
"else",
"=",
"null",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"items",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this",
"->",
"items",
"[",
"$",
"name",
"]",
":",
"$... | @param string $name
@param null $else
@return mixed|null | [
"@param",
"string",
"$name",
"@param",
"null",
"$else"
] | train | https://github.com/judus/minimal-collections/blob/0dd5d1980164f1479358b821937e1b236e0e15d4/src/Collection.php#L126-L130 |
judus/minimal-collections | src/Collection.php | Collection.each | public function each($closure)
{
$container = new static();
$index = -1;
foreach ($this->items as $key => $item) {
$container->add($closure($key, $item, $index++), $key);
}
return $container;
} | php | public function each($closure)
{
$container = new static();
$index = -1;
foreach ($this->items as $key => $item) {
$container->add($closure($key, $item, $index++), $key);
}
return $container;
} | [
"public",
"function",
"each",
"(",
"$",
"closure",
")",
"{",
"$",
"container",
"=",
"new",
"static",
"(",
")",
";",
"$",
"index",
"=",
"-",
"1",
";",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"{",
"$"... | @param $closure
@return Collection | [
"@param",
"$closure"
] | train | https://github.com/judus/minimal-collections/blob/0dd5d1980164f1479358b821937e1b236e0e15d4/src/Collection.php#L137-L147 |
judus/minimal-collections | src/Collection.php | Collection.filter | public function filter(\Closure $closure, $keepKeys = false)
{
$collection = new Collection();
$i = 0;
foreach ($this->items as $key => $value) {
if ( ! $closure($value, $key, $i++)) {
$keepKeys || $key = null;
$collection->add($value, $key);
... | php | public function filter(\Closure $closure, $keepKeys = false)
{
$collection = new Collection();
$i = 0;
foreach ($this->items as $key => $value) {
if ( ! $closure($value, $key, $i++)) {
$keepKeys || $key = null;
$collection->add($value, $key);
... | [
"public",
"function",
"filter",
"(",
"\\",
"Closure",
"$",
"closure",
",",
"$",
"keepKeys",
"=",
"false",
")",
"{",
"$",
"collection",
"=",
"new",
"Collection",
"(",
")",
";",
"$",
"i",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as... | @param \Closure $closure
@param bool $keepKeys
@return Collection
@throws InvalidKeyException
@throws KeyInUseException | [
"@param",
"\\",
"Closure",
"$closure",
"@param",
"bool",
"$keepKeys"
] | train | https://github.com/judus/minimal-collections/blob/0dd5d1980164f1479358b821937e1b236e0e15d4/src/Collection.php#L157-L170 |
judus/minimal-collections | src/Collection.php | Collection.extract | public function extract($key)
{
$extracted = [];
foreach ($this->items as $item) {
foreach (func_get_args() as $key) {
if ($item instanceof CollectionInterface) {
$extracted[] = $item->get($key);
} else if (is_object($item)) {
... | php | public function extract($key)
{
$extracted = [];
foreach ($this->items as $item) {
foreach (func_get_args() as $key) {
if ($item instanceof CollectionInterface) {
$extracted[] = $item->get($key);
} else if (is_object($item)) {
... | [
"public",
"function",
"extract",
"(",
"$",
"key",
")",
"{",
"$",
"extracted",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"$",
"item",
")",
"{",
"foreach",
"(",
"func_get_args",
"(",
")",
"as",
"$",
"key",
")",
"{",
"if"... | @param $key
@return array
@throws InvalidKeyException | [
"@param",
"$key"
] | train | https://github.com/judus/minimal-collections/blob/0dd5d1980164f1479358b821937e1b236e0e15d4/src/Collection.php#L178-L195 |
AnonymPHP/Anonym-Route | Matchers/NewMatcher.php | NewMatcher.match | public function match($url = null)
{
$match = parent::match($url);
$find = $this->replaceParameters();
if (false !== $find || true === $match) {
return true;
} else {
return false;
}
} | php | public function match($url = null)
{
$match = parent::match($url);
$find = $this->replaceParameters();
if (false !== $find || true === $match) {
return true;
} else {
return false;
}
} | [
"public",
"function",
"match",
"(",
"$",
"url",
"=",
"null",
")",
"{",
"$",
"match",
"=",
"parent",
"::",
"match",
"(",
"$",
"url",
")",
";",
"$",
"find",
"=",
"$",
"this",
"->",
"replaceParameters",
"(",
")",
";",
"if",
"(",
"false",
"!==",
"$",... | make the match
@param string|null $url
@return bool | [
"make",
"the",
"match"
] | train | https://github.com/AnonymPHP/Anonym-Route/blob/bb7f8004fbbd2998af8b0061f404f026f11466ab/Matchers/NewMatcher.php#L51-L62 |
AnonymPHP/Anonym-Route | Matchers/NewMatcher.php | NewMatcher.resolvePregCallback | private function resolvePregCallback($finded)
{
$matchEx = explode(' ', $this->getMatchUrl());
$requestEx = explode(' ', $this->getRequestedUrl());
$key = array_search($finded[0], $matchEx);
$cln = $finded[1];
if (strstr($cln, ':')) {
list($cln, $filter) = explo... | php | private function resolvePregCallback($finded)
{
$matchEx = explode(' ', $this->getMatchUrl());
$requestEx = explode(' ', $this->getRequestedUrl());
$key = array_search($finded[0], $matchEx);
$cln = $finded[1];
if (strstr($cln, ':')) {
list($cln, $filter) = explo... | [
"private",
"function",
"resolvePregCallback",
"(",
"$",
"finded",
")",
"{",
"$",
"matchEx",
"=",
"explode",
"(",
"' '",
",",
"$",
"this",
"->",
"getMatchUrl",
"(",
")",
")",
";",
"$",
"requestEx",
"=",
"explode",
"(",
"' '",
",",
"$",
"this",
"->",
"... | resolve the preg callback
@param array $finded
@return bool|string | [
"resolve",
"the",
"preg",
"callback"
] | train | https://github.com/AnonymPHP/Anonym-Route/blob/bb7f8004fbbd2998af8b0061f404f026f11466ab/Matchers/NewMatcher.php#L99-L125 |
AnonymPHP/Anonym-Route | Matchers/NewMatcher.php | NewMatcher.runFilter | private function runFilter($filter, $parameter)
{
if (!strstr($filter, '(') && !strstr($filter, ')')) {
if (!$filter = $this->getFilter($filter)) {
return false;
}
}
return preg_match('@' . $filter . '@si', $parameter) ?: false;
} | php | private function runFilter($filter, $parameter)
{
if (!strstr($filter, '(') && !strstr($filter, ')')) {
if (!$filter = $this->getFilter($filter)) {
return false;
}
}
return preg_match('@' . $filter . '@si', $parameter) ?: false;
} | [
"private",
"function",
"runFilter",
"(",
"$",
"filter",
",",
"$",
"parameter",
")",
"{",
"if",
"(",
"!",
"strstr",
"(",
"$",
"filter",
",",
"'('",
")",
"&&",
"!",
"strstr",
"(",
"$",
"filter",
",",
"')'",
")",
")",
"{",
"if",
"(",
"!",
"$",
"fi... | execute a filter
@param string $filter
@param string $parameter
@return bool|int | [
"execute",
"a",
"filter"
] | train | https://github.com/AnonymPHP/Anonym-Route/blob/bb7f8004fbbd2998af8b0061f404f026f11466ab/Matchers/NewMatcher.php#L134-L143 |
linuxjuggler/lumen-make | src/LumenMakeServiceProvider.php | LumenMakeServiceProvider.register | public function register()
{
$this->commands([
ConsoleMakeCommand::class,
ControllerMakeCommand::class,
EnvironmentCommand::class,
EventMakeCommand::class,
JobMakeCommand::class,
KeyGenerateCommand::class,
... | php | public function register()
{
$this->commands([
ConsoleMakeCommand::class,
ControllerMakeCommand::class,
EnvironmentCommand::class,
EventMakeCommand::class,
JobMakeCommand::class,
KeyGenerateCommand::class,
... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"commands",
"(",
"[",
"ConsoleMakeCommand",
"::",
"class",
",",
"ControllerMakeCommand",
"::",
"class",
",",
"EnvironmentCommand",
"::",
"class",
",",
"EventMakeCommand",
"::",
"class",
",",
"... | Register any application services. | [
"Register",
"any",
"application",
"services",
"."
] | train | https://github.com/linuxjuggler/lumen-make/blob/80e794f78957ea56770a1b27c0f7160d0b7ea76d/src/LumenMakeServiceProvider.php#L26-L44 |
opensourcerefinery/vicus | src/Component/CallbackResolver.php | CallbackResolver.convertCallback | public function convertCallback($name)
{
list($service, $method) = explode(':', $name, 2);
if (!isset($this->container[$service])) {
throw new \InvalidArgumentException(sprintf('Service "%s" does not exist.', $service));
}
return array($this->container[$service], $metho... | php | public function convertCallback($name)
{
list($service, $method) = explode(':', $name, 2);
if (!isset($this->container[$service])) {
throw new \InvalidArgumentException(sprintf('Service "%s" does not exist.', $service));
}
return array($this->container[$service], $metho... | [
"public",
"function",
"convertCallback",
"(",
"$",
"name",
")",
"{",
"list",
"(",
"$",
"service",
",",
"$",
"method",
")",
"=",
"explode",
"(",
"':'",
",",
"$",
"name",
",",
"2",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"contain... | Returns a callable given its string representation.
@param string $name
@return array A callable array
@throws \InvalidArgumentException In case the method does not exist. | [
"Returns",
"a",
"callable",
"given",
"its",
"string",
"representation",
"."
] | train | https://github.com/opensourcerefinery/vicus/blob/5be93d75bf6ab8009a299e9946c8333f0017fa3e/src/Component/CallbackResolver.php#L46-L55 |
bseries/base_tag | models/Tags.php | Tags.depend | public function depend($entity, $type) {
$depend = $type === 'count' ? 0 : [];
foreach (static::_dependent() as $model) {
$results = $model::find($type, [
'conditions' => [
'tags' => $entity->name
]
]);
if (!$results) {
continue;
}
if ($type === 'count') {
$depend += $results;
... | php | public function depend($entity, $type) {
$depend = $type === 'count' ? 0 : [];
foreach (static::_dependent() as $model) {
$results = $model::find($type, [
'conditions' => [
'tags' => $entity->name
]
]);
if (!$results) {
continue;
}
if ($type === 'count') {
$depend += $results;
... | [
"public",
"function",
"depend",
"(",
"$",
"entity",
",",
"$",
"type",
")",
"{",
"$",
"depend",
"=",
"$",
"type",
"===",
"'count'",
"?",
"0",
":",
"[",
"]",
";",
"foreach",
"(",
"static",
"::",
"_dependent",
"(",
")",
"as",
"$",
"model",
")",
"{",... | Do not use in performance criticial parts. | [
"Do",
"not",
"use",
"in",
"performance",
"criticial",
"parts",
"."
] | train | https://github.com/bseries/base_tag/blob/b66e817ac8268813790677fed259d8904b6dbb92/models/Tags.php#L79-L100 |
vanilla/legacy-passwords | src/DrupalPassword.php | DrupalPassword.needsRehash | public function needsRehash($hash) {
if (strpos($hash, '$') === false) {
return true;
} else {
if (strpos($hash, '$S$') !== 0) {
return true;
}
}
return true;
} | php | public function needsRehash($hash) {
if (strpos($hash, '$') === false) {
return true;
} else {
if (strpos($hash, '$S$') !== 0) {
return true;
}
}
return true;
} | [
"public",
"function",
"needsRehash",
"(",
"$",
"hash",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"hash",
",",
"'$'",
")",
"===",
"false",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"if",
"(",
"strpos",
"(",
"$",
"hash",
",",
"'$S$'",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/vanilla/legacy-passwords/blob/3363312791bef1ea781b2896f99feb65d116c6cd/src/DrupalPassword.php#L30-L40 |
nicodevs/laito | src/Laito/Database.php | Database.reset | public function reset()
{
$this->table = '';
$this->columns = [];
$this->joins = [];
$this->wheres = [];
$this->whereIn = [];
$this->groupBy = false;
$this->orderBy = false;
$this->offset = 0;
$this->limit = 10;
$this->fields = [];
... | php | public function reset()
{
$this->table = '';
$this->columns = [];
$this->joins = [];
$this->wheres = [];
$this->whereIn = [];
$this->groupBy = false;
$this->orderBy = false;
$this->offset = 0;
$this->limit = 10;
$this->fields = [];
... | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"table",
"=",
"''",
";",
"$",
"this",
"->",
"columns",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"joins",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"wheres",
"=",
"[",
"]",
";",
"$",
... | Reset to default values
@return object Database instance | [
"Reset",
"to",
"default",
"values"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L101-L114 |
nicodevs/laito | src/Laito/Database.php | Database.select | public function select($columns)
{
if (is_array($columns)) {
$this->columns = $columns;
} elseif ($columns === '*') {
$this->columns = ['*'];
}
return $this;
} | php | public function select($columns)
{
if (is_array($columns)) {
$this->columns = $columns;
} elseif ($columns === '*') {
$this->columns = ['*'];
}
return $this;
} | [
"public",
"function",
"select",
"(",
"$",
"columns",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"columns",
")",
")",
"{",
"$",
"this",
"->",
"columns",
"=",
"$",
"columns",
";",
"}",
"elseif",
"(",
"$",
"columns",
"===",
"'*'",
")",
"{",
"$",
"th... | Sets the columns to be selected
@param array $columns Columns to select
@return object Database instance | [
"Sets",
"the",
"columns",
"to",
"be",
"selected"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L122-L130 |
nicodevs/laito | src/Laito/Database.php | Database.join | public function join($table, $first, $operator, $second, $type = 'LEFT')
{
$this->joins[] = [
'table' => $table,
'first' => $first,
'operator' => $operator,
'second' => $second,
'type' => $type
];
return $this;
} | php | public function join($table, $first, $operator, $second, $type = 'LEFT')
{
$this->joins[] = [
'table' => $table,
'first' => $first,
'operator' => $operator,
'second' => $second,
'type' => $type
];
return $this;
} | [
"public",
"function",
"join",
"(",
"$",
"table",
",",
"$",
"first",
",",
"$",
"operator",
",",
"$",
"second",
",",
"$",
"type",
"=",
"'LEFT'",
")",
"{",
"$",
"this",
"->",
"joins",
"[",
"]",
"=",
"[",
"'table'",
"=>",
"$",
"table",
",",
"'first'"... | Sets a table to JOIN with
@param string $table Table name
@param string $first Left key for the ON condition
@param string $operator Operator for the ON condition
@param string $second Right key for the ON condition
@param string $type Join type
@return object Database instance | [
"Sets",
"a",
"table",
"to",
"JOIN",
"with"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L169-L179 |
nicodevs/laito | src/Laito/Database.php | Database.where | public function where($column, $value, $operator = '=', $table = null)
{
$table = $table? $table : $this->table;
$this->wheres[] = [
'table' => $table,
'column' => $column,
'value' => $value,
'operator' => $operator
];
return $this;
... | php | public function where($column, $value, $operator = '=', $table = null)
{
$table = $table? $table : $this->table;
$this->wheres[] = [
'table' => $table,
'column' => $column,
'value' => $value,
'operator' => $operator
];
return $this;
... | [
"public",
"function",
"where",
"(",
"$",
"column",
",",
"$",
"value",
",",
"$",
"operator",
"=",
"'='",
",",
"$",
"table",
"=",
"null",
")",
"{",
"$",
"table",
"=",
"$",
"table",
"?",
"$",
"table",
":",
"$",
"this",
"->",
"table",
";",
"$",
"th... | Sets a WHERE condition
@param string $column Column name
@param string $value Value to match
@param string $operator Operator to compare with
@param string $table Table
@return object Database instance | [
"Sets",
"a",
"WHERE",
"condition"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L190-L200 |
nicodevs/laito | src/Laito/Database.php | Database.whereIn | public function whereIn($column, $values, $table = null)
{
$table = isset($table)? $table : $this->table;
$this->whereIn[] = [
'table' => $table,
'column' => $column,
'values' => $values
];
return $this;
} | php | public function whereIn($column, $values, $table = null)
{
$table = isset($table)? $table : $this->table;
$this->whereIn[] = [
'table' => $table,
'column' => $column,
'values' => $values
];
return $this;
} | [
"public",
"function",
"whereIn",
"(",
"$",
"column",
",",
"$",
"values",
",",
"$",
"table",
"=",
"null",
")",
"{",
"$",
"table",
"=",
"isset",
"(",
"$",
"table",
")",
"?",
"$",
"table",
":",
"$",
"this",
"->",
"table",
";",
"$",
"this",
"->",
"... | Sets a WHERE IN condition
@param string $column Column name
@param string $values Values to match
@param string $table Table
@return object Database instance | [
"Sets",
"a",
"WHERE",
"IN",
"condition"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L210-L219 |
nicodevs/laito | src/Laito/Database.php | Database.get | public function get()
{
// Define columns
$columns = count($this->columns)? $this->getColumnsString() : $this->table . '.*';
// Define root
$root = 'SELECT ' . $columns . ' FROM ' . $this->table;
// Define joins
$joins = count($this->joins)? $this->getJoinString() :... | php | public function get()
{
// Define columns
$columns = count($this->columns)? $this->getColumnsString() : $this->table . '.*';
// Define root
$root = 'SELECT ' . $columns . ' FROM ' . $this->table;
// Define joins
$joins = count($this->joins)? $this->getJoinString() :... | [
"public",
"function",
"get",
"(",
")",
"{",
"// Define columns",
"$",
"columns",
"=",
"count",
"(",
"$",
"this",
"->",
"columns",
")",
"?",
"$",
"this",
"->",
"getColumnsString",
"(",
")",
":",
"$",
"this",
"->",
"table",
".",
"'.*'",
";",
"// Define r... | Performs a SELECT query
@return bool|array Array of results, or false | [
"Performs",
"a",
"SELECT",
"query"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L290-L345 |
nicodevs/laito | src/Laito/Database.php | Database.count | public function count($column)
{
// Set a really hight limit
$this->limit(pow(100, 3));
// Select only the COUNT column and get
$result = $this->select(['COUNT(' . $this->table . '.' . $column .') as count'])->get();
// Reset
$this->reset();
// Return numbe... | php | public function count($column)
{
// Set a really hight limit
$this->limit(pow(100, 3));
// Select only the COUNT column and get
$result = $this->select(['COUNT(' . $this->table . '.' . $column .') as count'])->get();
// Reset
$this->reset();
// Return numbe... | [
"public",
"function",
"count",
"(",
"$",
"column",
")",
"{",
"// Set a really hight limit",
"$",
"this",
"->",
"limit",
"(",
"pow",
"(",
"100",
",",
"3",
")",
")",
";",
"// Select only the COUNT column and get",
"$",
"result",
"=",
"$",
"this",
"->",
"select... | Performs a SELECT COUNT query
@param string $column Column to count by
@return int Number of rows matching the SELECT query | [
"Performs",
"a",
"SELECT",
"COUNT",
"query"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L367-L380 |
nicodevs/laito | src/Laito/Database.php | Database.insert | public function insert($fields)
{
// Set fields
$this->fields($fields);
// Define fields
$fields = $this->getInsertFieldsString();
// Build query
$this->query = 'INSERT INTO ' . $this->table . $fields;
// Prepare statement
$this->statement = $this->... | php | public function insert($fields)
{
// Set fields
$this->fields($fields);
// Define fields
$fields = $this->getInsertFieldsString();
// Build query
$this->query = 'INSERT INTO ' . $this->table . $fields;
// Prepare statement
$this->statement = $this->... | [
"public",
"function",
"insert",
"(",
"$",
"fields",
")",
"{",
"// Set fields",
"$",
"this",
"->",
"fields",
"(",
"$",
"fields",
")",
";",
"// Define fields",
"$",
"fields",
"=",
"$",
"this",
"->",
"getInsertFieldsString",
"(",
")",
";",
"// Build query",
"... | Performs an INSERT query
@param array $fields Array of columns names and values to insert
@return bool Query success or fail | [
"Performs",
"an",
"INSERT",
"query"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L388-L413 |
nicodevs/laito | src/Laito/Database.php | Database.update | public function update($fields)
{
// Set fields
$this->fields($fields);
// Resolve fields
$fields = $this->getUpdateFieldsString();
// Define wheres
$where = $this->getWhereString();
// Build query
$this->query = 'UPDATE ' . $this->table . ' SET ' .... | php | public function update($fields)
{
// Set fields
$this->fields($fields);
// Resolve fields
$fields = $this->getUpdateFieldsString();
// Define wheres
$where = $this->getWhereString();
// Build query
$this->query = 'UPDATE ' . $this->table . ' SET ' .... | [
"public",
"function",
"update",
"(",
"$",
"fields",
")",
"{",
"// Set fields",
"$",
"this",
"->",
"fields",
"(",
"$",
"fields",
")",
";",
"// Resolve fields",
"$",
"fields",
"=",
"$",
"this",
"->",
"getUpdateFieldsString",
"(",
")",
";",
"// Define wheres",
... | Performs an UPDATE query
@param array $fields Array of columns names and values to insert
@return bool Query success or fail | [
"Performs",
"an",
"UPDATE",
"query"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L438-L471 |
nicodevs/laito | src/Laito/Database.php | Database.delete | public function delete()
{
// Define wheres
$where = $this->getWhereString();
// Define where in
$whereIn = $this->getWhereInString();
// Build query
$this->query = 'DELETE FROM ' . $this->table . ' '. $where . ' ' . $whereIn;
// Prepare statement
$... | php | public function delete()
{
// Define wheres
$where = $this->getWhereString();
// Define where in
$whereIn = $this->getWhereInString();
// Build query
$this->query = 'DELETE FROM ' . $this->table . ' '. $where . ' ' . $whereIn;
// Prepare statement
$... | [
"public",
"function",
"delete",
"(",
")",
"{",
"// Define wheres",
"$",
"where",
"=",
"$",
"this",
"->",
"getWhereString",
"(",
")",
";",
"// Define where in",
"$",
"whereIn",
"=",
"$",
"this",
"->",
"getWhereInString",
"(",
")",
";",
"// Build query",
"$",
... | Performs a DELETE query
@return bool Query success or fail | [
"Performs",
"a",
"DELETE",
"query"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L478-L505 |
nicodevs/laito | src/Laito/Database.php | Database.getWhereString | private function getWhereString()
{
// If there are not where conditions, return empty
if (!count($this->wheres)) {
return 'WHERE 1=1 ';
}
// Create where named placeholders
$wheres = array_map(function ($where) {
return $where['table'] . '.' . $where... | php | private function getWhereString()
{
// If there are not where conditions, return empty
if (!count($this->wheres)) {
return 'WHERE 1=1 ';
}
// Create where named placeholders
$wheres = array_map(function ($where) {
return $where['table'] . '.' . $where... | [
"private",
"function",
"getWhereString",
"(",
")",
"{",
"// If there are not where conditions, return empty",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"wheres",
")",
")",
"{",
"return",
"'WHERE 1=1 '",
";",
"}",
"// Create where named placeholders",
"$",
"wh... | Returns the wheres array as a WHERE string
@return string WHERE string | [
"Returns",
"the",
"wheres",
"array",
"as",
"a",
"WHERE",
"string"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L542-L556 |
nicodevs/laito | src/Laito/Database.php | Database.getWhereInString | private function getWhereInString()
{
// String holder
$string = '';
// If there are not where in conditions, return empty
if (!count($this->whereIn)) {
return $string;
}
// Iterate where creating the full conditions
foreach ($this->whereIn as $w... | php | private function getWhereInString()
{
// String holder
$string = '';
// If there are not where in conditions, return empty
if (!count($this->whereIn)) {
return $string;
}
// Iterate where creating the full conditions
foreach ($this->whereIn as $w... | [
"private",
"function",
"getWhereInString",
"(",
")",
"{",
"// String holder",
"$",
"string",
"=",
"''",
";",
"// If there are not where in conditions, return empty",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"whereIn",
")",
")",
"{",
"return",
"$",
"strin... | Returns the where in array as a WHERE IN string
@return string WHERE string | [
"Returns",
"the",
"where",
"in",
"array",
"as",
"a",
"WHERE",
"IN",
"string"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L563-L580 |
nicodevs/laito | src/Laito/Database.php | Database.getColumnsString | private function getColumnsString()
{
if (count($this->columns) === 1 && $this->columns[0] === '*') {
return '*';
}
$columns = array_map(function ($column) {
return (strpos($column, '.') === false)? $this->table . '.' . $column : $column;
}, $this->columns);
... | php | private function getColumnsString()
{
if (count($this->columns) === 1 && $this->columns[0] === '*') {
return '*';
}
$columns = array_map(function ($column) {
return (strpos($column, '.') === false)? $this->table . '.' . $column : $column;
}, $this->columns);
... | [
"private",
"function",
"getColumnsString",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"columns",
")",
"===",
"1",
"&&",
"$",
"this",
"->",
"columns",
"[",
"0",
"]",
"===",
"'*'",
")",
"{",
"return",
"'*'",
";",
"}",
"$",
"columns",
... | Returns the columns array as a field list string
@return string Field list string | [
"Returns",
"the",
"columns",
"array",
"as",
"a",
"field",
"list",
"string"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L587-L596 |
nicodevs/laito | src/Laito/Database.php | Database.getJoinString | private function getJoinString()
{
// If there are not joins, return empty
if (!count($this->orderBy)) {
return '';
}
// Create join strings
$joins = array_map(function ($join) {
return $join['type'] . ' JOIN ' . $join['table'] . ' ON ' . $this->table... | php | private function getJoinString()
{
// If there are not joins, return empty
if (!count($this->orderBy)) {
return '';
}
// Create join strings
$joins = array_map(function ($join) {
return $join['type'] . ' JOIN ' . $join['table'] . ' ON ' . $this->table... | [
"private",
"function",
"getJoinString",
"(",
")",
"{",
"// If there are not joins, return empty",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"orderBy",
")",
")",
"{",
"return",
"''",
";",
"}",
"// Create join strings",
"$",
"joins",
"=",
"array_map",
"("... | Returns the joins array as a JOIN string
@return string JOIN string | [
"Returns",
"the",
"joins",
"array",
"as",
"a",
"JOIN",
"string"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L603-L617 |
nicodevs/laito | src/Laito/Database.php | Database.getInsertFieldsString | private function getInsertFieldsString()
{
// Get field keys
$fieldKeys = array_keys($this->fields);
// Create placeholders
$fieldsPlaceholders = array_map(function ($field) {
return ':' . $field;
}, $fieldKeys);
// Return complete fields string
... | php | private function getInsertFieldsString()
{
// Get field keys
$fieldKeys = array_keys($this->fields);
// Create placeholders
$fieldsPlaceholders = array_map(function ($field) {
return ':' . $field;
}, $fieldKeys);
// Return complete fields string
... | [
"private",
"function",
"getInsertFieldsString",
"(",
")",
"{",
"// Get field keys",
"$",
"fieldKeys",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"fields",
")",
";",
"// Create placeholders",
"$",
"fieldsPlaceholders",
"=",
"array_map",
"(",
"function",
"(",
"$",
... | Returns the fields array as a VALUES string for inserts
@return string VALUES string for inserts | [
"Returns",
"the",
"fields",
"array",
"as",
"a",
"VALUES",
"string",
"for",
"inserts"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L640-L652 |
nicodevs/laito | src/Laito/Database.php | Database.getUpdateFieldsString | private function getUpdateFieldsString()
{
// Create placeholders
$fieldsPlaceholders = array_map(function ($field) {
return $field . '=:' . $field;
}, array_keys($this->fields));
// Return complete fields string
return implode(',', $fieldsPlaceholders);
} | php | private function getUpdateFieldsString()
{
// Create placeholders
$fieldsPlaceholders = array_map(function ($field) {
return $field . '=:' . $field;
}, array_keys($this->fields));
// Return complete fields string
return implode(',', $fieldsPlaceholders);
} | [
"private",
"function",
"getUpdateFieldsString",
"(",
")",
"{",
"// Create placeholders",
"$",
"fieldsPlaceholders",
"=",
"array_map",
"(",
"function",
"(",
"$",
"field",
")",
"{",
"return",
"$",
"field",
".",
"'=:'",
".",
"$",
"field",
";",
"}",
",",
"array_... | Returns the fields array as a 'foo=:foo, bar=:bar' string for updates
@return string String for updates | [
"Returns",
"the",
"fields",
"array",
"as",
"a",
"foo",
"=",
":",
"foo",
"bar",
"=",
":",
"bar",
"string",
"for",
"updates"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L659-L668 |
nicodevs/laito | src/Laito/Database.php | Database.bindWheres | private function bindWheres()
{
foreach ($this->wheres as $where) {
$this->statement->bindValue(':' . $where['table'] . $where['column'], $where['value']);
}
} | php | private function bindWheres()
{
foreach ($this->wheres as $where) {
$this->statement->bindValue(':' . $where['table'] . $where['column'], $where['value']);
}
} | [
"private",
"function",
"bindWheres",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"wheres",
"as",
"$",
"where",
")",
"{",
"$",
"this",
"->",
"statement",
"->",
"bindValue",
"(",
"':'",
".",
"$",
"where",
"[",
"'table'",
"]",
".",
"$",
"where",
... | Binds the values of the WHERE conditions | [
"Binds",
"the",
"values",
"of",
"the",
"WHERE",
"conditions"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L674-L679 |
nicodevs/laito | src/Laito/Database.php | Database.bindFields | private function bindFields()
{
foreach ($this->fields as $key => $value) {
$this->statement->bindValue(':' . $key, $value);
}
} | php | private function bindFields()
{
foreach ($this->fields as $key => $value) {
$this->statement->bindValue(':' . $key, $value);
}
} | [
"private",
"function",
"bindFields",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"statement",
"->",
"bindValue",
"(",
"':'",
".",
"$",
"key",
",",
"$",
"value",
")",... | Binds the values of the fields to insert or update | [
"Binds",
"the",
"values",
"of",
"the",
"fields",
"to",
"insert",
"or",
"update"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L685-L690 |
Hnto/nuki | src/Handlers/Http/Files.php | Files.file | public function file($key) {
if (!isset($this->files[$key])) {
return null;
}
return $this->createFile($this->files[$key]);
} | php | public function file($key) {
if (!isset($this->files[$key])) {
return null;
}
return $this->createFile($this->files[$key]);
} | [
"public",
"function",
"file",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"files",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"createFile",
"(",
"$",
"this",
"->... | Get file by key
@param int $key
@return \Nuki\Models\Data\File | [
"Get",
"file",
"by",
"key"
] | train | https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Handlers/Http/Files.php#L31-L37 |
Hnto/nuki | src/Handlers/Http/Files.php | Files.createFile | private function createFile(array $fileInfo = []) {
$file = new \Nuki\Models\Data\File($fileInfo['tmp_name'], $fileInfo['size']);
$file->setExtension(pathinfo($fileInfo['name'], PATHINFO_EXTENSION));
$file->setName(pathinfo($fileInfo['name'], PATHINFO_BASENAME));
return $file;
} | php | private function createFile(array $fileInfo = []) {
$file = new \Nuki\Models\Data\File($fileInfo['tmp_name'], $fileInfo['size']);
$file->setExtension(pathinfo($fileInfo['name'], PATHINFO_EXTENSION));
$file->setName(pathinfo($fileInfo['name'], PATHINFO_BASENAME));
return $file;
} | [
"private",
"function",
"createFile",
"(",
"array",
"$",
"fileInfo",
"=",
"[",
"]",
")",
"{",
"$",
"file",
"=",
"new",
"\\",
"Nuki",
"\\",
"Models",
"\\",
"Data",
"\\",
"File",
"(",
"$",
"fileInfo",
"[",
"'tmp_name'",
"]",
",",
"$",
"fileInfo",
"[",
... | Create file object
@param array $fileInfo
@return \Nuki\Models\Data\File | [
"Create",
"file",
"object"
] | train | https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Handlers/Http/Files.php#L61-L68 |
Hnto/nuki | src/Handlers/Http/Files.php | Files.normalize | private function normalize() : array {
$files = [];
foreach($_FILES as $key => $file) {
if (!is_array($file['name'])) {
$files[$key][] = $file;
continue;
}
foreach($file['name'] as $subKey => $name) {
$files[$key][$subKey] = [
'name' => $nam... | php | private function normalize() : array {
$files = [];
foreach($_FILES as $key => $file) {
if (!is_array($file['name'])) {
$files[$key][] = $file;
continue;
}
foreach($file['name'] as $subKey => $name) {
$files[$key][$subKey] = [
'name' => $nam... | [
"private",
"function",
"normalize",
"(",
")",
":",
"array",
"{",
"$",
"files",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"_FILES",
"as",
"$",
"key",
"=>",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"file",
"[",
"'name'",
"]",
"... | Normalize $_FILES array
@return array | [
"Normalize",
"$_FILES",
"array"
] | train | https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Handlers/Http/Files.php#L75-L97 |
anime-db/catalog-bundle | src/Entity/Type.php | Type.addItem | public function addItem(Item $item)
{
if (!$this->items->contains($item)) {
$this->items->add($item);
$item->setType($this);
}
return $this;
} | php | public function addItem(Item $item)
{
if (!$this->items->contains($item)) {
$this->items->add($item);
$item->setType($this);
}
return $this;
} | [
"public",
"function",
"addItem",
"(",
"Item",
"$",
"item",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"items",
"->",
"contains",
"(",
"$",
"item",
")",
")",
"{",
"$",
"this",
"->",
"items",
"->",
"add",
"(",
"$",
"item",
")",
";",
"$",
"item"... | @param Item $item
@return Type | [
"@param",
"Item",
"$item"
] | train | https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Entity/Type.php#L111-L119 |
anime-db/catalog-bundle | src/Entity/Type.php | Type.removeItem | public function removeItem(Item $item)
{
if ($this->items->contains($item)) {
$this->items->removeElement($item);
$item->setType(null);
}
return $this;
} | php | public function removeItem(Item $item)
{
if ($this->items->contains($item)) {
$this->items->removeElement($item);
$item->setType(null);
}
return $this;
} | [
"public",
"function",
"removeItem",
"(",
"Item",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"items",
"->",
"contains",
"(",
"$",
"item",
")",
")",
"{",
"$",
"this",
"->",
"items",
"->",
"removeElement",
"(",
"$",
"item",
")",
";",
"$",
... | @param Item $item
@return Type | [
"@param",
"Item",
"$item"
] | train | https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Entity/Type.php#L126-L134 |
bseddon/XPath20 | Proxy/DateProxy.php | DateProxy.Gt | protected function Gt( $val )
{
if ( $val->GetValueCode() != DateProxyFactory::Code )
throw XPath2Exception::withErrorCodeAndParams( "XPTY0004", Resources::BinaryOperatorNotDefined,
array(
"op:gt",
SequenceType::WithTypeCodeAndCardinality( SequenceType::GetXmlTypeCodeFromObject( $this... | php | protected function Gt( $val )
{
if ( $val->GetValueCode() != DateProxyFactory::Code )
throw XPath2Exception::withErrorCodeAndParams( "XPTY0004", Resources::BinaryOperatorNotDefined,
array(
"op:gt",
SequenceType::WithTypeCodeAndCardinality( SequenceType::GetXmlTypeCodeFromObject( $this... | [
"protected",
"function",
"Gt",
"(",
"$",
"val",
")",
"{",
"if",
"(",
"$",
"val",
"->",
"GetValueCode",
"(",
")",
"!=",
"DateProxyFactory",
"::",
"Code",
")",
"throw",
"XPath2Exception",
"::",
"withErrorCodeAndParams",
"(",
"\"XPTY0004\"",
",",
"Resources",
"... | Gt
@param ValueProxy $val
@return bool | [
"Gt"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Proxy/DateProxy.php#L115-L126 |
bseddon/XPath20 | Proxy/DateProxy.php | DateProxy.Neg | protected function Neg()
{
throw XPath2Exception::withErrorCodeAndParams( "XPTY0004", Resources::UnaryOperatorNotDefined,
array(
"fn:unary-minus",
SequenceType::WithTypeCodeAndCardinality( SequenceType::GetXmlTypeCodeFromObject( $this->_value ), XmlTypeCardinality::One )
)
);
} | php | protected function Neg()
{
throw XPath2Exception::withErrorCodeAndParams( "XPTY0004", Resources::UnaryOperatorNotDefined,
array(
"fn:unary-minus",
SequenceType::WithTypeCodeAndCardinality( SequenceType::GetXmlTypeCodeFromObject( $this->_value ), XmlTypeCardinality::One )
)
);
} | [
"protected",
"function",
"Neg",
"(",
")",
"{",
"throw",
"XPath2Exception",
"::",
"withErrorCodeAndParams",
"(",
"\"XPTY0004\"",
",",
"Resources",
"::",
"UnaryOperatorNotDefined",
",",
"array",
"(",
"\"fn:unary-minus\"",
",",
"SequenceType",
"::",
"WithTypeCodeAndCardina... | Neg
@return ValueProxy | [
"Neg"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Proxy/DateProxy.php#L142-L150 |
bseddon/XPath20 | Proxy/DateProxy.php | DateProxy.Sub | protected function Sub( $value )
{
switch ( $value->GetValueCode() )
{
case DateProxyFactory::Code:
return new DayTimeDurationProxy( DateValue::Sub( $this->_value, /* DateValue */ $value->getValue() ) );
case YearMonthDurationProxyFactory::Code:
/**
... | php | protected function Sub( $value )
{
switch ( $value->GetValueCode() )
{
case DateProxyFactory::Code:
return new DayTimeDurationProxy( DateValue::Sub( $this->_value, /* DateValue */ $value->getValue() ) );
case YearMonthDurationProxyFactory::Code:
/**
... | [
"protected",
"function",
"Sub",
"(",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"value",
"->",
"GetValueCode",
"(",
")",
")",
"{",
"case",
"DateProxyFactory",
"::",
"Code",
":",
"return",
"new",
"DayTimeDurationProxy",
"(",
"DateValue",
"::",
"Sub",
"(",
... | Sub
@param ValueProxy $value
@return ValueProxy | [
"Sub"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Proxy/DateProxy.php#L193-L227 |
nguyenanhung/image | src/Utils.php | Utils.getImageFromUrl | public static function getImageFromUrl($url = '')
{
try {
$curl = new Curl();
$curl->setOpt(CURLOPT_RETURNTRANSFER, TRUE);
$curl->setOpt(CURLOPT_ENCODING, "");
$curl->setOpt(CURLOPT_MAXREDIRS, 10);
$curl->setOpt(CURLOPT_TIMEOUT, 30);
$c... | php | public static function getImageFromUrl($url = '')
{
try {
$curl = new Curl();
$curl->setOpt(CURLOPT_RETURNTRANSFER, TRUE);
$curl->setOpt(CURLOPT_ENCODING, "");
$curl->setOpt(CURLOPT_MAXREDIRS, 10);
$curl->setOpt(CURLOPT_TIMEOUT, 30);
$c... | [
"public",
"static",
"function",
"getImageFromUrl",
"(",
"$",
"url",
"=",
"''",
")",
"{",
"try",
"{",
"$",
"curl",
"=",
"new",
"Curl",
"(",
")",
";",
"$",
"curl",
"->",
"setOpt",
"(",
"CURLOPT_RETURNTRANSFER",
",",
"TRUE",
")",
";",
"$",
"curl",
"->",... | Function getImageFromUrl
@author: 713uk13m <dev@nguyenanhung.com>
@time : 11/2/18 16:48
@param string $url
@return array|bool|null|string
@throws \Exception | [
"Function",
"getImageFromUrl"
] | train | https://github.com/nguyenanhung/image/blob/5d30dfa203c0411209b8985ab4a86a6be9a7b2d1/src/Utils.php#L50-L89 |
nguyenanhung/image | src/Utils.php | Utils.debug | public static function debug($msg = 'test')
{
try {
if (function_exists('log_message')) {
log_message('debug', $msg);
} else {
if (self::USE_DEBUG === TRUE) {
$logger = new Logger('imageCache');
$logger->pushHand... | php | public static function debug($msg = 'test')
{
try {
if (function_exists('log_message')) {
log_message('debug', $msg);
} else {
if (self::USE_DEBUG === TRUE) {
$logger = new Logger('imageCache');
$logger->pushHand... | [
"public",
"static",
"function",
"debug",
"(",
"$",
"msg",
"=",
"'test'",
")",
"{",
"try",
"{",
"if",
"(",
"function_exists",
"(",
"'log_message'",
")",
")",
"{",
"log_message",
"(",
"'debug'",
",",
"$",
"msg",
")",
";",
"}",
"else",
"{",
"if",
"(",
... | Function debug
@author: 713uk13m <dev@nguyenanhung.com>
@time : 11/3/18 17:43
@param string $msg | [
"Function",
"debug"
] | train | https://github.com/nguyenanhung/image/blob/5d30dfa203c0411209b8985ab4a86a6be9a7b2d1/src/Utils.php#L99-L120 |
stubbles/stubbles-streams | src/main/php/file/FileOutputStream.php | FileOutputStream.write | public function write(string $bytes): int
{
if ($this->isFileCreationDelayed()) {
$this->setHandle($this->openFile($this->file, $this->mode));
}
return parent::write($bytes);
} | php | public function write(string $bytes): int
{
if ($this->isFileCreationDelayed()) {
$this->setHandle($this->openFile($this->file, $this->mode));
}
return parent::write($bytes);
} | [
"public",
"function",
"write",
"(",
"string",
"$",
"bytes",
")",
":",
"int",
"{",
"if",
"(",
"$",
"this",
"->",
"isFileCreationDelayed",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setHandle",
"(",
"$",
"this",
"->",
"openFile",
"(",
"$",
"this",
"->",
... | writes given bytes
@param string $bytes
@return int amount of written bytes | [
"writes",
"given",
"bytes"
] | train | https://github.com/stubbles/stubbles-streams/blob/99b0dace5fcf71584d1456b4b5408017b896bdf5/src/main/php/file/FileOutputStream.php#L81-L88 |
stubbles/stubbles-streams | src/main/php/file/FileOutputStream.php | FileOutputStream.openFile | protected function openFile(string $file, string $mode)
{
$fp = @fopen($file, $mode);
if (false === $fp) {
throw new StreamException(
'Can not open file ' . $file . ' with mode ' . $mode . ': '
.
str_replace('fopen(' . $file . '... | php | protected function openFile(string $file, string $mode)
{
$fp = @fopen($file, $mode);
if (false === $fp) {
throw new StreamException(
'Can not open file ' . $file . ' with mode ' . $mode . ': '
.
str_replace('fopen(' . $file . '... | [
"protected",
"function",
"openFile",
"(",
"string",
"$",
"file",
",",
"string",
"$",
"mode",
")",
"{",
"$",
"fp",
"=",
"@",
"fopen",
"(",
"$",
"file",
",",
"$",
"mode",
")",
";",
"if",
"(",
"false",
"===",
"$",
"fp",
")",
"{",
"throw",
"new",
"... | helper method to open a file handle
@param string $file
@param string $mode
@return resource
@throws \stubbles\streams\StreamException | [
"helper",
"method",
"to",
"open",
"a",
"file",
"handle"
] | train | https://github.com/stubbles/stubbles-streams/blob/99b0dace5fcf71584d1456b4b5408017b896bdf5/src/main/php/file/FileOutputStream.php#L108-L120 |
makinacorpus/drupal-apubsub | src/Backend/DrupalBackend.php | DrupalBackend.fetch | public function fetch(array $conditions = null)
{
$cursor = new DrupalMessageCursor($this);
if (!empty($conditions)) {
$cursor->setConditions($conditions);
}
return $cursor;
} | php | public function fetch(array $conditions = null)
{
$cursor = new DrupalMessageCursor($this);
if (!empty($conditions)) {
$cursor->setConditions($conditions);
}
return $cursor;
} | [
"public",
"function",
"fetch",
"(",
"array",
"$",
"conditions",
"=",
"null",
")",
"{",
"$",
"cursor",
"=",
"new",
"DrupalMessageCursor",
"(",
"$",
"this",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"conditions",
")",
")",
"{",
"$",
"cursor",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Backend/DrupalBackend.php#L76-L85 |
makinacorpus/drupal-apubsub | src/Backend/DrupalBackend.php | DrupalBackend.fetchChannels | public function fetchChannels(array $conditions = null)
{
$cursor = new DrupalChannelCursor($this);
if (!empty($conditions)) {
$cursor->setConditions($conditions);
}
return $cursor;
} | php | public function fetchChannels(array $conditions = null)
{
$cursor = new DrupalChannelCursor($this);
if (!empty($conditions)) {
$cursor->setConditions($conditions);
}
return $cursor;
} | [
"public",
"function",
"fetchChannels",
"(",
"array",
"$",
"conditions",
"=",
"null",
")",
"{",
"$",
"cursor",
"=",
"new",
"DrupalChannelCursor",
"(",
"$",
"this",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"conditions",
")",
")",
"{",
"$",
"cursor",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Backend/DrupalBackend.php#L90-L99 |
makinacorpus/drupal-apubsub | src/Backend/DrupalBackend.php | DrupalBackend.createChannel | public function createChannel($id, $title = null, $ignoreErrors = false)
{
$chan = null;
$created = new \DateTime();
$dbId = null;
$cx = $this->db;
$tx = null;
try {
$tx = $cx->startTransaction();
// Do not ever use cache here... | php | public function createChannel($id, $title = null, $ignoreErrors = false)
{
$chan = null;
$created = new \DateTime();
$dbId = null;
$cx = $this->db;
$tx = null;
try {
$tx = $cx->startTransaction();
// Do not ever use cache here... | [
"public",
"function",
"createChannel",
"(",
"$",
"id",
",",
"$",
"title",
"=",
"null",
",",
"$",
"ignoreErrors",
"=",
"false",
")",
"{",
"$",
"chan",
"=",
"null",
";",
"$",
"created",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"$",
"dbId",
"=",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Backend/DrupalBackend.php#L104-L163 |
makinacorpus/drupal-apubsub | src/Backend/DrupalBackend.php | DrupalBackend.createChannels | public function createChannels($idList, $ignoreErrors = false)
{
if (empty($idList)) {
return [];
}
$ret = [];
$created = new \DateTime();
$createdString = $created->format(Misc::SQL_DATETIME);
$cx = $this->db;
$tx ... | php | public function createChannels($idList, $ignoreErrors = false)
{
if (empty($idList)) {
return [];
}
$ret = [];
$created = new \DateTime();
$createdString = $created->format(Misc::SQL_DATETIME);
$cx = $this->db;
$tx ... | [
"public",
"function",
"createChannels",
"(",
"$",
"idList",
",",
"$",
"ignoreErrors",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"idList",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"ret",
"=",
"[",
"]",
";",
"$",
"created",
"="... | {@inheritdoc} | [
"{"
] | train | https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Backend/DrupalBackend.php#L168-L228 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.