id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
191,100 | cakebake/yii2-actionlog | model/ActionLog.php | ActionLog.add | public static function add($status = null, $message = null, $uID = 0)
{
$model = Yii::createObject(__CLASS__);
$model->user_id = ((int)$uID !== 0) ? (int)$uID : (int)$model->getUserID();
$model->user_remote = $_SERVER['REMOTE_ADDR'];
$model->action = Yii::$app->requestedAction->id;
... | php | public static function add($status = null, $message = null, $uID = 0)
{
$model = Yii::createObject(__CLASS__);
$model->user_id = ((int)$uID !== 0) ? (int)$uID : (int)$model->getUserID();
$model->user_remote = $_SERVER['REMOTE_ADDR'];
$model->action = Yii::$app->requestedAction->id;
... | [
"public",
"static",
"function",
"add",
"(",
"$",
"status",
"=",
"null",
",",
"$",
"message",
"=",
"null",
",",
"$",
"uID",
"=",
"0",
")",
"{",
"$",
"model",
"=",
"Yii",
"::",
"createObject",
"(",
"__CLASS__",
")",
";",
"$",
"model",
"->",
"user_id"... | Adds a message to ActionLog model
@param string $status The log status information
@param mixed $message The log message
@param int $uID The user id | [
"Adds",
"a",
"message",
"to",
"ActionLog",
"model"
] | 2f7eb5ac2683fb33ec248291db6454840b18e70d | https://github.com/cakebake/yii2-actionlog/blob/2f7eb5ac2683fb33ec248291db6454840b18e70d/model/ActionLog.php#L59-L70 |
191,101 | cakebake/yii2-actionlog | model/ActionLog.php | ActionLog.getUserID | public static function getUserID()
{
$user = Yii::$app->getUser();
return $user && !$user->getIsGuest() ? $user->getId() : 0;
} | php | public static function getUserID()
{
$user = Yii::$app->getUser();
return $user && !$user->getIsGuest() ? $user->getId() : 0;
} | [
"public",
"static",
"function",
"getUserID",
"(",
")",
"{",
"$",
"user",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getUser",
"(",
")",
";",
"return",
"$",
"user",
"&&",
"!",
"$",
"user",
"->",
"getIsGuest",
"(",
")",
"?",
"$",
"user",
"->",
"getId",
"... | Get the current user ID
@return int The user ID | [
"Get",
"the",
"current",
"user",
"ID"
] | 2f7eb5ac2683fb33ec248291db6454840b18e70d | https://github.com/cakebake/yii2-actionlog/blob/2f7eb5ac2683fb33ec248291db6454840b18e70d/model/ActionLog.php#L77-L82 |
191,102 | OpenBuildings/spiderling | src/Openbuildings/Spiderling/Driver/SimpleXML.php | Driver_SimpleXML.initialize | public function initialize()
{
@ $this->_dom->loadXML($this->content());
$this->_dom->encoding = 'utf-8';
$this->_xpath = new Driver_Simple_Xpath($this->_dom);
$this->_forms = new Driver_Simple_Forms($this->_xpath);
} | php | public function initialize()
{
@ $this->_dom->loadXML($this->content());
$this->_dom->encoding = 'utf-8';
$this->_xpath = new Driver_Simple_Xpath($this->_dom);
$this->_forms = new Driver_Simple_Forms($this->_xpath);
} | [
"public",
"function",
"initialize",
"(",
")",
"{",
"@",
"$",
"this",
"->",
"_dom",
"->",
"loadXML",
"(",
"$",
"this",
"->",
"content",
"(",
")",
")",
";",
"$",
"this",
"->",
"_dom",
"->",
"encoding",
"=",
"'utf-8'",
";",
"$",
"this",
"->",
"_xpath"... | Initialze the dom, xpath and forms objects, based on the content string | [
"Initialze",
"the",
"dom",
"xpath",
"and",
"forms",
"objects",
"based",
"on",
"the",
"content",
"string"
] | 00cec77eb7228204fda55596dee49ff1a5f14ac5 | https://github.com/OpenBuildings/spiderling/blob/00cec77eb7228204fda55596dee49ff1a5f14ac5/src/Openbuildings/Spiderling/Driver/SimpleXML.php#L31-L37 |
191,103 | anlutro/php-menu | src/Builder.php | Builder.getNested | protected function getNested($key)
{
$segments = explode('.', $key);
$data = $this->getMenu(array_shift($segments));
if (!$data) return null;
foreach ($segments as $key) {
if ($data instanceof Nodes\SubmenuNode) {
$data = $data->getSubmenu();
}
if ($data instanceof Collection) {
$data = $dat... | php | protected function getNested($key)
{
$segments = explode('.', $key);
$data = $this->getMenu(array_shift($segments));
if (!$data) return null;
foreach ($segments as $key) {
if ($data instanceof Nodes\SubmenuNode) {
$data = $data->getSubmenu();
}
if ($data instanceof Collection) {
$data = $dat... | [
"protected",
"function",
"getNested",
"(",
"$",
"key",
")",
"{",
"$",
"segments",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"getMenu",
"(",
"array_shift",
"(",
"$",
"segments",
")",
")",
";",
"if",
... | Get a nested menu.
@param string $key
@return mixed | [
"Get",
"a",
"nested",
"menu",
"."
] | 4ae76261eb16204a2bc889f5196d5797e587623d | https://github.com/anlutro/php-menu/blob/4ae76261eb16204a2bc889f5196d5797e587623d/src/Builder.php#L89-L108 |
191,104 | anlutro/php-menu | src/Builder.php | Builder.render | public function render($key, RendererInterface $renderer = null)
{
if (!$this->hasMenu($key)) {
return '';
}
return $this->renderMenu($this->getMenu($key), $renderer);
} | php | public function render($key, RendererInterface $renderer = null)
{
if (!$this->hasMenu($key)) {
return '';
}
return $this->renderMenu($this->getMenu($key), $renderer);
} | [
"public",
"function",
"render",
"(",
"$",
"key",
",",
"RendererInterface",
"$",
"renderer",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasMenu",
"(",
"$",
"key",
")",
")",
"{",
"return",
"''",
";",
"}",
"return",
"$",
"this",
"->",
... | Render a menu if it exists.
@param string $key
@return string | [
"Render",
"a",
"menu",
"if",
"it",
"exists",
"."
] | 4ae76261eb16204a2bc889f5196d5797e587623d | https://github.com/anlutro/php-menu/blob/4ae76261eb16204a2bc889f5196d5797e587623d/src/Builder.php#L133-L140 |
191,105 | anlutro/php-menu | src/Builder.php | Builder.renderMenu | public function renderMenu(Collection $menu, RendererInterface $renderer = null)
{
if ($renderer === null) {
$renderer = $this->getDefaultRenderer();
}
return $renderer->render($menu);
} | php | public function renderMenu(Collection $menu, RendererInterface $renderer = null)
{
if ($renderer === null) {
$renderer = $this->getDefaultRenderer();
}
return $renderer->render($menu);
} | [
"public",
"function",
"renderMenu",
"(",
"Collection",
"$",
"menu",
",",
"RendererInterface",
"$",
"renderer",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"renderer",
"===",
"null",
")",
"{",
"$",
"renderer",
"=",
"$",
"this",
"->",
"getDefaultRenderer",
"(",
... | Render a menu collection instance.
@param Collection $menu
@param RendererInterface $renderer Optional
@return string | [
"Render",
"a",
"menu",
"collection",
"instance",
"."
] | 4ae76261eb16204a2bc889f5196d5797e587623d | https://github.com/anlutro/php-menu/blob/4ae76261eb16204a2bc889f5196d5797e587623d/src/Builder.php#L150-L157 |
191,106 | OpenBuildings/spiderling | src/Openbuildings/Spiderling/Driver/Phantomjs/Connection.php | Driver_Phantomjs_Connection.start | public function start($pid_file = NULL, $log_file = '/dev/null')
{
if ($pid_file)
{
$this->_pid_file = $pid_file;
if (is_file($this->_pid_file))
{
Phantomjs::kill(file_get_contents($pid_file));
unlink($this->_pid_file);
}
}
$this->_pid = Phantomjs::start('phantom.js', $this->port(), 'phant... | php | public function start($pid_file = NULL, $log_file = '/dev/null')
{
if ($pid_file)
{
$this->_pid_file = $pid_file;
if (is_file($this->_pid_file))
{
Phantomjs::kill(file_get_contents($pid_file));
unlink($this->_pid_file);
}
}
$this->_pid = Phantomjs::start('phantom.js', $this->port(), 'phant... | [
"public",
"function",
"start",
"(",
"$",
"pid_file",
"=",
"NULL",
",",
"$",
"log_file",
"=",
"'/dev/null'",
")",
"{",
"if",
"(",
"$",
"pid_file",
")",
"{",
"$",
"this",
"->",
"_pid_file",
"=",
"$",
"pid_file",
";",
"if",
"(",
"is_file",
"(",
"$",
"... | Start a new phantomjs server, optionally provide pid_file and log file.
If you provide a pid_file, it will kill the process currently running on that pid, before starting the new one
If the start is unsuccessfull it will return FALSE
@param string $pid_file
@param string $log_file
@return boolean | [
"Start",
"a",
"new",
"phantomjs",
"server",
"optionally",
"provide",
"pid_file",
"and",
"log",
"file",
".",
"If",
"you",
"provide",
"a",
"pid_file",
"it",
"will",
"kill",
"the",
"process",
"currently",
"running",
"on",
"that",
"pid",
"before",
"starting",
"t... | 00cec77eb7228204fda55596dee49ff1a5f14ac5 | https://github.com/OpenBuildings/spiderling/blob/00cec77eb7228204fda55596dee49ff1a5f14ac5/src/Openbuildings/Spiderling/Driver/Phantomjs/Connection.php#L111-L135 |
191,107 | OpenBuildings/spiderling | src/Openbuildings/Spiderling/Driver/Phantomjs/Connection.php | Driver_Phantomjs_Connection.stop | public function stop()
{
if ($this->is_started())
{
$this->delete('session');
$this->_pid = NULL;
}
if ($this->_pid_file AND is_file($this->_pid_file))
{
unlink($this->_pid_file);
}
$self = $this;
return Attempt::make(function() use ($self) {
return ! $self->is_running();
});
} | php | public function stop()
{
if ($this->is_started())
{
$this->delete('session');
$this->_pid = NULL;
}
if ($this->_pid_file AND is_file($this->_pid_file))
{
unlink($this->_pid_file);
}
$self = $this;
return Attempt::make(function() use ($self) {
return ! $self->is_running();
});
} | [
"public",
"function",
"stop",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"is_started",
"(",
")",
")",
"{",
"$",
"this",
"->",
"delete",
"(",
"'session'",
")",
";",
"$",
"this",
"->",
"_pid",
"=",
"NULL",
";",
"}",
"if",
"(",
"$",
"this",
"->"... | Gracefully stop the phantomjs server. Return FALSE on failure. Clear the pid_file if set
@return boolean | [
"Gracefully",
"stop",
"the",
"phantomjs",
"server",
".",
"Return",
"FALSE",
"on",
"failure",
".",
"Clear",
"the",
"pid_file",
"if",
"set"
] | 00cec77eb7228204fda55596dee49ff1a5f14ac5 | https://github.com/OpenBuildings/spiderling/blob/00cec77eb7228204fda55596dee49ff1a5f14ac5/src/Openbuildings/Spiderling/Driver/Phantomjs/Connection.php#L159-L176 |
191,108 | OpenBuildings/spiderling | src/Openbuildings/Spiderling/Driver/Phantomjs/Connection.php | Driver_Phantomjs_Connection.call | protected function call($command, array $options = array())
{
$curl = curl_init();
$options[CURLOPT_URL] = $this->command_url($command);
$options[CURLOPT_RETURNTRANSFER] = TRUE;
$options[CURLOPT_FOLLOWLOCATION] = TRUE;
curl_setopt_array($curl, $options);
$raw = '';
Attempt::make(function() use ($curl,... | php | protected function call($command, array $options = array())
{
$curl = curl_init();
$options[CURLOPT_URL] = $this->command_url($command);
$options[CURLOPT_RETURNTRANSFER] = TRUE;
$options[CURLOPT_FOLLOWLOCATION] = TRUE;
curl_setopt_array($curl, $options);
$raw = '';
Attempt::make(function() use ($curl,... | [
"protected",
"function",
"call",
"(",
"$",
"command",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"curl",
"=",
"curl_init",
"(",
")",
";",
"$",
"options",
"[",
"CURLOPT_URL",
"]",
"=",
"$",
"this",
"->",
"command_url",
"(",
... | Perform a custom request on the phantomjs server, using curl
@param string $command
@param array $options
@return mixed | [
"Perform",
"a",
"custom",
"request",
"on",
"the",
"phantomjs",
"server",
"using",
"curl"
] | 00cec77eb7228204fda55596dee49ff1a5f14ac5 | https://github.com/OpenBuildings/spiderling/blob/00cec77eb7228204fda55596dee49ff1a5f14ac5/src/Openbuildings/Spiderling/Driver/Phantomjs/Connection.php#L241-L271 |
191,109 | xsanisty/SlimStarter | app/controllers/Admin/AdminController.php | AdminController.login | public function login()
{
if(Sentry::check()){
Response::redirect($this->siteUrl('admin'));
}else{
$this->data['redirect'] = (Input::get('redirect')) ? base64_decode(Input::get('redirect')) : '';
View::display('admin/login.twig', $this->data);
}
} | php | public function login()
{
if(Sentry::check()){
Response::redirect($this->siteUrl('admin'));
}else{
$this->data['redirect'] = (Input::get('redirect')) ? base64_decode(Input::get('redirect')) : '';
View::display('admin/login.twig', $this->data);
}
} | [
"public",
"function",
"login",
"(",
")",
"{",
"if",
"(",
"Sentry",
"::",
"check",
"(",
")",
")",
"{",
"Response",
"::",
"redirect",
"(",
"$",
"this",
"->",
"siteUrl",
"(",
"'admin'",
")",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"data",
"["... | display the login form | [
"display",
"the",
"login",
"form"
] | 3a2d012e8bd3928698f3340de203b9c0155cd853 | https://github.com/xsanisty/SlimStarter/blob/3a2d012e8bd3928698f3340de203b9c0155cd853/app/controllers/Admin/AdminController.php#L25-L33 |
191,110 | xsanisty/SlimStarter | app/controllers/Admin/AdminController.php | AdminController.doLogin | public function doLogin()
{
$remember = Input::post('remember', false);
$email = Input::post('email');
$redirect = Input::post('redirect');
$redirect = ($redirect) ? $redirect : 'admin';
try{
$credential = array(
'email' => $email,
... | php | public function doLogin()
{
$remember = Input::post('remember', false);
$email = Input::post('email');
$redirect = Input::post('redirect');
$redirect = ($redirect) ? $redirect : 'admin';
try{
$credential = array(
'email' => $email,
... | [
"public",
"function",
"doLogin",
"(",
")",
"{",
"$",
"remember",
"=",
"Input",
"::",
"post",
"(",
"'remember'",
",",
"false",
")",
";",
"$",
"email",
"=",
"Input",
"::",
"post",
"(",
"'email'",
")",
";",
"$",
"redirect",
"=",
"Input",
"::",
"post",
... | Process the login | [
"Process",
"the",
"login"
] | 3a2d012e8bd3928698f3340de203b9c0155cd853 | https://github.com/xsanisty/SlimStarter/blob/3a2d012e8bd3928698f3340de203b9c0155cd853/app/controllers/Admin/AdminController.php#L38-L69 |
191,111 | dlnsk/h-rbac | config/exampleClass.php | AuthorizationClass.editOwnPost | public function editOwnPost($user, $post) {
$post = $this->getModel(\App\Post::class, $post); // helper method for geting model
return $user->id === $post->user_id;
} | php | public function editOwnPost($user, $post) {
$post = $this->getModel(\App\Post::class, $post); // helper method for geting model
return $user->id === $post->user_id;
} | [
"public",
"function",
"editOwnPost",
"(",
"$",
"user",
",",
"$",
"post",
")",
"{",
"$",
"post",
"=",
"$",
"this",
"->",
"getModel",
"(",
"\\",
"App",
"\\",
"Post",
"::",
"class",
",",
"$",
"post",
")",
";",
"// helper method for geting model",
"return",
... | Methods which checking permissions.
Methods should be present only if additional checking needs. | [
"Methods",
"which",
"checking",
"permissions",
".",
"Methods",
"should",
"be",
"present",
"only",
"if",
"additional",
"checking",
"needs",
"."
] | 3bed613522adf5d0e7dbdd1ab2ef9388af0b270a | https://github.com/dlnsk/h-rbac/blob/3bed613522adf5d0e7dbdd1ab2ef9388af0b270a/config/exampleClass.php#L49-L53 |
191,112 | Web-Feet/coasterframework | src/Libraries/Blocks/Richtext.php | Richtext.exportFiles | public function exportFiles($content)
{
$uploadFiles = [];
if ($content) {
$dom = new DOMDocument;
libxml_use_internal_errors(true);
$dom->loadHTML($content);
$tags = ['a' => 'href', 'img' => 'src'];
foreach ($tags as $tag => $attri... | php | public function exportFiles($content)
{
$uploadFiles = [];
if ($content) {
$dom = new DOMDocument;
libxml_use_internal_errors(true);
$dom->loadHTML($content);
$tags = ['a' => 'href', 'img' => 'src'];
foreach ($tags as $tag => $attri... | [
"public",
"function",
"exportFiles",
"(",
"$",
"content",
")",
"{",
"$",
"uploadFiles",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"content",
")",
"{",
"$",
"dom",
"=",
"new",
"DOMDocument",
";",
"libxml_use_internal_errors",
"(",
"true",
")",
";",
"$",
"dom"... | Return files for exporting with theme data
@param string $content
@return array | [
"Return",
"files",
"for",
"exporting",
"with",
"theme",
"data"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/Richtext.php#L25-L47 |
191,113 | OpenBuildings/spiderling | src/Openbuildings/Spiderling/Driver/Simple/Xpath.php | Driver_Simple_Xpath.find | public function find($expression, $contextnode = NULL)
{
if ($expression instanceof \DOMNode)
return $expression;
@ $items = $contextnode ? $this->query($expression, $contextnode) : $this->query($expression);
if ( ! $items)
throw new Exception_Xpath('Error in expression: ":expression"', array(':expressio... | php | public function find($expression, $contextnode = NULL)
{
if ($expression instanceof \DOMNode)
return $expression;
@ $items = $contextnode ? $this->query($expression, $contextnode) : $this->query($expression);
if ( ! $items)
throw new Exception_Xpath('Error in expression: ":expression"', array(':expressio... | [
"public",
"function",
"find",
"(",
"$",
"expression",
",",
"$",
"contextnode",
"=",
"NULL",
")",
"{",
"if",
"(",
"$",
"expression",
"instanceof",
"\\",
"DOMNode",
")",
"return",
"$",
"expression",
";",
"@",
"$",
"items",
"=",
"$",
"contextnode",
"?",
"... | Find a DOMElement wit ha given xpath expression, optionally provide parent DOMNode to use as context.
@param string $expression
@param DOMNode $contextnode
@return DOMNode
@throws Exception_Xpath If no elements were found | [
"Find",
"a",
"DOMElement",
"wit",
"ha",
"given",
"xpath",
"expression",
"optionally",
"provide",
"parent",
"DOMNode",
"to",
"use",
"as",
"context",
"."
] | 00cec77eb7228204fda55596dee49ff1a5f14ac5 | https://github.com/OpenBuildings/spiderling/blob/00cec77eb7228204fda55596dee49ff1a5f14ac5/src/Openbuildings/Spiderling/Driver/Simple/Xpath.php#L22-L37 |
191,114 | xsanisty/SlimStarter | src/SlimStarter/Menu/MenuManager.php | MenuManager.render | public function render($menu, $tag = 'ul', $options){
return $this->renderMenu(
$this->menuCollection[$menu],
$tag,
$options,
$this->menuCollection[$menu]->getActiveMenu(),
0
);
} | php | public function render($menu, $tag = 'ul', $options){
return $this->renderMenu(
$this->menuCollection[$menu],
$tag,
$options,
$this->menuCollection[$menu]->getActiveMenu(),
0
);
} | [
"public",
"function",
"render",
"(",
"$",
"menu",
",",
"$",
"tag",
"=",
"'ul'",
",",
"$",
"options",
")",
"{",
"return",
"$",
"this",
"->",
"renderMenu",
"(",
"$",
"this",
"->",
"menuCollection",
"[",
"$",
"menu",
"]",
",",
"$",
"tag",
",",
"$",
... | Render specific menu to html
@param string $menu
@param string $tag
@return String | [
"Render",
"specific",
"menu",
"to",
"html"
] | 3a2d012e8bd3928698f3340de203b9c0155cd853 | https://github.com/xsanisty/SlimStarter/blob/3a2d012e8bd3928698f3340de203b9c0155cd853/src/SlimStarter/Menu/MenuManager.php#L36-L44 |
191,115 | anlutro/php-menu | src/Collection.php | Collection.addItemInstance | public function addItemInstance(Nodes\NodeInterface $item, $location = null)
{
$location = (int) $location;
$this->items[$location][] = $item;
if ($id = $item->getId()) {
$this->ids[$id] = $item;
}
return $item;
} | php | public function addItemInstance(Nodes\NodeInterface $item, $location = null)
{
$location = (int) $location;
$this->items[$location][] = $item;
if ($id = $item->getId()) {
$this->ids[$id] = $item;
}
return $item;
} | [
"public",
"function",
"addItemInstance",
"(",
"Nodes",
"\\",
"NodeInterface",
"$",
"item",
",",
"$",
"location",
"=",
"null",
")",
"{",
"$",
"location",
"=",
"(",
"int",
")",
"$",
"location",
";",
"$",
"this",
"->",
"items",
"[",
"$",
"location",
"]",
... | Add a new node instance to the collection.
@param Nodes\NodeInterface $item
@param int $location
@return Nodes\NodeInterface $item | [
"Add",
"a",
"new",
"node",
"instance",
"to",
"the",
"collection",
"."
] | 4ae76261eb16204a2bc889f5196d5797e587623d | https://github.com/anlutro/php-menu/blob/4ae76261eb16204a2bc889f5196d5797e587623d/src/Collection.php#L98-L109 |
191,116 | anlutro/php-menu | src/Collection.php | Collection.addItem | public function addItem($title, $url, array $attributes = array(), $location = null)
{
return $this->addItemInstance($this->makeItem($title, $url, $attributes), $location);
} | php | public function addItem($title, $url, array $attributes = array(), $location = null)
{
return $this->addItemInstance($this->makeItem($title, $url, $attributes), $location);
} | [
"public",
"function",
"addItem",
"(",
"$",
"title",
",",
"$",
"url",
",",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"location",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"addItemInstance",
"(",
"$",
"this",
"->",
"makeIt... | Add a regular item to the menu collection.
@param string $title
@param string $url
@param array $attributes
@param int $location
@return \anlutro\Menu\Nodes\AnchorNode | [
"Add",
"a",
"regular",
"item",
"to",
"the",
"menu",
"collection",
"."
] | 4ae76261eb16204a2bc889f5196d5797e587623d | https://github.com/anlutro/php-menu/blob/4ae76261eb16204a2bc889f5196d5797e587623d/src/Collection.php#L121-L124 |
191,117 | anlutro/php-menu | src/Collection.php | Collection.addSubmenu | public function addSubmenu($title, array $attributes = array(), $location = null)
{
return $this->addItemInstance($this->makeSubmenu($title, $attributes), $location);
} | php | public function addSubmenu($title, array $attributes = array(), $location = null)
{
return $this->addItemInstance($this->makeSubmenu($title, $attributes), $location);
} | [
"public",
"function",
"addSubmenu",
"(",
"$",
"title",
",",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"location",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"addItemInstance",
"(",
"$",
"this",
"->",
"makeSubmenu",
"(",
"$"... | Add a submenu to the menu collection.
@param string $title
@param array $attributes
@param int $location
@return \anlutro\Menu\Nodes\SubmenuNode | [
"Add",
"a",
"submenu",
"to",
"the",
"menu",
"collection",
"."
] | 4ae76261eb16204a2bc889f5196d5797e587623d | https://github.com/anlutro/php-menu/blob/4ae76261eb16204a2bc889f5196d5797e587623d/src/Collection.php#L149-L152 |
191,118 | anlutro/php-menu | src/Collection.php | Collection.makeSubmenu | public function makeSubmenu($title, array $attributes = array())
{
$collection = new static($this->builder, ['id' => StringUtils::slug($title)]);
return new Nodes\SubmenuNode($title, $collection, $attributes);
} | php | public function makeSubmenu($title, array $attributes = array())
{
$collection = new static($this->builder, ['id' => StringUtils::slug($title)]);
return new Nodes\SubmenuNode($title, $collection, $attributes);
} | [
"public",
"function",
"makeSubmenu",
"(",
"$",
"title",
",",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
")",
"{",
"$",
"collection",
"=",
"new",
"static",
"(",
"$",
"this",
"->",
"builder",
",",
"[",
"'id'",
"=>",
"StringUtils",
"::",
"slug",
... | Make a new submenu item instance.
@param string $title
@param array $attributes
@return \anlutro\Menu\Nodes\SubmenuNode | [
"Make",
"a",
"new",
"submenu",
"item",
"instance",
"."
] | 4ae76261eb16204a2bc889f5196d5797e587623d | https://github.com/anlutro/php-menu/blob/4ae76261eb16204a2bc889f5196d5797e587623d/src/Collection.php#L162-L167 |
191,119 | anlutro/php-menu | src/Collection.php | Collection.addDivider | public function addDivider($location = null)
{
$node = new Nodes\DividerNode('divider-'.(++$this->dividerCount));
$this->addItemInstance($node, $location);
} | php | public function addDivider($location = null)
{
$node = new Nodes\DividerNode('divider-'.(++$this->dividerCount));
$this->addItemInstance($node, $location);
} | [
"public",
"function",
"addDivider",
"(",
"$",
"location",
"=",
"null",
")",
"{",
"$",
"node",
"=",
"new",
"Nodes",
"\\",
"DividerNode",
"(",
"'divider-'",
".",
"(",
"++",
"$",
"this",
"->",
"dividerCount",
")",
")",
";",
"$",
"this",
"->",
"addItemInst... | Add a divider to the items.
@param int $location | [
"Add",
"a",
"divider",
"to",
"the",
"items",
"."
] | 4ae76261eb16204a2bc889f5196d5797e587623d | https://github.com/anlutro/php-menu/blob/4ae76261eb16204a2bc889f5196d5797e587623d/src/Collection.php#L174-L179 |
191,120 | anlutro/php-menu | src/Collection.php | Collection.getItem | public function getItem($id)
{
return array_key_exists($id, $this->ids) ? $this->ids[$id] : null;
} | php | public function getItem($id)
{
return array_key_exists($id, $this->ids) ? $this->ids[$id] : null;
} | [
"public",
"function",
"getItem",
"(",
"$",
"id",
")",
"{",
"return",
"array_key_exists",
"(",
"$",
"id",
",",
"$",
"this",
"->",
"ids",
")",
"?",
"$",
"this",
"->",
"ids",
"[",
"$",
"id",
"]",
":",
"null",
";",
"}"
] | Get an item from the collection.
@param string $id
@return \anlutro\Menu\Nodes\NodeInterface|null | [
"Get",
"an",
"item",
"from",
"the",
"collection",
"."
] | 4ae76261eb16204a2bc889f5196d5797e587623d | https://github.com/anlutro/php-menu/blob/4ae76261eb16204a2bc889f5196d5797e587623d/src/Collection.php#L188-L191 |
191,121 | anlutro/php-menu | src/Collection.php | Collection.removeItem | public function removeItem($id)
{
if (!array_key_exists($id, $this->ids)) {
return false;
}
$item = $this->ids[$id];
unset($this->ids[$id]);
foreach ($this->items as $k1 => $v1) {
foreach ($v1 as $k2 => $v2) {
if ($item === $v2) {
unset($this->items[$k1][$k2]);
}
}
}
} | php | public function removeItem($id)
{
if (!array_key_exists($id, $this->ids)) {
return false;
}
$item = $this->ids[$id];
unset($this->ids[$id]);
foreach ($this->items as $k1 => $v1) {
foreach ($v1 as $k2 => $v2) {
if ($item === $v2) {
unset($this->items[$k1][$k2]);
}
}
}
} | [
"public",
"function",
"removeItem",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"id",
",",
"$",
"this",
"->",
"ids",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"item",
"=",
"$",
"this",
"->",
"ids",
"[",
"$",
"... | Remove an item from the collection.
@param string $id
@return boolean | [
"Remove",
"an",
"item",
"from",
"the",
"collection",
"."
] | 4ae76261eb16204a2bc889f5196d5797e587623d | https://github.com/anlutro/php-menu/blob/4ae76261eb16204a2bc889f5196d5797e587623d/src/Collection.php#L200-L216 |
191,122 | Web-Feet/coasterframework | src/Models/PageBlock.php | PageBlock.preloadPageBlock | public static function preloadPageBlock($pageId, $blockId, $version = 0, $preloadBy = 'page_id')
{
($preloadBy == 'page_id') ? static::_preloadDataByPage($pageId, $version) : static::_preloadDataByBlock($blockId, $version);
return static::_preloadGet('byVersionPage', [$version, $pageId, $blockId]... | php | public static function preloadPageBlock($pageId, $blockId, $version = 0, $preloadBy = 'page_id')
{
($preloadBy == 'page_id') ? static::_preloadDataByPage($pageId, $version) : static::_preloadDataByBlock($blockId, $version);
return static::_preloadGet('byVersionPage', [$version, $pageId, $blockId]... | [
"public",
"static",
"function",
"preloadPageBlock",
"(",
"$",
"pageId",
",",
"$",
"blockId",
",",
"$",
"version",
"=",
"0",
",",
"$",
"preloadBy",
"=",
"'page_id'",
")",
"{",
"(",
"$",
"preloadBy",
"==",
"'page_id'",
")",
"?",
"static",
"::",
"_preloadDa... | Load all page block data for block on page,
@param $pageId
@param $blockId
@param int $version
@param string $preloadBy
@return PageBlock[] array key is language_id | [
"Load",
"all",
"page",
"block",
"data",
"for",
"block",
"on",
"page"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Models/PageBlock.php#L80-L84 |
191,123 | Web-Feet/coasterframework | src/Models/PageBlock.php | PageBlock.preloadPageBlockLanguage | public static function preloadPageBlockLanguage($pageId, $blockId, $version = 0, $preloadBy = 'page_id')
{
($preloadBy == 'page_id') ? static::_preloadDataByPage($pageId, $version) : static::_preloadDataByBlock($blockId, $version);
return static::_preloadGet('byVersionPage', [$version, $pageId, $... | php | public static function preloadPageBlockLanguage($pageId, $blockId, $version = 0, $preloadBy = 'page_id')
{
($preloadBy == 'page_id') ? static::_preloadDataByPage($pageId, $version) : static::_preloadDataByBlock($blockId, $version);
return static::_preloadGet('byVersionPage', [$version, $pageId, $... | [
"public",
"static",
"function",
"preloadPageBlockLanguage",
"(",
"$",
"pageId",
",",
"$",
"blockId",
",",
"$",
"version",
"=",
"0",
",",
"$",
"preloadBy",
"=",
"'page_id'",
")",
"{",
"(",
"$",
"preloadBy",
"==",
"'page_id'",
")",
"?",
"static",
"::",
"_p... | Load page block data for block on page in current language
@param $pageId
@param $blockId
@param int $version
@param string $preloadBy
@return static | [
"Load",
"page",
"block",
"data",
"for",
"block",
"on",
"page",
"in",
"current",
"language"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Models/PageBlock.php#L94-L98 |
191,124 | Web-Feet/coasterframework | src/Models/PageBlock.php | PageBlock.livePageBlocksForBlock | public static function livePageBlocksForBlock($blockId, $reload = false)
{
if ($reload) {
static::_preloadClear('liveBlocks');
}
if (!static::_preloadIsset('liveBlocks', $blockId)) {
$pageBlocks = Block::getDataForVersion(new static, -1, ['block_id' => $blockId,... | php | public static function livePageBlocksForBlock($blockId, $reload = false)
{
if ($reload) {
static::_preloadClear('liveBlocks');
}
if (!static::_preloadIsset('liveBlocks', $blockId)) {
$pageBlocks = Block::getDataForVersion(new static, -1, ['block_id' => $blockId,... | [
"public",
"static",
"function",
"livePageBlocksForBlock",
"(",
"$",
"blockId",
",",
"$",
"reload",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"reload",
")",
"{",
"static",
"::",
"_preloadClear",
"(",
"'liveBlocks'",
")",
";",
"}",
"if",
"(",
"!",
"static",
... | Load page block data for all live versions of a block across all pages
@param int $blockId
@param bool $reload
@return PageBlock[] | [
"Load",
"page",
"block",
"data",
"for",
"all",
"live",
"versions",
"of",
"a",
"block",
"across",
"all",
"pages"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Models/PageBlock.php#L148-L158 |
191,125 | Web-Feet/coasterframework | src/Libraries/Blocks/Selectwprice.php | Selectwprice._defaultData | protected function _defaultData($content)
{
$content = @unserialize($content);
if (empty($content) || !is_a($content, \stdClass::class)) {
$content = new \stdClass;
}
$content->selected = isset($content->selected) ? $content->selected : '';
$content->price ... | php | protected function _defaultData($content)
{
$content = @unserialize($content);
if (empty($content) || !is_a($content, \stdClass::class)) {
$content = new \stdClass;
}
$content->selected = isset($content->selected) ? $content->selected : '';
$content->price ... | [
"protected",
"function",
"_defaultData",
"(",
"$",
"content",
")",
"{",
"$",
"content",
"=",
"@",
"unserialize",
"(",
"$",
"content",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"content",
")",
"||",
"!",
"is_a",
"(",
"$",
"content",
",",
"\\",
"stdClass... | Get valid selectwprice data
@param $content
@return \stdClass | [
"Get",
"valid",
"selectwprice",
"data"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/Selectwprice.php#L67-L76 |
191,126 | Web-Feet/coasterframework | src/Libraries/Blocks/Selectwprice.php | Selectwprice.generateSearchText | public function generateSearchText($content)
{
$content = $this->_defaultData($content);
$searchText = $this->_generateSearchText($content->selected, $content->price);
return parent::generateSearchText($searchText);
} | php | public function generateSearchText($content)
{
$content = $this->_defaultData($content);
$searchText = $this->_generateSearchText($content->selected, $content->price);
return parent::generateSearchText($searchText);
} | [
"public",
"function",
"generateSearchText",
"(",
"$",
"content",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"_defaultData",
"(",
"$",
"content",
")",
";",
"$",
"searchText",
"=",
"$",
"this",
"->",
"_generateSearchText",
"(",
"$",
"content",
"->",
... | Add select option and price data to search
@param null|string $content
@return null|string | [
"Add",
"select",
"option",
"and",
"price",
"data",
"to",
"search"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/Selectwprice.php#L83-L88 |
191,127 | TimeIncOSS/swagger-bundle | src/Analyser/ClassAnalyser.php | ClassAnalyser.analyse | public function analyse($file, array &$classes = [])
{
$tokens = token_get_all(file_get_contents($file));
$namespace = '';
$buildingNs = false;
$buildingClass = false;
foreach ($tokens as $token) {
if ($token[0] == T_NAMESPACE) {
$buildingNs = tru... | php | public function analyse($file, array &$classes = [])
{
$tokens = token_get_all(file_get_contents($file));
$namespace = '';
$buildingNs = false;
$buildingClass = false;
foreach ($tokens as $token) {
if ($token[0] == T_NAMESPACE) {
$buildingNs = tru... | [
"public",
"function",
"analyse",
"(",
"$",
"file",
",",
"array",
"&",
"$",
"classes",
"=",
"[",
"]",
")",
"{",
"$",
"tokens",
"=",
"token_get_all",
"(",
"file_get_contents",
"(",
"$",
"file",
")",
")",
";",
"$",
"namespace",
"=",
"''",
";",
"$",
"b... | Given a file name, search and extract all class names in the file.
@param string $file File to search in
@param array $classes Array to append classes to
@return array Array of all class names | [
"Given",
"a",
"file",
"name",
"search",
"and",
"extract",
"all",
"class",
"names",
"in",
"the",
"file",
"."
] | d1179aef505ae330c15ff2871bffef5fb2e285e2 | https://github.com/TimeIncOSS/swagger-bundle/blob/d1179aef505ae330c15ff2871bffef5fb2e285e2/src/Analyser/ClassAnalyser.php#L22-L59 |
191,128 | TimeIncOSS/swagger-bundle | src/Analyser/ClassAnalyser.php | ClassAnalyser.analysePaths | public function analysePaths(Finder $finder)
{
$classes = [];
foreach ($finder as $file) {
$this->analyse($file, $classes);
}
return $classes;
} | php | public function analysePaths(Finder $finder)
{
$classes = [];
foreach ($finder as $file) {
$this->analyse($file, $classes);
}
return $classes;
} | [
"public",
"function",
"analysePaths",
"(",
"Finder",
"$",
"finder",
")",
"{",
"$",
"classes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"finder",
"as",
"$",
"file",
")",
"{",
"$",
"this",
"->",
"analyse",
"(",
"$",
"file",
",",
"$",
"classes",
")",
... | Find all class names by a finder instance.
@param Finder $finder
@return array | [
"Find",
"all",
"class",
"names",
"by",
"a",
"finder",
"instance",
"."
] | d1179aef505ae330c15ff2871bffef5fb2e285e2 | https://github.com/TimeIncOSS/swagger-bundle/blob/d1179aef505ae330c15ff2871bffef5fb2e285e2/src/Analyser/ClassAnalyser.php#L68-L76 |
191,129 | xsanisty/SlimStarter | app/modules/UserGroup/Controllers/UserController.php | UserController.index | public function index($page = 1)
{
$user = Sentry::getUser();
$this->data['title'] = 'Users List';
$this->data['users'] = User::where('id', '<>', $user->id)
->get()
->toArray();
/** load the user.js app */
$this->... | php | public function index($page = 1)
{
$user = Sentry::getUser();
$this->data['title'] = 'Users List';
$this->data['users'] = User::where('id', '<>', $user->id)
->get()
->toArray();
/** load the user.js app */
$this->... | [
"public",
"function",
"index",
"(",
"$",
"page",
"=",
"1",
")",
"{",
"$",
"user",
"=",
"Sentry",
"::",
"getUser",
"(",
")",
";",
"$",
"this",
"->",
"data",
"[",
"'title'",
"]",
"=",
"'Users List'",
";",
"$",
"this",
"->",
"data",
"[",
"'users'",
... | display list of resource | [
"display",
"list",
"of",
"resource"
] | 3a2d012e8bd3928698f3340de203b9c0155cd853 | https://github.com/xsanisty/SlimStarter/blob/3a2d012e8bd3928698f3340de203b9c0155cd853/app/modules/UserGroup/Controllers/UserController.php#L29-L45 |
191,130 | xsanisty/SlimStarter | app/modules/UserGroup/Controllers/UserController.php | UserController.show | public function show($id)
{
if(Request::isAjax()){
$user = null;
$message = '';
try{
$user = Sentry::findUserById($id);
}catch(Exception $e){
$message = $e->getMessage();
}
Response::headers()->set('Co... | php | public function show($id)
{
if(Request::isAjax()){
$user = null;
$message = '';
try{
$user = Sentry::findUserById($id);
}catch(Exception $e){
$message = $e->getMessage();
}
Response::headers()->set('Co... | [
"public",
"function",
"show",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"Request",
"::",
"isAjax",
"(",
")",
")",
"{",
"$",
"user",
"=",
"null",
";",
"$",
"message",
"=",
"''",
";",
"try",
"{",
"$",
"user",
"=",
"Sentry",
"::",
"findUserById",
"(",
... | display resource with specific id | [
"display",
"resource",
"with",
"specific",
"id"
] | 3a2d012e8bd3928698f3340de203b9c0155cd853 | https://github.com/xsanisty/SlimStarter/blob/3a2d012e8bd3928698f3340de203b9c0155cd853/app/modules/UserGroup/Controllers/UserController.php#L50-L75 |
191,131 | xsanisty/SlimStarter | app/modules/UserGroup/Controllers/UserController.php | UserController.edit | public function edit($id)
{
try{
$user = Sentry::findUserById($id);
//display edit form in non-ajax request
//
$this->data['title'] = 'Edit User';
$this->data['user'] = $user->toArray();
View::display('@usergroup/user/edit.twig', $this... | php | public function edit($id)
{
try{
$user = Sentry::findUserById($id);
//display edit form in non-ajax request
//
$this->data['title'] = 'Edit User';
$this->data['user'] = $user->toArray();
View::display('@usergroup/user/edit.twig', $this... | [
"public",
"function",
"edit",
"(",
"$",
"id",
")",
"{",
"try",
"{",
"$",
"user",
"=",
"Sentry",
"::",
"findUserById",
"(",
"$",
"id",
")",
";",
"//display edit form in non-ajax request",
"//",
"$",
"this",
"->",
"data",
"[",
"'title'",
"]",
"=",
"'Edit U... | show edit from resource with specific id | [
"show",
"edit",
"from",
"resource",
"with",
"specific",
"id"
] | 3a2d012e8bd3928698f3340de203b9c0155cd853 | https://github.com/xsanisty/SlimStarter/blob/3a2d012e8bd3928698f3340de203b9c0155cd853/app/modules/UserGroup/Controllers/UserController.php#L80-L96 |
191,132 | xsanisty/SlimStarter | app/modules/UserGroup/Controllers/UserController.php | UserController.update | public function update($id)
{
$success = false;
$message = '';
$user = null;
$code = 0;
try{
$input = Input::put();
/** in case request come from post http form */
$input = is_null($input) ? Input::post() : $input;
if($i... | php | public function update($id)
{
$success = false;
$message = '';
$user = null;
$code = 0;
try{
$input = Input::put();
/** in case request come from post http form */
$input = is_null($input) ? Input::post() : $input;
if($i... | [
"public",
"function",
"update",
"(",
"$",
"id",
")",
"{",
"$",
"success",
"=",
"false",
";",
"$",
"message",
"=",
"''",
";",
"$",
"user",
"=",
"null",
";",
"$",
"code",
"=",
"0",
";",
"try",
"{",
"$",
"input",
"=",
"Input",
"::",
"put",
"(",
... | update resource with specific id | [
"update",
"resource",
"with",
"specific",
"id"
] | 3a2d012e8bd3928698f3340de203b9c0155cd853 | https://github.com/xsanisty/SlimStarter/blob/3a2d012e8bd3928698f3340de203b9c0155cd853/app/modules/UserGroup/Controllers/UserController.php#L101-L151 |
191,133 | xsanisty/SlimStarter | app/modules/UserGroup/Controllers/UserController.php | UserController.store | public function store()
{
$user = null;
$message = '';
$success = false;
try{
$input = Input::post();
if($input['password'] != $input['confirm_password']){
throw new Exception("Password and confirmation password not match", 1);
... | php | public function store()
{
$user = null;
$message = '';
$success = false;
try{
$input = Input::post();
if($input['password'] != $input['confirm_password']){
throw new Exception("Password and confirmation password not match", 1);
... | [
"public",
"function",
"store",
"(",
")",
"{",
"$",
"user",
"=",
"null",
";",
"$",
"message",
"=",
"''",
";",
"$",
"success",
"=",
"false",
";",
"try",
"{",
"$",
"input",
"=",
"Input",
"::",
"post",
"(",
")",
";",
"if",
"(",
"$",
"input",
"[",
... | create new resource | [
"create",
"new",
"resource"
] | 3a2d012e8bd3928698f3340de203b9c0155cd853 | https://github.com/xsanisty/SlimStarter/blob/3a2d012e8bd3928698f3340de203b9c0155cd853/app/modules/UserGroup/Controllers/UserController.php#L156-L196 |
191,134 | xsanisty/SlimStarter | app/modules/UserGroup/Controllers/UserController.php | UserController.destroy | public function destroy($id)
{
$id = (int) $id;
$deleted = false;
$message = '';
$code = 0;
try{
$user = Sentry::findUserById($id);
$deleted = $user->delete();
$code = 200;
}catch(UserNotFoundException $e){
... | php | public function destroy($id)
{
$id = (int) $id;
$deleted = false;
$message = '';
$code = 0;
try{
$user = Sentry::findUserById($id);
$deleted = $user->delete();
$code = 200;
}catch(UserNotFoundException $e){
... | [
"public",
"function",
"destroy",
"(",
"$",
"id",
")",
"{",
"$",
"id",
"=",
"(",
"int",
")",
"$",
"id",
";",
"$",
"deleted",
"=",
"false",
";",
"$",
"message",
"=",
"''",
";",
"$",
"code",
"=",
"0",
";",
"try",
"{",
"$",
"user",
"=",
"Sentry",... | destroy resource with specific id | [
"destroy",
"resource",
"with",
"specific",
"id"
] | 3a2d012e8bd3928698f3340de203b9c0155cd853 | https://github.com/xsanisty/SlimStarter/blob/3a2d012e8bd3928698f3340de203b9c0155cd853/app/modules/UserGroup/Controllers/UserController.php#L201-L233 |
191,135 | Web-Feet/coasterframework | src/Libraries/Blocks/Selectmultiple.php | Selectmultiple.generateSearchText | public function generateSearchText($content)
{
$content = @unserialize($content) ?: [];
$searchText = $this->_generateSearchText(...$content);
return parent::generateSearchText($searchText);
} | php | public function generateSearchText($content)
{
$content = @unserialize($content) ?: [];
$searchText = $this->_generateSearchText(...$content);
return parent::generateSearchText($searchText);
} | [
"public",
"function",
"generateSearchText",
"(",
"$",
"content",
")",
"{",
"$",
"content",
"=",
"@",
"unserialize",
"(",
"$",
"content",
")",
"?",
":",
"[",
"]",
";",
"$",
"searchText",
"=",
"$",
"this",
"->",
"_generateSearchText",
"(",
"...",
"$",
"c... | Unserialize string before generating search text
@param null|string $content
@return null|string | [
"Unserialize",
"string",
"before",
"generating",
"search",
"text"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/Selectmultiple.php#L52-L57 |
191,136 | Web-Feet/coasterframework | src/Libraries/Blocks/Selectmultiple.php | Selectmultiple.filter | public function filter($content, $search, $type)
{
$items = !empty($content) ? unserialize($content) : [];
switch ($type) {
case 'in':
foreach ($items as $item) {
if (strpos($item, $search) !== false) {
return true;
... | php | public function filter($content, $search, $type)
{
$items = !empty($content) ? unserialize($content) : [];
switch ($type) {
case 'in':
foreach ($items as $item) {
if (strpos($item, $search) !== false) {
return true;
... | [
"public",
"function",
"filter",
"(",
"$",
"content",
",",
"$",
"search",
",",
"$",
"type",
")",
"{",
"$",
"items",
"=",
"!",
"empty",
"(",
"$",
"content",
")",
"?",
"unserialize",
"(",
"$",
"content",
")",
":",
"[",
"]",
";",
"switch",
"(",
"$",
... | Filter in now an array search
@param string $content
@param string $search
@param string $type
@return bool | [
"Filter",
"in",
"now",
"an",
"array",
"search"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/Selectmultiple.php#L76-L91 |
191,137 | Web-Feet/coasterframework | src/Libraries/Builder/MenuTree.php | MenuTree.getFlatSubItems | public function getFlatSubItems()
{
$key = $this->getKey();
$itemIds = Arr::get($this->_tree, $key);
$flatItemIds = $this->_dot($itemIds, $key ? $key . '.' : '');
$items = [];
foreach ($flatItemIds as $itemId => $value) {
$items[$itemId] = $this->_itemData[$itemId... | php | public function getFlatSubItems()
{
$key = $this->getKey();
$itemIds = Arr::get($this->_tree, $key);
$flatItemIds = $this->_dot($itemIds, $key ? $key . '.' : '');
$items = [];
foreach ($flatItemIds as $itemId => $value) {
$items[$itemId] = $this->_itemData[$itemId... | [
"public",
"function",
"getFlatSubItems",
"(",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getKey",
"(",
")",
";",
"$",
"itemIds",
"=",
"Arr",
"::",
"get",
"(",
"$",
"this",
"->",
"_tree",
",",
"$",
"key",
")",
";",
"$",
"flatItemIds",
"=",
"$"... | Recursive and flatten
@return array|mixed | [
"Recursive",
"and",
"flatten"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Builder/MenuTree.php#L124-L134 |
191,138 | Web-Feet/coasterframework | src/Models/Page.php | Page.getOrderedPages | public static function getOrderedPages($pageIds)
{
$pages = [];
foreach ($pageIds as $pageId) {
$pages[$pageId] = static::preload($pageId);
}
uasort($pages, ['self', '_orderAsc']);
return $pages;
} | php | public static function getOrderedPages($pageIds)
{
$pages = [];
foreach ($pageIds as $pageId) {
$pages[$pageId] = static::preload($pageId);
}
uasort($pages, ['self', '_orderAsc']);
return $pages;
} | [
"public",
"static",
"function",
"getOrderedPages",
"(",
"$",
"pageIds",
")",
"{",
"$",
"pages",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"pageIds",
"as",
"$",
"pageId",
")",
"{",
"$",
"pages",
"[",
"$",
"pageId",
"]",
"=",
"static",
"::",
"preload",
... | returns ordered pages | [
"returns",
"ordered",
"pages"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Models/Page.php#L171-L179 |
191,139 | Web-Feet/coasterframework | src/Libraries/Blocks/Image.php | Image.display | public function display($content, $options = [])
{
$imageData = $this->_defaultData($content);
if (empty($imageData->file)) {
return '';
}
if (empty($imageData->title)) {
if (empty($options['title'])) {
$fileName = substr(strrchr($i... | php | public function display($content, $options = [])
{
$imageData = $this->_defaultData($content);
if (empty($imageData->file)) {
return '';
}
if (empty($imageData->title)) {
if (empty($options['title'])) {
$fileName = substr(strrchr($i... | [
"public",
"function",
"display",
"(",
"$",
"content",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"imageData",
"=",
"$",
"this",
"->",
"_defaultData",
"(",
"$",
"content",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"imageData",
"->",
"file",
")... | Display image, image can be cropped with croppa
@param string $content
@param array $options
@return string | [
"Display",
"image",
"image",
"can",
"be",
"cropped",
"with",
"croppa"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/Image.php#L31-L69 |
191,140 | Web-Feet/coasterframework | src/Libraries/Blocks/Image.php | Image.edit | public function edit($content)
{
$imageData = $this->_defaultData($content);
$imageData->file = str_replace(URL::to('/'), '', $imageData->file);
return parent::edit($imageData);
} | php | public function edit($content)
{
$imageData = $this->_defaultData($content);
$imageData->file = str_replace(URL::to('/'), '', $imageData->file);
return parent::edit($imageData);
} | [
"public",
"function",
"edit",
"(",
"$",
"content",
")",
"{",
"$",
"imageData",
"=",
"$",
"this",
"->",
"_defaultData",
"(",
"$",
"content",
")",
";",
"$",
"imageData",
"->",
"file",
"=",
"str_replace",
"(",
"URL",
"::",
"to",
"(",
"'/'",
")",
",",
... | Load image block data with domain relative paths
@param string $content
@return string | [
"Load",
"image",
"block",
"data",
"with",
"domain",
"relative",
"paths"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/Image.php#L90-L95 |
191,141 | Web-Feet/coasterframework | src/Libraries/Blocks/Image.php | Image.submit | public function submit($postContent)
{
if (!empty($postContent['alt']) || !empty($postContent['source'])) {
$imageData = $this->_defaultData('');
$imageData->title = !empty($postContent['alt']) ? $postContent['alt'] : '';
$imageData->file = !empty($postContent['sourc... | php | public function submit($postContent)
{
if (!empty($postContent['alt']) || !empty($postContent['source'])) {
$imageData = $this->_defaultData('');
$imageData->title = !empty($postContent['alt']) ? $postContent['alt'] : '';
$imageData->file = !empty($postContent['sourc... | [
"public",
"function",
"submit",
"(",
"$",
"postContent",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"postContent",
"[",
"'alt'",
"]",
")",
"||",
"!",
"empty",
"(",
"$",
"postContent",
"[",
"'source'",
"]",
")",
")",
"{",
"$",
"imageData",
"=",
"$... | Save image block data
@param array $postContent
@return static | [
"Save",
"image",
"block",
"data"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/Image.php#L102-L112 |
191,142 | Web-Feet/coasterframework | src/Libraries/Blocks/Image.php | Image.generateSearchText | public function generateSearchText($content)
{
$content = $this->_defaultData($content);
$searchText = $this->_generateSearchText($content->title, basename($content->file));
return parent::generateSearchText($searchText);
} | php | public function generateSearchText($content)
{
$content = $this->_defaultData($content);
$searchText = $this->_generateSearchText($content->title, basename($content->file));
return parent::generateSearchText($searchText);
} | [
"public",
"function",
"generateSearchText",
"(",
"$",
"content",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"_defaultData",
"(",
"$",
"content",
")",
";",
"$",
"searchText",
"=",
"$",
"this",
"->",
"_generateSearchText",
"(",
"$",
"content",
"->",
... | Add image filename and image title data to search
@param null|string $content
@return null|string | [
"Add",
"image",
"filename",
"and",
"image",
"title",
"data",
"to",
"search"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/Image.php#L119-L124 |
191,143 | Web-Feet/coasterframework | src/Libraries/Blocks/Image.php | Image._defaultData | protected function _defaultData($content)
{
$content = @unserialize($content);
if (empty($content) || !is_a($content, \stdClass::class)) {
$content = new \stdClass;
}
$content->file = empty($content->file) ? '' : $content->file;
$content->title = empty($con... | php | protected function _defaultData($content)
{
$content = @unserialize($content);
if (empty($content) || !is_a($content, \stdClass::class)) {
$content = new \stdClass;
}
$content->file = empty($content->file) ? '' : $content->file;
$content->title = empty($con... | [
"protected",
"function",
"_defaultData",
"(",
"$",
"content",
")",
"{",
"$",
"content",
"=",
"@",
"unserialize",
"(",
"$",
"content",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"content",
")",
"||",
"!",
"is_a",
"(",
"$",
"content",
",",
"\\",
"stdClass... | Return valid image data
@param $content
@return \stdClass | [
"Return",
"valid",
"image",
"data"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/Image.php#L131-L140 |
191,144 | Web-Feet/coasterframework | src/Libraries/Blocks/Image.php | Image.exportFiles | public function exportFiles($content)
{
$content = $this->_defaultData($content);
if ($content->file && (strpos($content->file, '/') === 0 || strpos($content->file, URL::to('/')) === 0)) {
return [str_replace(URL::to('/'), '', $content->file)];
} else {
return [... | php | public function exportFiles($content)
{
$content = $this->_defaultData($content);
if ($content->file && (strpos($content->file, '/') === 0 || strpos($content->file, URL::to('/')) === 0)) {
return [str_replace(URL::to('/'), '', $content->file)];
} else {
return [... | [
"public",
"function",
"exportFiles",
"(",
"$",
"content",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"_defaultData",
"(",
"$",
"content",
")",
";",
"if",
"(",
"$",
"content",
"->",
"file",
"&&",
"(",
"strpos",
"(",
"$",
"content",
"->",
"file"... | Return image file for exporting with theme data
@param string $content
@return array | [
"Return",
"image",
"file",
"for",
"exporting",
"with",
"theme",
"data"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/Image.php#L147-L155 |
191,145 | Web-Feet/coasterframework | src/Libraries/Blocks/AbstractBlock.php | AbstractBlock.displayView | public function displayView($view = '', $suffix = '')
{
$viewTag = $view . ($suffix ? '#' . $suffix : '');
if (!array_key_exists($viewTag, $this->_displayViewCache)) {
$this->_displayViewCache[$viewTag] = '';
$viewRootPath = 'themes.' . PageBuilder::getData('theme') . '.bloc... | php | public function displayView($view = '', $suffix = '')
{
$viewTag = $view . ($suffix ? '#' . $suffix : '');
if (!array_key_exists($viewTag, $this->_displayViewCache)) {
$this->_displayViewCache[$viewTag] = '';
$viewRootPath = 'themes.' . PageBuilder::getData('theme') . '.bloc... | [
"public",
"function",
"displayView",
"(",
"$",
"view",
"=",
"''",
",",
"$",
"suffix",
"=",
"''",
")",
"{",
"$",
"viewTag",
"=",
"$",
"view",
".",
"(",
"$",
"suffix",
"?",
"'#'",
".",
"$",
"suffix",
":",
"''",
")",
";",
"if",
"(",
"!",
"array_ke... | Return display block view path
@param string $view
@param string $suffix
@return string | [
"Return",
"display",
"block",
"view",
"path"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/AbstractBlock.php#L126-L144 |
191,146 | Web-Feet/coasterframework | src/Libraries/Blocks/AbstractBlock.php | AbstractBlock._renderDisplayView | protected function _renderDisplayView($options, $data = [], $returnRaw = false)
{
if (array_key_exists('repeated_view', $options) && $options['repeated_view']) {
return $this->_renderRepeatedDisplayView($options, $data);
} elseif ($displayView = $this->displayViewOptions($options)) {
... | php | protected function _renderDisplayView($options, $data = [], $returnRaw = false)
{
if (array_key_exists('repeated_view', $options) && $options['repeated_view']) {
return $this->_renderRepeatedDisplayView($options, $data);
} elseif ($displayView = $this->displayViewOptions($options)) {
... | [
"protected",
"function",
"_renderDisplayView",
"(",
"$",
"options",
",",
"$",
"data",
"=",
"[",
"]",
",",
"$",
"returnRaw",
"=",
"false",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'repeated_view'",
",",
"$",
"options",
")",
"&&",
"$",
"options",
"["... | Return rendered display block view
@param array $options
@param array $data
@param bool $returnRaw
@return string | [
"Return",
"rendered",
"display",
"block",
"view"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/AbstractBlock.php#L164-L177 |
191,147 | Web-Feet/coasterframework | src/Libraries/Blocks/AbstractBlock.php | AbstractBlock.edit | public function edit($content)
{
$dotName = str_replace(['[', ']'], ['.', ''], $this->_getInputHTMLKey());
$submittedData = Request::input($dotName);
return CmsBlockInput::make($this->_block->type, $this->_editViewData + [
'label' => $this->_block->label,
'nam... | php | public function edit($content)
{
$dotName = str_replace(['[', ']'], ['.', ''], $this->_getInputHTMLKey());
$submittedData = Request::input($dotName);
return CmsBlockInput::make($this->_block->type, $this->_editViewData + [
'label' => $this->_block->label,
'nam... | [
"public",
"function",
"edit",
"(",
"$",
"content",
")",
"{",
"$",
"dotName",
"=",
"str_replace",
"(",
"[",
"'['",
",",
"']'",
"]",
",",
"[",
"'.'",
",",
"''",
"]",
",",
"$",
"this",
"->",
"_getInputHTMLKey",
"(",
")",
")",
";",
"$",
"submittedData"... | Admin display for the block
@param string $content
@return string | [
"Admin",
"display",
"for",
"the",
"block"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/AbstractBlock.php#L262-L275 |
191,148 | Web-Feet/coasterframework | src/Libraries/Blocks/AbstractBlock.php | AbstractBlock._getInputHTMLKey | protected function _getInputHTMLKey($altKey = '')
{
if ($this->_block->getRepeaterId() && $this->_block->getRepeaterRowId()) {
$inputHTMLKey = 'repeater[' . $this->_block->getRepeaterId() . '][' . $this->_block->getRepeaterRowId() . ']';
} else {
$inputHTMLKey = 'block';
... | php | protected function _getInputHTMLKey($altKey = '')
{
if ($this->_block->getRepeaterId() && $this->_block->getRepeaterRowId()) {
$inputHTMLKey = 'repeater[' . $this->_block->getRepeaterId() . '][' . $this->_block->getRepeaterRowId() . ']';
} else {
$inputHTMLKey = 'block';
... | [
"protected",
"function",
"_getInputHTMLKey",
"(",
"$",
"altKey",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_block",
"->",
"getRepeaterId",
"(",
")",
"&&",
"$",
"this",
"->",
"_block",
"->",
"getRepeaterRowId",
"(",
")",
")",
"{",
"$",
"inputH... | Create the html key to be used in the block view
@param string $altKey
@return string | [
"Create",
"the",
"html",
"key",
"to",
"be",
"used",
"in",
"the",
"block",
"view"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/AbstractBlock.php#L282-L290 |
191,149 | Web-Feet/coasterframework | src/Libraries/Blocks/AbstractBlock.php | AbstractBlock.save | public function save($content)
{
$this->_isSaved = true;
$this->_contentSaved = (string) $content;
$this->_block->updateContent($this->_contentSaved);
return $this;
} | php | public function save($content)
{
$this->_isSaved = true;
$this->_contentSaved = (string) $content;
$this->_block->updateContent($this->_contentSaved);
return $this;
} | [
"public",
"function",
"save",
"(",
"$",
"content",
")",
"{",
"$",
"this",
"->",
"_isSaved",
"=",
"true",
";",
"$",
"this",
"->",
"_contentSaved",
"=",
"(",
"string",
")",
"$",
"content",
";",
"$",
"this",
"->",
"_block",
"->",
"updateContent",
"(",
"... | Update block, raw data should be string
@param string $content
@return static | [
"Update",
"block",
"raw",
"data",
"should",
"be",
"string"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/AbstractBlock.php#L307-L313 |
191,150 | Web-Feet/coasterframework | src/Libraries/Blocks/AbstractBlock.php | AbstractBlock.publish | public function publish()
{
if ($this->_block->getPageId() && $this->_isSaved) {
$searchText = $this->_block->search_weight > 0 ? $this->generateSearchText($this->_contentSaved) : '';
$this->_block->publishContent($searchText);
}
return $this;
} | php | public function publish()
{
if ($this->_block->getPageId() && $this->_isSaved) {
$searchText = $this->_block->search_weight > 0 ? $this->generateSearchText($this->_contentSaved) : '';
$this->_block->publishContent($searchText);
}
return $this;
} | [
"public",
"function",
"publish",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_block",
"->",
"getPageId",
"(",
")",
"&&",
"$",
"this",
"->",
"_isSaved",
")",
"{",
"$",
"searchText",
"=",
"$",
"this",
"->",
"_block",
"->",
"search_weight",
">",
"0",
... | Should only be called after save
By default, updates search text and publishes a new page version
@return static | [
"Should",
"only",
"be",
"called",
"after",
"save",
"By",
"default",
"updates",
"search",
"text",
"and",
"publishes",
"a",
"new",
"page",
"version"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/AbstractBlock.php#L330-L337 |
191,151 | Web-Feet/coasterframework | src/Libraries/Blocks/AbstractBlock.php | AbstractBlock._generateSearchText | protected function _generateSearchText(...$contentParts)
{
$searchText = '';
foreach ($contentParts as $contentPart) {
$contentPart = trim((string) $contentPart);
if ($contentPart !== '') {
$searchText .= $contentPart . ' ';
}
}
$se... | php | protected function _generateSearchText(...$contentParts)
{
$searchText = '';
foreach ($contentParts as $contentPart) {
$contentPart = trim((string) $contentPart);
if ($contentPart !== '') {
$searchText .= $contentPart . ' ';
}
}
$se... | [
"protected",
"function",
"_generateSearchText",
"(",
"...",
"$",
"contentParts",
")",
"{",
"$",
"searchText",
"=",
"''",
";",
"foreach",
"(",
"$",
"contentParts",
"as",
"$",
"contentPart",
")",
"{",
"$",
"contentPart",
"=",
"trim",
"(",
"(",
"string",
")",... | Joins all non whitespace parameters passed through as and returns string or null if only whitespace
Also removes HTML tags
@param array ...$contentParts
@return null|string | [
"Joins",
"all",
"non",
"whitespace",
"parameters",
"passed",
"through",
"as",
"and",
"returns",
"string",
"or",
"null",
"if",
"only",
"whitespace",
"Also",
"removes",
"HTML",
"tags"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/AbstractBlock.php#L355-L366 |
191,152 | Web-Feet/coasterframework | src/Libraries/Blocks/AbstractBlock.php | AbstractBlock.filter | public function filter($content, $search, $type)
{
switch ($type) {
case 'in':
return (strpos($content, $search) !== false);
break;
default:
return ($content == $search);
}
} | php | public function filter($content, $search, $type)
{
switch ($type) {
case 'in':
return (strpos($content, $search) !== false);
break;
default:
return ($content == $search);
}
} | [
"public",
"function",
"filter",
"(",
"$",
"content",
",",
"$",
"search",
",",
"$",
"type",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"'in'",
":",
"return",
"(",
"strpos",
"(",
"$",
"content",
",",
"$",
"search",
")",
"!==",
"false",
... | Used by the PageBuilder filter functions to filter block data
@param string $content
@param string $search
@param string $type
@return bool | [
"Used",
"by",
"the",
"PageBuilder",
"filter",
"functions",
"to",
"filter",
"block",
"data"
] | 8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7 | https://github.com/Web-Feet/coasterframework/blob/8e1dbfd5f240786f8de59d789a8450bbc4cf1ba7/src/Libraries/Blocks/AbstractBlock.php#L375-L384 |
191,153 | Laurentvw/scrapher | src/Laurentvw/Scrapher/Matcher.php | Matcher.setFilter | public function setFilter($filter = null)
{
$this->filter = is_callable($filter) ? $filter : null;
return $this;
} | php | public function setFilter($filter = null)
{
$this->filter = is_callable($filter) ? $filter : null;
return $this;
} | [
"public",
"function",
"setFilter",
"(",
"$",
"filter",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"filter",
"=",
"is_callable",
"(",
"$",
"filter",
")",
"?",
"$",
"filter",
":",
"null",
";",
"return",
"$",
"this",
";",
"}"
] | Set the filter to be applied to the matches.
@param \Closure $filter
@return Matcher | [
"Set",
"the",
"filter",
"to",
"be",
"applied",
"to",
"the",
"matches",
"."
] | 0d0236a8a709166c92e56fd69af95a914e79fc7c | https://github.com/Laurentvw/scrapher/blob/0d0236a8a709166c92e56fd69af95a914e79fc7c/src/Laurentvw/Scrapher/Matcher.php#L74-L79 |
191,154 | Laurentvw/scrapher | src/Laurentvw/Scrapher/Matcher.php | Matcher.fetch | private function fetch(array $matchLine)
{
$result = array();
foreach ($this->getSelector()->getConfig() as $match) {
// Get the match value, optionally apply a function to it
if (isset($match['apply'])) {
$result[$match['name']] = $match['apply']($matchLine[... | php | private function fetch(array $matchLine)
{
$result = array();
foreach ($this->getSelector()->getConfig() as $match) {
// Get the match value, optionally apply a function to it
if (isset($match['apply'])) {
$result[$match['name']] = $match['apply']($matchLine[... | [
"private",
"function",
"fetch",
"(",
"array",
"$",
"matchLine",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getSelector",
"(",
")",
"->",
"getConfig",
"(",
")",
"as",
"$",
"match",
")",
"{",
"// Get the m... | Fetch the values from a match.
@param array $matchLine
@return array | [
"Fetch",
"the",
"values",
"from",
"a",
"match",
"."
] | 0d0236a8a709166c92e56fd69af95a914e79fc7c | https://github.com/Laurentvw/scrapher/blob/0d0236a8a709166c92e56fd69af95a914e79fc7c/src/Laurentvw/Scrapher/Matcher.php#L138-L168 |
191,155 | ulozenka/api-v3 | src/UlozenkaLib/APIv3/Model/BaseResponse.php | BaseResponse.getNextLinkQueryStringParams | public function getNextLinkQueryStringParams()
{
$nextLink = $this->getNextLink();
if (!isset($nextLink)) {
throw new \Exception('No HATEOAS \"next\" link provided.');
}
$parsedUrl = parse_url($nextLink->getUrl());
$qsArray = [];
parse_str($parsedUrl['quer... | php | public function getNextLinkQueryStringParams()
{
$nextLink = $this->getNextLink();
if (!isset($nextLink)) {
throw new \Exception('No HATEOAS \"next\" link provided.');
}
$parsedUrl = parse_url($nextLink->getUrl());
$qsArray = [];
parse_str($parsedUrl['quer... | [
"public",
"function",
"getNextLinkQueryStringParams",
"(",
")",
"{",
"$",
"nextLink",
"=",
"$",
"this",
"->",
"getNextLink",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"nextLink",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'No HATEOAS... | QS params parsed from the HATEOAS "next" link
@return array
@throws \Exception | [
"QS",
"params",
"parsed",
"from",
"the",
"HATEOAS",
"next",
"link"
] | bf0c7e518b787f71d5d1bbb5c3b6c43b7c8abb3f | https://github.com/ulozenka/api-v3/blob/bf0c7e518b787f71d5d1bbb5c3b6c43b7c8abb3f/src/UlozenkaLib/APIv3/Model/BaseResponse.php#L174-L184 |
191,156 | Laurentvw/scrapher | src/Laurentvw/Scrapher/Scrapher.php | Scrapher.addUrl | public function addUrl($url)
{
$page = new Page($url);
$this->addContent($page->getHTML(), $url);
return $this;
} | php | public function addUrl($url)
{
$page = new Page($url);
$this->addContent($page->getHTML(), $url);
return $this;
} | [
"public",
"function",
"addUrl",
"(",
"$",
"url",
")",
"{",
"$",
"page",
"=",
"new",
"Page",
"(",
"$",
"url",
")",
";",
"$",
"this",
"->",
"addContent",
"(",
"$",
"page",
"->",
"getHTML",
"(",
")",
",",
"$",
"url",
")",
";",
"return",
"$",
"this... | Add URL to scrape.
@param string $url
@return Scrapher | [
"Add",
"URL",
"to",
"scrape",
"."
] | 0d0236a8a709166c92e56fd69af95a914e79fc7c | https://github.com/Laurentvw/scrapher/blob/0d0236a8a709166c92e56fd69af95a914e79fc7c/src/Laurentvw/Scrapher/Scrapher.php#L84-L90 |
191,157 | Laurentvw/scrapher | src/Laurentvw/Scrapher/Scrapher.php | Scrapher.addContent | public function addContent($content, $key = null)
{
if (!is_null($key)) {
$this->contents[$key] = $content;
} else {
$this->contents[] = $content;
}
return $this;
} | php | public function addContent($content, $key = null)
{
if (!is_null($key)) {
$this->contents[$key] = $content;
} else {
$this->contents[] = $content;
}
return $this;
} | [
"public",
"function",
"addContent",
"(",
"$",
"content",
",",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"key",
")",
")",
"{",
"$",
"this",
"->",
"contents",
"[",
"$",
"key",
"]",
"=",
"$",
"content",
";",
"}",
"els... | Add content to scrape.
@param string $content
@param null $key
@return Scrapher | [
"Add",
"content",
"to",
"scrape",
"."
] | 0d0236a8a709166c92e56fd69af95a914e79fc7c | https://github.com/Laurentvw/scrapher/blob/0d0236a8a709166c92e56fd69af95a914e79fc7c/src/Laurentvw/Scrapher/Scrapher.php#L115-L124 |
191,158 | Laurentvw/scrapher | src/Laurentvw/Scrapher/Scrapher.php | Scrapher.orderBy | public function orderBy($name, $order = 'asc', $projection = null)
{
$order = strtolower($order) == 'desc' ? SORT_DESC : SORT_ASC;
$this->orderBy[] = array($name, $order, $projection);
return $this;
} | php | public function orderBy($name, $order = 'asc', $projection = null)
{
$order = strtolower($order) == 'desc' ? SORT_DESC : SORT_ASC;
$this->orderBy[] = array($name, $order, $projection);
return $this;
} | [
"public",
"function",
"orderBy",
"(",
"$",
"name",
",",
"$",
"order",
"=",
"'asc'",
",",
"$",
"projection",
"=",
"null",
")",
"{",
"$",
"order",
"=",
"strtolower",
"(",
"$",
"order",
")",
"==",
"'desc'",
"?",
"SORT_DESC",
":",
"SORT_ASC",
";",
"$",
... | Order the matches.
@param string $name
@param string $order
@param string $projection
@return Scrapher | [
"Order",
"the",
"matches",
"."
] | 0d0236a8a709166c92e56fd69af95a914e79fc7c | https://github.com/Laurentvw/scrapher/blob/0d0236a8a709166c92e56fd69af95a914e79fc7c/src/Laurentvw/Scrapher/Scrapher.php#L219-L225 |
191,159 | Laurentvw/scrapher | src/Laurentvw/Scrapher/Scrapher.php | Scrapher.get | public function get($columns = array('*'))
{
$columns = is_array($columns) ? $columns : func_get_args();
return $this->scrape($columns);
} | php | public function get($columns = array('*'))
{
$columns = is_array($columns) ? $columns : func_get_args();
return $this->scrape($columns);
} | [
"public",
"function",
"get",
"(",
"$",
"columns",
"=",
"array",
"(",
"'*'",
")",
")",
"{",
"$",
"columns",
"=",
"is_array",
"(",
"$",
"columns",
")",
"?",
"$",
"columns",
":",
"func_get_args",
"(",
")",
";",
"return",
"$",
"this",
"->",
"scrape",
"... | Get all the matches.
@param array $columns
@return array | [
"Get",
"all",
"the",
"matches",
"."
] | 0d0236a8a709166c92e56fd69af95a914e79fc7c | https://github.com/Laurentvw/scrapher/blob/0d0236a8a709166c92e56fd69af95a914e79fc7c/src/Laurentvw/Scrapher/Scrapher.php#L234-L239 |
191,160 | Laurentvw/scrapher | src/Laurentvw/Scrapher/Scrapher.php | Scrapher.first | public function first($columns = array('*'))
{
$columns = is_array($columns) ? $columns : func_get_args();
$results = $this->scrape($columns);
return current($results);
} | php | public function first($columns = array('*'))
{
$columns = is_array($columns) ? $columns : func_get_args();
$results = $this->scrape($columns);
return current($results);
} | [
"public",
"function",
"first",
"(",
"$",
"columns",
"=",
"array",
"(",
"'*'",
")",
")",
"{",
"$",
"columns",
"=",
"is_array",
"(",
"$",
"columns",
")",
"?",
"$",
"columns",
":",
"func_get_args",
"(",
")",
";",
"$",
"results",
"=",
"$",
"this",
"->"... | Get the first match.
@param array $columns
@return array | [
"Get",
"the",
"first",
"match",
"."
] | 0d0236a8a709166c92e56fd69af95a914e79fc7c | https://github.com/Laurentvw/scrapher/blob/0d0236a8a709166c92e56fd69af95a914e79fc7c/src/Laurentvw/Scrapher/Scrapher.php#L248-L255 |
191,161 | Laurentvw/scrapher | src/Laurentvw/Scrapher/Scrapher.php | Scrapher.last | public function last($columns = array('*'))
{
$columns = is_array($columns) ? $columns : func_get_args();
$results = $this->scrape($columns);
return end($results);
} | php | public function last($columns = array('*'))
{
$columns = is_array($columns) ? $columns : func_get_args();
$results = $this->scrape($columns);
return end($results);
} | [
"public",
"function",
"last",
"(",
"$",
"columns",
"=",
"array",
"(",
"'*'",
")",
")",
"{",
"$",
"columns",
"=",
"is_array",
"(",
"$",
"columns",
")",
"?",
"$",
"columns",
":",
"func_get_args",
"(",
")",
";",
"$",
"results",
"=",
"$",
"this",
"->",... | Get the last match.
@param array $columns
@return array | [
"Get",
"the",
"last",
"match",
"."
] | 0d0236a8a709166c92e56fd69af95a914e79fc7c | https://github.com/Laurentvw/scrapher/blob/0d0236a8a709166c92e56fd69af95a914e79fc7c/src/Laurentvw/Scrapher/Scrapher.php#L264-L271 |
191,162 | Laurentvw/scrapher | src/Laurentvw/Scrapher/Scrapher.php | Scrapher.scrape | protected function scrape($columns)
{
if (!$this->contents) {
throw new ContentNotFoundException();
}
$results = array();
foreach ($this->contents as $id => $content) {
$results = array_merge($results, $this->getMatcher()->getMatches($content, $id));
... | php | protected function scrape($columns)
{
if (!$this->contents) {
throw new ContentNotFoundException();
}
$results = array();
foreach ($this->contents as $id => $content) {
$results = array_merge($results, $this->getMatcher()->getMatches($content, $id));
... | [
"protected",
"function",
"scrape",
"(",
"$",
"columns",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"contents",
")",
"{",
"throw",
"new",
"ContentNotFoundException",
"(",
")",
";",
"}",
"$",
"results",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$... | The actual scraping.
@param array $columns
@throws ContentNotFoundException
@return array | [
"The",
"actual",
"scraping",
"."
] | 0d0236a8a709166c92e56fd69af95a914e79fc7c | https://github.com/Laurentvw/scrapher/blob/0d0236a8a709166c92e56fd69af95a914e79fc7c/src/Laurentvw/Scrapher/Scrapher.php#L319-L355 |
191,163 | davidtsadler/ebay-sdk | src/DTS/eBaySDK/Parser/XmlParser.php | XmlParser.endElement | private function endElement($parser, $name)
{
$meta = $this->metaStack->pop();
if (!$this->metaStack->isEmpty()) {
// Element in the XML may not exist as a property name in the class.
// This could happen if the SDK is out of date with what eBay return.
// It cou... | php | private function endElement($parser, $name)
{
$meta = $this->metaStack->pop();
if (!$this->metaStack->isEmpty()) {
// Element in the XML may not exist as a property name in the class.
// This could happen if the SDK is out of date with what eBay return.
// It cou... | [
"private",
"function",
"endElement",
"(",
"$",
"parser",
",",
"$",
"name",
")",
"{",
"$",
"meta",
"=",
"$",
"this",
"->",
"metaStack",
"->",
"pop",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"metaStack",
"->",
"isEmpty",
"(",
")",
")",
"{"... | Handler for the parser that is called at the end of each XML element.
Creates the required PHP object that represents the element and assigns
it to the parent PHP object.
@param resource $parser Reference to the XML parser calling the handler.
@param string $name The name of the element. | [
"Handler",
"for",
"the",
"parser",
"that",
"is",
"called",
"at",
"the",
"end",
"of",
"each",
"XML",
"element",
"."
] | faf4327880f70dfcec08e7bb9a832b8baecf8a4d | https://github.com/davidtsadler/ebay-sdk/blob/faf4327880f70dfcec08e7bb9a832b8baecf8a4d/src/DTS/eBaySDK/Parser/XmlParser.php#L106-L128 |
191,164 | davidtsadler/ebay-sdk | src/DTS/eBaySDK/Parser/XmlParser.php | XmlParser.getPhpMeta | private function getPhpMeta($elementName, $attributes)
{
$meta = new \StdClass();
$meta->propertyName = '';
$meta->phpType = '';
$meta->unbound = false;
$meta->attribute = false;
$meta->elementName = '';
$meta->strData = '';
if (!$this->metaStack->isE... | php | private function getPhpMeta($elementName, $attributes)
{
$meta = new \StdClass();
$meta->propertyName = '';
$meta->phpType = '';
$meta->unbound = false;
$meta->attribute = false;
$meta->elementName = '';
$meta->strData = '';
if (!$this->metaStack->isE... | [
"private",
"function",
"getPhpMeta",
"(",
"$",
"elementName",
",",
"$",
"attributes",
")",
"{",
"$",
"meta",
"=",
"new",
"\\",
"StdClass",
"(",
")",
";",
"$",
"meta",
"->",
"propertyName",
"=",
"''",
";",
"$",
"meta",
"->",
"phpType",
"=",
"''",
";",... | Looks up the PHP meta data for the element.
Allow the parser to build the required PHP object for an element.
@param string $name The name of the element.
@param arrary $attributes Associative array of the element's attributes.
@returns array Associative array containing the PHP meta data. | [
"Looks",
"up",
"the",
"PHP",
"meta",
"data",
"for",
"the",
"element",
"."
] | faf4327880f70dfcec08e7bb9a832b8baecf8a4d | https://github.com/davidtsadler/ebay-sdk/blob/faf4327880f70dfcec08e7bb9a832b8baecf8a4d/src/DTS/eBaySDK/Parser/XmlParser.php#L150-L192 |
191,165 | davidtsadler/ebay-sdk | src/DTS/eBaySDK/Parser/XmlParser.php | XmlParser.setByValue | private function setByValue($meta)
{
return (
is_subclass_of($meta->phpObject, '\DTS\eBaySDK\Types\Base64BinaryType', false) ||
is_subclass_of($meta->phpObject, '\DTS\eBaySDK\Types\BooleanType', false) ||
is_subclass_of($meta->phpObject, '\DTS\eBaySDK\Types\DecimalType', ... | php | private function setByValue($meta)
{
return (
is_subclass_of($meta->phpObject, '\DTS\eBaySDK\Types\Base64BinaryType', false) ||
is_subclass_of($meta->phpObject, '\DTS\eBaySDK\Types\BooleanType', false) ||
is_subclass_of($meta->phpObject, '\DTS\eBaySDK\Types\DecimalType', ... | [
"private",
"function",
"setByValue",
"(",
"$",
"meta",
")",
"{",
"return",
"(",
"is_subclass_of",
"(",
"$",
"meta",
"->",
"phpObject",
",",
"'\\DTS\\eBaySDK\\Types\\Base64BinaryType'",
",",
"false",
")",
"||",
"is_subclass_of",
"(",
"$",
"meta",
"->",
"phpObject... | Determines if the the property of an object is set by a _value_ property.
@param array $meta The PHP meta data.
@returns boolean True if the property need to be set by _value_. | [
"Determines",
"if",
"the",
"the",
"property",
"of",
"an",
"object",
"is",
"set",
"by",
"a",
"_value_",
"property",
"."
] | faf4327880f70dfcec08e7bb9a832b8baecf8a4d | https://github.com/davidtsadler/ebay-sdk/blob/faf4327880f70dfcec08e7bb9a832b8baecf8a4d/src/DTS/eBaySDK/Parser/XmlParser.php#L260-L272 |
191,166 | php-resque/resque | src/Resque/Component/Worker/Worker.php | Worker.handleFailedJob | protected function handleFailedJob(JobInterface $job, \Exception $exception)
{
if ($job instanceof TrackableJobInterface) {
$job->setState(JobInterface::STATE_FAILED);
}
$this->getLogger()->error(
'Perform failure on {job}, {message}',
array(
... | php | protected function handleFailedJob(JobInterface $job, \Exception $exception)
{
if ($job instanceof TrackableJobInterface) {
$job->setState(JobInterface::STATE_FAILED);
}
$this->getLogger()->error(
'Perform failure on {job}, {message}',
array(
... | [
"protected",
"function",
"handleFailedJob",
"(",
"JobInterface",
"$",
"job",
",",
"\\",
"Exception",
"$",
"exception",
")",
"{",
"if",
"(",
"$",
"job",
"instanceof",
"TrackableJobInterface",
")",
"{",
"$",
"job",
"->",
"setState",
"(",
"JobInterface",
"::",
... | Handle failed job
@param JobInterface $job The job that failed.
@param \Exception $exception The reason the job failed. | [
"Handle",
"failed",
"job"
] | 2c3afa60c509f9eb0e24e0ad833d1e0377f25e7d | https://github.com/php-resque/resque/blob/2c3afa60c509f9eb0e24e0ad833d1e0377f25e7d/src/Resque/Component/Worker/Worker.php#L397-L416 |
191,167 | php-resque/resque | src/Resque/Component/Worker/Worker.php | Worker.halt | public function halt()
{
if($this->getProcess()->getPid() == getmypid()) {
$this->stop();
$this->haltCurrentJob();
}else{
$this->getProcess()->kill(SIGINT);
}
} | php | public function halt()
{
if($this->getProcess()->getPid() == getmypid()) {
$this->stop();
$this->haltCurrentJob();
}else{
$this->getProcess()->kill(SIGINT);
}
} | [
"public",
"function",
"halt",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getProcess",
"(",
")",
"->",
"getPid",
"(",
")",
"==",
"getmypid",
"(",
")",
")",
"{",
"$",
"this",
"->",
"stop",
"(",
")",
";",
"$",
"this",
"->",
"haltCurrentJob",
"(",... | Force an immediate shutdown of the worker, killing any child jobs
currently running, or the job it is currently working on. | [
"Force",
"an",
"immediate",
"shutdown",
"of",
"the",
"worker",
"killing",
"any",
"child",
"jobs",
"currently",
"running",
"or",
"the",
"job",
"it",
"is",
"currently",
"working",
"on",
"."
] | 2c3afa60c509f9eb0e24e0ad833d1e0377f25e7d | https://github.com/php-resque/resque/blob/2c3afa60c509f9eb0e24e0ad833d1e0377f25e7d/src/Resque/Component/Worker/Worker.php#L523-L531 |
191,168 | php-resque/resque | src/Resque/Component/Worker/Worker.php | Worker.reset | public function reset(){
$this->setId(null);
$this->shutdown = false;
$this->getLogger()->notice('Worker {worker} reset', array('worker' => $this));
} | php | public function reset(){
$this->setId(null);
$this->shutdown = false;
$this->getLogger()->notice('Worker {worker} reset', array('worker' => $this));
} | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"setId",
"(",
"null",
")",
";",
"$",
"this",
"->",
"shutdown",
"=",
"false",
";",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"notice",
"(",
"'Worker {worker} reset'",
",",
"array",
... | Get worker ready to start again. | [
"Get",
"worker",
"ready",
"to",
"start",
"again",
"."
] | 2c3afa60c509f9eb0e24e0ad833d1e0377f25e7d | https://github.com/php-resque/resque/blob/2c3afa60c509f9eb0e24e0ad833d1e0377f25e7d/src/Resque/Component/Worker/Worker.php#L550-L554 |
191,169 | php-resque/resque | src/Resque/Component/Worker/Worker.php | Worker.setCurrentJob | public function setCurrentJob(JobInterface $job = null)
{
if (null !== $job && null !== $this->getCurrentJob()) {
throw new ResqueRuntimeException(
sprintf(
'Cannot set current job to %s when current job is not null, current job is %s',
$jo... | php | public function setCurrentJob(JobInterface $job = null)
{
if (null !== $job && null !== $this->getCurrentJob()) {
throw new ResqueRuntimeException(
sprintf(
'Cannot set current job to %s when current job is not null, current job is %s',
$jo... | [
"public",
"function",
"setCurrentJob",
"(",
"JobInterface",
"$",
"job",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"job",
"&&",
"null",
"!==",
"$",
"this",
"->",
"getCurrentJob",
"(",
")",
")",
"{",
"throw",
"new",
"ResqueRuntimeException",
"(... | Set current job
Sets which job the worker is currently working on, and records it in redis.
@param JobInterface|null $job The job being worked on, or null if the worker isn't processing a job anymore.
@throws ResqueRuntimeException when current job is not cleared before setting a new one.
@return $this | [
"Set",
"current",
"job"
] | 2c3afa60c509f9eb0e24e0ad833d1e0377f25e7d | https://github.com/php-resque/resque/blob/2c3afa60c509f9eb0e24e0ad833d1e0377f25e7d/src/Resque/Component/Worker/Worker.php#L604-L621 |
191,170 | alexpechkarev/google-geocoder | src/Alexpechkarev/GoogleGeocoder/GoogleGeocoder.php | GoogleGeocoder.call | protected function call()
{
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $this->requestUrl[$this->format].$this->param,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_FAILONERROR ... | php | protected function call()
{
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $this->requestUrl[$this->format].$this->param,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_FAILONERROR ... | [
"protected",
"function",
"call",
"(",
")",
"{",
"$",
"curl",
"=",
"curl_init",
"(",
")",
";",
"curl_setopt_array",
"(",
"$",
"curl",
",",
"array",
"(",
"CURLOPT_RETURNTRANSFER",
"=>",
"1",
",",
"CURLOPT_URL",
"=>",
"$",
"this",
"->",
"requestUrl",
"[",
"... | Make cURL call
@return string
@throws \RuntimeException | [
"Make",
"cURL",
"call"
] | 65c37b25058ca7b0465840d28601aa344b700fe0 | https://github.com/alexpechkarev/google-geocoder/blob/65c37b25058ca7b0465840d28601aa344b700fe0/src/Alexpechkarev/GoogleGeocoder/GoogleGeocoder.php#L69-L89 |
191,171 | davidtsadler/ebay-sdk | src/DTS/eBaySDK/Types/BaseType.php | BaseType.elementMeta | public function elementMeta($elementName)
{
$class = get_class($this);
if (array_key_exists($elementName, self::$properties[$class])) {
$info = self::$properties[$class][$elementName];
$nameKey = $info['attribute'] ? 'attributeName' : 'elementName';
if (array_key_... | php | public function elementMeta($elementName)
{
$class = get_class($this);
if (array_key_exists($elementName, self::$properties[$class])) {
$info = self::$properties[$class][$elementName];
$nameKey = $info['attribute'] ? 'attributeName' : 'elementName';
if (array_key_... | [
"public",
"function",
"elementMeta",
"(",
"$",
"elementName",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"elementName",
",",
"self",
"::",
"$",
"properties",
"[",
"$",
"class",
"]",
")... | Returns the meta data for a property.
This method is used when parsing the XML into a PHP object. The parser
needs the meta data for a property when the parser has only the element name.
@param $string $elementName The XML element that we want the meta for.
@return mixed The meta for the property or null if not foun... | [
"Returns",
"the",
"meta",
"data",
"for",
"a",
"property",
"."
] | faf4327880f70dfcec08e7bb9a832b8baecf8a4d | https://github.com/davidtsadler/ebay-sdk/blob/faf4327880f70dfcec08e7bb9a832b8baecf8a4d/src/DTS/eBaySDK/Types/BaseType.php#L162-L184 |
191,172 | davidtsadler/ebay-sdk | src/DTS/eBaySDK/Types/BaseType.php | BaseType.setValues | protected function setValues($class, array $values = array())
{
foreach ($values as $property => $value) {
$actualValue = self::determineActualValueToAssign($class, $property, $value);
$this->set($class, $property, $actualValue);
}
} | php | protected function setValues($class, array $values = array())
{
foreach ($values as $property => $value) {
$actualValue = self::determineActualValueToAssign($class, $property, $value);
$this->set($class, $property, $actualValue);
}
} | [
"protected",
"function",
"setValues",
"(",
"$",
"class",
",",
"array",
"$",
"values",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"property",
"=>",
"$",
"value",
")",
"{",
"$",
"actualValue",
"=",
"self",
"::",
"determ... | Assign multiple values to an object.
@param string $class The name of the class the properties belong to.
@param array $values. Associative array of property names and their values.
@throws UnknownPropertyException If the property does not exist.
@throws InvalidPropertyTypeException If the value is the wrong type for ... | [
"Assign",
"multiple",
"values",
"to",
"an",
"object",
"."
] | faf4327880f70dfcec08e7bb9a832b8baecf8a4d | https://github.com/davidtsadler/ebay-sdk/blob/faf4327880f70dfcec08e7bb9a832b8baecf8a4d/src/DTS/eBaySDK/Types/BaseType.php#L257-L263 |
191,173 | davidtsadler/ebay-sdk | src/DTS/eBaySDK/Types/BaseType.php | BaseType.getValue | private function getValue($class, $name)
{
$info = self::propertyInfo($class, $name);
if ($info['unbound'] && !array_key_exists($name, $this->values)) {
$this->values[$name] = new Types\UnboundType($class, $name, $info['type']);
}
return array_key_exists($name, $this->v... | php | private function getValue($class, $name)
{
$info = self::propertyInfo($class, $name);
if ($info['unbound'] && !array_key_exists($name, $this->values)) {
$this->values[$name] = new Types\UnboundType($class, $name, $info['type']);
}
return array_key_exists($name, $this->v... | [
"private",
"function",
"getValue",
"(",
"$",
"class",
",",
"$",
"name",
")",
"{",
"$",
"info",
"=",
"self",
"::",
"propertyInfo",
"(",
"$",
"class",
",",
"$",
"name",
")",
";",
"if",
"(",
"$",
"info",
"[",
"'unbound'",
"]",
"&&",
"!",
"array_key_ex... | Get the value of a property. Assumes property exists.
@param string $class The name of the class the properties belong to.
@param string $name The property name.
@returns mixed The value of the property. | [
"Get",
"the",
"value",
"of",
"a",
"property",
".",
"Assumes",
"property",
"exists",
"."
] | faf4327880f70dfcec08e7bb9a832b8baecf8a4d | https://github.com/davidtsadler/ebay-sdk/blob/faf4327880f70dfcec08e7bb9a832b8baecf8a4d/src/DTS/eBaySDK/Types/BaseType.php#L336-L345 |
191,174 | davidtsadler/ebay-sdk | src/DTS/eBaySDK/Types/BaseType.php | BaseType.setValue | private function setValue($class, $name, $value)
{
$info = self::propertyInfo($class, $name);
if (!$info['unbound']) {
$this->values[$name] = $value;
} else {
$actualType = self::getActualType($value);
if ('array' !== $actualType) {
throw ... | php | private function setValue($class, $name, $value)
{
$info = self::propertyInfo($class, $name);
if (!$info['unbound']) {
$this->values[$name] = $value;
} else {
$actualType = self::getActualType($value);
if ('array' !== $actualType) {
throw ... | [
"private",
"function",
"setValue",
"(",
"$",
"class",
",",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"info",
"=",
"self",
"::",
"propertyInfo",
"(",
"$",
"class",
",",
"$",
"name",
")",
";",
"if",
"(",
"!",
"$",
"info",
"[",
"'unbound'",
"]"... | Set the value of a property. Assumes property exists.
@param string $class The name of the class the properties belong to.
@param string $name The property name.
@param mixed $value. The value to assign to the property.
@throws InvalidPropertyTypeException If trying to assign a non array type to an unbound property. | [
"Set",
"the",
"value",
"of",
"a",
"property",
".",
"Assumes",
"property",
"exists",
"."
] | faf4327880f70dfcec08e7bb9a832b8baecf8a4d | https://github.com/davidtsadler/ebay-sdk/blob/faf4327880f70dfcec08e7bb9a832b8baecf8a4d/src/DTS/eBaySDK/Types/BaseType.php#L355-L372 |
191,175 | davidtsadler/ebay-sdk | src/DTS/eBaySDK/Types/BaseType.php | BaseType.attributesToXml | private function attributesToXml() {
$attributes = array();
foreach (self::$properties[get_class($this)] as $name => $info) {
if(!$info['attribute']) {
continue;
}
if (!array_key_exists($name, $this->values)) {
continue;
}... | php | private function attributesToXml() {
$attributes = array();
foreach (self::$properties[get_class($this)] as $name => $info) {
if(!$info['attribute']) {
continue;
}
if (!array_key_exists($name, $this->values)) {
continue;
}... | [
"private",
"function",
"attributesToXml",
"(",
")",
"{",
"$",
"attributes",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"properties",
"[",
"get_class",
"(",
"$",
"this",
")",
"]",
"as",
"$",
"name",
"=>",
"$",
"info",
")",
"{",
... | Returns an XML string of the object's attributes.
@returns string The XML. | [
"Returns",
"an",
"XML",
"string",
"of",
"the",
"object",
"s",
"attributes",
"."
] | faf4327880f70dfcec08e7bb9a832b8baecf8a4d | https://github.com/davidtsadler/ebay-sdk/blob/faf4327880f70dfcec08e7bb9a832b8baecf8a4d/src/DTS/eBaySDK/Types/BaseType.php#L379-L395 |
191,176 | davidtsadler/ebay-sdk | src/DTS/eBaySDK/Types/BaseType.php | BaseType.propertiesToXml | private function propertiesToXml() {
$properties = array();
foreach (self::$properties[get_class($this)] as $name => $info) {
if($info['attribute']) {
continue;
}
if (!array_key_exists($name, $this->values)) {
continue;
}
... | php | private function propertiesToXml() {
$properties = array();
foreach (self::$properties[get_class($this)] as $name => $info) {
if($info['attribute']) {
continue;
}
if (!array_key_exists($name, $this->values)) {
continue;
}
... | [
"private",
"function",
"propertiesToXml",
"(",
")",
"{",
"$",
"properties",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"properties",
"[",
"get_class",
"(",
"$",
"this",
")",
"]",
"as",
"$",
"name",
"=>",
"$",
"info",
")",
"{",
... | Returns an XML string of the object's properties.
@returns string The XML. | [
"Returns",
"an",
"XML",
"string",
"of",
"the",
"object",
"s",
"properties",
"."
] | faf4327880f70dfcec08e7bb9a832b8baecf8a4d | https://github.com/davidtsadler/ebay-sdk/blob/faf4327880f70dfcec08e7bb9a832b8baecf8a4d/src/DTS/eBaySDK/Types/BaseType.php#L402-L431 |
191,177 | davidtsadler/ebay-sdk | src/DTS/eBaySDK/Types/BaseType.php | BaseType.ensurePropertyExists | private static function ensurePropertyExists($class, $name)
{
if (!array_key_exists($name, self::$properties[$class])) {
throw new Exceptions\UnknownPropertyException(get_called_class(), $name);
}
} | php | private static function ensurePropertyExists($class, $name)
{
if (!array_key_exists($name, self::$properties[$class])) {
throw new Exceptions\UnknownPropertyException(get_called_class(), $name);
}
} | [
"private",
"static",
"function",
"ensurePropertyExists",
"(",
"$",
"class",
",",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"self",
"::",
"$",
"properties",
"[",
"$",
"class",
"]",
")",
")",
"{",
"throw",
"new",
... | Determines if the property is a member of the class.
@param string $class The name of the class that we are checking for.
@param string $name The property name.
@throws UnknownPropertyException If the property does not exist. | [
"Determines",
"if",
"the",
"property",
"is",
"a",
"member",
"of",
"the",
"class",
"."
] | faf4327880f70dfcec08e7bb9a832b8baecf8a4d | https://github.com/davidtsadler/ebay-sdk/blob/faf4327880f70dfcec08e7bb9a832b8baecf8a4d/src/DTS/eBaySDK/Types/BaseType.php#L440-L445 |
191,178 | davidtsadler/ebay-sdk | src/DTS/eBaySDK/Types/BaseType.php | BaseType.encodeValueXml | private static function encodeValueXml($value)
{
if ($value instanceof \DateTime) {
return $value->format('Y-m-d\TH:i:s.000\Z');
}
else if (is_bool($value)){
return $value ? 'true' : 'false';
} else {
return $value;
}
} | php | private static function encodeValueXml($value)
{
if ($value instanceof \DateTime) {
return $value->format('Y-m-d\TH:i:s.000\Z');
}
else if (is_bool($value)){
return $value ? 'true' : 'false';
} else {
return $value;
}
} | [
"private",
"static",
"function",
"encodeValueXml",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"\\",
"DateTime",
")",
"{",
"return",
"$",
"value",
"->",
"format",
"(",
"'Y-m-d\\TH:i:s.000\\Z'",
")",
";",
"}",
"else",
"if",
"(",
"i... | Helper function to convert a value into XML
@param mixed $value The value of the property.
@returns string The XML. | [
"Helper",
"function",
"to",
"convert",
"a",
"value",
"into",
"XML"
] | faf4327880f70dfcec08e7bb9a832b8baecf8a4d | https://github.com/davidtsadler/ebay-sdk/blob/faf4327880f70dfcec08e7bb9a832b8baecf8a4d/src/DTS/eBaySDK/Types/BaseType.php#L549-L559 |
191,179 | davidtsadler/ebay-sdk | src/DTS/eBaySDK/Types/BaseType.php | BaseType.propertyToArrayValue | private static function propertyToArrayValue($value)
{
if (is_subclass_of($value, '\DTS\eBaySDK\Types\BaseType', false)) {
return $value->toArray();
}
else if ($value instanceof \DateTime) {
return $value->format('Y-m-d\TH:i:s.000\Z');
} else {
ret... | php | private static function propertyToArrayValue($value)
{
if (is_subclass_of($value, '\DTS\eBaySDK\Types\BaseType', false)) {
return $value->toArray();
}
else if ($value instanceof \DateTime) {
return $value->format('Y-m-d\TH:i:s.000\Z');
} else {
ret... | [
"private",
"static",
"function",
"propertyToArrayValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_subclass_of",
"(",
"$",
"value",
",",
"'\\DTS\\eBaySDK\\Types\\BaseType'",
",",
"false",
")",
")",
"{",
"return",
"$",
"value",
"->",
"toArray",
"(",
")",
";... | Helper function to convert a property in a value that we want in an array.
@param mixed $value The value of the property.
@returns mixed A value to add to an array. | [
"Helper",
"function",
"to",
"convert",
"a",
"property",
"in",
"a",
"value",
"that",
"we",
"want",
"in",
"an",
"array",
"."
] | faf4327880f70dfcec08e7bb9a832b8baecf8a4d | https://github.com/davidtsadler/ebay-sdk/blob/faf4327880f70dfcec08e7bb9a832b8baecf8a4d/src/DTS/eBaySDK/Types/BaseType.php#L568-L578 |
191,180 | davidtsadler/ebay-sdk | src/DTS/eBaySDK/Types/BaseType.php | BaseType.actualValue | private static function actualValue($info, $class, $property, $value)
{
/**
* Shortcut. Objects can be assigned as is.
*/
if (is_object($value)) {
return $value;
}
switch ($info['type']) {
case 'integer':
case 'string':
... | php | private static function actualValue($info, $class, $property, $value)
{
/**
* Shortcut. Objects can be assigned as is.
*/
if (is_object($value)) {
return $value;
}
switch ($info['type']) {
case 'integer':
case 'string':
... | [
"private",
"static",
"function",
"actualValue",
"(",
"$",
"info",
",",
"$",
"class",
",",
"$",
"property",
",",
"$",
"value",
")",
"{",
"/**\n * Shortcut. Objects can be assigned as is.\n */",
"if",
"(",
"is_object",
"(",
"$",
"value",
")",
")",
... | Helper function when assigning values via the ctor. | [
"Helper",
"function",
"when",
"assigning",
"values",
"via",
"the",
"ctor",
"."
] | faf4327880f70dfcec08e7bb9a832b8baecf8a4d | https://github.com/davidtsadler/ebay-sdk/blob/faf4327880f70dfcec08e7bb9a832b8baecf8a4d/src/DTS/eBaySDK/Types/BaseType.php#L606-L626 |
191,181 | micheleangioni/multi-language | src/MicheleAngioni/MultiLanguage/LanguageManager.php | LanguageManager.setLocale | public function setLocale(string $locale)
{
if (!in_array($locale, $this->getAvailableLanguages())) {
throw new LanguageNotFoundException("Language $locale not found.");
}
$this->translator->setLocale($locale);
} | php | public function setLocale(string $locale)
{
if (!in_array($locale, $this->getAvailableLanguages())) {
throw new LanguageNotFoundException("Language $locale not found.");
}
$this->translator->setLocale($locale);
} | [
"public",
"function",
"setLocale",
"(",
"string",
"$",
"locale",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"locale",
",",
"$",
"this",
"->",
"getAvailableLanguages",
"(",
")",
")",
")",
"{",
"throw",
"new",
"LanguageNotFoundException",
"(",
"\"Langua... | Set new locale.
@param string $locale
@throws LanguageNotFoundException | [
"Set",
"new",
"locale",
"."
] | 030aaf3f06997d3d6cbd5b40a785ae6fe010d516 | https://github.com/micheleangioni/multi-language/blob/030aaf3f06997d3d6cbd5b40a785ae6fe010d516/src/MicheleAngioni/MultiLanguage/LanguageManager.php#L158-L165 |
191,182 | micheleangioni/multi-language | src/MicheleAngioni/MultiLanguage/LanguageManager.php | LanguageManager.getAvailableLanguages | public function getAvailableLanguages()
{
$languages = [];
$paths = $this->fileSystem->getDirectories($this->getLanguagesPath());
foreach ($paths as $path) {
$languages[] = substr($path, strlen($this->getLanguagesPath()) + 1);
}
return $languages;
} | php | public function getAvailableLanguages()
{
$languages = [];
$paths = $this->fileSystem->getDirectories($this->getLanguagesPath());
foreach ($paths as $path) {
$languages[] = substr($path, strlen($this->getLanguagesPath()) + 1);
}
return $languages;
} | [
"public",
"function",
"getAvailableLanguages",
"(",
")",
"{",
"$",
"languages",
"=",
"[",
"]",
";",
"$",
"paths",
"=",
"$",
"this",
"->",
"fileSystem",
"->",
"getDirectories",
"(",
"$",
"this",
"->",
"getLanguagesPath",
"(",
")",
")",
";",
"foreach",
"("... | Return the list of available languages.
@return array | [
"Return",
"the",
"list",
"of",
"available",
"languages",
"."
] | 030aaf3f06997d3d6cbd5b40a785ae6fe010d516 | https://github.com/micheleangioni/multi-language/blob/030aaf3f06997d3d6cbd5b40a785ae6fe010d516/src/MicheleAngioni/MultiLanguage/LanguageManager.php#L184-L195 |
191,183 | micheleangioni/multi-language | src/MicheleAngioni/MultiLanguage/LanguageManager.php | LanguageManager.createNewLanguage | public function createNewLanguage(string $newLocale)
{
if (count($this->getAvailableLanguages()) >= $this->allowedLanguages) {
throw new DirectoryNotCreatedException("Max number of allowed languages alread reached.");
}
if (!$this->fileSystem->makeDirectory($this->getLanguagesPa... | php | public function createNewLanguage(string $newLocale)
{
if (count($this->getAvailableLanguages()) >= $this->allowedLanguages) {
throw new DirectoryNotCreatedException("Max number of allowed languages alread reached.");
}
if (!$this->fileSystem->makeDirectory($this->getLanguagesPa... | [
"public",
"function",
"createNewLanguage",
"(",
"string",
"$",
"newLocale",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"getAvailableLanguages",
"(",
")",
")",
">=",
"$",
"this",
"->",
"allowedLanguages",
")",
"{",
"throw",
"new",
"DirectoryNotCrea... | Create a new directory under the languages directory for input locale.
Return true on success.
@param string $newLocale
@throws DirectoryNotCreatedException
@return bool | [
"Create",
"a",
"new",
"directory",
"under",
"the",
"languages",
"directory",
"for",
"input",
"locale",
".",
"Return",
"true",
"on",
"success",
"."
] | 030aaf3f06997d3d6cbd5b40a785ae6fe010d516 | https://github.com/micheleangioni/multi-language/blob/030aaf3f06997d3d6cbd5b40a785ae6fe010d516/src/MicheleAngioni/MultiLanguage/LanguageManager.php#L286-L297 |
191,184 | micheleangioni/multi-language | src/MicheleAngioni/MultiLanguage/LanguageManager.php | LanguageManager.purifyInputs | protected function purifyInputs(array $inputs)
{
$newInputs = [];
foreach ($inputs as $key => $value) {
if (is_array($value)) {
throw new InvalidArgumentException('Input array can NOT contain nested arrays.');
}
if (strlen((string)$key) > $this->... | php | protected function purifyInputs(array $inputs)
{
$newInputs = [];
foreach ($inputs as $key => $value) {
if (is_array($value)) {
throw new InvalidArgumentException('Input array can NOT contain nested arrays.');
}
if (strlen((string)$key) > $this->... | [
"protected",
"function",
"purifyInputs",
"(",
"array",
"$",
"inputs",
")",
"{",
"$",
"newInputs",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"inputs",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",... | Escape input array. Keys beginning with _ are discarded. If the file already exists, it gets overwritten.
@param array $inputs
@throws InvalidArgumentException
@throws TextTooLongException
@return array | [
"Escape",
"input",
"array",
".",
"Keys",
"beginning",
"with",
"_",
"are",
"discarded",
".",
"If",
"the",
"file",
"already",
"exists",
"it",
"gets",
"overwritten",
"."
] | 030aaf3f06997d3d6cbd5b40a785ae6fe010d516 | https://github.com/micheleangioni/multi-language/blob/030aaf3f06997d3d6cbd5b40a785ae6fe010d516/src/MicheleAngioni/MultiLanguage/LanguageManager.php#L357-L378 |
191,185 | micheleangioni/multi-language | src/MicheleAngioni/MultiLanguage/LanguageManager.php | LanguageManager.buildArray | public function buildArray(array $inputs)
{
$newArray = [];
foreach ($inputs as $path => $value) {
if (is_array($value)) {
throw new InvalidArgumentException('Input array CANNOT contain nested arrays.');
}
if (isset($path[0])) {
i... | php | public function buildArray(array $inputs)
{
$newArray = [];
foreach ($inputs as $path => $value) {
if (is_array($value)) {
throw new InvalidArgumentException('Input array CANNOT contain nested arrays.');
}
if (isset($path[0])) {
i... | [
"public",
"function",
"buildArray",
"(",
"array",
"$",
"inputs",
")",
"{",
"$",
"newArray",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"inputs",
"as",
"$",
"path",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{... | Build the final array that will be written into the file. Support dot notation.
@param array $inputs
@throws InvalidArgumentException
@throws TooManyNestedArraysException
@return array | [
"Build",
"the",
"final",
"array",
"that",
"will",
"be",
"written",
"into",
"the",
"file",
".",
"Support",
"dot",
"notation",
"."
] | 030aaf3f06997d3d6cbd5b40a785ae6fe010d516 | https://github.com/micheleangioni/multi-language/blob/030aaf3f06997d3d6cbd5b40a785ae6fe010d516/src/MicheleAngioni/MultiLanguage/LanguageManager.php#L406-L426 |
191,186 | micheleangioni/multi-language | src/MicheleAngioni/MultiLanguage/LanguageManager.php | LanguageManager.assignArrayByDotPath | protected function assignArrayByDotPath(&$arr, string $path, string $value)
{
$keys = explode('.', $path);
// Check that no key have a '0' value
// This is because the '0' key is not read
foreach ($keys as $keyValue) {
if ($keyValue == '0') {
throw new In... | php | protected function assignArrayByDotPath(&$arr, string $path, string $value)
{
$keys = explode('.', $path);
// Check that no key have a '0' value
// This is because the '0' key is not read
foreach ($keys as $keyValue) {
if ($keyValue == '0') {
throw new In... | [
"protected",
"function",
"assignArrayByDotPath",
"(",
"&",
"$",
"arr",
",",
"string",
"$",
"path",
",",
"string",
"$",
"value",
")",
"{",
"$",
"keys",
"=",
"explode",
"(",
"'.'",
",",
"$",
"path",
")",
";",
"// Check that no key have a '0' value",
"// This i... | Take a path of nested array with dot notation and build an array, saving it through reference.
@param array $arr
@param string $path
@param string $value
@throws InvalidArgumentException
@throws TooManyNestedArraysException | [
"Take",
"a",
"path",
"of",
"nested",
"array",
"with",
"dot",
"notation",
"and",
"build",
"an",
"array",
"saving",
"it",
"through",
"reference",
"."
] | 030aaf3f06997d3d6cbd5b40a785ae6fe010d516 | https://github.com/micheleangioni/multi-language/blob/030aaf3f06997d3d6cbd5b40a785ae6fe010d516/src/MicheleAngioni/MultiLanguage/LanguageManager.php#L438-L462 |
191,187 | micheleangioni/multi-language | src/MicheleAngioni/MultiLanguage/LanguageManager.php | LanguageManager.convertArrayToDotNotation | public function convertArrayToDotNotation(array $array)
{
$recursiveIterator = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($array));
$newArray = [];
foreach ($recursiveIterator as $leafValue) {
$keys = [];
foreach (range(0, $recursiveIterator->getDep... | php | public function convertArrayToDotNotation(array $array)
{
$recursiveIterator = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($array));
$newArray = [];
foreach ($recursiveIterator as $leafValue) {
$keys = [];
foreach (range(0, $recursiveIterator->getDep... | [
"public",
"function",
"convertArrayToDotNotation",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"recursiveIterator",
"=",
"new",
"\\",
"RecursiveIteratorIterator",
"(",
"new",
"\\",
"RecursiveArrayIterator",
"(",
"$",
"array",
")",
")",
";",
"$",
"newArray",
"=",
... | Convert an array with nested arrays into a dot notation array.
@param array $array
@return array | [
"Convert",
"an",
"array",
"with",
"nested",
"arrays",
"into",
"a",
"dot",
"notation",
"array",
"."
] | 030aaf3f06997d3d6cbd5b40a785ae6fe010d516 | https://github.com/micheleangioni/multi-language/blob/030aaf3f06997d3d6cbd5b40a785ae6fe010d516/src/MicheleAngioni/MultiLanguage/LanguageManager.php#L471-L488 |
191,188 | micheleangioni/multi-language | src/MicheleAngioni/MultiLanguage/LanguageManager.php | LanguageManager.checkIfKeysAreSafe | protected function checkIfKeysAreSafe(string $fileName, array $array)
{
$languageFile = $this->getLanguageFile($fileName, true);
foreach ($array as $key => $value) {
if (isset($key[0])) {
if ($key[0] === '_' || $key[0] === '.') {
continue;
... | php | protected function checkIfKeysAreSafe(string $fileName, array $array)
{
$languageFile = $this->getLanguageFile($fileName, true);
foreach ($array as $key => $value) {
if (isset($key[0])) {
if ($key[0] === '_' || $key[0] === '.') {
continue;
... | [
"protected",
"function",
"checkIfKeysAreSafe",
"(",
"string",
"$",
"fileName",
",",
"array",
"$",
"array",
")",
"{",
"$",
"languageFile",
"=",
"$",
"this",
"->",
"getLanguageFile",
"(",
"$",
"fileName",
",",
"true",
")",
";",
"foreach",
"(",
"$",
"array",
... | Check if input keys are safe, i.e. all its keys are contained in the default locale language file.
@param string $fileName
@param array $array
@return bool | [
"Check",
"if",
"input",
"keys",
"are",
"safe",
"i",
".",
"e",
".",
"all",
"its",
"keys",
"are",
"contained",
"in",
"the",
"default",
"locale",
"language",
"file",
"."
] | 030aaf3f06997d3d6cbd5b40a785ae6fe010d516 | https://github.com/micheleangioni/multi-language/blob/030aaf3f06997d3d6cbd5b40a785ae6fe010d516/src/MicheleAngioni/MultiLanguage/LanguageManager.php#L498-L515 |
191,189 | micheleangioni/multi-language | src/MicheleAngioni/MultiLanguage/LanguageManager.php | LanguageManager.checkIfFileNameIsSafe | protected function checkIfFileNameIsSafe(string $fileName)
{
$allowedFileNames = $this->getLanguageFiles(true);
if (!in_array($fileName, $allowedFileNames)) {
return false;
}
return true;
} | php | protected function checkIfFileNameIsSafe(string $fileName)
{
$allowedFileNames = $this->getLanguageFiles(true);
if (!in_array($fileName, $allowedFileNames)) {
return false;
}
return true;
} | [
"protected",
"function",
"checkIfFileNameIsSafe",
"(",
"string",
"$",
"fileName",
")",
"{",
"$",
"allowedFileNames",
"=",
"$",
"this",
"->",
"getLanguageFiles",
"(",
"true",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"fileName",
",",
"$",
"allowedFileNa... | Check if input file name is safe, i.e. if the default locale contains a file with the same name.
@param string $fileName
@return bool | [
"Check",
"if",
"input",
"file",
"name",
"is",
"safe",
"i",
".",
"e",
".",
"if",
"the",
"default",
"locale",
"contains",
"a",
"file",
"with",
"the",
"same",
"name",
"."
] | 030aaf3f06997d3d6cbd5b40a785ae6fe010d516 | https://github.com/micheleangioni/multi-language/blob/030aaf3f06997d3d6cbd5b40a785ae6fe010d516/src/MicheleAngioni/MultiLanguage/LanguageManager.php#L524-L533 |
191,190 | alexeevdv/yii2-recaptcha-widget | src/Recaptcha.php | Recaptcha.initTranslations | protected function initTranslations()
{
/** @var \yii\i18n\I18N $i18n */
$i18n = Instance::ensure($this->i18n, \yii\i18n\I18N::class);
$i18n->translations['recaptcha*'] = [
'class' => PhpMessageSource::class,
'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'me... | php | protected function initTranslations()
{
/** @var \yii\i18n\I18N $i18n */
$i18n = Instance::ensure($this->i18n, \yii\i18n\I18N::class);
$i18n->translations['recaptcha*'] = [
'class' => PhpMessageSource::class,
'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'me... | [
"protected",
"function",
"initTranslations",
"(",
")",
"{",
"/** @var \\yii\\i18n\\I18N $i18n */",
"$",
"i18n",
"=",
"Instance",
"::",
"ensure",
"(",
"$",
"this",
"->",
"i18n",
",",
"\\",
"yii",
"\\",
"i18n",
"\\",
"I18N",
"::",
"class",
")",
";",
"$",
"i1... | Initializes translations for component | [
"Initializes",
"translations",
"for",
"component"
] | 109ccba613d86b6a05ebd2e1c042bcad3e567803 | https://github.com/alexeevdv/yii2-recaptcha-widget/blob/109ccba613d86b6a05ebd2e1c042bcad3e567803/src/Recaptcha.php#L115-L127 |
191,191 | php-resque/resque | src/Resque/Component/Core/Foreman.php | Foreman.deregisterOnWorkerExit | public function deregisterOnWorkerExit(WorkerInterface $worker)
{
$process = $worker->getProcess();
$process->wait();
if ($process->isCleanExit()) {
$this->registry->deregister($worker);
} else {
throw new ResqueRuntimeException(
sprintf(
... | php | public function deregisterOnWorkerExit(WorkerInterface $worker)
{
$process = $worker->getProcess();
$process->wait();
if ($process->isCleanExit()) {
$this->registry->deregister($worker);
} else {
throw new ResqueRuntimeException(
sprintf(
... | [
"public",
"function",
"deregisterOnWorkerExit",
"(",
"WorkerInterface",
"$",
"worker",
")",
"{",
"$",
"process",
"=",
"$",
"worker",
"->",
"getProcess",
"(",
")",
";",
"$",
"process",
"->",
"wait",
"(",
")",
";",
"if",
"(",
"$",
"process",
"->",
"isClean... | Deregister on worker exit.
@param WorkerInterface $worker The worker to wait for exit and then deregister.
@throws ResqueRuntimeException when $worker fails to exit cleanly.
@return void | [
"Deregister",
"on",
"worker",
"exit",
"."
] | 2c3afa60c509f9eb0e24e0ad833d1e0377f25e7d | https://github.com/php-resque/resque/blob/2c3afa60c509f9eb0e24e0ad833d1e0377f25e7d/src/Resque/Component/Core/Foreman.php#L163-L178 |
191,192 | php-resque/resque | src/Resque/Component/Core/Foreman.php | Foreman.pruneDeadWorkers | public function pruneDeadWorkers()
{
$workerPids = $this->getLocalWorkerPids();
$workers = $this->registry->all(); // @todo Maybe findWorkersForHost($hostname) ?
$hostname = $this->system->getHostname();
foreach ($workers as $worker) {
if ($worker instanceof WorkerInterfa... | php | public function pruneDeadWorkers()
{
$workerPids = $this->getLocalWorkerPids();
$workers = $this->registry->all(); // @todo Maybe findWorkersForHost($hostname) ?
$hostname = $this->system->getHostname();
foreach ($workers as $worker) {
if ($worker instanceof WorkerInterfa... | [
"public",
"function",
"pruneDeadWorkers",
"(",
")",
"{",
"$",
"workerPids",
"=",
"$",
"this",
"->",
"getLocalWorkerPids",
"(",
")",
";",
"$",
"workers",
"=",
"$",
"this",
"->",
"registry",
"->",
"all",
"(",
")",
";",
"// @todo Maybe findWorkersForHost($hostnam... | Prune dead workers.
Look for any workers which should be running on this server and if
they're not, remove them from Redis.
This is a form of garbage collection to handle cases where the
server may have been killed and the workers did not exit gracefully
and therefore leave state information in Redis.
@return void | [
"Prune",
"dead",
"workers",
"."
] | 2c3afa60c509f9eb0e24e0ad833d1e0377f25e7d | https://github.com/php-resque/resque/blob/2c3afa60c509f9eb0e24e0ad833d1e0377f25e7d/src/Resque/Component/Core/Foreman.php#L192-L211 |
191,193 | php-resque/resque | src/Resque/Component/Core/Process.php | Process.kill | public function kill($signal = SIGKILL)
{
if (!$this->getPid()) {
throw new ResqueRuntimeException(
'Cannot kill a process with out a pid set'
);
}
//TODO: needs logger
//$this->getLogger()->notice('Sending {signal} to process {pid}', array('s... | php | public function kill($signal = SIGKILL)
{
if (!$this->getPid()) {
throw new ResqueRuntimeException(
'Cannot kill a process with out a pid set'
);
}
//TODO: needs logger
//$this->getLogger()->notice('Sending {signal} to process {pid}', array('s... | [
"public",
"function",
"kill",
"(",
"$",
"signal",
"=",
"SIGKILL",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getPid",
"(",
")",
")",
"{",
"throw",
"new",
"ResqueRuntimeException",
"(",
"'Cannot kill a process with out a pid set'",
")",
";",
"}",
"//TODO: ... | Attempt to kill the process
@param int $signal The signal to send to the process
@return $this | [
"Attempt",
"to",
"kill",
"the",
"process"
] | 2c3afa60c509f9eb0e24e0ad833d1e0377f25e7d | https://github.com/php-resque/resque/blob/2c3afa60c509f9eb0e24e0ad833d1e0377f25e7d/src/Resque/Component/Core/Process.php#L155-L172 |
191,194 | php-resque/resque | src/Resque/Component/Core/Process.php | Process.setTitle | public function setTitle($title)
{
if (getmypid() != $this->getPid()) {
throw new ResqueRuntimeException(
sprintf(
'Can not set title when process pid has changed. Expected "%s", got "%s"',
$this->getPid(),
getmypid()
... | php | public function setTitle($title)
{
if (getmypid() != $this->getPid()) {
throw new ResqueRuntimeException(
sprintf(
'Can not set title when process pid has changed. Expected "%s", got "%s"',
$this->getPid(),
getmypid()
... | [
"public",
"function",
"setTitle",
"(",
"$",
"title",
")",
"{",
"if",
"(",
"getmypid",
"(",
")",
"!=",
"$",
"this",
"->",
"getPid",
"(",
")",
")",
"{",
"throw",
"new",
"ResqueRuntimeException",
"(",
"sprintf",
"(",
"'Can not set title when process pid has chang... | Set process title
If possible, sets the title of the currently running process.
It is used to indicate the current state of the worker.
Only supported systems with the PECL proctitle module installed, or CLI SAPI > 5.5.
@see http://pecl.php.net/package/proctitle
@see http://php.net/manual/en/function.cli-set-proces... | [
"Set",
"process",
"title"
] | 2c3afa60c509f9eb0e24e0ad833d1e0377f25e7d | https://github.com/php-resque/resque/blob/2c3afa60c509f9eb0e24e0ad833d1e0377f25e7d/src/Resque/Component/Core/Process.php#L210-L235 |
191,195 | davidtsadler/ebay-sdk | src/DTS/eBaySDK/Services/BaseService.php | BaseService.config | public function config($option = null, $value = null)
{
if ($option !== null) {
self::ensureValidConfigOptions($option);
if (!is_array($option)) {
if ($value !== null) {
$this->config[$option] = $value;
}
return arr... | php | public function config($option = null, $value = null)
{
if ($option !== null) {
self::ensureValidConfigOptions($option);
if (!is_array($option)) {
if ($value !== null) {
$this->config[$option] = $value;
}
return arr... | [
"public",
"function",
"config",
"(",
"$",
"option",
"=",
"null",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"option",
"!==",
"null",
")",
"{",
"self",
"::",
"ensureValidConfigOptions",
"(",
"$",
"option",
")",
";",
"if",
"(",
"!",
"i... | Method to get or set the service's configuration.
@param mixed Pass an associative array to set multiple configuration options. Pass a string to get or set a single configuration option.
@param mixed Will be the value that is assigned when the name of a configuration option is passed in as the first parameter.
@throws... | [
"Method",
"to",
"get",
"or",
"set",
"the",
"service",
"s",
"configuration",
"."
] | faf4327880f70dfcec08e7bb9a832b8baecf8a4d | https://github.com/davidtsadler/ebay-sdk/blob/faf4327880f70dfcec08e7bb9a832b8baecf8a4d/src/DTS/eBaySDK/Services/BaseService.php#L109-L123 |
191,196 | davidtsadler/ebay-sdk | src/DTS/eBaySDK/Services/BaseService.php | BaseService.buildAttachmentBody | private function buildAttachmentBody($attachment)
{
return sprintf('%s%s%s%s%s%s',
'--MIME_boundary'.self::CRLF,
'Content-Type: '.$attachment['mimeType'].self::CRLF,
'Content-Transfer-Encoding: binary'.self::CRLF,
'Content-ID: <attachment.bin@devbay.net>'.self... | php | private function buildAttachmentBody($attachment)
{
return sprintf('%s%s%s%s%s%s',
'--MIME_boundary'.self::CRLF,
'Content-Type: '.$attachment['mimeType'].self::CRLF,
'Content-Transfer-Encoding: binary'.self::CRLF,
'Content-ID: <attachment.bin@devbay.net>'.self... | [
"private",
"function",
"buildAttachmentBody",
"(",
"$",
"attachment",
")",
"{",
"return",
"sprintf",
"(",
"'%s%s%s%s%s%s'",
",",
"'--MIME_boundary'",
".",
"self",
"::",
"CRLF",
",",
"'Content-Type: '",
".",
"$",
"attachment",
"[",
"'mimeType'",
"]",
".",
"self",... | Builds the attachment part of the request body string.
@param array $attachment The attachement
@return string The attachment part of request body. | [
"Builds",
"the",
"attachment",
"part",
"of",
"the",
"request",
"body",
"string",
"."
] | faf4327880f70dfcec08e7bb9a832b8baecf8a4d | https://github.com/davidtsadler/ebay-sdk/blob/faf4327880f70dfcec08e7bb9a832b8baecf8a4d/src/DTS/eBaySDK/Services/BaseService.php#L232-L242 |
191,197 | davidtsadler/ebay-sdk | src/DTS/eBaySDK/Services/BaseService.php | BaseService.extractXml | private function extractXml($response)
{
/**
* Ugly way of seeing if an attachment is present in the response.
*/
if (strpos($response, 'application/xop+xml') === false) {
return array($response, array('data' => null, 'mimeType' => null));
} else {
r... | php | private function extractXml($response)
{
/**
* Ugly way of seeing if an attachment is present in the response.
*/
if (strpos($response, 'application/xop+xml') === false) {
return array($response, array('data' => null, 'mimeType' => null));
} else {
r... | [
"private",
"function",
"extractXml",
"(",
"$",
"response",
")",
"{",
"/**\n * Ugly way of seeing if an attachment is present in the response.\n */",
"if",
"(",
"strpos",
"(",
"$",
"response",
",",
"'application/xop+xml'",
")",
"===",
"false",
")",
"{",
"re... | Extracts the XML from the response if it contains an attachment.
@param string The XML response body.
@return array first item is the XML part of response body and the second
is an attachement if one was present in the API response. | [
"Extracts",
"the",
"XML",
"from",
"the",
"response",
"if",
"it",
"contains",
"an",
"attachment",
"."
] | faf4327880f70dfcec08e7bb9a832b8baecf8a4d | https://github.com/davidtsadler/ebay-sdk/blob/faf4327880f70dfcec08e7bb9a832b8baecf8a4d/src/DTS/eBaySDK/Services/BaseService.php#L252-L262 |
191,198 | davidtsadler/ebay-sdk | src/DTS/eBaySDK/Services/BaseService.php | BaseService.extractXmlAndAttachment | private function extractXmlAndAttachment($response)
{
$attachment = array('data' => null, 'mimeType' => null);
preg_match('/\r\n/', $response, $matches, PREG_OFFSET_CAPTURE);
$boundary = substr($response, 0, $matches[0][1]);
$xmlStartPos = strpos($response, '<?xml ');
$xmlE... | php | private function extractXmlAndAttachment($response)
{
$attachment = array('data' => null, 'mimeType' => null);
preg_match('/\r\n/', $response, $matches, PREG_OFFSET_CAPTURE);
$boundary = substr($response, 0, $matches[0][1]);
$xmlStartPos = strpos($response, '<?xml ');
$xmlE... | [
"private",
"function",
"extractXmlAndAttachment",
"(",
"$",
"response",
")",
"{",
"$",
"attachment",
"=",
"array",
"(",
"'data'",
"=>",
"null",
",",
"'mimeType'",
"=>",
"null",
")",
";",
"preg_match",
"(",
"'/\\r\\n/'",
",",
"$",
"response",
",",
"$",
"mat... | Extracts the XML and the attachment from the response if it contains an attachment.
@param string The XML response body.
@return string The XML part of response body. | [
"Extracts",
"the",
"XML",
"and",
"the",
"attachment",
"from",
"the",
"response",
"if",
"it",
"contains",
"an",
"attachment",
"."
] | faf4327880f70dfcec08e7bb9a832b8baecf8a4d | https://github.com/davidtsadler/ebay-sdk/blob/faf4327880f70dfcec08e7bb9a832b8baecf8a4d/src/DTS/eBaySDK/Services/BaseService.php#L271-L293 |
191,199 | davidtsadler/ebay-sdk | src/DTS/eBaySDK/Services/BaseService.php | BaseService.ensureValidConfigOptions | private static function ensureValidConfigOptions($option)
{
$class = get_called_class();
if (!is_array($option)) {
self::ensureValidConfigOption($class, $option);
} else {
$keys = array_keys($option);
foreach ($keys as $key) {
self::ensure... | php | private static function ensureValidConfigOptions($option)
{
$class = get_called_class();
if (!is_array($option)) {
self::ensureValidConfigOption($class, $option);
} else {
$keys = array_keys($option);
foreach ($keys as $key) {
self::ensure... | [
"private",
"static",
"function",
"ensureValidConfigOptions",
"(",
"$",
"option",
")",
"{",
"$",
"class",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"option",
")",
")",
"{",
"self",
"::",
"ensureValidConfigOption",
"(",
"$... | Helper function to ensure that the passed configuration options exist.
@param mixed $option Pass either the name of an option or an array of options.
@throws UnknownConfigurationOptionException If an option does not exist. | [
"Helper",
"function",
"to",
"ensure",
"that",
"the",
"passed",
"configuration",
"options",
"exist",
"."
] | faf4327880f70dfcec08e7bb9a832b8baecf8a4d | https://github.com/davidtsadler/ebay-sdk/blob/faf4327880f70dfcec08e7bb9a832b8baecf8a4d/src/DTS/eBaySDK/Services/BaseService.php#L320-L332 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.