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
blackprism/serializer
src/Blackprism/Serializer/Configuration/Object.php
Object.registerToConfigurationWithIdentifier
public function registerToConfigurationWithIdentifier( Configuration $configuration, string $identifier ): ObjectInterface { $this->identifier($identifier); $configuration->addConfigurationObjectWithIdentifier($this->className, $this, $identifier); return $this; }
php
public function registerToConfigurationWithIdentifier( Configuration $configuration, string $identifier ): ObjectInterface { $this->identifier($identifier); $configuration->addConfigurationObjectWithIdentifier($this->className, $this, $identifier); return $this; }
[ "public", "function", "registerToConfigurationWithIdentifier", "(", "Configuration", "$", "configuration", ",", "string", "$", "identifier", ")", ":", "ObjectInterface", "{", "$", "this", "->", "identifier", "(", "$", "identifier", ")", ";", "$", "configuration", ...
@param Configuration $configuration @param string $identifier @return ObjectInterface
[ "@param", "Configuration", "$configuration", "@param", "string", "$identifier" ]
train
https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Configuration/Object.php#L196-L204
blackprism/serializer
src/Blackprism/Serializer/Configuration/Object.php
Object.getTypeForAttribute
public function getTypeForAttribute(string $attribute): TypeInterface { if (isset($this->attributes[$attribute]) === false) { return $this->blackhole; } return $this->attributes[$attribute]; }
php
public function getTypeForAttribute(string $attribute): TypeInterface { if (isset($this->attributes[$attribute]) === false) { return $this->blackhole; } return $this->attributes[$attribute]; }
[ "public", "function", "getTypeForAttribute", "(", "string", "$", "attribute", ")", ":", "TypeInterface", "{", "if", "(", "isset", "(", "$", "this", "->", "attributes", "[", "$", "attribute", "]", ")", "===", "false", ")", "{", "return", "$", "this", "->"...
@param string $attribute @return TypeInterface
[ "@param", "string", "$attribute" ]
train
https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Configuration/Object.php#L211-L218
drmvc/framework
src/Framework/App.php
App.initRequest
private function initRequest(): App { try { $request = ServerRequestFactory::fromGlobals(); $this->containers()->set('request', $request); } catch (\InvalidArgumentException $e) { new Exception($e); } return $this; }
php
private function initRequest(): App { try { $request = ServerRequestFactory::fromGlobals(); $this->containers()->set('request', $request); } catch (\InvalidArgumentException $e) { new Exception($e); } return $this; }
[ "private", "function", "initRequest", "(", ")", ":", "App", "{", "try", "{", "$", "request", "=", "ServerRequestFactory", "::", "fromGlobals", "(", ")", ";", "$", "this", "->", "containers", "(", ")", "->", "set", "(", "'request'", ",", "$", "request", ...
Initiate PSR-7 request object @return App
[ "Initiate", "PSR", "-", "7", "request", "object" ]
train
https://github.com/drmvc/framework/blob/6a49aa4e0314b37343a95d7c8ac5d10f72b45d71/src/Framework/App.php#L94-L103
drmvc/framework
src/Framework/App.php
App.initResponse
private function initResponse(): App { try { $response = new Response(); $this->containers()->set('response', $response); } catch (\InvalidArgumentException $e) { new Exception($e); } return $this; }
php
private function initResponse(): App { try { $response = new Response(); $this->containers()->set('response', $response); } catch (\InvalidArgumentException $e) { new Exception($e); } return $this; }
[ "private", "function", "initResponse", "(", ")", ":", "App", "{", "try", "{", "$", "response", "=", "new", "Response", "(", ")", ";", "$", "this", "->", "containers", "(", ")", "->", "set", "(", "'response'", ",", "$", "response", ")", ";", "}", "c...
Initiate PSR-7 response object @return App
[ "Initiate", "PSR", "-", "7", "response", "object" ]
train
https://github.com/drmvc/framework/blob/6a49aa4e0314b37343a95d7c8ac5d10f72b45d71/src/Framework/App.php#L110-L119
drmvc/framework
src/Framework/App.php
App.initRouter
private function initRouter(): App { $request = $this->container('request'); $response = $this->container('response'); $router = new Router($request, $response); $router->error(Error::class); $this->containers()->set('router', $router); return $this; }
php
private function initRouter(): App { $request = $this->container('request'); $response = $this->container('response'); $router = new Router($request, $response); $router->error(Error::class); $this->containers()->set('router', $router); return $this; }
[ "private", "function", "initRouter", "(", ")", ":", "App", "{", "$", "request", "=", "$", "this", "->", "container", "(", "'request'", ")", ";", "$", "response", "=", "$", "this", "->", "container", "(", "'response'", ")", ";", "$", "router", "=", "n...
Put route into the container of classes @return App
[ "Put", "route", "into", "the", "container", "of", "classes" ]
train
https://github.com/drmvc/framework/blob/6a49aa4e0314b37343a95d7c8ac5d10f72b45d71/src/Framework/App.php#L126-L135
drmvc/framework
src/Framework/App.php
App.map
public function map(array $methods, string $pattern, $callable): MethodsInterface { $this->container('router')->map($methods, $pattern, $callable); return $this; }
php
public function map(array $methods, string $pattern, $callable): MethodsInterface { $this->container('router')->map($methods, $pattern, $callable); return $this; }
[ "public", "function", "map", "(", "array", "$", "methods", ",", "string", "$", "pattern", ",", "$", "callable", ")", ":", "MethodsInterface", "{", "$", "this", "->", "container", "(", "'router'", ")", "->", "map", "(", "$", "methods", ",", "$", "patter...
Few methods provided @param array $methods @param string $pattern @param callable|string $callable @return MethodsInterface
[ "Few", "methods", "provided" ]
train
https://github.com/drmvc/framework/blob/6a49aa4e0314b37343a95d7c8ac5d10f72b45d71/src/Framework/App.php#L206-L210
drmvc/framework
src/Framework/App.php
App.extractActionFromClass
private function extractActionFromClass(string $className) { // If class contain method name if (strpos($className, ':') !== false) { $classArray = explode(':', $className); $classAction = end($classArray); } else { $classAction = null; } r...
php
private function extractActionFromClass(string $className) { // If class contain method name if (strpos($className, ':') !== false) { $classArray = explode(':', $className); $classAction = end($classArray); } else { $classAction = null; } r...
[ "private", "function", "extractActionFromClass", "(", "string", "$", "className", ")", "{", "// If class contain method name", "if", "(", "strpos", "(", "$", "className", ",", "':'", ")", "!==", "false", ")", "{", "$", "classArray", "=", "explode", "(", "':'",...
Here we need parse line of class and extract action name after last ":" symbol @param string $className @return string|null
[ "Here", "we", "need", "parse", "line", "of", "class", "and", "extract", "action", "name", "after", "last", ":", "symbol" ]
train
https://github.com/drmvc/framework/blob/6a49aa4e0314b37343a95d7c8ac5d10f72b45d71/src/Framework/App.php#L218-L228
drmvc/framework
src/Framework/App.php
App.extractClass
private function extractClass(string $className): string { // If class name contain ":" symbol if (strpos($className, ':') !== false) { $classArray = explode(':', $className); $className = $classArray[0]; } return $className; }
php
private function extractClass(string $className): string { // If class name contain ":" symbol if (strpos($className, ':') !== false) { $classArray = explode(':', $className); $className = $classArray[0]; } return $className; }
[ "private", "function", "extractClass", "(", "string", "$", "className", ")", ":", "string", "{", "// If class name contain \":\" symbol", "if", "(", "strpos", "(", "$", "className", ",", "':'", ")", "!==", "false", ")", "{", "$", "classArray", "=", "explode", ...
Parse line of class, end return only class name (without possible action) @param string $className @return string
[ "Parse", "line", "of", "class", "end", "return", "only", "class", "name", "(", "without", "possible", "action", ")" ]
train
https://github.com/drmvc/framework/blob/6a49aa4e0314b37343a95d7c8ac5d10f72b45d71/src/Framework/App.php#L236-L244
drmvc/framework
src/Framework/App.php
App.detectAction
private function detectAction(string $className, array $variables = []): string { $action = // 1. Action name in line with class name eg. MyApp\Index:test - alias for `action_test` $this->extractActionFromClass($className) ?? ( // 2. If action name in vari...
php
private function detectAction(string $className, array $variables = []): string { $action = // 1. Action name in line with class name eg. MyApp\Index:test - alias for `action_test` $this->extractActionFromClass($className) ?? ( // 2. If action name in vari...
[ "private", "function", "detectAction", "(", "string", "$", "className", ",", "array", "$", "variables", "=", "[", "]", ")", ":", "string", "{", "$", "action", "=", "// 1. Action name in line with class name eg. MyApp\\Index:test - alias for `action_test`", "$", "this", ...
Detect action by string name, variable or use default @param string $className - eg. MyApp\Index:test @param array $variables @return string
[ "Detect", "action", "by", "string", "name", "variable", "or", "use", "default" ]
train
https://github.com/drmvc/framework/blob/6a49aa4e0314b37343a95d7c8ac5d10f72b45d71/src/Framework/App.php#L253-L266
drmvc/framework
src/Framework/App.php
App.methodCheck
private function methodCheck($class, string $action): bool { try { // If method not found in required class if (!\method_exists($class, $action)) { $className = \get_class($class); throw new Exception("Method \"$action\" is not found in \"$className\""...
php
private function methodCheck($class, string $action): bool { try { // If method not found in required class if (!\method_exists($class, $action)) { $className = \get_class($class); throw new Exception("Method \"$action\" is not found in \"$className\""...
[ "private", "function", "methodCheck", "(", "$", "class", ",", "string", "$", "action", ")", ":", "bool", "{", "try", "{", "// If method not found in required class", "if", "(", "!", "\\", "method_exists", "(", "$", "class", ",", "$", "action", ")", ")", "{...
Check if method exist in required class @param object $class @param string $action @return bool
[ "Check", "if", "method", "exist", "in", "required", "class" ]
train
https://github.com/drmvc/framework/blob/6a49aa4e0314b37343a95d7c8ac5d10f72b45d71/src/Framework/App.php#L275-L287
drmvc/framework
src/Framework/App.php
App.exec
private function exec( RouteInterface $route, RequestInterface $request, ResponseInterface $response, bool $error = false ) { $variables = $route->getVariables(); $callback = $route->getCallback(); // If extracted call back is string if (\is_string($c...
php
private function exec( RouteInterface $route, RequestInterface $request, ResponseInterface $response, bool $error = false ) { $variables = $route->getVariables(); $callback = $route->getCallback(); // If extracted call back is string if (\is_string($c...
[ "private", "function", "exec", "(", "RouteInterface", "$", "route", ",", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ",", "bool", "$", "error", "=", "false", ")", "{", "$", "variables", "=", "$", "route", "->", "getVariable...
Here we need to solve how to display the page, and if method is not available need to show error @param RouteInterface $route @param RequestInterface $request @param ResponseInterface $response @param bool $error @return StreamInterface
[ "Here", "we", "need", "to", "solve", "how", "to", "display", "the", "page", "and", "if", "method", "is", "not", "available", "need", "to", "show", "error" ]
train
https://github.com/drmvc/framework/blob/6a49aa4e0314b37343a95d7c8ac5d10f72b45d71/src/Framework/App.php#L299-L331
drmvc/framework
src/Framework/App.php
App.run
public function run(): StreamInterface { // Extract some important objects $router = $this->container('router'); $request = $this->container('request'); $response = $this->container('response'); // Get current matched route with and extract variables with callback $r...
php
public function run(): StreamInterface { // Extract some important objects $router = $this->container('router'); $request = $this->container('request'); $response = $this->container('response'); // Get current matched route with and extract variables with callback $r...
[ "public", "function", "run", "(", ")", ":", "StreamInterface", "{", "// Extract some important objects", "$", "router", "=", "$", "this", "->", "container", "(", "'router'", ")", ";", "$", "request", "=", "$", "this", "->", "container", "(", "'request'", ")"...
Simple runner should parse query and make work on user's class @return StreamInterface
[ "Simple", "runner", "should", "parse", "query", "and", "make", "work", "on", "user", "s", "class" ]
train
https://github.com/drmvc/framework/blob/6a49aa4e0314b37343a95d7c8ac5d10f72b45d71/src/Framework/App.php#L338-L349
stubbles/stubbles-webapp-core
src/main/php/routing/ResolvingResource.php
ResolvingResource.resolve
public function resolve(Request $request, Response $response) { $uriPath = $this->calledUri->path($this->route->configuredPath()); $target = $this->route->target(); if (is_callable($target)) { return $target($request, $response, $uriPath); } if ($target instance...
php
public function resolve(Request $request, Response $response) { $uriPath = $this->calledUri->path($this->route->configuredPath()); $target = $this->route->target(); if (is_callable($target)) { return $target($request, $response, $uriPath); } if ($target instance...
[ "public", "function", "resolve", "(", "Request", "$", "request", ",", "Response", "$", "response", ")", "{", "$", "uriPath", "=", "$", "this", "->", "calledUri", "->", "path", "(", "$", "this", "->", "route", "->", "configuredPath", "(", ")", ")", ";",...
triggers actual logic on this resource The logic might be capsuled in a closure, a callback, or a processor class. The return value from this logic will be used to evaluate whether post processors are called by the web app. A return value of false means no post processor will be called, whereas any other or no return ...
[ "triggers", "actual", "logic", "on", "this", "resource" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/ResolvingResource.php#L73-L94
FrenchFrogs/framework
src/Table/Renderer/Bootstrap.php
Bootstrap.table
public function table(Table\Table $table) { // Headers $head = ''; $headers = []; $hasStrainer = false; foreach($table->getColumns() as $column) { /** @var Column\Column $column */ $label = $column->getLabel(); if ($column->hasDescription()) { $label .=...
php
public function table(Table\Table $table) { // Headers $head = ''; $headers = []; $hasStrainer = false; foreach($table->getColumns() as $column) { /** @var Column\Column $column */ $label = $column->getLabel(); if ($column->hasDescription()) { $label .=...
[ "public", "function", "table", "(", "Table", "\\", "Table", "$", "table", ")", "{", "// Headers", "$", "head", "=", "''", ";", "$", "headers", "=", "[", "]", ";", "$", "hasStrainer", "=", "false", ";", "foreach", "(", "$", "table", "->", "getColumns"...
Render the table structure Main method @param \FrenchFrogs\Table\Table\Table $table @return mixed|string @throws \Exception
[ "Render", "the", "table", "structure", "Main", "method" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Bootstrap.php#L56-L176
FrenchFrogs/framework
src/Table/Renderer/Bootstrap.php
Bootstrap.container
public function container(Column\Container $column, array $row) { $html = ''; foreach($column->getColumns() as $c) { /** @var Column\Column $c */ $html .= $c->render($row) . PHP_EOL; } return $this->post($html, $column, $row); }
php
public function container(Column\Container $column, array $row) { $html = ''; foreach($column->getColumns() as $c) { /** @var Column\Column $c */ $html .= $c->render($row) . PHP_EOL; } return $this->post($html, $column, $row); }
[ "public", "function", "container", "(", "Column", "\\", "Container", "$", "column", ",", "array", "$", "row", ")", "{", "$", "html", "=", "''", ";", "foreach", "(", "$", "column", "->", "getColumns", "(", ")", "as", "$", "c", ")", "{", "/** @var Colu...
Render a container @param \FrenchFrogs\Table\Column\Container $column @param array $row @return string
[ "Render", "a", "container" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Bootstrap.php#L186-L195
FrenchFrogs/framework
src/Table/Renderer/Bootstrap.php
Bootstrap.boolean
public function boolean(Column\Boolean $column, array $row) { $html = ''; if($column->getValue($row)) { $html .= '<i class="fa fa-check"></i>'; } return $this->post($html, $column, $row); }
php
public function boolean(Column\Boolean $column, array $row) { $html = ''; if($column->getValue($row)) { $html .= '<i class="fa fa-check"></i>'; } return $this->post($html, $column, $row); }
[ "public", "function", "boolean", "(", "Column", "\\", "Boolean", "$", "column", ",", "array", "$", "row", ")", "{", "$", "html", "=", "''", ";", "if", "(", "$", "column", "->", "getValue", "(", "$", "row", ")", ")", "{", "$", "html", ".=", "'<i c...
render boolean icon @param \FrenchFrogs\Table\Column\Boolean $column @param array $row @return string
[ "render", "boolean", "icon" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Bootstrap.php#L204-L213
FrenchFrogs/framework
src/Table/Renderer/Bootstrap.php
Bootstrap.remote_boolean
public function remote_boolean(Column\RemoteBoolean $column, array $row) { $table = $column->getTable(); // Attributes $attributes = [ 'class' => 'ff-remote-boolean make-switch', 'type' => 'checkbox', 'data-size' => 'small', 'value' => true, ...
php
public function remote_boolean(Column\RemoteBoolean $column, array $row) { $table = $column->getTable(); // Attributes $attributes = [ 'class' => 'ff-remote-boolean make-switch', 'type' => 'checkbox', 'data-size' => 'small', 'value' => true, ...
[ "public", "function", "remote_boolean", "(", "Column", "\\", "RemoteBoolean", "$", "column", ",", "array", "$", "row", ")", "{", "$", "table", "=", "$", "column", "->", "getTable", "(", ")", ";", "// Attributes", "$", "attributes", "=", "[", "'class'", "...
render boolean switch @param \FrenchFrogs\Table\Column\BooleanSwitch $column @param array $row @return string
[ "render", "boolean", "switch" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Bootstrap.php#L222-L245
FrenchFrogs/framework
src/Table/Renderer/Bootstrap.php
Bootstrap.icon
public function icon(Column\Icon $column, array $row) { $html = ''; $html .= '<i class="fa '. $column->getValue($row).'"></i>'; return $this->post($html, $column, $row); }
php
public function icon(Column\Icon $column, array $row) { $html = ''; $html .= '<i class="fa '. $column->getValue($row).'"></i>'; return $this->post($html, $column, $row); }
[ "public", "function", "icon", "(", "Column", "\\", "Icon", "$", "column", ",", "array", "$", "row", ")", "{", "$", "html", "=", "''", ";", "$", "html", ".=", "'<i class=\"fa '", ".", "$", "column", "->", "getValue", "(", "$", "row", ")", ".", "'\">...
Render Icon column @param \FrenchFrogs\Table\Column\Icon $column @param array $row @return string
[ "Render", "Icon", "column" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Bootstrap.php#L255-L262
FrenchFrogs/framework
src/Table/Renderer/Bootstrap.php
Bootstrap.custom
public function custom(Column\Custom $column, array $row) { $html = call_user_func($column->getCustom(), $row); return $this->post($html, $column, $row); }
php
public function custom(Column\Custom $column, array $row) { $html = call_user_func($column->getCustom(), $row); return $this->post($html, $column, $row); }
[ "public", "function", "custom", "(", "Column", "\\", "Custom", "$", "column", ",", "array", "$", "row", ")", "{", "$", "html", "=", "call_user_func", "(", "$", "column", "->", "getCustom", "(", ")", ",", "$", "row", ")", ";", "return", "$", "this", ...
Render custom callable column @param \FrenchFrogs\Table\Column\Custom $column @param array $row @return mixed
[ "Render", "custom", "callable", "column" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Bootstrap.php#L271-L275
FrenchFrogs/framework
src/Table/Renderer/Bootstrap.php
Bootstrap.text
public function text(Column\Text $column, array $row) { $attributes = $column->getAttributes(); if($column->hasTooltip()){ $attributes += [ 'data-placement' => $column->getTooltipPosition(), 'data-original-title' => $column->getValue($row), ...
php
public function text(Column\Text $column, array $row) { $attributes = $column->getAttributes(); if($column->hasTooltip()){ $attributes += [ 'data-placement' => $column->getTooltipPosition(), 'data-original-title' => $column->getValue($row), ...
[ "public", "function", "text", "(", "Column", "\\", "Text", "$", "column", ",", "array", "$", "row", ")", "{", "$", "attributes", "=", "$", "column", "->", "getAttributes", "(", ")", ";", "if", "(", "$", "column", "->", "hasTooltip", "(", ")", ")", ...
Render text column @param \FrenchFrogs\Table\Column\Text $column @param array $row @return mixed|string
[ "Render", "text", "column" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Bootstrap.php#L285-L303
FrenchFrogs/framework
src/Table/Renderer/Bootstrap.php
Bootstrap.remote_text
public function remote_text(Column\RemoteText $column, array $row) { $html = $this->text($column, $row); $html .= html('input', [ 'type' => 'text', 'data-id' => $row[$column->getTable()->getIdField()], 'data-column' => $column->getName() ]); $htm...
php
public function remote_text(Column\RemoteText $column, array $row) { $html = $this->text($column, $row); $html .= html('input', [ 'type' => 'text', 'data-id' => $row[$column->getTable()->getIdField()], 'data-column' => $column->getName() ]); $htm...
[ "public", "function", "remote_text", "(", "Column", "\\", "RemoteText", "$", "column", ",", "array", "$", "row", ")", "{", "$", "html", "=", "$", "this", "->", "text", "(", "$", "column", ",", "$", "row", ")", ";", "$", "html", ".=", "html", "(", ...
Render a text remote @param \FrenchFrogs\Table\Column\RemoteText $column @param array $row @return mixed|string
[ "Render", "a", "text", "remote" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Bootstrap.php#L342-L353
FrenchFrogs/framework
src/Table/Renderer/Bootstrap.php
Bootstrap.remote_select
public function remote_select(Column\RemoteSelect $column, array $row) { // OPTIONS $options = html('option', [], '--'); $elementValue = $row[$column->getIndex()]; foreach($column->getOptions() as $value => $key){ $attr = ['value' => $value]; if ($value == $e...
php
public function remote_select(Column\RemoteSelect $column, array $row) { // OPTIONS $options = html('option', [], '--'); $elementValue = $row[$column->getIndex()]; foreach($column->getOptions() as $value => $key){ $attr = ['value' => $value]; if ($value == $e...
[ "public", "function", "remote_select", "(", "Column", "\\", "RemoteSelect", "$", "column", ",", "array", "$", "row", ")", "{", "// OPTIONS", "$", "options", "=", "html", "(", "'option'", ",", "[", "]", ",", "'--'", ")", ";", "$", "elementValue", "=", "...
Render remote Select @param \FrenchFrogs\Table\Column\RemoteSelect $column @param array $row @return string
[ "Render", "remote", "Select" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Bootstrap.php#L362-L382
FrenchFrogs/framework
src/Table/Renderer/Bootstrap.php
Bootstrap.link
public function link(Column\Link $column, array $row) { if ($column->isRemote()) { $column->addAttribute('data-target', '#' . $column->getRemoteId()) ->addAttribute('data-toggle', 'modal'); } elseif($column->isCallback()) { $column->addClass('callback-remote'...
php
public function link(Column\Link $column, array $row) { if ($column->isRemote()) { $column->addAttribute('data-target', '#' . $column->getRemoteId()) ->addAttribute('data-toggle', 'modal'); } elseif($column->isCallback()) { $column->addClass('callback-remote'...
[ "public", "function", "link", "(", "Column", "\\", "Link", "$", "column", ",", "array", "$", "row", ")", "{", "if", "(", "$", "column", "->", "isRemote", "(", ")", ")", "{", "$", "column", "->", "addAttribute", "(", "'data-target'", ",", "'#'", ".", ...
Render link column @param \FrenchFrogs\Table\Column\Link $column @param array $row @return string
[ "Render", "link", "column" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Bootstrap.php#L392-L404
FrenchFrogs/framework
src/Table/Renderer/Bootstrap.php
Bootstrap.media
public function media(Column\Media $column, array $row) { $media = $column->getBindedLink($row); $extension = pathinfo($media, PATHINFO_EXTENSION); if (empty($extension)) { return ''; } if (($pos = strpos($extension, '?')) !== false) { $extension =...
php
public function media(Column\Media $column, array $row) { $media = $column->getBindedLink($row); $extension = pathinfo($media, PATHINFO_EXTENSION); if (empty($extension)) { return ''; } if (($pos = strpos($extension, '?')) !== false) { $extension =...
[ "public", "function", "media", "(", "Column", "\\", "Media", "$", "column", ",", "array", "$", "row", ")", "{", "$", "media", "=", "$", "column", "->", "getBindedLink", "(", "$", "row", ")", ";", "$", "extension", "=", "pathinfo", "(", "$", "media", ...
Render a media content @param \FrenchFrogs\Table\Column\Link $column @param array $row @return string
[ "Render", "a", "media", "content" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Bootstrap.php#L413-L442
FrenchFrogs/framework
src/Table/Renderer/Bootstrap.php
Bootstrap.button
public function button(Column\Button $column, array $row) { if ($column->hasOption()) { $column->addClass(constant( Style::class . '::' . $column->getOption())); } if ($column->hasSize()) { $column->addClass(constant( Style::class . '::' . $column->getSize())); ...
php
public function button(Column\Button $column, array $row) { if ($column->hasOption()) { $column->addClass(constant( Style::class . '::' . $column->getOption())); } if ($column->hasSize()) { $column->addClass(constant( Style::class . '::' . $column->getSize())); ...
[ "public", "function", "button", "(", "Column", "\\", "Button", "$", "column", ",", "array", "$", "row", ")", "{", "if", "(", "$", "column", "->", "hasOption", "(", ")", ")", "{", "$", "column", "->", "addClass", "(", "constant", "(", "Style", "::", ...
Render a button @param \FrenchFrogs\Table\Column\Button $column @param array $row @return mixed
[ "Render", "a", "button" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Bootstrap.php#L452-L493
FrenchFrogs/framework
src/Table/Renderer/Bootstrap.php
Bootstrap.code
public function code(Column\Code $column, array $row) { $html = html('code', [],$column->getValue($row)); return $this->post($html, $column, $row); }
php
public function code(Column\Code $column, array $row) { $html = html('code', [],$column->getValue($row)); return $this->post($html, $column, $row); }
[ "public", "function", "code", "(", "Column", "\\", "Code", "$", "column", ",", "array", "$", "row", ")", "{", "$", "html", "=", "html", "(", "'code'", ",", "[", "]", ",", "$", "column", "->", "getValue", "(", "$", "row", ")", ")", ";", "return", ...
Rendor a code element @param \FrenchFrogs\Table\Column\Code $column @param array $row @return string
[ "Rendor", "a", "code", "element" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Bootstrap.php#L503-L507
FrenchFrogs/framework
src/Table/Renderer/Bootstrap.php
Bootstrap.pre
public function pre(Column\Pre $column, array $row) { $html = html('pre', [],$column->getValue($row)); return $this->post($html, $column, $row); }
php
public function pre(Column\Pre $column, array $row) { $html = html('pre', [],$column->getValue($row)); return $this->post($html, $column, $row); }
[ "public", "function", "pre", "(", "Column", "\\", "Pre", "$", "column", ",", "array", "$", "row", ")", "{", "$", "html", "=", "html", "(", "'pre'", ",", "[", "]", ",", "$", "column", "->", "getValue", "(", "$", "row", ")", ")", ";", "return", "...
Render a pre element @param \FrenchFrogs\Table\Column\Code $column @param array $row @return string
[ "Render", "a", "pre", "element" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Bootstrap.php#L516-L520
FrenchFrogs/framework
src/Table/Renderer/Bootstrap.php
Bootstrap.datatable
public function datatable(Table\Table $table) { $options = []; // Is remote loading if ($table->isRemote()) { $table->addClass('datatable-remote'); $table->save(); $options += [ 'ajax' => ['url' => route('datatable', ['token' => $table->g...
php
public function datatable(Table\Table $table) { $options = []; // Is remote loading if ($table->isRemote()) { $table->addClass('datatable-remote'); $table->save(); $options += [ 'ajax' => ['url' => route('datatable', ['token' => $table->g...
[ "public", "function", "datatable", "(", "Table", "\\", "Table", "$", "table", ")", "{", "$", "options", "=", "[", "]", ";", "// Is remote loading", "if", "(", "$", "table", "->", "isRemote", "(", ")", ")", "{", "$", "table", "->", "addClass", "(", "'...
Render datatable js @param \FrenchFrogs\Table\Table\Table $table @return string
[ "Render", "datatable", "js" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Bootstrap.php#L530-L639
FrenchFrogs/framework
src/Table/Renderer/Bootstrap.php
Bootstrap.strainerSelect
public function strainerSelect(Column\Strainer\Select $strainer) { $element = $strainer->getElement(); $element->addStyle('width', '100%'); $element->addClass(Style::FORM_ELEMENT_CONTROL); $options = ''; if ($element->hasPlaceholder()){ $options .= html('option'...
php
public function strainerSelect(Column\Strainer\Select $strainer) { $element = $strainer->getElement(); $element->addStyle('width', '100%'); $element->addClass(Style::FORM_ELEMENT_CONTROL); $options = ''; if ($element->hasPlaceholder()){ $options .= html('option'...
[ "public", "function", "strainerSelect", "(", "Column", "\\", "Strainer", "\\", "Select", "$", "strainer", ")", "{", "$", "element", "=", "$", "strainer", "->", "getElement", "(", ")", ";", "$", "element", "->", "addStyle", "(", "'width'", ",", "'100%'", ...
Render strainer for a select element @param \FrenchFrogs\Table\Column\Strainer\Select $strainer @return string
[ "Render", "strainer", "for", "a", "select", "element" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Bootstrap.php#L647-L668
FrenchFrogs/framework
src/Table/Renderer/Bootstrap.php
Bootstrap.strainerText
public function strainerText(Column\Strainer\Text $strainer) { $element = $strainer->getElement(); $element->addStyle('width', '100%'); $element->addClass('text-center'); $element->addClass(Style::FORM_ELEMENT_CONTROL); return html('input', $element->getAttributes()); }
php
public function strainerText(Column\Strainer\Text $strainer) { $element = $strainer->getElement(); $element->addStyle('width', '100%'); $element->addClass('text-center'); $element->addClass(Style::FORM_ELEMENT_CONTROL); return html('input', $element->getAttributes()); }
[ "public", "function", "strainerText", "(", "Column", "\\", "Strainer", "\\", "Text", "$", "strainer", ")", "{", "$", "element", "=", "$", "strainer", "->", "getElement", "(", ")", ";", "$", "element", "->", "addStyle", "(", "'width'", ",", "'100%'", ")",...
Render a striner for a text element @param Column\Strainer\Text $strainer @return string
[ "Render", "a", "striner", "for", "a", "text", "element" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Bootstrap.php#L677-L685
FrenchFrogs/framework
src/Table/Renderer/Bootstrap.php
Bootstrap.strainerDateRange
public function strainerDateRange(Column\Strainer\DateRange $strainer) { $element = $strainer->getElement(); $html = html('input', ['type' => 'text', 'class' => Style::FORM_ELEMENT_CONTROL, 'name' => $element->getFrom()]); $html .= '<span class="input-group-addon">-</span>'; $html ....
php
public function strainerDateRange(Column\Strainer\DateRange $strainer) { $element = $strainer->getElement(); $html = html('input', ['type' => 'text', 'class' => Style::FORM_ELEMENT_CONTROL, 'name' => $element->getFrom()]); $html .= '<span class="input-group-addon">-</span>'; $html ....
[ "public", "function", "strainerDateRange", "(", "Column", "\\", "Strainer", "\\", "DateRange", "$", "strainer", ")", "{", "$", "element", "=", "$", "strainer", "->", "getElement", "(", ")", ";", "$", "html", "=", "html", "(", "'input'", ",", "[", "'type'...
Render a striner for a text element @param Column\Strainer\Text $strainer @return string
[ "Render", "a", "striner", "for", "a", "text", "element" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Bootstrap.php#L723-L735
bestit/commercetools-order-export-bundle
src/OrderNameGenerator.php
OrderNameGenerator.getOrderName
public function getOrderName(Order $order): string { if (preg_match_all('/{{(.*)}}/U', $scheme = $this->getNameScheme(), $matches)) { foreach ($matches[1] as $index => $foundSnippet) { $foundSnippetName = trim($foundSnippet); $usedSnippet = $order->hasField($found...
php
public function getOrderName(Order $order): string { if (preg_match_all('/{{(.*)}}/U', $scheme = $this->getNameScheme(), $matches)) { foreach ($matches[1] as $index => $foundSnippet) { $foundSnippetName = trim($foundSnippet); $usedSnippet = $order->hasField($found...
[ "public", "function", "getOrderName", "(", "Order", "$", "order", ")", ":", "string", "{", "if", "(", "preg_match_all", "(", "'/{{(.*)}}/U'", ",", "$", "scheme", "=", "$", "this", "->", "getNameScheme", "(", ")", ",", "$", "matches", ")", ")", "{", "fo...
Returns the name for the order. @param Order $order @return string
[ "Returns", "the", "name", "for", "the", "order", "." ]
train
https://github.com/bestit/commercetools-order-export-bundle/blob/44bd0dedff6edab5ecf5803dcf6d24ffe0dbf845/src/OrderNameGenerator.php#L44-L58
nicoSWD/put.io-api-v2
src/PutIO/Helpers/HTTP/HTTPHelper.php
HTTPHelper.getMIMEType
protected function getMIMEType($file) { $mime = 'application/octet-stream'; if (function_exists('finfo_open') && $info = @finfo_open(FILEINFO_MIME)) { if (($mime = @finfo_file($info, $file)) !== \false) { $mime = explode(';', $mime); $mime = trim($mime[0]...
php
protected function getMIMEType($file) { $mime = 'application/octet-stream'; if (function_exists('finfo_open') && $info = @finfo_open(FILEINFO_MIME)) { if (($mime = @finfo_file($info, $file)) !== \false) { $mime = explode(';', $mime); $mime = trim($mime[0]...
[ "protected", "function", "getMIMEType", "(", "$", "file", ")", "{", "$", "mime", "=", "'application/octet-stream'", ";", "if", "(", "function_exists", "(", "'finfo_open'", ")", "&&", "$", "info", "=", "@", "finfo_open", "(", "FILEINFO_MIME", ")", ")", "{", ...
Attempts to get the MIME type of a given file. Required for native file uploads. Relies on the file info extension, which is shipped with PHP 5.3 and enabled by default. So,... nothing should go wrong, RIGHT? @param string $file Path of the file you want to get the MIME type of. @return string
[ "Attempts", "to", "get", "the", "MIME", "type", "of", "a", "given", "file", ".", "Required", "for", "native", "file", "uploads", "." ]
train
https://github.com/nicoSWD/put.io-api-v2/blob/d91bedd91ea75793512a921bfd9aa83e86a6f0a7/src/PutIO/Helpers/HTTP/HTTPHelper.php#L85-L97
nicoSWD/put.io-api-v2
src/PutIO/Helpers/HTTP/HTTPHelper.php
HTTPHelper.getResponse
protected function getResponse($response, $returnBool, $arrayKey = '') { $response = $this->jsonDecode($response); if ($response === \null) { return \false; } if ($returnBool) { return $this->getStatus($response); } if ($arra...
php
protected function getResponse($response, $returnBool, $arrayKey = '') { $response = $this->jsonDecode($response); if ($response === \null) { return \false; } if ($returnBool) { return $this->getStatus($response); } if ($arra...
[ "protected", "function", "getResponse", "(", "$", "response", ",", "$", "returnBool", ",", "$", "arrayKey", "=", "''", ")", "{", "$", "response", "=", "$", "this", "->", "jsonDecode", "(", "$", "response", ")", ";", "if", "(", "$", "response", "===", ...
Decodes the response and returns the appropriate value @param string $response Response data from server. @param bool $returnBool Whether or not to return boolean @param string $arrayKey Will return all data on a specific array key of the response. @return array|bool
[ "Decodes", "the", "response", "and", "returns", "the", "appropriate", "value" ]
train
https://github.com/nicoSWD/put.io-api-v2/blob/d91bedd91ea75793512a921bfd9aa83e86a6f0a7/src/PutIO/Helpers/HTTP/HTTPHelper.php#L108-L129
nicoSWD/put.io-api-v2
src/PutIO/Helpers/HTTP/HTTPHelper.php
HTTPHelper.nativeJsonDecode
protected function nativeJsonDecode($string) { $result = @json_decode($string, \true); if (!$result || JSON_ERROR_NONE !== json_last_error()) { $result = \null; } return $result; }
php
protected function nativeJsonDecode($string) { $result = @json_decode($string, \true); if (!$result || JSON_ERROR_NONE !== json_last_error()) { $result = \null; } return $result; }
[ "protected", "function", "nativeJsonDecode", "(", "$", "string", ")", "{", "$", "result", "=", "@", "json_decode", "(", "$", "string", ",", "\\", "true", ")", ";", "if", "(", "!", "$", "result", "||", "JSON_ERROR_NONE", "!==", "json_last_error", "(", ")"...
Decodes a JSON encoded string natively. @param string $string @return array|null
[ "Decodes", "a", "JSON", "encoded", "string", "natively", "." ]
train
https://github.com/nicoSWD/put.io-api-v2/blob/d91bedd91ea75793512a921bfd9aa83e86a6f0a7/src/PutIO/Helpers/HTTP/HTTPHelper.php#L160-L169
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Comparator/Native.php
Native.compare
public function compare(NI $a, NI $b) { switch ($this->arbitrate($a, $b)) { case 'int': case 'whole': case 'natural': case 'float': return $this->intFloatCompare($a, $b); case 'rational': list($a, $b) = $this->checkR...
php
public function compare(NI $a, NI $b) { switch ($this->arbitrate($a, $b)) { case 'int': case 'whole': case 'natural': case 'float': return $this->intFloatCompare($a, $b); case 'rational': list($a, $b) = $this->checkR...
[ "public", "function", "compare", "(", "NI", "$", "a", ",", "NI", "$", "b", ")", "{", "switch", "(", "$", "this", "->", "arbitrate", "(", "$", "a", ",", "$", "b", ")", ")", "{", "case", "'int'", ":", "case", "'whole'", ":", "case", "'natural'", ...
a == b = 0 a < b = -1 a > b = 1 @param NI $a first term @param NI $b second term @return int @noinspection PhpInconsistentReturnPointsInspection
[ "a", "==", "b", "=", "0", "a", "<", "b", "=", "-", "1", "a", ">", "b", "=", "1" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Comparator/Native.php#L48-L66
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Comparator/Native.php
Native.intFloatCompare
protected function intFloatCompare(NI $a, NI $b) { return $this->rationalCompare( RationalTypeFactory::fromFloat($a->asFloatType()), RationalTypeFactory::fromFloat($b->asFloatType()) ); }
php
protected function intFloatCompare(NI $a, NI $b) { return $this->rationalCompare( RationalTypeFactory::fromFloat($a->asFloatType()), RationalTypeFactory::fromFloat($b->asFloatType()) ); }
[ "protected", "function", "intFloatCompare", "(", "NI", "$", "a", ",", "NI", "$", "b", ")", "{", "return", "$", "this", "->", "rationalCompare", "(", "RationalTypeFactory", "::", "fromFloat", "(", "$", "a", "->", "asFloatType", "(", ")", ")", ",", "Ration...
Compare int and float types @param NI $a @param NI $b @return int
[ "Compare", "int", "and", "float", "types" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Comparator/Native.php#L75-L81
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Comparator/Native.php
Native.rationalCompare
protected function rationalCompare(RationalType $a, RationalType $b) { $res = $this->calculator->rationalSub($a, $b); if ($res->numerator()->get() == 0) { return 0; } if ($res->numerator()->get() < 0) { return -1; } return 1; }
php
protected function rationalCompare(RationalType $a, RationalType $b) { $res = $this->calculator->rationalSub($a, $b); if ($res->numerator()->get() == 0) { return 0; } if ($res->numerator()->get() < 0) { return -1; } return 1; }
[ "protected", "function", "rationalCompare", "(", "RationalType", "$", "a", ",", "RationalType", "$", "b", ")", "{", "$", "res", "=", "$", "this", "->", "calculator", "->", "rationalSub", "(", "$", "a", ",", "$", "b", ")", ";", "if", "(", "$", "res", ...
Compare two rationals @param RationalType $a @param RationalType $b @return int
[ "Compare", "two", "rationals" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Comparator/Native.php#L90-L101
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Comparator/Native.php
Native.complexCompare
protected function complexCompare(ComplexType $a, ComplexType $b) { if ($a->isReal() && $b->isReal()) { return $this->rationalCompare($a->r(), $b->r()); } //hack to get around native php integer limitations //what we should be doing here is to return $this->rationalCompa...
php
protected function complexCompare(ComplexType $a, ComplexType $b) { if ($a->isReal() && $b->isReal()) { return $this->rationalCompare($a->r(), $b->r()); } //hack to get around native php integer limitations //what we should be doing here is to return $this->rationalCompa...
[ "protected", "function", "complexCompare", "(", "ComplexType", "$", "a", ",", "ComplexType", "$", "b", ")", "{", "if", "(", "$", "a", "->", "isReal", "(", ")", "&&", "$", "b", "->", "isReal", "(", ")", ")", "{", "return", "$", "this", "->", "ration...
Compare complex numbers. If both operands are real then compare the real parts else compare the modulii of the two numbers @param ComplexType $a @param ComplexType $b @return boolean
[ "Compare", "complex", "numbers", ".", "If", "both", "operands", "are", "real", "then", "compare", "the", "real", "parts", "else", "compare", "the", "modulii", "of", "the", "two", "numbers" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Comparator/Native.php#L113-L132
acasademont/wurfl
WURFL/Handlers/CatchAllMozillaHandler.php
WURFL_Handlers_CatchAllMozillaHandler.applyConclusiveMatch
public function applyConclusiveMatch($userAgent) { if (WURFL_Configuration_ConfigHolder::getWURFLConfig()->isHighPerformance()) { //High performance mode $tolerance = WURFL_Handlers_Utils::firstCloseParen($userAgent); return $this->getDeviceIDFromRIS($userAgent, $toleranc...
php
public function applyConclusiveMatch($userAgent) { if (WURFL_Configuration_ConfigHolder::getWURFLConfig()->isHighPerformance()) { //High performance mode $tolerance = WURFL_Handlers_Utils::firstCloseParen($userAgent); return $this->getDeviceIDFromRIS($userAgent, $toleranc...
[ "public", "function", "applyConclusiveMatch", "(", "$", "userAgent", ")", "{", "if", "(", "WURFL_Configuration_ConfigHolder", "::", "getWURFLConfig", "(", ")", "->", "isHighPerformance", "(", ")", ")", "{", "//High performance mode", "$", "tolerance", "=", "WURFL_Ha...
If UA starts with Mozilla, apply LD with tolerance 5. @param string $userAgent @return string
[ "If", "UA", "starts", "with", "Mozilla", "apply", "LD", "with", "tolerance", "5", "." ]
train
https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Handlers/CatchAllMozillaHandler.php#L51-L61
dreamfactorysoftware/df-azure
src/Components/DocumentDBConnection.php
DocumentDBConnection.setOptions
public function setOptions(array $options) { $limit = array_get($options, static::OPT_LIMIT); if (!empty($limit)) { $this->setHeaders(['x-ms-max-item-count' => $limit]); } }
php
public function setOptions(array $options) { $limit = array_get($options, static::OPT_LIMIT); if (!empty($limit)) { $this->setHeaders(['x-ms-max-item-count' => $limit]); } }
[ "public", "function", "setOptions", "(", "array", "$", "options", ")", "{", "$", "limit", "=", "array_get", "(", "$", "options", ",", "static", "::", "OPT_LIMIT", ")", ";", "if", "(", "!", "empty", "(", "$", "limit", ")", ")", "{", "$", "this", "->...
Sets options. @param array $options
[ "Sets", "options", "." ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/DocumentDBConnection.php#L52-L59
dreamfactorysoftware/df-azure
src/Components/DocumentDBConnection.php
DocumentDBConnection.listCollections
public function listCollections(array $options = []) { $this->setOptions($options); $coll = new Collection($this->client, $this->database); $coll->setHeaders($this->getHeaders()); $rs = $coll->getAll(); $this->checkResponse($rs); $colls = array_get($rs, 'DocumentColle...
php
public function listCollections(array $options = []) { $this->setOptions($options); $coll = new Collection($this->client, $this->database); $coll->setHeaders($this->getHeaders()); $rs = $coll->getAll(); $this->checkResponse($rs); $colls = array_get($rs, 'DocumentColle...
[ "public", "function", "listCollections", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "setOptions", "(", "$", "options", ")", ";", "$", "coll", "=", "new", "Collection", "(", "$", "this", "->", "client", ",", "$", "this",...
List all collections in a Database. @param array $options Operation options @return array
[ "List", "all", "collections", "in", "a", "Database", "." ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/DocumentDBConnection.php#L87-L103
dreamfactorysoftware/df-azure
src/Components/DocumentDBConnection.php
DocumentDBConnection.getCollection
public function getCollection($id, array $options = []) { $this->setOptions($options); $coll = new Collection($this->client, $this->database); $coll->setHeaders($this->getHeaders()); $rs = $coll->get($id); $this->checkResponse($rs); unset($rs['_curl_info']); ...
php
public function getCollection($id, array $options = []) { $this->setOptions($options); $coll = new Collection($this->client, $this->database); $coll->setHeaders($this->getHeaders()); $rs = $coll->get($id); $this->checkResponse($rs); unset($rs['_curl_info']); ...
[ "public", "function", "getCollection", "(", "$", "id", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "setOptions", "(", "$", "options", ")", ";", "$", "coll", "=", "new", "Collection", "(", "$", "this", "->", "client", "...
Retrieves a collection information. @param string $id Collection ID @param array $options Operation options @return array
[ "Retrieves", "a", "collection", "information", "." ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/DocumentDBConnection.php#L113-L123
dreamfactorysoftware/df-azure
src/Components/DocumentDBConnection.php
DocumentDBConnection.createCollection
public function createCollection(array $data, array $options = []) { $this->setOptions($options); $coll = new Collection($this->client, $this->database); $coll->setHeaders($this->getHeaders()); $rs = $coll->create($data); $this->checkResponse($rs); unset($rs['_curl_in...
php
public function createCollection(array $data, array $options = []) { $this->setOptions($options); $coll = new Collection($this->client, $this->database); $coll->setHeaders($this->getHeaders()); $rs = $coll->create($data); $this->checkResponse($rs); unset($rs['_curl_in...
[ "public", "function", "createCollection", "(", "array", "$", "data", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "setOptions", "(", "$", "options", ")", ";", "$", "coll", "=", "new", "Collection", "(", "$", "this", "->",...
Creates a collection. @param array $data Collection data @param array $options Operation options @return array
[ "Creates", "a", "collection", "." ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/DocumentDBConnection.php#L133-L143
dreamfactorysoftware/df-azure
src/Components/DocumentDBConnection.php
DocumentDBConnection.replaceCollection
public function replaceCollection(array $data, $id, array $options = []) { $this->setOptions($options); $coll = new Collection($this->client, $this->database); $coll->setHeaders($this->getHeaders()); $rs = $coll->replace($data, $id); $this->checkResponse($rs); unset($...
php
public function replaceCollection(array $data, $id, array $options = []) { $this->setOptions($options); $coll = new Collection($this->client, $this->database); $coll->setHeaders($this->getHeaders()); $rs = $coll->replace($data, $id); $this->checkResponse($rs); unset($...
[ "public", "function", "replaceCollection", "(", "array", "$", "data", ",", "$", "id", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "setOptions", "(", "$", "options", ")", ";", "$", "coll", "=", "new", "Collection", "(", ...
Replaces a collection. @param array $data Collection data @param string $id @param array $options Operation options @return array
[ "Replaces", "a", "collection", "." ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/DocumentDBConnection.php#L154-L164
dreamfactorysoftware/df-azure
src/Components/DocumentDBConnection.php
DocumentDBConnection.deleteCollection
public function deleteCollection($id, array $options = []) { $this->setOptions($options); $coll = new Collection($this->client, $this->database); $coll->setHeaders($this->getHeaders()); $rs = $coll->delete($id); $this->checkResponse($rs); unset($rs['_curl_info']); ...
php
public function deleteCollection($id, array $options = []) { $this->setOptions($options); $coll = new Collection($this->client, $this->database); $coll->setHeaders($this->getHeaders()); $rs = $coll->delete($id); $this->checkResponse($rs); unset($rs['_curl_info']); ...
[ "public", "function", "deleteCollection", "(", "$", "id", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "setOptions", "(", "$", "options", ")", ";", "$", "coll", "=", "new", "Collection", "(", "$", "this", "->", "client", ...
Deletes a collection. @param string $id Collection ID @param array $options Operation options @return array
[ "Deletes", "a", "collection", "." ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/DocumentDBConnection.php#L174-L184
dreamfactorysoftware/df-azure
src/Components/DocumentDBConnection.php
DocumentDBConnection.listDocuments
public function listDocuments($collection, array $options = []) { $this->setOptions($options); $doc = new Document($this->client, $this->database, $collection); $doc->setHeaders($this->getHeaders()); $rs = $doc->getAll(); $this->checkResponse($rs); unset($rs['_curl_in...
php
public function listDocuments($collection, array $options = []) { $this->setOptions($options); $doc = new Document($this->client, $this->database, $collection); $doc->setHeaders($this->getHeaders()); $rs = $doc->getAll(); $this->checkResponse($rs); unset($rs['_curl_in...
[ "public", "function", "listDocuments", "(", "$", "collection", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "setOptions", "(", "$", "options", ")", ";", "$", "doc", "=", "new", "Document", "(", "$", "this", "->", "client"...
List all documents in a collection. @param string $collection Collection to list documents from @param array $options Operation options @return array
[ "List", "all", "documents", "in", "a", "collection", "." ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/DocumentDBConnection.php#L198-L208
dreamfactorysoftware/df-azure
src/Components/DocumentDBConnection.php
DocumentDBConnection.getDocument
public function getDocument($collection, $id, array $options = []) { $this->setOptions($options); $doc = new Document($this->client, $this->database, $collection); $doc->setHeaders($this->getHeaders()); $rs = $doc->get($id); $this->checkResponse($rs); unset($rs['_curl...
php
public function getDocument($collection, $id, array $options = []) { $this->setOptions($options); $doc = new Document($this->client, $this->database, $collection); $doc->setHeaders($this->getHeaders()); $rs = $doc->get($id); $this->checkResponse($rs); unset($rs['_curl...
[ "public", "function", "getDocument", "(", "$", "collection", ",", "$", "id", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "setOptions", "(", "$", "options", ")", ";", "$", "doc", "=", "new", "Document", "(", "$", "this"...
Retrieves a document. @param string $collection Collection to list document from @param string $id ID of the document to retrieve @param array $options Operation options @return array
[ "Retrieves", "a", "document", "." ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/DocumentDBConnection.php#L219-L229
dreamfactorysoftware/df-azure
src/Components/DocumentDBConnection.php
DocumentDBConnection.createDocument
public function createDocument($collection, array $data, array $options = []) { $this->setOptions($options); $doc = new Document($this->client, $this->database, $collection); $doc->setHeaders($this->getHeaders()); $rs = $doc->create($data); $this->checkResponse($rs); ...
php
public function createDocument($collection, array $data, array $options = []) { $this->setOptions($options); $doc = new Document($this->client, $this->database, $collection); $doc->setHeaders($this->getHeaders()); $rs = $doc->create($data); $this->checkResponse($rs); ...
[ "public", "function", "createDocument", "(", "$", "collection", ",", "array", "$", "data", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "setOptions", "(", "$", "options", ")", ";", "$", "doc", "=", "new", "Document", "(",...
Creates a document. @param string $collection Collection to create a document in @param array $data Document data @param array $options Operation options @return array
[ "Creates", "a", "document", "." ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/DocumentDBConnection.php#L240-L250
dreamfactorysoftware/df-azure
src/Components/DocumentDBConnection.php
DocumentDBConnection.replaceDocument
public function replaceDocument($collection, array $data, $id, array $options = []) { $this->setOptions($options); $doc = new Document($this->client, $this->database, $collection); $doc->setHeaders($this->getHeaders()); $rs = $doc->replace($data, $id); $this->checkResponse($r...
php
public function replaceDocument($collection, array $data, $id, array $options = []) { $this->setOptions($options); $doc = new Document($this->client, $this->database, $collection); $doc->setHeaders($this->getHeaders()); $rs = $doc->replace($data, $id); $this->checkResponse($r...
[ "public", "function", "replaceDocument", "(", "$", "collection", ",", "array", "$", "data", ",", "$", "id", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "setOptions", "(", "$", "options", ")", ";", "$", "doc", "=", "new...
Replaces a document. @param string $collection Collection to replace a document in @param array $data Document data @param string $id ID of the document being replaced @param array $options Operation options @return array
[ "Replaces", "a", "document", "." ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/DocumentDBConnection.php#L262-L272
dreamfactorysoftware/df-azure
src/Components/DocumentDBConnection.php
DocumentDBConnection.deleteDocument
public function deleteDocument($collection, $id, array $options = []) { $this->setOptions($options); $doc = new Document($this->client, $this->database, $collection); $doc->setHeaders($this->getHeaders()); $rs = $doc->delete($id); $this->checkResponse($rs); unset($rs[...
php
public function deleteDocument($collection, $id, array $options = []) { $this->setOptions($options); $doc = new Document($this->client, $this->database, $collection); $doc->setHeaders($this->getHeaders()); $rs = $doc->delete($id); $this->checkResponse($rs); unset($rs[...
[ "public", "function", "deleteDocument", "(", "$", "collection", ",", "$", "id", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "setOptions", "(", "$", "options", ")", ";", "$", "doc", "=", "new", "Document", "(", "$", "th...
Deletes a document. @param string $collection Collection to delete a document from @param string $id ID of the document to delete @param array $options Operation options @return array
[ "Deletes", "a", "document", "." ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/DocumentDBConnection.php#L283-L293
dreamfactorysoftware/df-azure
src/Components/DocumentDBConnection.php
DocumentDBConnection.queryDocument
public function queryDocument($collection, $sql, array $params = [], array $options = []) { $this->setOptions($options); $doc = new Document($this->client, $this->database, $collection); $doc->setHeaders($this->getHeaders()); $rs = $doc->query($sql, $params); $this->checkResp...
php
public function queryDocument($collection, $sql, array $params = [], array $options = []) { $this->setOptions($options); $doc = new Document($this->client, $this->database, $collection); $doc->setHeaders($this->getHeaders()); $rs = $doc->query($sql, $params); $this->checkResp...
[ "public", "function", "queryDocument", "(", "$", "collection", ",", "$", "sql", ",", "array", "$", "params", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "setOptions", "(", "$", "options", ")", ";", "$", ...
Queries a collection for documents. @param string $collection Collection to perform the query on @param string $sql SQL query string @param array $params Query parameters @param array $options Operation options @return array
[ "Queries", "a", "collection", "for", "documents", "." ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/DocumentDBConnection.php#L305-L315
dreamfactorysoftware/df-azure
src/Components/DocumentDBConnection.php
DocumentDBConnection.checkResponse
protected function checkResponse(array $response) { $responseCode = intval(array_get($response, '_curl_info.http_code')); $message = array_get($response, 'message'); if ($responseCode >= 400) { $context = ['response_headers' => array_get($response, '_curl_info.response_headers')...
php
protected function checkResponse(array $response) { $responseCode = intval(array_get($response, '_curl_info.http_code')); $message = array_get($response, 'message'); if ($responseCode >= 400) { $context = ['response_headers' => array_get($response, '_curl_info.response_headers')...
[ "protected", "function", "checkResponse", "(", "array", "$", "response", ")", "{", "$", "responseCode", "=", "intval", "(", "array_get", "(", "$", "response", ",", "'_curl_info.http_code'", ")", ")", ";", "$", "message", "=", "array_get", "(", "$", "response...
Checks response status code for exceptions. @param array $response @throws \DreamFactory\Core\Exceptions\RestException
[ "Checks", "response", "status", "code", "for", "exceptions", "." ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/DocumentDBConnection.php#L324-L333
vincentchalamon/VinceCmsSonataAdminBundle
Admin/Entity/MenuAdmin.php
MenuAdmin.setUploadDir
public function setUploadDir($uploadDir, $webDir) { $this->uploadDir = $uploadDir; $this->webDir = $webDir; return $this; }
php
public function setUploadDir($uploadDir, $webDir) { $this->uploadDir = $uploadDir; $this->webDir = $webDir; return $this; }
[ "public", "function", "setUploadDir", "(", "$", "uploadDir", ",", "$", "webDir", ")", "{", "$", "this", "->", "uploadDir", "=", "$", "uploadDir", ";", "$", "this", "->", "webDir", "=", "$", "webDir", ";", "return", "$", "this", ";", "}" ]
Set upload directory @author Vincent Chalamon <vincentchalamon@gmail.com> @param string $uploadDir @param string $webDir @return MenuAdmin
[ "Set", "upload", "directory" ]
train
https://github.com/vincentchalamon/VinceCmsSonataAdminBundle/blob/edc768061734a92ba116488dd7b61ad40af21ceb/Admin/Entity/MenuAdmin.php#L117-L123
vincentchalamon/VinceCmsSonataAdminBundle
Admin/Entity/MenuAdmin.php
MenuAdmin.createQuery
public function createQuery($context = 'list') { $query = parent::createQuery($context); $query->leftJoin($query->getRootAlias().'.article', 'article')->addSelect('article') ->leftJoin($query->getRootAlias().'.parent', 'parent')->addSelect('parent') ->leftJoin($query->get...
php
public function createQuery($context = 'list') { $query = parent::createQuery($context); $query->leftJoin($query->getRootAlias().'.article', 'article')->addSelect('article') ->leftJoin($query->getRootAlias().'.parent', 'parent')->addSelect('parent') ->leftJoin($query->get...
[ "public", "function", "createQuery", "(", "$", "context", "=", "'list'", ")", "{", "$", "query", "=", "parent", "::", "createQuery", "(", "$", "context", ")", ";", "$", "query", "->", "leftJoin", "(", "$", "query", "->", "getRootAlias", "(", ")", ".", ...
Need to override createQuery method because of list order & joins {@inheritdoc}
[ "Need", "to", "override", "createQuery", "method", "because", "of", "list", "order", "&", "joins" ]
train
https://github.com/vincentchalamon/VinceCmsSonataAdminBundle/blob/edc768061734a92ba116488dd7b61ad40af21ceb/Admin/Entity/MenuAdmin.php#L130-L139
vincentchalamon/VinceCmsSonataAdminBundle
Admin/Entity/MenuAdmin.php
MenuAdmin.configureListFields
protected function configureListFields(ListMapper $mapper) { $mapper ->add('up', 'field_tree_up', array( 'label' => 'menu.field.up', ) ) ->add('down', 'field_tree_down', array( 'label' => 'menu.field.down', ...
php
protected function configureListFields(ListMapper $mapper) { $mapper ->add('up', 'field_tree_up', array( 'label' => 'menu.field.up', ) ) ->add('down', 'field_tree_down', array( 'label' => 'menu.field.down', ...
[ "protected", "function", "configureListFields", "(", "ListMapper", "$", "mapper", ")", "{", "$", "mapper", "->", "add", "(", "'up'", ",", "'field_tree_up'", ",", "array", "(", "'label'", "=>", "'menu.field.up'", ",", ")", ")", "->", "add", "(", "'down'", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/vincentchalamon/VinceCmsSonataAdminBundle/blob/edc768061734a92ba116488dd7b61ad40af21ceb/Admin/Entity/MenuAdmin.php#L144-L161
vincentchalamon/VinceCmsSonataAdminBundle
Admin/Entity/MenuAdmin.php
MenuAdmin.configureFormFields
protected function configureFormFields(FormMapper $mapper) { $id = $this->getSubject()->getId(); $mapper->with('menu.group.general', array('class' => 'col-md-6')); if (!$id || $this->getSubject()->getLvl()) { $mapper ->add('parent', null, array( ...
php
protected function configureFormFields(FormMapper $mapper) { $id = $this->getSubject()->getId(); $mapper->with('menu.group.general', array('class' => 'col-md-6')); if (!$id || $this->getSubject()->getLvl()) { $mapper ->add('parent', null, array( ...
[ "protected", "function", "configureFormFields", "(", "FormMapper", "$", "mapper", ")", "{", "$", "id", "=", "$", "this", "->", "getSubject", "(", ")", "->", "getId", "(", ")", ";", "$", "mapper", "->", "with", "(", "'menu.group.general'", ",", "array", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/vincentchalamon/VinceCmsSonataAdminBundle/blob/edc768061734a92ba116488dd7b61ad40af21ceb/Admin/Entity/MenuAdmin.php#L174-L242
vincentchalamon/VinceCmsSonataAdminBundle
Admin/Entity/MenuAdmin.php
MenuAdmin.preRemove
public function preRemove($object) { /** @var Menu $object */ if ($object->isImage() && is_file($this->uploadDir.pathinfo($object->getPath(), PATHINFO_BASENAME))) { unlink($this->uploadDir.pathinfo($object->getPath(), PATHINFO_BASENAME)); } $this->menuRepository->verify()...
php
public function preRemove($object) { /** @var Menu $object */ if ($object->isImage() && is_file($this->uploadDir.pathinfo($object->getPath(), PATHINFO_BASENAME))) { unlink($this->uploadDir.pathinfo($object->getPath(), PATHINFO_BASENAME)); } $this->menuRepository->verify()...
[ "public", "function", "preRemove", "(", "$", "object", ")", "{", "/** @var Menu $object */", "if", "(", "$", "object", "->", "isImage", "(", ")", "&&", "is_file", "(", "$", "this", "->", "uploadDir", ".", "pathinfo", "(", "$", "object", "->", "getPath", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/vincentchalamon/VinceCmsSonataAdminBundle/blob/edc768061734a92ba116488dd7b61ad40af21ceb/Admin/Entity/MenuAdmin.php#L247-L255
vincentchalamon/VinceCmsSonataAdminBundle
Admin/Entity/MenuAdmin.php
MenuAdmin.prePersist
public function prePersist($object) { /** @var Menu $object */ if ($object->isImage()) { $object->upload($this->uploadDir, $this->webDir); } $this->menuRepository->verify(); $this->menuRepository->recover(); }
php
public function prePersist($object) { /** @var Menu $object */ if ($object->isImage()) { $object->upload($this->uploadDir, $this->webDir); } $this->menuRepository->verify(); $this->menuRepository->recover(); }
[ "public", "function", "prePersist", "(", "$", "object", ")", "{", "/** @var Menu $object */", "if", "(", "$", "object", "->", "isImage", "(", ")", ")", "{", "$", "object", "->", "upload", "(", "$", "this", "->", "uploadDir", ",", "$", "this", "->", "we...
{@inheritdoc}
[ "{" ]
train
https://github.com/vincentchalamon/VinceCmsSonataAdminBundle/blob/edc768061734a92ba116488dd7b61ad40af21ceb/Admin/Entity/MenuAdmin.php#L260-L268
yosmanyga/resource
src/Yosmanyga/Resource/Cacher/Storer/CheckFileStorer.php
CheckFileStorer.getFilename
protected function getFilename(Resource $resource) { return sprintf( '%s/%s%s', $this->dir, md5(serialize($resource)), $this->suffix ); }
php
protected function getFilename(Resource $resource) { return sprintf( '%s/%s%s', $this->dir, md5(serialize($resource)), $this->suffix ); }
[ "protected", "function", "getFilename", "(", "Resource", "$", "resource", ")", "{", "return", "sprintf", "(", "'%s/%s%s'", ",", "$", "this", "->", "dir", ",", "md5", "(", "serialize", "(", "$", "resource", ")", ")", ",", "$", "this", "->", "suffix", ")...
@param \Yosmanyga\Resource\Resource $resource @return string
[ "@param", "\\", "Yosmanyga", "\\", "Resource", "\\", "Resource", "$resource" ]
train
https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Cacher/Storer/CheckFileStorer.php#L30-L38
gugglegum/mb-str-pad
src/MbString.php
MbString.mb_str_pad
public static function mb_str_pad(string $input, int $pad_length, string $pad_string = " ", int $pad_type = STR_PAD_RIGHT, string $encoding = "UTF-8") { $input_length = mb_strlen($input); switch ($pad_type) { case STR_PAD_RIGHT : return $input . self::mb_fill_string($pad_...
php
public static function mb_str_pad(string $input, int $pad_length, string $pad_string = " ", int $pad_type = STR_PAD_RIGHT, string $encoding = "UTF-8") { $input_length = mb_strlen($input); switch ($pad_type) { case STR_PAD_RIGHT : return $input . self::mb_fill_string($pad_...
[ "public", "static", "function", "mb_str_pad", "(", "string", "$", "input", ",", "int", "$", "pad_length", ",", "string", "$", "pad_string", "=", "\" \"", ",", "int", "$", "pad_type", "=", "STR_PAD_RIGHT", ",", "string", "$", "encoding", "=", "\"UTF-8\"", "...
Multi-byte version of str_pad() @param string $input @param int $pad_length @param string $pad_string @param int $pad_type @param string $encoding @return string
[ "Multi", "-", "byte", "version", "of", "str_pad", "()" ]
train
https://github.com/gugglegum/mb-str-pad/blob/18fefbdf543dd35b2c25e26d6aab1e3d61cde9f1/src/MbString.php#L19-L34
gugglegum/mb-str-pad
src/MbString.php
MbString.mb_fill_string
private static function mb_fill_string(string $pattern, $length, $encoding = 'UTF-8'): string { $pattern_length = mb_strlen($pattern, $encoding); $str = ''; $i = 0; while ($i < $length) { if ($length - $i >= $pattern_length) { $str .= $pattern; ...
php
private static function mb_fill_string(string $pattern, $length, $encoding = 'UTF-8'): string { $pattern_length = mb_strlen($pattern, $encoding); $str = ''; $i = 0; while ($i < $length) { if ($length - $i >= $pattern_length) { $str .= $pattern; ...
[ "private", "static", "function", "mb_fill_string", "(", "string", "$", "pattern", ",", "$", "length", ",", "$", "encoding", "=", "'UTF-8'", ")", ":", "string", "{", "$", "pattern_length", "=", "mb_strlen", "(", "$", "pattern", ",", "$", "encoding", ")", ...
Returns a string of given length filled with some pattern substring @param string $pattern @param $length @param string $encoding @return string
[ "Returns", "a", "string", "of", "given", "length", "filled", "with", "some", "pattern", "substring" ]
train
https://github.com/gugglegum/mb-str-pad/blob/18fefbdf543dd35b2c25e26d6aab1e3d61cde9f1/src/MbString.php#L44-L59
stubbles/stubbles-webapp-core
src/main/php/htmlpassthrough/HtmlFilePassThrough.php
HtmlFilePassThrough.resolve
public function resolve(Request $request, Response $response, UriPath $uriPath) { $routeName = $uriPath->remaining('index.html'); if (!file_exists($this->routePath . $routeName)) { return $response->notFound(); } return $this->modifyContent( $request, ...
php
public function resolve(Request $request, Response $response, UriPath $uriPath) { $routeName = $uriPath->remaining('index.html'); if (!file_exists($this->routePath . $routeName)) { return $response->notFound(); } return $this->modifyContent( $request, ...
[ "public", "function", "resolve", "(", "Request", "$", "request", ",", "Response", "$", "response", ",", "UriPath", "$", "uriPath", ")", "{", "$", "routeName", "=", "$", "uriPath", "->", "remaining", "(", "'index.html'", ")", ";", "if", "(", "!", "file_ex...
processes the request @param \stubbles\webapp\Request $request current request @param \stubbles\webapp\Response $response response to send @param \stubbles\webapp\UriPath $uriPath information about called uri path @return string|\stubbles\webapp\response\Error
[ "processes", "the", "request" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/htmlpassthrough/HtmlFilePassThrough.php#L49-L62
stubbles/stubbles-webapp-core
src/main/php/htmlpassthrough/HtmlFilePassThrough.php
HtmlFilePassThrough.modifyContent
protected function modifyContent( Request $request, Response $response, string $content, string $routeName ): string { return $content; }
php
protected function modifyContent( Request $request, Response $response, string $content, string $routeName ): string { return $content; }
[ "protected", "function", "modifyContent", "(", "Request", "$", "request", ",", "Response", "$", "response", ",", "string", "$", "content", ",", "string", "$", "routeName", ")", ":", "string", "{", "return", "$", "content", ";", "}" ]
hook to modify the content before passing it to the response @param \stubbles\webapp\Request $request current request @param \stubbles\webapp\Response $response response to send @param string $content actual content for response @param string $routeName name of...
[ "hook", "to", "modify", "the", "content", "before", "passing", "it", "to", "the", "response" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/htmlpassthrough/HtmlFilePassThrough.php#L73-L80
activecollab/databasestructure
src/Field/Composite/CreatedByField.php
CreatedByField.onAddedToType
public function onAddedToType(TypeInterface &$type) { parent::onAddedToType($type); if ($this->isRequired()) { $type->addTrait(CreatedByRequiredInterface::class); } else { $type->addTrait(CreatedByOptionalInterface::class); } }
php
public function onAddedToType(TypeInterface &$type) { parent::onAddedToType($type); if ($this->isRequired()) { $type->addTrait(CreatedByRequiredInterface::class); } else { $type->addTrait(CreatedByOptionalInterface::class); } }
[ "public", "function", "onAddedToType", "(", "TypeInterface", "&", "$", "type", ")", "{", "parent", "::", "onAddedToType", "(", "$", "type", ")", ";", "if", "(", "$", "this", "->", "isRequired", "(", ")", ")", "{", "$", "type", "->", "addTrait", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Field/Composite/CreatedByField.php#L34-L43
eloquent/liberator
src/LiberatorObject.php
LiberatorObject.popsCall
public function popsCall($method, array &$arguments) { if ($this->liberatorReflector->hasMethod($method)) { $method = $this->liberatorReflector->getMethod($method); $method->setAccessible(true); return $this->popsProxySubValue( $method->invokeArgs($this->...
php
public function popsCall($method, array &$arguments) { if ($this->liberatorReflector->hasMethod($method)) { $method = $this->liberatorReflector->getMethod($method); $method->setAccessible(true); return $this->popsProxySubValue( $method->invokeArgs($this->...
[ "public", "function", "popsCall", "(", "$", "method", ",", "array", "&", "$", "arguments", ")", "{", "if", "(", "$", "this", "->", "liberatorReflector", "->", "hasMethod", "(", "$", "method", ")", ")", "{", "$", "method", "=", "$", "this", "->", "lib...
Call a method on the wrapped object with support for by-reference arguments. @param string $method The name of the method to call. @param array &$arguments The arguments. @return mixed The result of the method call.
[ "Call", "a", "method", "on", "the", "wrapped", "object", "with", "support", "for", "by", "-", "reference", "arguments", "." ]
train
https://github.com/eloquent/liberator/blob/d90c159e0067f7f3e376c8e4b1b72d502f7aa0aa/src/LiberatorObject.php#L60-L72
eloquent/liberator
src/LiberatorObject.php
LiberatorObject.__isset
public function __isset($property) { if ($propertyReflector = $this->liberatorPropertyReflector($property)) { return null !== $propertyReflector->getValue($this->popsValue()); } return parent::__isset($property); }
php
public function __isset($property) { if ($propertyReflector = $this->liberatorPropertyReflector($property)) { return null !== $propertyReflector->getValue($this->popsValue()); } return parent::__isset($property); }
[ "public", "function", "__isset", "(", "$", "property", ")", "{", "if", "(", "$", "propertyReflector", "=", "$", "this", "->", "liberatorPropertyReflector", "(", "$", "property", ")", ")", "{", "return", "null", "!==", "$", "propertyReflector", "->", "getValu...
Returns true if the property exists on the wrapped object. @param string $property The name of the property to search for. @return boolean True if the property exists.
[ "Returns", "true", "if", "the", "property", "exists", "on", "the", "wrapped", "object", "." ]
train
https://github.com/eloquent/liberator/blob/d90c159e0067f7f3e376c8e4b1b72d502f7aa0aa/src/LiberatorObject.php#L116-L123
hollodotme/TreeMDown
src/Utilities/Linker.php
Linker.getInternalLinks
public function getInternalLinks( \DOMNode $node ) : array { $this->guardHasOwnerDocument( $node ); $internalLinks = []; $xpath = new \DOMXPath( $node->ownerDocument ); $aTags = $xpath->query( '*//a[@href]' ); /** @var \DOMElement $aTag */ foreach ( $aTags as $aTag ) { $href = $aTag-...
php
public function getInternalLinks( \DOMNode $node ) : array { $this->guardHasOwnerDocument( $node ); $internalLinks = []; $xpath = new \DOMXPath( $node->ownerDocument ); $aTags = $xpath->query( '*//a[@href]' ); /** @var \DOMElement $aTag */ foreach ( $aTags as $aTag ) { $href = $aTag-...
[ "public", "function", "getInternalLinks", "(", "\\", "DOMNode", "$", "node", ")", ":", "array", "{", "$", "this", "->", "guardHasOwnerDocument", "(", "$", "node", ")", ";", "$", "internalLinks", "=", "[", "]", ";", "$", "xpath", "=", "new", "\\", "DOMX...
@param \DOMNode $node @throws \InvalidArgumentException @return array|\DOMElement[]
[ "@param", "\\", "DOMNode", "$node" ]
train
https://github.com/hollodotme/TreeMDown/blob/462c4118c70b68963e0176d540fc8502730ffe27/src/Utilities/Linker.php#L29-L48
WellCommerce/CoreBundle
Form/AbstractFormBuilder.php
AbstractFormBuilder.initService
protected function initService(string $type, string $alias, array $options) { $id = $this->resolverFactory->resolve($type, $alias); $service = $this->get($id); $service->setOptions($options); return $service; }
php
protected function initService(string $type, string $alias, array $options) { $id = $this->resolverFactory->resolve($type, $alias); $service = $this->get($id); $service->setOptions($options); return $service; }
[ "protected", "function", "initService", "(", "string", "$", "type", ",", "string", "$", "alias", ",", "array", "$", "options", ")", "{", "$", "id", "=", "$", "this", "->", "resolverFactory", "->", "resolve", "(", "$", "type", ",", "$", "alias", ")", ...
Initializes a service by its type @param string $type @param string $alias @param array $options @return object
[ "Initializes", "a", "service", "by", "its", "type" ]
train
https://github.com/WellCommerce/CoreBundle/blob/984fbd544d4b10cf11e54e0f3c304d100deb6842/Form/AbstractFormBuilder.php#L129-L137
stubbles/stubbles-webapp-core
src/main/php/routing/AbstractResource.php
AbstractResource.negotiateMimeType
public function negotiateMimeType(Request $request, Response $response): bool { if ($this->supportedMimeTypes->isContentNegotationDisabled()) { return true; } $mimeType = $this->supportedMimeTypes->findMatch( $request->readHeader('HTTP_ACCEPT') ...
php
public function negotiateMimeType(Request $request, Response $response): bool { if ($this->supportedMimeTypes->isContentNegotationDisabled()) { return true; } $mimeType = $this->supportedMimeTypes->findMatch( $request->readHeader('HTTP_ACCEPT') ...
[ "public", "function", "negotiateMimeType", "(", "Request", "$", "request", ",", "Response", "$", "response", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "supportedMimeTypes", "->", "isContentNegotationDisabled", "(", ")", ")", "{", "return", "true", ...
negotiates proper mime type for given request @param \stubbles\webapp\Request $request @param \stubbles\webapp\Response $response response to send @return bool @since 6.0.0
[ "negotiates", "proper", "mime", "type", "for", "given", "request" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/AbstractResource.php#L89-L120
stubbles/stubbles-webapp-core
src/main/php/routing/AbstractResource.php
AbstractResource.applyPreInterceptors
public function applyPreInterceptors(Request $request, Response $response): bool { return $this->interceptors->preProcess($request, $response); }
php
public function applyPreInterceptors(Request $request, Response $response): bool { return $this->interceptors->preProcess($request, $response); }
[ "public", "function", "applyPreInterceptors", "(", "Request", "$", "request", ",", "Response", "$", "response", ")", ":", "bool", "{", "return", "$", "this", "->", "interceptors", "->", "preProcess", "(", "$", "request", ",", "$", "response", ")", ";", "}"...
apply pre interceptors Returns false if one of the pre interceptors cancels the request. @param \stubbles\webapp\Request $request current request @param \stubbles\webapp\Response $response response to send @return bool
[ "apply", "pre", "interceptors" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/AbstractResource.php#L141-L144
stubbles/stubbles-webapp-core
src/main/php/routing/AbstractResource.php
AbstractResource.applyPostInterceptors
public function applyPostInterceptors(Request $request, Response $response): bool { return $this->interceptors->postProcess($request, $response); }
php
public function applyPostInterceptors(Request $request, Response $response): bool { return $this->interceptors->postProcess($request, $response); }
[ "public", "function", "applyPostInterceptors", "(", "Request", "$", "request", ",", "Response", "$", "response", ")", ":", "bool", "{", "return", "$", "this", "->", "interceptors", "->", "postProcess", "(", "$", "request", ",", "$", "response", ")", ";", "...
apply post interceptors @param \stubbles\webapp\Request $request current request @param \stubbles\webapp\Response $response response to send @return bool
[ "apply", "post", "interceptors" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/AbstractResource.php#L153-L156
hamjoint/mustard-auctions
src/lib/Http/Controllers/ItemController.php
ItemController.getBid
public function getBid($itemId) { $item = Item::findOrFail($itemId); if (!$item->auction) { return redirect($item->url)->withErrors([ 'This item is not an auction, so cannot be bid on.', ]); } $bids = $item->getBidHistory(); $highest...
php
public function getBid($itemId) { $item = Item::findOrFail($itemId); if (!$item->auction) { return redirect($item->url)->withErrors([ 'This item is not an auction, so cannot be bid on.', ]); } $bids = $item->getBidHistory(); $highest...
[ "public", "function", "getBid", "(", "$", "itemId", ")", "{", "$", "item", "=", "Item", "::", "findOrFail", "(", "$", "itemId", ")", ";", "if", "(", "!", "$", "item", "->", "auction", ")", "{", "return", "redirect", "(", "$", "item", "->", "url", ...
Return the item bid view. @param int $itemId @return \Illuminate\View\View
[ "Return", "the", "item", "bid", "view", "." ]
train
https://github.com/hamjoint/mustard-auctions/blob/66c8723d8681466e280263ad100f3fdc5895480d/src/lib/Http/Controllers/ItemController.php#L40-L68
hamjoint/mustard-auctions
src/lib/Http/Controllers/ItemController.php
ItemController.postBid
public function postBid(Request $request) { $item = Item::findOrFail($request->input('item_id')); if ($item->seller->userId == Auth::user()->userId) { return redirect()->back()->withErrors([ 'You cannot bid on your own items.', ]); } if (time...
php
public function postBid(Request $request) { $item = Item::findOrFail($request->input('item_id')); if ($item->seller->userId == Auth::user()->userId) { return redirect()->back()->withErrors([ 'You cannot bid on your own items.', ]); } if (time...
[ "public", "function", "postBid", "(", "Request", "$", "request", ")", "{", "$", "item", "=", "Item", "::", "findOrFail", "(", "$", "request", "->", "input", "(", "'item_id'", ")", ")", ";", "if", "(", "$", "item", "->", "seller", "->", "userId", "=="...
Place a bid. @param \Illuminate\Http\Request $request @return \Illuminate\Http\RedirectResponse
[ "Place", "a", "bid", "." ]
train
https://github.com/hamjoint/mustard-auctions/blob/66c8723d8681466e280263ad100f3fdc5895480d/src/lib/Http/Controllers/ItemController.php#L77-L179
hamjoint/mustard-auctions
src/lib/Http/Controllers/ItemController.php
ItemController.endedAuctionsAdmin
public static function endedAuctionsAdmin() { $items = Item::has('bids') ->where('auction', true) ->whereRaw('`reserve_price` <= `bidding_price`') ->where('user_ended', 0) ->where('winning_bid_id', 0) ->where('end_date', '<', time()) ->...
php
public static function endedAuctionsAdmin() { $items = Item::has('bids') ->where('auction', true) ->whereRaw('`reserve_price` <= `bidding_price`') ->where('user_ended', 0) ->where('winning_bid_id', 0) ->where('end_date', '<', time()) ->...
[ "public", "static", "function", "endedAuctionsAdmin", "(", ")", "{", "$", "items", "=", "Item", "::", "has", "(", "'bids'", ")", "->", "where", "(", "'auction'", ",", "true", ")", "->", "whereRaw", "(", "'`reserve_price` <= `bidding_price`'", ")", "->", "whe...
Watch an item. @param \Illuminate\Http\Request $request @return \Illuminate\Http\RedirectResponse
[ "Watch", "an", "item", "." ]
train
https://github.com/hamjoint/mustard-auctions/blob/66c8723d8681466e280263ad100f3fdc5895480d/src/lib/Http/Controllers/ItemController.php#L188-L213
nkt/flame
src/QueryBuilder/SaveQuery.php
SaveQuery.column
public function column($name, $value) { $this->columns[$this->grammar->buildId($name)] = $value; return $this; }
php
public function column($name, $value) { $this->columns[$this->grammar->buildId($name)] = $value; return $this; }
[ "public", "function", "column", "(", "$", "name", ",", "$", "value", ")", "{", "$", "this", "->", "columns", "[", "$", "this", "->", "grammar", "->", "buildId", "(", "$", "name", ")", "]", "=", "$", "value", ";", "return", "$", "this", ";", "}" ]
@param string $name @param string $value @return static
[ "@param", "string", "$name", "@param", "string", "$value" ]
train
https://github.com/nkt/flame/blob/16f9f172db5a8a618b628429e0986eacb089d217/src/QueryBuilder/SaveQuery.php#L56-L61
nkt/flame
src/QueryBuilder/SaveQuery.php
SaveQuery.columns
public function columns(array $columns) { foreach ($columns as $name => $value) { $this->columns[$this->grammar->buildId($name)] = $value; } return $this; }
php
public function columns(array $columns) { foreach ($columns as $name => $value) { $this->columns[$this->grammar->buildId($name)] = $value; } return $this; }
[ "public", "function", "columns", "(", "array", "$", "columns", ")", "{", "foreach", "(", "$", "columns", "as", "$", "name", "=>", "$", "value", ")", "{", "$", "this", "->", "columns", "[", "$", "this", "->", "grammar", "->", "buildId", "(", "$", "n...
@param array $columns @return static
[ "@param", "array", "$columns" ]
train
https://github.com/nkt/flame/blob/16f9f172db5a8a618b628429e0986eacb089d217/src/QueryBuilder/SaveQuery.php#L68-L75
movoin/one-swoole
src/Config/Config.php
Config.setRootPath
public static function setRootPath(string $root) { $mode = static::mode(); $path = "{$root}/{$mode}"; if (! file_exists($path)) { throw new InvalidArgumentException("'{$path}' not exists"); } static::$root = realpath($root); static::$path = realpath($pat...
php
public static function setRootPath(string $root) { $mode = static::mode(); $path = "{$root}/{$mode}"; if (! file_exists($path)) { throw new InvalidArgumentException("'{$path}' not exists"); } static::$root = realpath($root); static::$path = realpath($pat...
[ "public", "static", "function", "setRootPath", "(", "string", "$", "root", ")", "{", "$", "mode", "=", "static", "::", "mode", "(", ")", ";", "$", "path", "=", "\"{$root}/{$mode}\"", ";", "if", "(", "!", "file_exists", "(", "$", "path", ")", ")", "{"...
设置配置文件根目录 @param string $root @throws \InvalidArgumentException
[ "设置配置文件根目录" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Config/Config.php#L81-L94
movoin/one-swoole
src/Config/Config.php
Config.load
public static function load($force = false) { if ($force === false && ! empty(static::$config)) { return; } if (! isset(static::$placeholders['{ROOT_PATH}'])) { static::addPlaceHolder('{ROOT_PATH}', ROOT_PATH); } if (! isset(static::$placeholders['{R...
php
public static function load($force = false) { if ($force === false && ! empty(static::$config)) { return; } if (! isset(static::$placeholders['{ROOT_PATH}'])) { static::addPlaceHolder('{ROOT_PATH}', ROOT_PATH); } if (! isset(static::$placeholders['{R...
[ "public", "static", "function", "load", "(", "$", "force", "=", "false", ")", "{", "if", "(", "$", "force", "===", "false", "&&", "!", "empty", "(", "static", "::", "$", "config", ")", ")", "{", "return", ";", "}", "if", "(", "!", "isset", "(", ...
加载配置 @param bool $force @throws \RuntimeException
[ "加载配置" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Config/Config.php#L127-L215
movoin/one-swoole
src/Config/Config.php
Config.writeFile
public static function writeFile(string $filename, array $config): bool { return (bool) file_put_contents( static::$root . '/' . $filename, Yaml::dump($config) ); }
php
public static function writeFile(string $filename, array $config): bool { return (bool) file_put_contents( static::$root . '/' . $filename, Yaml::dump($config) ); }
[ "public", "static", "function", "writeFile", "(", "string", "$", "filename", ",", "array", "$", "config", ")", ":", "bool", "{", "return", "(", "bool", ")", "file_put_contents", "(", "static", "::", "$", "root", ".", "'/'", ".", "$", "filename", ",", "...
写入配置文件 @param string $filename @param array $config @return bool
[ "写入配置文件" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Config/Config.php#L249-L255
movoin/one-swoole
src/Config/Config.php
Config.importFromPath
private static function importFromPath(string $path): array { $conf = []; $paths = new DirectoryIterator($path); foreach ($paths as $path) { if ($path->isDot()) { continue; } if ($path->isDir()) { $conf[$path->getFileName(...
php
private static function importFromPath(string $path): array { $conf = []; $paths = new DirectoryIterator($path); foreach ($paths as $path) { if ($path->isDot()) { continue; } if ($path->isDir()) { $conf[$path->getFileName(...
[ "private", "static", "function", "importFromPath", "(", "string", "$", "path", ")", ":", "array", "{", "$", "conf", "=", "[", "]", ";", "$", "paths", "=", "new", "DirectoryIterator", "(", "$", "path", ")", ";", "foreach", "(", "$", "paths", "as", "$"...
从路径导入配置文件 @param string $path @return array
[ "从路径导入配置文件" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Config/Config.php#L264-L292
movoin/one-swoole
src/Config/Config.php
Config.preformPlaceHolder
private static function preformPlaceHolder(array $config): array { $preform = []; foreach ($config as $name => $value) { if (Assert::array($value)) { $preform[$name] = static::preformPlaceHolder($value); } elseif (Assert::string($value)) { $pr...
php
private static function preformPlaceHolder(array $config): array { $preform = []; foreach ($config as $name => $value) { if (Assert::array($value)) { $preform[$name] = static::preformPlaceHolder($value); } elseif (Assert::string($value)) { $pr...
[ "private", "static", "function", "preformPlaceHolder", "(", "array", "$", "config", ")", ":", "array", "{", "$", "preform", "=", "[", "]", ";", "foreach", "(", "$", "config", "as", "$", "name", "=>", "$", "value", ")", "{", "if", "(", "Assert", "::",...
预处理占位符 @param array $config @return array
[ "预处理占位符" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Config/Config.php#L301-L322
27cm/password-generator
src/Generator.php
Generator.generate
public function generate($lenght = 4, $separator = ' ') { $length = count($this->lists); $words = []; $randomArray = static::getRandomArray($lenght); foreach ($randomArray as $index => $random) { $list = $this->lists[$index % $length]; $words[] = $list->get($...
php
public function generate($lenght = 4, $separator = ' ') { $length = count($this->lists); $words = []; $randomArray = static::getRandomArray($lenght); foreach ($randomArray as $index => $random) { $list = $this->lists[$index % $length]; $words[] = $list->get($...
[ "public", "function", "generate", "(", "$", "lenght", "=", "4", ",", "$", "separator", "=", "' '", ")", "{", "$", "length", "=", "count", "(", "$", "this", "->", "lists", ")", ";", "$", "words", "=", "[", "]", ";", "$", "randomArray", "=", "stati...
Generate password from word lists. @param int $lenght Password length in words. @param string $separator Word separator. @return string Generated password.
[ "Generate", "password", "from", "word", "lists", "." ]
train
https://github.com/27cm/password-generator/blob/c7f835f3bc302a91497bf5f659e404e750fb03bf/src/Generator.php#L41-L53
27cm/password-generator
src/Generator.php
Generator.generateRu
public static function generateRu($lenght = 4, $separator = ' ') { $list = new WordList\Ru(); return (new static($list))->generate($lenght, $separator); }
php
public static function generateRu($lenght = 4, $separator = ' ') { $list = new WordList\Ru(); return (new static($list))->generate($lenght, $separator); }
[ "public", "static", "function", "generateRu", "(", "$", "lenght", "=", "4", ",", "$", "separator", "=", "' '", ")", "{", "$", "list", "=", "new", "WordList", "\\", "Ru", "(", ")", ";", "return", "(", "new", "static", "(", "$", "list", ")", ")", "...
Static function generates Russian phrase password. @param int $lenght Password length in words. @param string $separator Word separator. @return string Generated password.
[ "Static", "function", "generates", "Russian", "phrase", "password", "." ]
train
https://github.com/27cm/password-generator/blob/c7f835f3bc302a91497bf5f659e404e750fb03bf/src/Generator.php#L63-L67
27cm/password-generator
src/Generator.php
Generator.generateEn
public static function generateEn($lenght = 4, $separator = ' ') { $list = new WordList\En(); return (new static($list))->generate($lenght, $separator); }
php
public static function generateEn($lenght = 4, $separator = ' ') { $list = new WordList\En(); return (new static($list))->generate($lenght, $separator); }
[ "public", "static", "function", "generateEn", "(", "$", "lenght", "=", "4", ",", "$", "separator", "=", "' '", ")", "{", "$", "list", "=", "new", "WordList", "\\", "En", "(", ")", ";", "return", "(", "new", "static", "(", "$", "list", ")", ")", "...
Static function generates English phrase password. @param int $lenght Password length in words. @param string $separator Word separator. @return string Generated password.
[ "Static", "function", "generates", "English", "phrase", "password", "." ]
train
https://github.com/27cm/password-generator/blob/c7f835f3bc302a91497bf5f659e404e750fb03bf/src/Generator.php#L77-L81
27cm/password-generator
src/Generator.php
Generator.generateDe
public static function generateDe($lenght = 4, $separator = ' ') { $list = new WordList\De(); return (new static($list))->generate($lenght, $separator); }
php
public static function generateDe($lenght = 4, $separator = ' ') { $list = new WordList\De(); return (new static($list))->generate($lenght, $separator); }
[ "public", "static", "function", "generateDe", "(", "$", "lenght", "=", "4", ",", "$", "separator", "=", "' '", ")", "{", "$", "list", "=", "new", "WordList", "\\", "De", "(", ")", ";", "return", "(", "new", "static", "(", "$", "list", ")", ")", "...
Static function generates German phrase password. @param int $lenght Password length in words. @param string $separator Word separator. @return string Generated password.
[ "Static", "function", "generates", "German", "phrase", "password", "." ]
train
https://github.com/27cm/password-generator/blob/c7f835f3bc302a91497bf5f659e404e750fb03bf/src/Generator.php#L91-L95
27cm/password-generator
src/Generator.php
Generator.generateRuTranslit
public static function generateRuTranslit($lenght = 4, $separator = ' ') { $list = new WordList\RuTranslit(); return (new static($list))->generate($lenght, $separator); }
php
public static function generateRuTranslit($lenght = 4, $separator = ' ') { $list = new WordList\RuTranslit(); return (new static($list))->generate($lenght, $separator); }
[ "public", "static", "function", "generateRuTranslit", "(", "$", "lenght", "=", "4", ",", "$", "separator", "=", "' '", ")", "{", "$", "list", "=", "new", "WordList", "\\", "RuTranslit", "(", ")", ";", "return", "(", "new", "static", "(", "$", "list", ...
Static function generates transliterated Russian phrase password @param int $lenght Password length in words. @param string $separator Word separator. @return string Generated password.
[ "Static", "function", "generates", "transliterated", "Russian", "phrase", "password" ]
train
https://github.com/27cm/password-generator/blob/c7f835f3bc302a91497bf5f659e404e750fb03bf/src/Generator.php#L105-L109
27cm/password-generator
src/Generator.php
Generator.getRandomArray
protected static function getRandomArray($length) { $bytes = random_bytes($length * 2); $result = []; foreach (unpack('S*', $bytes) as $long) { $result[] = $long / 0xFFFF; } return $result; }
php
protected static function getRandomArray($length) { $bytes = random_bytes($length * 2); $result = []; foreach (unpack('S*', $bytes) as $long) { $result[] = $long / 0xFFFF; } return $result; }
[ "protected", "static", "function", "getRandomArray", "(", "$", "length", ")", "{", "$", "bytes", "=", "random_bytes", "(", "$", "length", "*", "2", ")", ";", "$", "result", "=", "[", "]", ";", "foreach", "(", "unpack", "(", "'S*'", ",", "$", "bytes",...
Get array of random numbers between 0.0 - 1.0. @param int $length Array length. @return float[] Array of random values 0.0 - 1.0.
[ "Get", "array", "of", "random", "numbers", "between", "0", ".", "0", "-", "1", ".", "0", "." ]
train
https://github.com/27cm/password-generator/blob/c7f835f3bc302a91497bf5f659e404e750fb03bf/src/Generator.php#L118-L126
axelitus/php-base
src/Bool.php
Bool.extIs
public static function extIs($value) { if (static::is($value)) { return true; } if (is_string($value)) { // This function should be case insensitive so let's compare to the lower-cased input string. $value = strtolower($value); return (static:...
php
public static function extIs($value) { if (static::is($value)) { return true; } if (is_string($value)) { // This function should be case insensitive so let's compare to the lower-cased input string. $value = strtolower($value); return (static:...
[ "public", "static", "function", "extIs", "(", "$", "value", ")", "{", "if", "(", "static", "::", "is", "(", "$", "value", ")", ")", "{", "return", "true", ";", "}", "if", "(", "is_string", "(", "$", "value", ")", ")", "{", "// This function should be...
Tests if the given value is a bool or not. This function considers also the strings 'true', 'false', 'on', 'off', 'yes', 'no', 'y', 'n', '1', '0' to be booleans. The function is NOT case sensitive. @param mixed $value The value to test. @return bool Returns true if the value is a bool or 0 or 1, false otherwise.
[ "Tests", "if", "the", "given", "value", "is", "a", "bool", "or", "not", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Bool.php#L52-L65
axelitus/php-base
src/Bool.php
Bool.compare
public static function compare($bool1, $bool2) { if (!static::is($bool1) || !static::is($bool2)) { throw new \InvalidArgumentException( "The \$bool1 and \$bool2 parameters must be of type bool." ); } return ((int)$bool1 - (int)$bool2); }
php
public static function compare($bool1, $bool2) { if (!static::is($bool1) || !static::is($bool2)) { throw new \InvalidArgumentException( "The \$bool1 and \$bool2 parameters must be of type bool." ); } return ((int)$bool1 - (int)$bool2); }
[ "public", "static", "function", "compare", "(", "$", "bool1", ",", "$", "bool2", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "bool1", ")", "||", "!", "static", "::", "is", "(", "$", "bool2", ")", ")", "{", "throw", "new", "\\", "I...
Compares two bool values. The returning value contains the actual value difference. @param bool $bool1 The left operand. @param bool $bool2 The right operand. @return int Returns -1 if $bool1=false and $bool2=true, =0 if $bool1 == $bool2, 1 if $bool1=true and $bool2=false @throws \InvalidArgumentException
[ "Compares", "two", "bool", "values", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Bool.php#L130-L139
axelitus/php-base
src/Bool.php
Bool.parse
public static function parse($input) { if (Str::isNotOrEmpty($input)) { throw new \InvalidArgumentException("The \$input parameter must be a non-empty string."); } // This function is case insensitive so let's compare to the lower-cased input string. $input = strtolower(...
php
public static function parse($input) { if (Str::isNotOrEmpty($input)) { throw new \InvalidArgumentException("The \$input parameter must be a non-empty string."); } // This function is case insensitive so let's compare to the lower-cased input string. $input = strtolower(...
[ "public", "static", "function", "parse", "(", "$", "input", ")", "{", "if", "(", "Str", "::", "isNotOrEmpty", "(", "$", "input", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"The \\$input parameter must be a non-empty string.\"", ")", ...
Parses the input string into a bool. The only strings that this function parses to boolean are 'true', 'false', '1' and '0'. This function is NOT case sensitive. @param string $input The string to be parsed. @return bool The parsed bool. @throws \RuntimeException @throws \InvalidArgumentException
[ "Parses", "the", "input", "string", "into", "a", "bool", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Bool.php#L180-L206
axelitus/php-base
src/Bool.php
Bool.extParse
public static function extParse($input) { if (Str::isNotOrEmpty($input)) { throw new \InvalidArgumentException("The \$input parameter must be a non-empty string."); } // This function is case insensitive so let's compare to the lower-cased input string. $input = strtolow...
php
public static function extParse($input) { if (Str::isNotOrEmpty($input)) { throw new \InvalidArgumentException("The \$input parameter must be a non-empty string."); } // This function is case insensitive so let's compare to the lower-cased input string. $input = strtolow...
[ "public", "static", "function", "extParse", "(", "$", "input", ")", "{", "if", "(", "Str", "::", "isNotOrEmpty", "(", "$", "input", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"The \\$input parameter must be a non-empty string.\"", ")",...
Parses the input string into a bool. This function allows for an extended set of strings that are parsed as booleans: 'true', '1', 'on', 'yes', 'y', 'false', '0', 'off', 'no', 'n'. This function is NOT case sensitive. @param string $input The string to be parsed. @return bool The parsed bool. @throws \RuntimeExcepti...
[ "Parses", "the", "input", "string", "into", "a", "bool", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Bool.php#L221-L247
awethemes/wp-session
src/WP_Session_Handler.php
WP_Session_Handler.read
public function read( $session_id ) { $session = get_option( $this->get_option_name( $session_id ), null ); if ( $this->expired( $session ) ) { $this->exists = true; return null; } if ( isset( $session['payload'] ) ) { $this->exists = true; return $session['payload']; } }
php
public function read( $session_id ) { $session = get_option( $this->get_option_name( $session_id ), null ); if ( $this->expired( $session ) ) { $this->exists = true; return null; } if ( isset( $session['payload'] ) ) { $this->exists = true; return $session['payload']; } }
[ "public", "function", "read", "(", "$", "session_id", ")", "{", "$", "session", "=", "get_option", "(", "$", "this", "->", "get_option_name", "(", "$", "session_id", ")", ",", "null", ")", ";", "if", "(", "$", "this", "->", "expired", "(", "$", "sess...
{@inheritdoc}
[ "{" ]
train
https://github.com/awethemes/wp-session/blob/4819c6392a0dbcbbf547027b70d5af88e7a89d61/src/WP_Session_Handler.php#L55-L69
awethemes/wp-session
src/WP_Session_Handler.php
WP_Session_Handler.write
public function write( $session_id, $data ) { $payload = [ 'payload' => $data, 'last_activity' => time(), ]; // Try determines existence state of session ID. if ( ! $this->exists ) { $this->read( $session_id ); } if ( $this->exists ) { update_option( $this->get_option_name( $session_id ...
php
public function write( $session_id, $data ) { $payload = [ 'payload' => $data, 'last_activity' => time(), ]; // Try determines existence state of session ID. if ( ! $this->exists ) { $this->read( $session_id ); } if ( $this->exists ) { update_option( $this->get_option_name( $session_id ...
[ "public", "function", "write", "(", "$", "session_id", ",", "$", "data", ")", "{", "$", "payload", "=", "[", "'payload'", "=>", "$", "data", ",", "'last_activity'", "=>", "time", "(", ")", ",", "]", ";", "// Try determines existence state of session ID.", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/awethemes/wp-session/blob/4819c6392a0dbcbbf547027b70d5af88e7a89d61/src/WP_Session_Handler.php#L74-L92
awethemes/wp-session
src/WP_Session_Handler.php
WP_Session_Handler.destroy
public function destroy( $session_id ) { delete_option( $this->get_option_name( $session_id ) ); $this->exists = false; return true; }
php
public function destroy( $session_id ) { delete_option( $this->get_option_name( $session_id ) ); $this->exists = false; return true; }
[ "public", "function", "destroy", "(", "$", "session_id", ")", "{", "delete_option", "(", "$", "this", "->", "get_option_name", "(", "$", "session_id", ")", ")", ";", "$", "this", "->", "exists", "=", "false", ";", "return", "true", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/awethemes/wp-session/blob/4819c6392a0dbcbbf547027b70d5af88e7a89d61/src/WP_Session_Handler.php#L97-L103
awethemes/wp-session
src/WP_Session_Handler.php
WP_Session_Handler.gc
public function gc( $lifetime ) { global $wpdb; $placeholder = $this->get_option_name( '' ); // @codingStandardsIgnoreLine $sessions = $wpdb->get_results( "SELECT * FROM `$wpdb->options` WHERE `option_name` LIKE '{$placeholder}%' LIMIT 0, 10000", ARRAY_A ); if ( empty( $sessions ) ) { return; } $ex...
php
public function gc( $lifetime ) { global $wpdb; $placeholder = $this->get_option_name( '' ); // @codingStandardsIgnoreLine $sessions = $wpdb->get_results( "SELECT * FROM `$wpdb->options` WHERE `option_name` LIKE '{$placeholder}%' LIMIT 0, 10000", ARRAY_A ); if ( empty( $sessions ) ) { return; } $ex...
[ "public", "function", "gc", "(", "$", "lifetime", ")", "{", "global", "$", "wpdb", ";", "$", "placeholder", "=", "$", "this", "->", "get_option_name", "(", "''", ")", ";", "// @codingStandardsIgnoreLine", "$", "sessions", "=", "$", "wpdb", "->", "get_resul...
{@inheritdoc}
[ "{" ]
train
https://github.com/awethemes/wp-session/blob/4819c6392a0dbcbbf547027b70d5af88e7a89d61/src/WP_Session_Handler.php#L108-L138
tonicospinelli/class-generation
src/ClassGeneration/PropertyCollection.php
PropertyCollection.add
public function add($property) { if (!$property instanceof PropertyInterface) { throw new \InvalidArgumentException( 'This Property must be a instance of \ClassGeneration\PropertyInterface' ); } if ($property->getName() === null) { $propert...
php
public function add($property) { if (!$property instanceof PropertyInterface) { throw new \InvalidArgumentException( 'This Property must be a instance of \ClassGeneration\PropertyInterface' ); } if ($property->getName() === null) { $propert...
[ "public", "function", "add", "(", "$", "property", ")", "{", "if", "(", "!", "$", "property", "instanceof", "PropertyInterface", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'This Property must be a instance of \\ClassGeneration\\PropertyInterface'", ...
Adds a new Property on the collection. @param PropertyInterface $property @return bool @throws \InvalidArgumentException
[ "Adds", "a", "new", "Property", "on", "the", "collection", "." ]
train
https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/PropertyCollection.php#L31-L45
tonicospinelli/class-generation
src/ClassGeneration/PropertyCollection.php
PropertyCollection.toString
public function toString() { $string = ''; $properties = $this->getIterator(); foreach ($properties as $property) { $string .= $property->toString(); } return $string; }
php
public function toString() { $string = ''; $properties = $this->getIterator(); foreach ($properties as $property) { $string .= $property->toString(); } return $string; }
[ "public", "function", "toString", "(", ")", "{", "$", "string", "=", "''", ";", "$", "properties", "=", "$", "this", "->", "getIterator", "(", ")", ";", "foreach", "(", "$", "properties", "as", "$", "property", ")", "{", "$", "string", ".=", "$", "...
Parse the Property Collection to string. @return string
[ "Parse", "the", "Property", "Collection", "to", "string", "." ]
train
https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/PropertyCollection.php#L69-L78
tonicospinelli/class-generation
src/ClassGeneration/PropertyCollection.php
PropertyCollection.getByName
public function getByName($propertyName) { $foundList = new self(); $list = $this->getIterator(); foreach ($list as $property) { if ((is_array($propertyName) && in_array($property->getName(), $propertyName)) || ($property->getName() === $propertyName) ...
php
public function getByName($propertyName) { $foundList = new self(); $list = $this->getIterator(); foreach ($list as $property) { if ((is_array($propertyName) && in_array($property->getName(), $propertyName)) || ($property->getName() === $propertyName) ...
[ "public", "function", "getByName", "(", "$", "propertyName", ")", "{", "$", "foundList", "=", "new", "self", "(", ")", ";", "$", "list", "=", "$", "this", "->", "getIterator", "(", ")", ";", "foreach", "(", "$", "list", "as", "$", "property", ")", ...
Find the properties by name. @param string $propertyName @return PropertyCollection
[ "Find", "the", "properties", "by", "name", "." ]
train
https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/PropertyCollection.php#L87-L100
tonicospinelli/class-generation
src/ClassGeneration/PropertyCollection.php
PropertyCollection.removeByName
public function removeByName($propertyName) { $removedList = new self(); $list = $this->getIterator(); foreach ($list as $index => $property) { if ((is_array($propertyName) && in_array($property->getName(), $propertyName)) || ($property->getName() === $propertyNam...
php
public function removeByName($propertyName) { $removedList = new self(); $list = $this->getIterator(); foreach ($list as $index => $property) { if ((is_array($propertyName) && in_array($property->getName(), $propertyName)) || ($property->getName() === $propertyNam...
[ "public", "function", "removeByName", "(", "$", "propertyName", ")", "{", "$", "removedList", "=", "new", "self", "(", ")", ";", "$", "list", "=", "$", "this", "->", "getIterator", "(", ")", ";", "foreach", "(", "$", "list", "as", "$", "index", "=>",...
Removes tags by name. @param string $propertyName @return PropertyCollection
[ "Removes", "tags", "by", "name", "." ]
train
https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/PropertyCollection.php#L109-L123