repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
laravel/dusk
src/Browser.php
Browser.move
public function move($x, $y) { $this->driver->manage()->window()->setPosition( new WebDriverPoint($x, $y) ); return $this; }
php
public function move($x, $y) { $this->driver->manage()->window()->setPosition( new WebDriverPoint($x, $y) ); return $this; }
[ "public", "function", "move", "(", "$", "x", ",", "$", "y", ")", "{", "$", "this", "->", "driver", "->", "manage", "(", ")", "->", "window", "(", ")", "->", "setPosition", "(", "new", "WebDriverPoint", "(", "$", "x", ",", "$", "y", ")", ")", ";...
Move the browser window. @param int $x @param int $y @return $this
[ "Move", "the", "browser", "window", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Browser.php#L256-L263
train
laravel/dusk
src/Browser.php
Browser.screenshot
public function screenshot($name) { $this->driver->takeScreenshot( sprintf('%s/%s.png', rtrim(static::$storeScreenshotsAt, '/'), $name) ); return $this; }
php
public function screenshot($name) { $this->driver->takeScreenshot( sprintf('%s/%s.png', rtrim(static::$storeScreenshotsAt, '/'), $name) ); return $this; }
[ "public", "function", "screenshot", "(", "$", "name", ")", "{", "$", "this", "->", "driver", "->", "takeScreenshot", "(", "sprintf", "(", "'%s/%s.png'", ",", "rtrim", "(", "static", "::", "$", "storeScreenshotsAt", ",", "'/'", ")", ",", "$", "name", ")",...
Take a screenshot and store it with the given name. @param string $name @return $this
[ "Take", "a", "screenshot", "and", "store", "it", "with", "the", "given", "name", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Browser.php#L271-L278
train
laravel/dusk
src/Browser.php
Browser.storeConsoleLog
public function storeConsoleLog($name) { if (in_array($this->driver->getCapabilities()->getBrowserName(), static::$supportsRemoteLogs)) { $console = $this->driver->manage()->getLog('browser'); if (! empty($console)) { file_put_contents( sprintf('%...
php
public function storeConsoleLog($name) { if (in_array($this->driver->getCapabilities()->getBrowserName(), static::$supportsRemoteLogs)) { $console = $this->driver->manage()->getLog('browser'); if (! empty($console)) { file_put_contents( sprintf('%...
[ "public", "function", "storeConsoleLog", "(", "$", "name", ")", "{", "if", "(", "in_array", "(", "$", "this", "->", "driver", "->", "getCapabilities", "(", ")", "->", "getBrowserName", "(", ")", ",", "static", "::", "$", "supportsRemoteLogs", ")", ")", "...
Store the console output with the given name. @param string $name @return $this
[ "Store", "the", "console", "output", "with", "the", "given", "name", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Browser.php#L286-L299
train
laravel/dusk
src/Browser.php
Browser.withinFrame
public function withinFrame($selector, Closure $callback) { $this->driver->switchTo()->frame($this->resolver->findOrFail($selector)); $callback($this); $this->driver->switchTo()->defaultContent(); return $this; }
php
public function withinFrame($selector, Closure $callback) { $this->driver->switchTo()->frame($this->resolver->findOrFail($selector)); $callback($this); $this->driver->switchTo()->defaultContent(); return $this; }
[ "public", "function", "withinFrame", "(", "$", "selector", ",", "Closure", "$", "callback", ")", "{", "$", "this", "->", "driver", "->", "switchTo", "(", ")", "->", "frame", "(", "$", "this", "->", "resolver", "->", "findOrFail", "(", "$", "selector", ...
Switch to a specified frame in the browser and execute the given callback. @param string $selector @param \Closure $callback @return $this
[ "Switch", "to", "a", "specified", "frame", "in", "the", "browser", "and", "execute", "the", "given", "callback", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Browser.php#L308-L317
train
laravel/dusk
src/Browser.php
Browser.with
public function with($selector, Closure $callback) { $browser = new static( $this->driver, new ElementResolver($this->driver, $this->resolver->format($selector)) ); if ($this->page) { $browser->onWithoutAssert($this->page); } if ($selector instanceof...
php
public function with($selector, Closure $callback) { $browser = new static( $this->driver, new ElementResolver($this->driver, $this->resolver->format($selector)) ); if ($this->page) { $browser->onWithoutAssert($this->page); } if ($selector instanceof...
[ "public", "function", "with", "(", "$", "selector", ",", "Closure", "$", "callback", ")", "{", "$", "browser", "=", "new", "static", "(", "$", "this", "->", "driver", ",", "new", "ElementResolver", "(", "$", "this", "->", "driver", ",", "$", "this", ...
Execute a Closure with a scoped browser instance. @param string $selector @param \Closure $callback @return $this
[ "Execute", "a", "Closure", "with", "a", "scoped", "browser", "instance", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Browser.php#L338-L355
train
laravel/dusk
src/Browser.php
Browser.onComponent
public function onComponent($component, $parentResolver) { $this->component = $component; // Here we will set the component elements on the resolver instance, which will allow // the developer to access short-cuts for CSS selectors on the component which can // allow for more expres...
php
public function onComponent($component, $parentResolver) { $this->component = $component; // Here we will set the component elements on the resolver instance, which will allow // the developer to access short-cuts for CSS selectors on the component which can // allow for more expres...
[ "public", "function", "onComponent", "(", "$", "component", ",", "$", "parentResolver", ")", "{", "$", "this", "->", "component", "=", "$", "component", ";", "// Here we will set the component elements on the resolver instance, which will allow", "// the developer to access s...
Set the current component state. @param \Laravel\Dusk\Component $component @param \Laravel\Dusk\ElementResolver $parentResolver @return void
[ "Set", "the", "current", "component", "state", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Browser.php#L364-L380
train
laravel/dusk
src/ElementResolver.php
ElementResolver.resolveForTyping
public function resolveForTyping($field) { if (! is_null($element = $this->findById($field))) { return $element; } return $this->firstOrFail([ $field, "input[name='{$field}']", "textarea[name='{$field}']", ]); }
php
public function resolveForTyping($field) { if (! is_null($element = $this->findById($field))) { return $element; } return $this->firstOrFail([ $field, "input[name='{$field}']", "textarea[name='{$field}']", ]); }
[ "public", "function", "resolveForTyping", "(", "$", "field", ")", "{", "if", "(", "!", "is_null", "(", "$", "element", "=", "$", "this", "->", "findById", "(", "$", "field", ")", ")", ")", "{", "return", "$", "element", ";", "}", "return", "$", "th...
Resolve the element for a given input "field". @param string $field @return \Facebook\WebDriver\Remote\RemoteWebElement @throws \Exception
[ "Resolve", "the", "element", "for", "a", "given", "input", "field", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/ElementResolver.php#L82-L91
train
laravel/dusk
src/ElementResolver.php
ElementResolver.resolveForSelection
public function resolveForSelection($field) { if (! is_null($element = $this->findById($field))) { return $element; } return $this->firstOrFail([ $field, "select[name='{$field}']", ]); }
php
public function resolveForSelection($field) { if (! is_null($element = $this->findById($field))) { return $element; } return $this->firstOrFail([ $field, "select[name='{$field}']", ]); }
[ "public", "function", "resolveForSelection", "(", "$", "field", ")", "{", "if", "(", "!", "is_null", "(", "$", "element", "=", "$", "this", "->", "findById", "(", "$", "field", ")", ")", ")", "{", "return", "$", "element", ";", "}", "return", "$", ...
Resolve the element for a given select "field". @param string $field @return \Facebook\WebDriver\Remote\RemoteWebElement @throws \Exception
[ "Resolve", "the", "element", "for", "a", "given", "select", "field", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/ElementResolver.php#L100-L109
train
laravel/dusk
src/ElementResolver.php
ElementResolver.resolveSelectOptions
public function resolveSelectOptions($field, array $values) { $options = $this->resolveForSelection($field) ->findElements(WebDriverBy::tagName('option')); if (empty($options)) { return []; } return array_filter($options, function ($option) use ($values)...
php
public function resolveSelectOptions($field, array $values) { $options = $this->resolveForSelection($field) ->findElements(WebDriverBy::tagName('option')); if (empty($options)) { return []; } return array_filter($options, function ($option) use ($values)...
[ "public", "function", "resolveSelectOptions", "(", "$", "field", ",", "array", "$", "values", ")", "{", "$", "options", "=", "$", "this", "->", "resolveForSelection", "(", "$", "field", ")", "->", "findElements", "(", "WebDriverBy", "::", "tagName", "(", "...
Resolve all the options with the given value on the select field. @param string $field @param array $values @return \Facebook\WebDriver\Remote\RemoteWebElement[] @throws \Exception
[ "Resolve", "all", "the", "options", "with", "the", "given", "value", "on", "the", "select", "field", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/ElementResolver.php#L119-L131
train
laravel/dusk
src/ElementResolver.php
ElementResolver.resolveForChecking
public function resolveForChecking($field, $value = null) { if (! is_null($element = $this->findById($field))) { return $element; } $selector = 'input[type=checkbox]'; if (! is_null($field)) { $selector .= "[name='{$field}']"; } if (! is_nul...
php
public function resolveForChecking($field, $value = null) { if (! is_null($element = $this->findById($field))) { return $element; } $selector = 'input[type=checkbox]'; if (! is_null($field)) { $selector .= "[name='{$field}']"; } if (! is_nul...
[ "public", "function", "resolveForChecking", "(", "$", "field", ",", "$", "value", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "element", "=", "$", "this", "->", "findById", "(", "$", "field", ")", ")", ")", "{", "return", "$", "elem...
Resolve the element for a given checkbox "field". @param string|null $field @param string $value @return \Facebook\WebDriver\Remote\RemoteWebElement @throws \Exception
[ "Resolve", "the", "element", "for", "a", "given", "checkbox", "field", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/ElementResolver.php#L166-L185
train
laravel/dusk
src/ElementResolver.php
ElementResolver.resolveForAttachment
public function resolveForAttachment($field) { if (! is_null($element = $this->findById($field))) { return $element; } return $this->firstOrFail([ $field, "input[type=file][name='{$field}']", ]); }
php
public function resolveForAttachment($field) { if (! is_null($element = $this->findById($field))) { return $element; } return $this->firstOrFail([ $field, "input[type=file][name='{$field}']", ]); }
[ "public", "function", "resolveForAttachment", "(", "$", "field", ")", "{", "if", "(", "!", "is_null", "(", "$", "element", "=", "$", "this", "->", "findById", "(", "$", "field", ")", ")", ")", "{", "return", "$", "element", ";", "}", "return", "$", ...
Resolve the element for a given file "field". @param string $field @return \Facebook\WebDriver\Remote\RemoteWebElement @throws \Exception
[ "Resolve", "the", "element", "for", "a", "given", "file", "field", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/ElementResolver.php#L194-L203
train
laravel/dusk
src/ElementResolver.php
ElementResolver.resolveForField
public function resolveForField($field) { if (! is_null($element = $this->findById($field))) { return $element; } return $this->firstOrFail([ $field, "input[name='{$field}']", "textarea[name='{$field}']", "select[name='{$field}']", "button[name='{$field}'...
php
public function resolveForField($field) { if (! is_null($element = $this->findById($field))) { return $element; } return $this->firstOrFail([ $field, "input[name='{$field}']", "textarea[name='{$field}']", "select[name='{$field}']", "button[name='{$field}'...
[ "public", "function", "resolveForField", "(", "$", "field", ")", "{", "if", "(", "!", "is_null", "(", "$", "element", "=", "$", "this", "->", "findById", "(", "$", "field", ")", ")", ")", "{", "return", "$", "element", ";", "}", "return", "$", "thi...
Resolve the element for a given "field". @param string $field @return \Facebook\WebDriver\Remote\RemoteWebElement @throws \Exception
[ "Resolve", "the", "element", "for", "a", "given", "field", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/ElementResolver.php#L212-L222
train
laravel/dusk
src/ElementResolver.php
ElementResolver.resolveForButtonPress
public function resolveForButtonPress($button) { foreach ($this->buttonFinders as $method) { if (! is_null($element = $this->{$method}($button))) { return $element; } } throw new InvalidArgumentException( "Unable to locate button [{$button...
php
public function resolveForButtonPress($button) { foreach ($this->buttonFinders as $method) { if (! is_null($element = $this->{$method}($button))) { return $element; } } throw new InvalidArgumentException( "Unable to locate button [{$button...
[ "public", "function", "resolveForButtonPress", "(", "$", "button", ")", "{", "foreach", "(", "$", "this", "->", "buttonFinders", "as", "$", "method", ")", "{", "if", "(", "!", "is_null", "(", "$", "element", "=", "$", "this", "->", "{", "$", "method", ...
Resolve the element for a given button. @param string $button @return \Facebook\WebDriver\Remote\RemoteWebElement
[ "Resolve", "the", "element", "for", "a", "given", "button", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/ElementResolver.php#L230-L241
train
laravel/dusk
src/ElementResolver.php
ElementResolver.findButtonByName
protected function findButtonByName($button) { if (! is_null($element = $this->find("input[type=submit][name='{$button}']")) || ! is_null($element = $this->find("input[type=button][value='{$button}']")) || ! is_null($element = $this->find("button[name='{$button}']"))) { r...
php
protected function findButtonByName($button) { if (! is_null($element = $this->find("input[type=submit][name='{$button}']")) || ! is_null($element = $this->find("input[type=button][value='{$button}']")) || ! is_null($element = $this->find("button[name='{$button}']"))) { r...
[ "protected", "function", "findButtonByName", "(", "$", "button", ")", "{", "if", "(", "!", "is_null", "(", "$", "element", "=", "$", "this", "->", "find", "(", "\"input[type=submit][name='{$button}']\"", ")", ")", "||", "!", "is_null", "(", "$", "element", ...
Resolve the element for a given button by name. @param string $button @return \Facebook\WebDriver\Remote\RemoteWebElement|null
[ "Resolve", "the", "element", "for", "a", "given", "button", "by", "name", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/ElementResolver.php#L262-L269
train
laravel/dusk
src/ElementResolver.php
ElementResolver.findButtonByValue
protected function findButtonByValue($button) { foreach ($this->all('input[type=submit]') as $element) { if ($element->getAttribute('value') === $button) { return $element; } } }
php
protected function findButtonByValue($button) { foreach ($this->all('input[type=submit]') as $element) { if ($element->getAttribute('value') === $button) { return $element; } } }
[ "protected", "function", "findButtonByValue", "(", "$", "button", ")", "{", "foreach", "(", "$", "this", "->", "all", "(", "'input[type=submit]'", ")", "as", "$", "element", ")", "{", "if", "(", "$", "element", "->", "getAttribute", "(", "'value'", ")", ...
Resolve the element for a given button by value. @param string $button @return \Facebook\WebDriver\Remote\RemoteWebElement|null
[ "Resolve", "the", "element", "for", "a", "given", "button", "by", "value", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/ElementResolver.php#L277-L284
train
laravel/dusk
src/ElementResolver.php
ElementResolver.findButtonByText
protected function findButtonByText($button) { foreach ($this->all('button') as $element) { if (Str::contains($element->getText(), $button)) { return $element; } } }
php
protected function findButtonByText($button) { foreach ($this->all('button') as $element) { if (Str::contains($element->getText(), $button)) { return $element; } } }
[ "protected", "function", "findButtonByText", "(", "$", "button", ")", "{", "foreach", "(", "$", "this", "->", "all", "(", "'button'", ")", "as", "$", "element", ")", "{", "if", "(", "Str", "::", "contains", "(", "$", "element", "->", "getText", "(", ...
Resolve the element for a given button by text. @param string $button @return \Facebook\WebDriver\Remote\RemoteWebElement|null
[ "Resolve", "the", "element", "for", "a", "given", "button", "by", "text", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/ElementResolver.php#L292-L299
train
laravel/dusk
src/ElementResolver.php
ElementResolver.findById
protected function findById($selector) { if (preg_match('/^#[\w\-:]+$/', $selector)) { return $this->driver->findElement(WebDriverBy::id(substr($selector, 1))); } }
php
protected function findById($selector) { if (preg_match('/^#[\w\-:]+$/', $selector)) { return $this->driver->findElement(WebDriverBy::id(substr($selector, 1))); } }
[ "protected", "function", "findById", "(", "$", "selector", ")", "{", "if", "(", "preg_match", "(", "'/^#[\\w\\-:]+$/'", ",", "$", "selector", ")", ")", "{", "return", "$", "this", "->", "driver", "->", "findElement", "(", "WebDriverBy", "::", "id", "(", ...
Attempt to find the selector by ID. @param string $selector @return \Facebook\WebDriver\Remote\RemoteWebElement|null
[ "Attempt", "to", "find", "the", "selector", "by", "ID", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/ElementResolver.php#L307-L312
train
laravel/dusk
src/ElementResolver.php
ElementResolver.firstOrFail
public function firstOrFail($selectors) { foreach ((array) $selectors as $selector) { try { return $this->findOrFail($selector); } catch (Exception $e) { // } } throw $e; }
php
public function firstOrFail($selectors) { foreach ((array) $selectors as $selector) { try { return $this->findOrFail($selector); } catch (Exception $e) { // } } throw $e; }
[ "public", "function", "firstOrFail", "(", "$", "selectors", ")", "{", "foreach", "(", "(", "array", ")", "$", "selectors", "as", "$", "selector", ")", "{", "try", "{", "return", "$", "this", "->", "findOrFail", "(", "$", "selector", ")", ";", "}", "c...
Get the first element matching the given selectors. @param array $selectors @return \Facebook\WebDriver\Remote\RemoteWebElement @throws \Exception
[ "Get", "the", "first", "element", "matching", "the", "given", "selectors", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/ElementResolver.php#L336-L347
train
laravel/dusk
src/ElementResolver.php
ElementResolver.findOrFail
public function findOrFail($selector) { if (! is_null($element = $this->findById($selector))) { return $element; } return $this->driver->findElement( WebDriverBy::cssSelector($this->format($selector)) ); }
php
public function findOrFail($selector) { if (! is_null($element = $this->findById($selector))) { return $element; } return $this->driver->findElement( WebDriverBy::cssSelector($this->format($selector)) ); }
[ "public", "function", "findOrFail", "(", "$", "selector", ")", "{", "if", "(", "!", "is_null", "(", "$", "element", "=", "$", "this", "->", "findById", "(", "$", "selector", ")", ")", ")", "{", "return", "$", "element", ";", "}", "return", "$", "th...
Find an element by the given selector or throw an exception. @param string $selector @return \Facebook\WebDriver\Remote\RemoteWebElement
[ "Find", "an", "element", "by", "the", "given", "selector", "or", "throw", "an", "exception", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/ElementResolver.php#L355-L364
train
laravel/dusk
src/ElementResolver.php
ElementResolver.all
public function all($selector) { try { return $this->driver->findElements( WebDriverBy::cssSelector($this->format($selector)) ); } catch (Exception $e) { // } return []; }
php
public function all($selector) { try { return $this->driver->findElements( WebDriverBy::cssSelector($this->format($selector)) ); } catch (Exception $e) { // } return []; }
[ "public", "function", "all", "(", "$", "selector", ")", "{", "try", "{", "return", "$", "this", "->", "driver", "->", "findElements", "(", "WebDriverBy", "::", "cssSelector", "(", "$", "this", "->", "format", "(", "$", "selector", ")", ")", ")", ";", ...
Find the elements by the given selector or return an empty array. @param string $selector @return \Facebook\WebDriver\Remote\RemoteWebElement[]
[ "Find", "the", "elements", "by", "the", "given", "selector", "or", "return", "an", "empty", "array", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/ElementResolver.php#L372-L383
train
laravel/dusk
src/ElementResolver.php
ElementResolver.format
public function format($selector) { $sortedElements = collect($this->elements)->sortByDesc(function ($element, $key) { return strlen($key); })->toArray(); $selector = str_replace( array_keys($sortedElements), array_values($sortedElements), $originalSelector = $select...
php
public function format($selector) { $sortedElements = collect($this->elements)->sortByDesc(function ($element, $key) { return strlen($key); })->toArray(); $selector = str_replace( array_keys($sortedElements), array_values($sortedElements), $originalSelector = $select...
[ "public", "function", "format", "(", "$", "selector", ")", "{", "$", "sortedElements", "=", "collect", "(", "$", "this", "->", "elements", ")", "->", "sortByDesc", "(", "function", "(", "$", "element", ",", "$", "key", ")", "{", "return", "strlen", "("...
Format the given selector with the current prefix. @param string $selector @return string
[ "Format", "the", "given", "selector", "with", "the", "current", "prefix", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/ElementResolver.php#L391-L406
train
laravel/dusk
src/Concerns/InteractsWithJavascript.php
InteractsWithJavascript.script
public function script($scripts) { return collect((array) $scripts)->map(function ($script) { return $this->driver->executeScript($script); })->all(); }
php
public function script($scripts) { return collect((array) $scripts)->map(function ($script) { return $this->driver->executeScript($script); })->all(); }
[ "public", "function", "script", "(", "$", "scripts", ")", "{", "return", "collect", "(", "(", "array", ")", "$", "scripts", ")", "->", "map", "(", "function", "(", "$", "script", ")", "{", "return", "$", "this", "->", "driver", "->", "executeScript", ...
Execute JavaScript within the browser. @param string|array $scripts @return array
[ "Execute", "JavaScript", "within", "the", "browser", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Concerns/InteractsWithJavascript.php#L13-L18
train
laravel/dusk
src/Concerns/InteractsWithCookies.php
InteractsWithCookies.cookie
public function cookie($name, $value = null, $expiry = null, array $options = []) { if (! is_null($value)) { return $this->addCookie($name, $value, $expiry, $options); } if ($cookie = $this->driver->manage()->getCookieNamed($name)) { return decrypt(rawurldecode($cook...
php
public function cookie($name, $value = null, $expiry = null, array $options = []) { if (! is_null($value)) { return $this->addCookie($name, $value, $expiry, $options); } if ($cookie = $this->driver->manage()->getCookieNamed($name)) { return decrypt(rawurldecode($cook...
[ "public", "function", "cookie", "(", "$", "name", ",", "$", "value", "=", "null", ",", "$", "expiry", "=", "null", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "is_null", "(", "$", "value", ")", ")", "{", "return", "$"...
Get or set an encrypted cookie's value. @param string $name @param string|null $value @param int|DateTimeInterface|null $expiry @param array $options @return string
[ "Get", "or", "set", "an", "encrypted", "cookie", "s", "value", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Concerns/InteractsWithCookies.php#L18-L27
train
laravel/dusk
src/Concerns/InteractsWithCookies.php
InteractsWithCookies.addCookie
public function addCookie($name, $value, $expiry = null, array $options = [], $encrypt = true) { if ($encrypt) { $value = encrypt($value, $serialize = false); } if ($expiry instanceof DateTimeInterface) { $expiry = $expiry->getTimestamp(); } $this->d...
php
public function addCookie($name, $value, $expiry = null, array $options = [], $encrypt = true) { if ($encrypt) { $value = encrypt($value, $serialize = false); } if ($expiry instanceof DateTimeInterface) { $expiry = $expiry->getTimestamp(); } $this->d...
[ "public", "function", "addCookie", "(", "$", "name", ",", "$", "value", ",", "$", "expiry", "=", "null", ",", "array", "$", "options", "=", "[", "]", ",", "$", "encrypt", "=", "true", ")", "{", "if", "(", "$", "encrypt", ")", "{", "$", "value", ...
Add the given cookie. @param string $name @param string $value @param int|DateTimeInterface|null $expiry @param array $options @param bool $encrypt @return $this
[ "Add", "the", "given", "cookie", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Concerns/InteractsWithCookies.php#L59-L74
train
laravel/dusk
src/Concerns/MakesUrlAssertions.php
MakesUrlAssertions.assertUrlIs
public function assertUrlIs($url) { $pattern = str_replace('\*', '.*', preg_quote($url, '/')); $segments = parse_url($this->driver->getCurrentURL()); $currentUrl = sprintf( '%s://%s%s%s', $segments['scheme'], $segments['host'], Arr::get($segm...
php
public function assertUrlIs($url) { $pattern = str_replace('\*', '.*', preg_quote($url, '/')); $segments = parse_url($this->driver->getCurrentURL()); $currentUrl = sprintf( '%s://%s%s%s', $segments['scheme'], $segments['host'], Arr::get($segm...
[ "public", "function", "assertUrlIs", "(", "$", "url", ")", "{", "$", "pattern", "=", "str_replace", "(", "'\\*'", ",", "'.*'", ",", "preg_quote", "(", "$", "url", ",", "'/'", ")", ")", ";", "$", "segments", "=", "parse_url", "(", "$", "this", "->", ...
Assert that the current URL matches the given URL. @param string $url @return $this
[ "Assert", "that", "the", "current", "URL", "matches", "the", "given", "URL", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Concerns/MakesUrlAssertions.php#L16-L36
train
laravel/dusk
src/Concerns/MakesUrlAssertions.php
MakesUrlAssertions.assertSchemeIs
public function assertSchemeIs($scheme) { $pattern = str_replace('\*', '.*', preg_quote($scheme, '/')); $actual = parse_url($this->driver->getCurrentURL(), PHP_URL_SCHEME) ?? ''; PHPUnit::assertRegExp( '/^'.$pattern.'$/u', $actual, "Actual scheme [{$actual}] does no...
php
public function assertSchemeIs($scheme) { $pattern = str_replace('\*', '.*', preg_quote($scheme, '/')); $actual = parse_url($this->driver->getCurrentURL(), PHP_URL_SCHEME) ?? ''; PHPUnit::assertRegExp( '/^'.$pattern.'$/u', $actual, "Actual scheme [{$actual}] does no...
[ "public", "function", "assertSchemeIs", "(", "$", "scheme", ")", "{", "$", "pattern", "=", "str_replace", "(", "'\\*'", ",", "'.*'", ",", "preg_quote", "(", "$", "scheme", ",", "'/'", ")", ")", ";", "$", "actual", "=", "parse_url", "(", "$", "this", ...
Assert that the current scheme matches the given scheme. @param string $scheme @return $this
[ "Assert", "that", "the", "current", "scheme", "matches", "the", "given", "scheme", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Concerns/MakesUrlAssertions.php#L44-L56
train
laravel/dusk
src/Concerns/MakesUrlAssertions.php
MakesUrlAssertions.assertSchemeIsNot
public function assertSchemeIsNot($scheme) { $actual = parse_url($this->driver->getCurrentURL(), PHP_URL_SCHEME) ?? ''; PHPUnit::assertNotEquals( $scheme, $actual, "Scheme [{$scheme}] should not equal the actual value." ); return $this; }
php
public function assertSchemeIsNot($scheme) { $actual = parse_url($this->driver->getCurrentURL(), PHP_URL_SCHEME) ?? ''; PHPUnit::assertNotEquals( $scheme, $actual, "Scheme [{$scheme}] should not equal the actual value." ); return $this; }
[ "public", "function", "assertSchemeIsNot", "(", "$", "scheme", ")", "{", "$", "actual", "=", "parse_url", "(", "$", "this", "->", "driver", "->", "getCurrentURL", "(", ")", ",", "PHP_URL_SCHEME", ")", "??", "''", ";", "PHPUnit", "::", "assertNotEquals", "(...
Assert that the current scheme does not match the given scheme. @param string $scheme @return $this
[ "Assert", "that", "the", "current", "scheme", "does", "not", "match", "the", "given", "scheme", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Concerns/MakesUrlAssertions.php#L64-L74
train
laravel/dusk
src/Concerns/MakesUrlAssertions.php
MakesUrlAssertions.assertHostIs
public function assertHostIs($host) { $pattern = str_replace('\*', '.*', preg_quote($host, '/')); $actual = parse_url($this->driver->getCurrentURL(), PHP_URL_HOST) ?? ''; PHPUnit::assertRegExp( '/^'.$pattern.'$/u', $actual, "Actual host [{$actual}] does not equal ex...
php
public function assertHostIs($host) { $pattern = str_replace('\*', '.*', preg_quote($host, '/')); $actual = parse_url($this->driver->getCurrentURL(), PHP_URL_HOST) ?? ''; PHPUnit::assertRegExp( '/^'.$pattern.'$/u', $actual, "Actual host [{$actual}] does not equal ex...
[ "public", "function", "assertHostIs", "(", "$", "host", ")", "{", "$", "pattern", "=", "str_replace", "(", "'\\*'", ",", "'.*'", ",", "preg_quote", "(", "$", "host", ",", "'/'", ")", ")", ";", "$", "actual", "=", "parse_url", "(", "$", "this", "->", ...
Assert that the current host matches the given host. @param string $host @return $this
[ "Assert", "that", "the", "current", "host", "matches", "the", "given", "host", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Concerns/MakesUrlAssertions.php#L82-L94
train
laravel/dusk
src/Concerns/MakesUrlAssertions.php
MakesUrlAssertions.assertPortIs
public function assertPortIs($port) { $pattern = str_replace('\*', '.*', preg_quote($port, '/')); $actual = parse_url($this->driver->getCurrentURL(), PHP_URL_PORT) ?? ''; PHPUnit::assertRegExp( '/^'.$pattern.'$/u', $actual, "Actual port [{$actual}] does not equal ex...
php
public function assertPortIs($port) { $pattern = str_replace('\*', '.*', preg_quote($port, '/')); $actual = parse_url($this->driver->getCurrentURL(), PHP_URL_PORT) ?? ''; PHPUnit::assertRegExp( '/^'.$pattern.'$/u', $actual, "Actual port [{$actual}] does not equal ex...
[ "public", "function", "assertPortIs", "(", "$", "port", ")", "{", "$", "pattern", "=", "str_replace", "(", "'\\*'", ",", "'.*'", ",", "preg_quote", "(", "$", "port", ",", "'/'", ")", ")", ";", "$", "actual", "=", "parse_url", "(", "$", "this", "->", ...
Assert that the current port matches the given port. @param string $port @return $this
[ "Assert", "that", "the", "current", "port", "matches", "the", "given", "port", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Concerns/MakesUrlAssertions.php#L120-L132
train
laravel/dusk
src/Concerns/MakesUrlAssertions.php
MakesUrlAssertions.assertPathIs
public function assertPathIs($path) { $pattern = str_replace('\*', '.*', preg_quote($path, '/')); $actualPath = parse_url($this->driver->getCurrentURL(), PHP_URL_PATH) ?? ''; PHPUnit::assertRegExp( '/^'.$pattern.'$/u', $actualPath, "Actual path [{$actualPath}] does ...
php
public function assertPathIs($path) { $pattern = str_replace('\*', '.*', preg_quote($path, '/')); $actualPath = parse_url($this->driver->getCurrentURL(), PHP_URL_PATH) ?? ''; PHPUnit::assertRegExp( '/^'.$pattern.'$/u', $actualPath, "Actual path [{$actualPath}] does ...
[ "public", "function", "assertPathIs", "(", "$", "path", ")", "{", "$", "pattern", "=", "str_replace", "(", "'\\*'", ",", "'.*'", ",", "preg_quote", "(", "$", "path", ",", "'/'", ")", ")", ";", "$", "actualPath", "=", "parse_url", "(", "$", "this", "-...
Assert that the current URL path matches the given pattern. @param string $path @return $this
[ "Assert", "that", "the", "current", "URL", "path", "matches", "the", "given", "pattern", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Concerns/MakesUrlAssertions.php#L158-L170
train
laravel/dusk
src/Concerns/MakesUrlAssertions.php
MakesUrlAssertions.assertPathBeginsWith
public function assertPathBeginsWith($path) { $actualPath = parse_url($this->driver->getCurrentURL(), PHP_URL_PATH) ?? ''; PHPUnit::assertStringStartsWith( $path, $actualPath, "Actual path [{$actualPath}] does not begin with expected path [{$path}]." ); retu...
php
public function assertPathBeginsWith($path) { $actualPath = parse_url($this->driver->getCurrentURL(), PHP_URL_PATH) ?? ''; PHPUnit::assertStringStartsWith( $path, $actualPath, "Actual path [{$actualPath}] does not begin with expected path [{$path}]." ); retu...
[ "public", "function", "assertPathBeginsWith", "(", "$", "path", ")", "{", "$", "actualPath", "=", "parse_url", "(", "$", "this", "->", "driver", "->", "getCurrentURL", "(", ")", ",", "PHP_URL_PATH", ")", "??", "''", ";", "PHPUnit", "::", "assertStringStartsW...
Assert that the current URL path begins with given path. @param string $path @return $this
[ "Assert", "that", "the", "current", "URL", "path", "begins", "with", "given", "path", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Concerns/MakesUrlAssertions.php#L178-L188
train
laravel/dusk
src/Concerns/MakesUrlAssertions.php
MakesUrlAssertions.assertPathIsNot
public function assertPathIsNot($path) { $actualPath = parse_url($this->driver->getCurrentURL(), PHP_URL_PATH) ?? ''; PHPUnit::assertNotEquals( $path, $actualPath, "Path [{$path}] should not equal the actual value." ); return $this; }
php
public function assertPathIsNot($path) { $actualPath = parse_url($this->driver->getCurrentURL(), PHP_URL_PATH) ?? ''; PHPUnit::assertNotEquals( $path, $actualPath, "Path [{$path}] should not equal the actual value." ); return $this; }
[ "public", "function", "assertPathIsNot", "(", "$", "path", ")", "{", "$", "actualPath", "=", "parse_url", "(", "$", "this", "->", "driver", "->", "getCurrentURL", "(", ")", ",", "PHP_URL_PATH", ")", "??", "''", ";", "PHPUnit", "::", "assertNotEquals", "(",...
Assert that the current URL path does not match the given path. @param string $path @return $this
[ "Assert", "that", "the", "current", "URL", "path", "does", "not", "match", "the", "given", "path", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Concerns/MakesUrlAssertions.php#L196-L206
train
laravel/dusk
src/Concerns/MakesUrlAssertions.php
MakesUrlAssertions.assertFragmentIs
public function assertFragmentIs($fragment) { $pattern = preg_quote($fragment, '/'); $actualFragment = (string) parse_url($this->driver->executeScript('return window.location.href;'), PHP_URL_FRAGMENT); PHPUnit::assertRegExp( '/^'.str_replace('\*', '.*', $pattern).'$/u', $actua...
php
public function assertFragmentIs($fragment) { $pattern = preg_quote($fragment, '/'); $actualFragment = (string) parse_url($this->driver->executeScript('return window.location.href;'), PHP_URL_FRAGMENT); PHPUnit::assertRegExp( '/^'.str_replace('\*', '.*', $pattern).'$/u', $actua...
[ "public", "function", "assertFragmentIs", "(", "$", "fragment", ")", "{", "$", "pattern", "=", "preg_quote", "(", "$", "fragment", ",", "'/'", ")", ";", "$", "actualFragment", "=", "(", "string", ")", "parse_url", "(", "$", "this", "->", "driver", "->", ...
Assert that the current URL fragment matches the given pattern. @param string $fragment @return $this
[ "Assert", "that", "the", "current", "URL", "fragment", "matches", "the", "given", "pattern", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Concerns/MakesUrlAssertions.php#L214-L226
train
laravel/dusk
src/Concerns/MakesUrlAssertions.php
MakesUrlAssertions.assertFragmentBeginsWith
public function assertFragmentBeginsWith($fragment) { $actualFragment = (string) parse_url($this->driver->executeScript('return window.location.href;'), PHP_URL_FRAGMENT); PHPUnit::assertStringStartsWith( $fragment, $actualFragment, "Actual fragment [$actualFragment] does no...
php
public function assertFragmentBeginsWith($fragment) { $actualFragment = (string) parse_url($this->driver->executeScript('return window.location.href;'), PHP_URL_FRAGMENT); PHPUnit::assertStringStartsWith( $fragment, $actualFragment, "Actual fragment [$actualFragment] does no...
[ "public", "function", "assertFragmentBeginsWith", "(", "$", "fragment", ")", "{", "$", "actualFragment", "=", "(", "string", ")", "parse_url", "(", "$", "this", "->", "driver", "->", "executeScript", "(", "'return window.location.href;'", ")", ",", "PHP_URL_FRAGME...
Assert that the current URL fragment begins with given fragment. @param string $fragment @return $this
[ "Assert", "that", "the", "current", "URL", "fragment", "begins", "with", "given", "fragment", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Concerns/MakesUrlAssertions.php#L234-L244
train
laravel/dusk
src/Concerns/MakesUrlAssertions.php
MakesUrlAssertions.assertFragmentIsNot
public function assertFragmentIsNot($fragment) { $actualFragment = (string) parse_url($this->driver->executeScript('return window.location.href;'), PHP_URL_FRAGMENT); PHPUnit::assertNotEquals( $fragment, $actualFragment, "Fragment [{$fragment}] should not equal the actual va...
php
public function assertFragmentIsNot($fragment) { $actualFragment = (string) parse_url($this->driver->executeScript('return window.location.href;'), PHP_URL_FRAGMENT); PHPUnit::assertNotEquals( $fragment, $actualFragment, "Fragment [{$fragment}] should not equal the actual va...
[ "public", "function", "assertFragmentIsNot", "(", "$", "fragment", ")", "{", "$", "actualFragment", "=", "(", "string", ")", "parse_url", "(", "$", "this", "->", "driver", "->", "executeScript", "(", "'return window.location.href;'", ")", ",", "PHP_URL_FRAGMENT", ...
Assert that the current URL fragment does not match the given fragment. @param string $fragment @return $this
[ "Assert", "that", "the", "current", "URL", "fragment", "does", "not", "match", "the", "given", "fragment", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Concerns/MakesUrlAssertions.php#L252-L262
train
laravel/dusk
src/Concerns/MakesUrlAssertions.php
MakesUrlAssertions.assertQueryStringHas
public function assertQueryStringHas($name, $value = null) { $output = $this->assertHasQueryStringParameter($name); if (is_null($value)) { return $this; } $parsedOutputName = is_array($output[$name]) ? implode(',', $output[$name]) : $output[$name]; $parsedValue...
php
public function assertQueryStringHas($name, $value = null) { $output = $this->assertHasQueryStringParameter($name); if (is_null($value)) { return $this; } $parsedOutputName = is_array($output[$name]) ? implode(',', $output[$name]) : $output[$name]; $parsedValue...
[ "public", "function", "assertQueryStringHas", "(", "$", "name", ",", "$", "value", "=", "null", ")", "{", "$", "output", "=", "$", "this", "->", "assertHasQueryStringParameter", "(", "$", "name", ")", ";", "if", "(", "is_null", "(", "$", "value", ")", ...
Assert that a query string parameter is present and has a given value. @param string $name @param string $value @return $this
[ "Assert", "that", "a", "query", "string", "parameter", "is", "present", "and", "has", "a", "given", "value", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Concerns/MakesUrlAssertions.php#L283-L301
train
laravel/dusk
src/Concerns/MakesUrlAssertions.php
MakesUrlAssertions.assertQueryStringMissing
public function assertQueryStringMissing($name) { $parsedUrl = parse_url($this->driver->getCurrentURL()); if (! array_key_exists('query', $parsedUrl)) { PHPUnit::assertTrue(true); return $this; } parse_str($parsedUrl['query'], $output); PHPUnit::as...
php
public function assertQueryStringMissing($name) { $parsedUrl = parse_url($this->driver->getCurrentURL()); if (! array_key_exists('query', $parsedUrl)) { PHPUnit::assertTrue(true); return $this; } parse_str($parsedUrl['query'], $output); PHPUnit::as...
[ "public", "function", "assertQueryStringMissing", "(", "$", "name", ")", "{", "$", "parsedUrl", "=", "parse_url", "(", "$", "this", "->", "driver", "->", "getCurrentURL", "(", ")", ")", ";", "if", "(", "!", "array_key_exists", "(", "'query'", ",", "$", "...
Assert that the given query string parameter is missing. @param string $name @return $this
[ "Assert", "that", "the", "given", "query", "string", "parameter", "is", "missing", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Concerns/MakesUrlAssertions.php#L309-L327
train
laravel/dusk
src/Concerns/MakesUrlAssertions.php
MakesUrlAssertions.assertHasQueryStringParameter
protected function assertHasQueryStringParameter($name) { $parsedUrl = parse_url($this->driver->getCurrentURL()); PHPUnit::assertArrayHasKey( 'query', $parsedUrl, 'Did not see expected query string in ['.$this->driver->getCurrentURL().'].' ); parse_str($pars...
php
protected function assertHasQueryStringParameter($name) { $parsedUrl = parse_url($this->driver->getCurrentURL()); PHPUnit::assertArrayHasKey( 'query', $parsedUrl, 'Did not see expected query string in ['.$this->driver->getCurrentURL().'].' ); parse_str($pars...
[ "protected", "function", "assertHasQueryStringParameter", "(", "$", "name", ")", "{", "$", "parsedUrl", "=", "parse_url", "(", "$", "this", "->", "driver", "->", "getCurrentURL", "(", ")", ")", ";", "PHPUnit", "::", "assertArrayHasKey", "(", "'query'", ",", ...
Assert that the given query string parameter is present. @param string $name @return array
[ "Assert", "that", "the", "given", "query", "string", "parameter", "is", "present", "." ]
a6ac3e6489dc774445aa9459cdc332104591634a
https://github.com/laravel/dusk/blob/a6ac3e6489dc774445aa9459cdc332104591634a/src/Concerns/MakesUrlAssertions.php#L335-L352
train
JayBizzle/Crawler-Detect
src/CrawlerDetect.php
CrawlerDetect.setUserAgent
public function setUserAgent($userAgent) { if (is_null($userAgent)) { foreach ($this->getUaHttpHeaders() as $altHeader) { if (isset($this->httpHeaders[$altHeader])) { $userAgent .= $this->httpHeaders[$altHeader].' '; } } } ...
php
public function setUserAgent($userAgent) { if (is_null($userAgent)) { foreach ($this->getUaHttpHeaders() as $altHeader) { if (isset($this->httpHeaders[$altHeader])) { $userAgent .= $this->httpHeaders[$altHeader].' '; } } } ...
[ "public", "function", "setUserAgent", "(", "$", "userAgent", ")", "{", "if", "(", "is_null", "(", "$", "userAgent", ")", ")", "{", "foreach", "(", "$", "this", "->", "getUaHttpHeaders", "(", ")", "as", "$", "altHeader", ")", "{", "if", "(", "isset", ...
Set the user agent. @param string $userAgent
[ "Set", "the", "user", "agent", "." ]
ffb1880f8e9610569d3bc70dc90bf07db311471d
https://github.com/JayBizzle/Crawler-Detect/blob/ffb1880f8e9610569d3bc70dc90bf07db311471d/src/CrawlerDetect.php#L143-L154
train
JayBizzle/Crawler-Detect
src/CrawlerDetect.php
CrawlerDetect.isCrawler
public function isCrawler($userAgent = null) { $agent = trim(preg_replace( "/{$this->compiledExclusions}/i", '', $userAgent ?: $this->userAgent )); if ($agent == '') { return false; } $result = preg_match("/{$this->compiledReg...
php
public function isCrawler($userAgent = null) { $agent = trim(preg_replace( "/{$this->compiledExclusions}/i", '', $userAgent ?: $this->userAgent )); if ($agent == '') { return false; } $result = preg_match("/{$this->compiledReg...
[ "public", "function", "isCrawler", "(", "$", "userAgent", "=", "null", ")", "{", "$", "agent", "=", "trim", "(", "preg_replace", "(", "\"/{$this->compiledExclusions}/i\"", ",", "''", ",", "$", "userAgent", "?", ":", "$", "this", "->", "userAgent", ")", ")"...
Check user agent string against the regex. @param string|null $userAgent @return bool
[ "Check", "user", "agent", "string", "against", "the", "regex", "." ]
ffb1880f8e9610569d3bc70dc90bf07db311471d
https://github.com/JayBizzle/Crawler-Detect/blob/ffb1880f8e9610569d3bc70dc90bf07db311471d/src/CrawlerDetect.php#L163-L182
train
irazasyed/telegram-bot-sdk
src/Commands/Command.php
Command.triggerCommand
protected function triggerCommand($command, $arguments = null) { return $this->getCommandBus()->execute($command, $arguments ?: $this->arguments, $this->update); }
php
protected function triggerCommand($command, $arguments = null) { return $this->getCommandBus()->execute($command, $arguments ?: $this->arguments, $this->update); }
[ "protected", "function", "triggerCommand", "(", "$", "command", ",", "$", "arguments", "=", "null", ")", "{", "return", "$", "this", "->", "getCommandBus", "(", ")", "->", "execute", "(", "$", "command", ",", "$", "arguments", "?", ":", "$", "this", "-...
Helper to Trigger other Commands. @param $command @param null $arguments @return mixed
[ "Helper", "to", "Trigger", "other", "Commands", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Commands/Command.php#L151-L154
train
irazasyed/telegram-bot-sdk
src/Keyboard/Keyboard.php
Keyboard.row
public function row() { $property = 'keyboard'; if ($this->isInlineKeyboard()) { $property = 'inline_keyboard'; } $this->items[$property][] = func_get_args(); return $this; }
php
public function row() { $property = 'keyboard'; if ($this->isInlineKeyboard()) { $property = 'inline_keyboard'; } $this->items[$property][] = func_get_args(); return $this; }
[ "public", "function", "row", "(", ")", "{", "$", "property", "=", "'keyboard'", ";", "if", "(", "$", "this", "->", "isInlineKeyboard", "(", ")", ")", "{", "$", "property", "=", "'inline_keyboard'", ";", "}", "$", "this", "->", "items", "[", "$", "pro...
Create a new row in keyboard to add buttons. @return $this
[ "Create", "a", "new", "row", "in", "keyboard", "to", "add", "buttons", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Keyboard/Keyboard.php#L68-L78
train
irazasyed/telegram-bot-sdk
src/Answers/AnswerBus.php
AnswerBus.buildDependencyInjectedAnswer
protected function buildDependencyInjectedAnswer($answerClass) { // check if the command has a constructor if (!method_exists($answerClass, '__construct')) { return new $answerClass(); } // get constructor params $constructorReflector = new \ReflectionMethod($ans...
php
protected function buildDependencyInjectedAnswer($answerClass) { // check if the command has a constructor if (!method_exists($answerClass, '__construct')) { return new $answerClass(); } // get constructor params $constructorReflector = new \ReflectionMethod($ans...
[ "protected", "function", "buildDependencyInjectedAnswer", "(", "$", "answerClass", ")", "{", "// check if the command has a constructor", "if", "(", "!", "method_exists", "(", "$", "answerClass", ",", "'__construct'", ")", ")", "{", "return", "new", "$", "answerClass"...
Use PHP Reflection and Laravel Container to instantiate the answer with type hinted dependencies. @param $answerClass @return object
[ "Use", "PHP", "Reflection", "and", "Laravel", "Container", "to", "instantiate", "the", "answer", "with", "type", "hinted", "dependencies", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Answers/AnswerBus.php#L51-L78
train
irazasyed/telegram-bot-sdk
src/HttpClients/GuzzleHttpClient.php
GuzzleHttpClient.getOptions
private function getOptions(array $headers, $body, $options, $timeOut, $isAsyncRequest = false, $connectTimeOut = 10) { $default_options = [ RequestOptions::HEADERS => $headers, RequestOptions::BODY => $body, RequestOptions::TIMEOUT => $timeOut,...
php
private function getOptions(array $headers, $body, $options, $timeOut, $isAsyncRequest = false, $connectTimeOut = 10) { $default_options = [ RequestOptions::HEADERS => $headers, RequestOptions::BODY => $body, RequestOptions::TIMEOUT => $timeOut,...
[ "private", "function", "getOptions", "(", "array", "$", "headers", ",", "$", "body", ",", "$", "options", ",", "$", "timeOut", ",", "$", "isAsyncRequest", "=", "false", ",", "$", "connectTimeOut", "=", "10", ")", "{", "$", "default_options", "=", "[", ...
Prepares and returns request options. @param array $headers @param $body @param $options @param $timeOut @param $isAsyncRequest @param int $connectTimeOut @return array
[ "Prepares", "and", "returns", "request", "options", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/HttpClients/GuzzleHttpClient.php#L133-L144
train
irazasyed/telegram-bot-sdk
src/BotsManager.php
BotsManager.getBotConfig
public function getBotConfig($name = null) { $name = $name ?: $this->getDefaultBot(); $bots = $this->getConfig('bots'); if (!is_array($config = array_get($bots, $name)) && !$config) { throw new InvalidArgumentException("Bot [$name] not configured."); } $config['...
php
public function getBotConfig($name = null) { $name = $name ?: $this->getDefaultBot(); $bots = $this->getConfig('bots'); if (!is_array($config = array_get($bots, $name)) && !$config) { throw new InvalidArgumentException("Bot [$name] not configured."); } $config['...
[ "public", "function", "getBotConfig", "(", "$", "name", "=", "null", ")", "{", "$", "name", "=", "$", "name", "?", ":", "$", "this", "->", "getDefaultBot", "(", ")", ";", "$", "bots", "=", "$", "this", "->", "getConfig", "(", "'bots'", ")", ";", ...
Get the configuration for a bot. @param string|null $name @throws \InvalidArgumentException @return array
[ "Get", "the", "configuration", "for", "a", "bot", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/BotsManager.php#L69-L81
train
irazasyed/telegram-bot-sdk
src/BotsManager.php
BotsManager.bot
public function bot($name = null) { $name = $name ?: $this->getDefaultBot(); if (!isset($this->bots[$name])) { $this->bots[$name] = $this->makeBot($name); } return $this->bots[$name]; }
php
public function bot($name = null) { $name = $name ?: $this->getDefaultBot(); if (!isset($this->bots[$name])) { $this->bots[$name] = $this->makeBot($name); } return $this->bots[$name]; }
[ "public", "function", "bot", "(", "$", "name", "=", "null", ")", "{", "$", "name", "=", "$", "name", "?", ":", "$", "this", "->", "getDefaultBot", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "bots", "[", "$", "name", "]", ...
Get a bot instance. @param string $name @return Api
[ "Get", "a", "bot", "instance", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/BotsManager.php#L90-L99
train
irazasyed/telegram-bot-sdk
src/BotsManager.php
BotsManager.reconnect
public function reconnect($name = null) { $name = $name ?: $this->getDefaultBot(); $this->disconnect($name); return $this->bot($name); }
php
public function reconnect($name = null) { $name = $name ?: $this->getDefaultBot(); $this->disconnect($name); return $this->bot($name); }
[ "public", "function", "reconnect", "(", "$", "name", "=", "null", ")", "{", "$", "name", "=", "$", "name", "?", ":", "$", "this", "->", "getDefaultBot", "(", ")", ";", "$", "this", "->", "disconnect", "(", "$", "name", ")", ";", "return", "$", "t...
Reconnect to the given bot. @param string $name @return Api
[ "Reconnect", "to", "the", "given", "bot", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/BotsManager.php#L108-L114
train
irazasyed/telegram-bot-sdk
src/BotsManager.php
BotsManager.disconnect
public function disconnect($name = null) { $name = $name ?: $this->getDefaultBot(); unset($this->bots[$name]); }
php
public function disconnect($name = null) { $name = $name ?: $this->getDefaultBot(); unset($this->bots[$name]); }
[ "public", "function", "disconnect", "(", "$", "name", "=", "null", ")", "{", "$", "name", "=", "$", "name", "?", ":", "$", "this", "->", "getDefaultBot", "(", ")", ";", "unset", "(", "$", "this", "->", "bots", "[", "$", "name", "]", ")", ";", "...
Disconnect from the given bot. @param string $name @return void
[ "Disconnect", "from", "the", "given", "bot", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/BotsManager.php#L123-L127
train
irazasyed/telegram-bot-sdk
src/BotsManager.php
BotsManager.parseBotCommands
protected function parseBotCommands(array $commands) { $globalCommands = $this->getConfig('commands', []); $parsedCommands = $this->parseCommands($commands); return $this->deduplicateArray(array_merge($globalCommands, $parsedCommands)); }
php
protected function parseBotCommands(array $commands) { $globalCommands = $this->getConfig('commands', []); $parsedCommands = $this->parseCommands($commands); return $this->deduplicateArray(array_merge($globalCommands, $parsedCommands)); }
[ "protected", "function", "parseBotCommands", "(", "array", "$", "commands", ")", "{", "$", "globalCommands", "=", "$", "this", "->", "getConfig", "(", "'commands'", ",", "[", "]", ")", ";", "$", "parsedCommands", "=", "$", "this", "->", "parseCommands", "(...
Builds the list of commands for the given commands array. @param array $commands @return array An array of commands which includes global and bot specific commands.
[ "Builds", "the", "list", "of", "commands", "for", "the", "given", "commands", "array", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/BotsManager.php#L228-L234
train
irazasyed/telegram-bot-sdk
src/BotsManager.php
BotsManager.parseCommands
protected function parseCommands(array $commands) { if (!is_array($commands)) { return $commands; } $commandGroups = $this->getConfig('command_groups'); $sharedCommands = $this->getConfig('shared_commands'); $results = []; foreach ($commands as $command)...
php
protected function parseCommands(array $commands) { if (!is_array($commands)) { return $commands; } $commandGroups = $this->getConfig('command_groups'); $sharedCommands = $this->getConfig('shared_commands'); $results = []; foreach ($commands as $command)...
[ "protected", "function", "parseCommands", "(", "array", "$", "commands", ")", "{", "if", "(", "!", "is_array", "(", "$", "commands", ")", ")", "{", "return", "$", "commands", ";", "}", "$", "commandGroups", "=", "$", "this", "->", "getConfig", "(", "'c...
Parse an array of commands and build a list. @param array $commands @return array
[ "Parse", "an", "array", "of", "commands", "and", "build", "a", "list", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/BotsManager.php#L243-L277
train
irazasyed/telegram-bot-sdk
src/Api.php
Api.sendSticker
public function sendSticker(array $params) { if (is_file($params['sticker']) && (pathinfo($params['sticker'], PATHINFO_EXTENSION) !== 'webp')) { throw new TelegramSDKException('Invalid Sticker Provided. Supported Format: Webp'); } $response = $this->uploadFile('sendSticker', $pa...
php
public function sendSticker(array $params) { if (is_file($params['sticker']) && (pathinfo($params['sticker'], PATHINFO_EXTENSION) !== 'webp')) { throw new TelegramSDKException('Invalid Sticker Provided. Supported Format: Webp'); } $response = $this->uploadFile('sendSticker', $pa...
[ "public", "function", "sendSticker", "(", "array", "$", "params", ")", "{", "if", "(", "is_file", "(", "$", "params", "[", "'sticker'", "]", ")", "&&", "(", "pathinfo", "(", "$", "params", "[", "'sticker'", "]", ",", "PATHINFO_EXTENSION", ")", "!==", "...
Send .webp stickers. <code> $params = [ 'chat_id' => '', 'sticker' => '', 'disable_notification' => '', 'reply_to_message_id' => '', 'reply_markup' => '', ]; </code> @link https://core.telegram.org/bots/api#sendsticker @param array $params @var int|string $params ['chat_id'] @v...
[ "Send", ".", "webp", "stickers", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Api.php#L433-L442
train
irazasyed/telegram-bot-sdk
src/Api.php
Api.sendChatAction
public function sendChatAction(array $params) { $validActions = [ 'typing', 'upload_photo', 'record_video', 'upload_video', 'record_audio', 'upload_audio', 'upload_document', 'find_location', ]; ...
php
public function sendChatAction(array $params) { $validActions = [ 'typing', 'upload_photo', 'record_video', 'upload_video', 'record_audio', 'upload_audio', 'upload_document', 'find_location', ]; ...
[ "public", "function", "sendChatAction", "(", "array", "$", "params", ")", "{", "$", "validActions", "=", "[", "'typing'", ",", "'upload_photo'", ",", "'record_video'", ",", "'upload_video'", ",", "'record_audio'", ",", "'upload_audio'", ",", "'upload_document'", "...
Broadcast a Chat Action. <code> $params = [ 'chat_id' => '', 'action' => '', ]; </code> @link https://core.telegram.org/bots/api#sendchataction @param array $params @var int|string $params ['chat_id'] @var string $params ['action'] @throws TelegramSDKException @return bool
[ "Broadcast", "a", "Chat", "Action", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Api.php#L660-L680
train
irazasyed/telegram-bot-sdk
src/Api.php
Api.getChatAdministrators
public function getChatAdministrators(array $params) { $response = $this->post('getChatAdministrators', $params); return collect($response->getResult()) ->map(function ($admin) { return new ChatMember($admin); }) ->all(); }
php
public function getChatAdministrators(array $params) { $response = $this->post('getChatAdministrators', $params); return collect($response->getResult()) ->map(function ($admin) { return new ChatMember($admin); }) ->all(); }
[ "public", "function", "getChatAdministrators", "(", "array", "$", "params", ")", "{", "$", "response", "=", "$", "this", "->", "post", "(", "'getChatAdministrators'", ",", "$", "params", ")", ";", "return", "collect", "(", "$", "response", "->", "getResult",...
Get a list of administrators in a chat. <code> $params = [ 'chat_id' => '', ]; </code> @link https://core.telegram.org/bots/api#getchatadministrators @param array $params @var string|int $params ['chat_id'] Unique identifier for the target chat or username of the target supergroup or channel (in the format @chann...
[ "Get", "a", "list", "of", "administrators", "in", "a", "chat", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Api.php#L853-L862
train
irazasyed/telegram-bot-sdk
src/Api.php
Api.answerInlineQuery
public function answerInlineQuery(array $params = []) { if (is_array($params['results'])) { $params['results'] = json_encode($params['results']); } $this->post('answerInlineQuery', $params); return true; }
php
public function answerInlineQuery(array $params = []) { if (is_array($params['results'])) { $params['results'] = json_encode($params['results']); } $this->post('answerInlineQuery', $params); return true; }
[ "public", "function", "answerInlineQuery", "(", "array", "$", "params", "=", "[", "]", ")", "{", "if", "(", "is_array", "(", "$", "params", "[", "'results'", "]", ")", ")", "{", "$", "params", "[", "'results'", "]", "=", "json_encode", "(", "$", "par...
Use this method to send answers to an inline query. <code> $params = [ 'inline_query_id' => '', 'results' => [], 'cache_time' => 0, 'is_personal' => false, 'next_offset' => '', 'switch_pm_text' => '', 'switch_pm_parameter' => '', ]; </code> @link https://core.teleg...
[ "Use", "this", "method", "to", "send", "answers", "to", "an", "inline", "query", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Api.php#L1086-L1095
train
irazasyed/telegram-bot-sdk
src/Api.php
Api.setWebhook
public function setWebhook(array $params) { if (filter_var($params['url'], FILTER_VALIDATE_URL) === false) { throw new TelegramSDKException('Invalid URL Provided'); } if (parse_url($params['url'], PHP_URL_SCHEME) !== 'https') { throw new TelegramSDKException('Invalid...
php
public function setWebhook(array $params) { if (filter_var($params['url'], FILTER_VALIDATE_URL) === false) { throw new TelegramSDKException('Invalid URL Provided'); } if (parse_url($params['url'], PHP_URL_SCHEME) !== 'https') { throw new TelegramSDKException('Invalid...
[ "public", "function", "setWebhook", "(", "array", "$", "params", ")", "{", "if", "(", "filter_var", "(", "$", "params", "[", "'url'", "]", ",", "FILTER_VALIDATE_URL", ")", "===", "false", ")", "{", "throw", "new", "TelegramSDKException", "(", "'Invalid URL P...
Set a Webhook to receive incoming updates via an outgoing webhook. <code> $params = [ 'url' => '', 'certificate' => '', ]; </code> @link https://core.telegram.org/bots/api#setwebhook @param array $params @var string $params ['url'] HTTPS url to send updates to. @var string $params ['certificate'] ...
[ "Set", "a", "Webhook", "to", "receive", "incoming", "updates", "via", "an", "outgoing", "webhook", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Api.php#L1119-L1130
train
irazasyed/telegram-bot-sdk
src/Api.php
Api.getWebhookUpdate
public function getWebhookUpdate($shouldEmitEvent = true) { $body = json_decode(file_get_contents('php://input'), true); $update = new Update($body); if ($shouldEmitEvent) { $this->emitEvent(new UpdateWasReceived($update, $this)); } return $update; }
php
public function getWebhookUpdate($shouldEmitEvent = true) { $body = json_decode(file_get_contents('php://input'), true); $update = new Update($body); if ($shouldEmitEvent) { $this->emitEvent(new UpdateWasReceived($update, $this)); } return $update; }
[ "public", "function", "getWebhookUpdate", "(", "$", "shouldEmitEvent", "=", "true", ")", "{", "$", "body", "=", "json_decode", "(", "file_get_contents", "(", "'php://input'", ")", ",", "true", ")", ";", "$", "update", "=", "new", "Update", "(", "$", "body"...
Returns a webhook update sent by Telegram. Works only if you set a webhook. @see setWebhook @return Update
[ "Returns", "a", "webhook", "update", "sent", "by", "Telegram", ".", "Works", "only", "if", "you", "set", "a", "webhook", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Api.php#L1140-L1151
train
irazasyed/telegram-bot-sdk
src/Api.php
Api.commandsHandler
public function commandsHandler($webhook = false, array $params = []) { if ($webhook) { $update = $this->getWebhookUpdate(); $this->processCommand($update); return $update; } $updates = $this->getUpdates($params); $highestId = -1; foreac...
php
public function commandsHandler($webhook = false, array $params = []) { if ($webhook) { $update = $this->getWebhookUpdate(); $this->processCommand($update); return $update; } $updates = $this->getUpdates($params); $highestId = -1; foreac...
[ "public", "function", "commandsHandler", "(", "$", "webhook", "=", "false", ",", "array", "$", "params", "=", "[", "]", ")", "{", "if", "(", "$", "webhook", ")", "{", "$", "update", "=", "$", "this", "->", "getWebhookUpdate", "(", ")", ";", "$", "t...
Processes Inbound Commands. @param bool $webhook @param array $params @return Update|Update[]
[ "Processes", "Inbound", "Commands", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Api.php#L1317-L1343
train
irazasyed/telegram-bot-sdk
src/Api.php
Api.triggerCommand
public function triggerCommand($name, Update $update) { return $this->getCommandBus()->execute($name, $update->getMessage()->getText(), $update); }
php
public function triggerCommand($name, Update $update) { return $this->getCommandBus()->execute($name, $update->getMessage()->getText(), $update); }
[ "public", "function", "triggerCommand", "(", "$", "name", ",", "Update", "$", "update", ")", "{", "return", "$", "this", "->", "getCommandBus", "(", ")", "->", "execute", "(", "$", "name", ",", "$", "update", "->", "getMessage", "(", ")", "->", "getTex...
Helper to Trigger Commands. @param string $name Command Name @param Update $update Update Object @return mixed
[ "Helper", "to", "Trigger", "Commands", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Api.php#L1367-L1370
train
irazasyed/telegram-bot-sdk
src/Api.php
Api.get
protected function get($endpoint, $params = []) { if (array_key_exists('reply_markup', $params)) { $params['reply_markup'] = (string)$params['reply_markup']; } return $this->sendRequest( 'GET', $endpoint, $params ); }
php
protected function get($endpoint, $params = []) { if (array_key_exists('reply_markup', $params)) { $params['reply_markup'] = (string)$params['reply_markup']; } return $this->sendRequest( 'GET', $endpoint, $params ); }
[ "protected", "function", "get", "(", "$", "endpoint", ",", "$", "params", "=", "[", "]", ")", "{", "if", "(", "array_key_exists", "(", "'reply_markup'", ",", "$", "params", ")", ")", "{", "$", "params", "[", "'reply_markup'", "]", "=", "(", "string", ...
Sends a GET request to Telegram Bot API and returns the result. @param string $endpoint @param array $params @throws TelegramSDKException @return TelegramResponse
[ "Sends", "a", "GET", "request", "to", "Telegram", "Bot", "API", "and", "returns", "the", "result", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Api.php#L1416-L1427
train
irazasyed/telegram-bot-sdk
src/Api.php
Api.post
protected function post($endpoint, array $params = [], $fileUpload = false) { if ($fileUpload) { $params = ['multipart' => $params]; } else { if (array_key_exists('reply_markup', $params)) { $params['reply_markup'] = (string)$params['reply_markup']; ...
php
protected function post($endpoint, array $params = [], $fileUpload = false) { if ($fileUpload) { $params = ['multipart' => $params]; } else { if (array_key_exists('reply_markup', $params)) { $params['reply_markup'] = (string)$params['reply_markup']; ...
[ "protected", "function", "post", "(", "$", "endpoint", ",", "array", "$", "params", "=", "[", "]", ",", "$", "fileUpload", "=", "false", ")", "{", "if", "(", "$", "fileUpload", ")", "{", "$", "params", "=", "[", "'multipart'", "=>", "$", "params", ...
Sends a POST request to Telegram Bot API and returns the result. @param string $endpoint @param array $params @param bool $fileUpload Set true if a file is being uploaded. @return TelegramResponse
[ "Sends", "a", "POST", "request", "to", "Telegram", "Bot", "API", "and", "returns", "the", "result", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Api.php#L1438-L1456
train
irazasyed/telegram-bot-sdk
src/Api.php
Api.sendRequest
protected function sendRequest( $method, $endpoint, array $params = [] ) { $request = $this->request($method, $endpoint, $params); return $this->lastResponse = $this->client->sendRequest($request); }
php
protected function sendRequest( $method, $endpoint, array $params = [] ) { $request = $this->request($method, $endpoint, $params); return $this->lastResponse = $this->client->sendRequest($request); }
[ "protected", "function", "sendRequest", "(", "$", "method", ",", "$", "endpoint", ",", "array", "$", "params", "=", "[", "]", ")", "{", "$", "request", "=", "$", "this", "->", "request", "(", "$", "method", ",", "$", "endpoint", ",", "$", "params", ...
Sends a request to Telegram Bot API and returns the result. @param string $method @param string $endpoint @param array $params @throws TelegramSDKException @return TelegramResponse
[ "Sends", "a", "request", "to", "Telegram", "Bot", "API", "and", "returns", "the", "result", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Api.php#L1504-L1512
train
irazasyed/telegram-bot-sdk
src/Api.php
Api.request
protected function request( $method, $endpoint, array $params = [] ) { return new TelegramRequest( $this->getAccessToken(), $method, $endpoint, $params, $this->isAsyncRequest(), $this->getTimeOut(), $...
php
protected function request( $method, $endpoint, array $params = [] ) { return new TelegramRequest( $this->getAccessToken(), $method, $endpoint, $params, $this->isAsyncRequest(), $this->getTimeOut(), $...
[ "protected", "function", "request", "(", "$", "method", ",", "$", "endpoint", ",", "array", "$", "params", "=", "[", "]", ")", "{", "return", "new", "TelegramRequest", "(", "$", "this", "->", "getAccessToken", "(", ")", ",", "$", "method", ",", "$", ...
Instantiates a new TelegramRequest entity. @param string $method @param string $endpoint @param array $params @return TelegramRequest
[ "Instantiates", "a", "new", "TelegramRequest", "entity", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Api.php#L1523-L1537
train
irazasyed/telegram-bot-sdk
src/Api.php
Api.isValidFileOrUrl
protected function isValidFileOrUrl($name, $contents) { //Don't try to open a url as an actual file when using this method to setWebhook. if ($name == 'url') { return false; } //If a certificate name is passed, we must check for the file existing on the local server, ...
php
protected function isValidFileOrUrl($name, $contents) { //Don't try to open a url as an actual file when using this method to setWebhook. if ($name == 'url') { return false; } //If a certificate name is passed, we must check for the file existing on the local server, ...
[ "protected", "function", "isValidFileOrUrl", "(", "$", "name", ",", "$", "contents", ")", "{", "//Don't try to open a url as an actual file when using this method to setWebhook.", "if", "(", "$", "name", "==", "'url'", ")", "{", "return", "false", ";", "}", "//If a ce...
Determines if the string passed to be uploaded is a valid file on the local file system, or a valid remote URL. @param string $name @param string $contents @return bool
[ "Determines", "if", "the", "string", "passed", "to", "be", "uploaded", "is", "a", "valid", "file", "on", "the", "local", "file", "system", "or", "a", "valid", "remote", "URL", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Api.php#L1666-L1686
train
irazasyed/telegram-bot-sdk
src/Helpers/Emojify.php
Emojify.wordToEmojiReplace
protected function wordToEmojiReplace($line, $replace, $delimiter) { foreach ($replace as $key => $value) { $line = str_replace($delimiter.$key.$delimiter, $value, $line); } return $line; }
php
protected function wordToEmojiReplace($line, $replace, $delimiter) { foreach ($replace as $key => $value) { $line = str_replace($delimiter.$key.$delimiter, $value, $line); } return $line; }
[ "protected", "function", "wordToEmojiReplace", "(", "$", "line", ",", "$", "replace", ",", "$", "delimiter", ")", "{", "foreach", "(", "$", "replace", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "line", "=", "str_replace", "(", "$", "delimiter...
Finds words enclosed by the delimiter and converts them to the appropriate emoji character. @param $line @param $replace @param $delimiter @return mixed
[ "Finds", "words", "enclosed", "by", "the", "delimiter", "and", "converts", "them", "to", "the", "appropriate", "emoji", "character", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Helpers/Emojify.php#L159-L166
train
irazasyed/telegram-bot-sdk
src/Helpers/Emojify.php
Emojify.emojiToWordReplace
protected function emojiToWordReplace($line, $replace, $delimiter) { foreach ($replace as $key => $value) { $line = str_replace($key, $delimiter.$value.$delimiter, $line); } return $line; }
php
protected function emojiToWordReplace($line, $replace, $delimiter) { foreach ($replace as $key => $value) { $line = str_replace($key, $delimiter.$value.$delimiter, $line); } return $line; }
[ "protected", "function", "emojiToWordReplace", "(", "$", "line", ",", "$", "replace", ",", "$", "delimiter", ")", "{", "foreach", "(", "$", "replace", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "line", "=", "str_replace", "(", "$", "key", "...
Finds emojis and replaces them with text enclosed by the delimiter @param $line @param $replace @param $delimiter @return mixed
[ "Finds", "emojis", "and", "replaces", "them", "with", "text", "enclosed", "by", "the", "delimiter" ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Helpers/Emojify.php#L177-L184
train
irazasyed/telegram-bot-sdk
src/Helpers/Emojify.php
Emojify.getEmojiMap
protected function getEmojiMap() { if (!isset($this->emojiMapFile)) { $this->emojiMapFile = realpath(__DIR__.self::DEFAULT_EMOJI_MAP_FILE); } if (!file_exists($this->emojiMapFile)) { throw new TelegramEmojiMapFileNotFoundException(); } return json_de...
php
protected function getEmojiMap() { if (!isset($this->emojiMapFile)) { $this->emojiMapFile = realpath(__DIR__.self::DEFAULT_EMOJI_MAP_FILE); } if (!file_exists($this->emojiMapFile)) { throw new TelegramEmojiMapFileNotFoundException(); } return json_de...
[ "protected", "function", "getEmojiMap", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "emojiMapFile", ")", ")", "{", "$", "this", "->", "emojiMapFile", "=", "realpath", "(", "__DIR__", ".", "self", "::", "DEFAULT_EMOJI_MAP_FILE", ")", "...
Get Emoji Map Array. @return array @throws TelegramEmojiMapFileNotFoundException
[ "Get", "Emoji", "Map", "Array", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Helpers/Emojify.php#L192-L203
train
irazasyed/telegram-bot-sdk
src/Helpers/Emojify.php
Emojify.setupEmojiMaps
protected function setupEmojiMaps() { $this->emojiMap = $this->getEmojiMap(); $this->wordMap = array_flip($this->emojiMap); }
php
protected function setupEmojiMaps() { $this->emojiMap = $this->getEmojiMap(); $this->wordMap = array_flip($this->emojiMap); }
[ "protected", "function", "setupEmojiMaps", "(", ")", "{", "$", "this", "->", "emojiMap", "=", "$", "this", "->", "getEmojiMap", "(", ")", ";", "$", "this", "->", "wordMap", "=", "array_flip", "(", "$", "this", "->", "emojiMap", ")", ";", "}" ]
Setup Emoji Maps. @throws TelegramEmojiMapFileNotFoundException
[ "Setup", "Emoji", "Maps", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Helpers/Emojify.php#L210-L214
train
irazasyed/telegram-bot-sdk
src/TelegramResponse.php
TelegramResponse.decodeBody
public function decodeBody() { $this->decodedBody = json_decode($this->body, true); if ($this->decodedBody === null) { $this->decodedBody = []; parse_str($this->body, $this->decodedBody); } if (!is_array($this->decodedBody)) { $this->decodedBody ...
php
public function decodeBody() { $this->decodedBody = json_decode($this->body, true); if ($this->decodedBody === null) { $this->decodedBody = []; parse_str($this->body, $this->decodedBody); } if (!is_array($this->decodedBody)) { $this->decodedBody ...
[ "public", "function", "decodeBody", "(", ")", "{", "$", "this", "->", "decodedBody", "=", "json_decode", "(", "$", "this", "->", "body", ",", "true", ")", ";", "if", "(", "$", "this", "->", "decodedBody", "===", "null", ")", "{", "$", "this", "->", ...
Converts raw API response to proper decoded response.
[ "Converts", "raw", "API", "response", "to", "proper", "decoded", "response", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/TelegramResponse.php#L200-L216
train
irazasyed/telegram-bot-sdk
src/Objects/Message.php
Message.isType
public function isType($type) { if ($this->has(strtolower($type))) { return true; } return $this->detectType() === $type; }
php
public function isType($type) { if ($this->has(strtolower($type))) { return true; } return $this->detectType() === $type; }
[ "public", "function", "isType", "(", "$", "type", ")", "{", "if", "(", "$", "this", "->", "has", "(", "strtolower", "(", "$", "type", ")", ")", ")", "{", "return", "true", ";", "}", "return", "$", "this", "->", "detectType", "(", ")", "===", "$",...
Determine if the message is of given type @param string $type @return bool
[ "Determine", "if", "the", "message", "is", "of", "given", "type" ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Objects/Message.php#L96-L103
train
irazasyed/telegram-bot-sdk
src/Exceptions/TelegramResponseException.php
TelegramResponseException.create
public static function create(TelegramResponse $response) { $data = $response->getDecodedBody(); $code = null; $message = null; if (isset($data['ok'], $data['error_code']) && $data['ok'] === false) { $code = $data['error_code']; $message = isset($data['descri...
php
public static function create(TelegramResponse $response) { $data = $response->getDecodedBody(); $code = null; $message = null; if (isset($data['ok'], $data['error_code']) && $data['ok'] === false) { $code = $data['error_code']; $message = isset($data['descri...
[ "public", "static", "function", "create", "(", "TelegramResponse", "$", "response", ")", "{", "$", "data", "=", "$", "response", "->", "getDecodedBody", "(", ")", ";", "$", "code", "=", "null", ";", "$", "message", "=", "null", ";", "if", "(", "isset",...
A factory for creating the appropriate exception based on the response from Telegram. @param TelegramResponse $response The response that threw the exception. @return TelegramResponseException
[ "A", "factory", "for", "creating", "the", "appropriate", "exception", "based", "on", "the", "response", "from", "Telegram", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/Exceptions/TelegramResponseException.php#L46-L59
train
irazasyed/telegram-bot-sdk
src/FileUpload/InputFile.php
InputFile.open
public function open() { if (is_resource($this->path)) { return $this->path; } if (!$this->isRemoteFile() && !is_readable($this->path)) { throw new TelegramSDKException('Failed to create InputFile entity. Unable to read resource: '.$this->path.'.'); } ...
php
public function open() { if (is_resource($this->path)) { return $this->path; } if (!$this->isRemoteFile() && !is_readable($this->path)) { throw new TelegramSDKException('Failed to create InputFile entity. Unable to read resource: '.$this->path.'.'); } ...
[ "public", "function", "open", "(", ")", "{", "if", "(", "is_resource", "(", "$", "this", "->", "path", ")", ")", "{", "return", "$", "this", "->", "path", ";", "}", "if", "(", "!", "$", "this", "->", "isRemoteFile", "(", ")", "&&", "!", "is_reada...
Opens file stream. @throws TelegramSDKException @return resource
[ "Opens", "file", "stream", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/FileUpload/InputFile.php#L52-L63
train
irazasyed/telegram-bot-sdk
src/TelegramClient.php
TelegramClient.prepareRequest
public function prepareRequest(TelegramRequest $request) { $url = $this->getBaseBotUrl().$request->getAccessToken().'/'.$request->getEndpoint(); return [ $url, $request->getMethod(), $request->getHeaders(), $request->isAsyncRequest(), ]; }
php
public function prepareRequest(TelegramRequest $request) { $url = $this->getBaseBotUrl().$request->getAccessToken().'/'.$request->getEndpoint(); return [ $url, $request->getMethod(), $request->getHeaders(), $request->isAsyncRequest(), ]; }
[ "public", "function", "prepareRequest", "(", "TelegramRequest", "$", "request", ")", "{", "$", "url", "=", "$", "this", "->", "getBaseBotUrl", "(", ")", ".", "$", "request", "->", "getAccessToken", "(", ")", ".", "'/'", ".", "$", "request", "->", "getEnd...
Prepares the API request for sending to the client handler. @param TelegramRequest $request @return array
[ "Prepares", "the", "API", "request", "for", "sending", "to", "the", "client", "handler", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/TelegramClient.php#L83-L93
train
irazasyed/telegram-bot-sdk
src/TelegramClient.php
TelegramClient.sendRequest
public function sendRequest(TelegramRequest $request) { list($url, $method, $headers, $isAsyncRequest) = $this->prepareRequest($request); $timeOut = $request->getTimeOut(); $connectTimeOut = $request->getConnectTimeOut(); $options = $this->getOptions($request, $method); $r...
php
public function sendRequest(TelegramRequest $request) { list($url, $method, $headers, $isAsyncRequest) = $this->prepareRequest($request); $timeOut = $request->getTimeOut(); $connectTimeOut = $request->getConnectTimeOut(); $options = $this->getOptions($request, $method); $r...
[ "public", "function", "sendRequest", "(", "TelegramRequest", "$", "request", ")", "{", "list", "(", "$", "url", ",", "$", "method", ",", "$", "headers", ",", "$", "isAsyncRequest", ")", "=", "$", "this", "->", "prepareRequest", "(", "$", "request", ")", ...
Send an API request and process the result. @param TelegramRequest $request @throws TelegramSDKException @return TelegramResponse
[ "Send", "an", "API", "request", "and", "process", "the", "result", "." ]
2109011c2ad2a43dd9d874fd98b3e68bc826769c
https://github.com/irazasyed/telegram-bot-sdk/blob/2109011c2ad2a43dd9d874fd98b3e68bc826769c/src/TelegramClient.php#L104-L122
train
phpMv/ubiquity
src/Ubiquity/controllers/Startup.php
Startup.run
public static function run(array &$config) { self::$config = $config; self::startTemplateEngine ( $config ); if (isset ( $config ['sessionName'] )) USession::start ( $config ['sessionName'] ); self::forward ( $_GET ['c'] ); }
php
public static function run(array &$config) { self::$config = $config; self::startTemplateEngine ( $config ); if (isset ( $config ['sessionName'] )) USession::start ( $config ['sessionName'] ); self::forward ( $_GET ['c'] ); }
[ "public", "static", "function", "run", "(", "array", "&", "$", "config", ")", "{", "self", "::", "$", "config", "=", "$", "config", ";", "self", "::", "startTemplateEngine", "(", "$", "config", ")", ";", "if", "(", "isset", "(", "$", "config", "[", ...
Handles the request @param array $config The loaded config array
[ "Handles", "the", "request" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/Startup.php#L68-L74
train
phpMv/ubiquity
src/Ubiquity/controllers/Startup.php
Startup.forward
public static function forward($url, $initialize = true, $finalize = true) { $u = self::parseUrl ( $url ); if (is_array ( Router::getRoutes () ) && ($ru = Router::getRoute ( $url )) !== false) { if (\is_array ( $ru )) { if (is_callable ( $ru [0] )) { self::runCallable ( $ru ); } else { self::_p...
php
public static function forward($url, $initialize = true, $finalize = true) { $u = self::parseUrl ( $url ); if (is_array ( Router::getRoutes () ) && ($ru = Router::getRoute ( $url )) !== false) { if (\is_array ( $ru )) { if (is_callable ( $ru [0] )) { self::runCallable ( $ru ); } else { self::_p...
[ "public", "static", "function", "forward", "(", "$", "url", ",", "$", "initialize", "=", "true", ",", "$", "finalize", "=", "true", ")", "{", "$", "u", "=", "self", "::", "parseUrl", "(", "$", "url", ")", ";", "if", "(", "is_array", "(", "Router", ...
Forwards to url @param string $url The url to forward to @param boolean $initialize If true, the **initialize** method of the controller is called @param boolean $finalize If true, the **finalize** method of the controller is called
[ "Forwards", "to", "url" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/Startup.php#L83-L100
train
phpMv/ubiquity
src/Ubiquity/controllers/Startup.php
Startup.runAction
public static function runAction(array &$u, $initialize = true, $finalize = true) { $ctrl = $u [0]; self::$controller = $ctrl; self::$action = "index"; self::$actionParams = [ ]; if (\sizeof ( $u ) > 1) self::$action = $u [1]; if (\sizeof ( $u ) > 2) self::$actionParams = array_slice ( $u, 2 ); $co...
php
public static function runAction(array &$u, $initialize = true, $finalize = true) { $ctrl = $u [0]; self::$controller = $ctrl; self::$action = "index"; self::$actionParams = [ ]; if (\sizeof ( $u ) > 1) self::$action = $u [1]; if (\sizeof ( $u ) > 2) self::$actionParams = array_slice ( $u, 2 ); $co...
[ "public", "static", "function", "runAction", "(", "array", "&", "$", "u", ",", "$", "initialize", "=", "true", ",", "$", "finalize", "=", "true", ")", "{", "$", "ctrl", "=", "$", "u", "[", "0", "]", ";", "self", "::", "$", "controller", "=", "$",...
Runs an action on a controller @param array $u An array containing controller, action and parameters @param boolean $initialize If true, the **initialize** method of the controller is called @param boolean $finalize If true, the **finalize** method of the controller is called
[ "Runs", "an", "action", "on", "a", "controller" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/Startup.php#L122-L148
train
phpMv/ubiquity
src/Ubiquity/controllers/Startup.php
Startup.runCallable
public static function runCallable(array &$u) { self::$actionParams = [ ]; if (\sizeof ( $u ) > 1) { self::$actionParams = array_slice ( $u, 1 ); } if (isset ( self::$config ['di'] )) { $di = self::$config ['di']; if (\is_array ( $di )) { self::$actionParams = array_merge ( self::$actionParams, $di...
php
public static function runCallable(array &$u) { self::$actionParams = [ ]; if (\sizeof ( $u ) > 1) { self::$actionParams = array_slice ( $u, 1 ); } if (isset ( self::$config ['di'] )) { $di = self::$config ['di']; if (\is_array ( $di )) { self::$actionParams = array_merge ( self::$actionParams, $di...
[ "public", "static", "function", "runCallable", "(", "array", "&", "$", "u", ")", "{", "self", "::", "$", "actionParams", "=", "[", "]", ";", "if", "(", "\\", "sizeof", "(", "$", "u", ")", ">", "1", ")", "{", "self", "::", "$", "actionParams", "="...
Runs a callback @param array $u An array containing a callback, and some parameters
[ "Runs", "a", "callback" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/Startup.php#L155-L167
train
phpMv/ubiquity
src/Ubiquity/controllers/Startup.php
Startup.runAsString
public static function runAsString(array &$u, $initialize = true, $finalize = true) { \ob_start (); self::runAction ( $u, $initialize, $finalize ); return \ob_get_clean (); }
php
public static function runAsString(array &$u, $initialize = true, $finalize = true) { \ob_start (); self::runAction ( $u, $initialize, $finalize ); return \ob_get_clean (); }
[ "public", "static", "function", "runAsString", "(", "array", "&", "$", "u", ",", "$", "initialize", "=", "true", ",", "$", "finalize", "=", "true", ")", "{", "\\", "ob_start", "(", ")", ";", "self", "::", "runAction", "(", "$", "u", ",", "$", "init...
Runs an action on a controller and returns a string @param array $u @param boolean $initialize If true, the **initialize** method of the controller is called @param boolean $finalize If true, the **finalize** method of the controller is called @return string
[ "Runs", "an", "action", "on", "a", "controller", "and", "returns", "a", "string" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/Startup.php#L203-L207
train
phpMv/ubiquity
src/Ubiquity/controllers/auth/AuthController.php
AuthController.noAccess
public function noAccess($urlParts) { if (! is_array ( $urlParts )) { $urlParts = explode ( ".", $urlParts ); } USession::set ( "urlParts", $urlParts ); $fMessage = $this->_noAccessMsg; $this->noAccessMessage ( $fMessage ); $message = $this->fMessage ( $fMessage->parseContent ( [ "url" => implode ( "/", ...
php
public function noAccess($urlParts) { if (! is_array ( $urlParts )) { $urlParts = explode ( ".", $urlParts ); } USession::set ( "urlParts", $urlParts ); $fMessage = $this->_noAccessMsg; $this->noAccessMessage ( $fMessage ); $message = $this->fMessage ( $fMessage->parseContent ( [ "url" => implode ( "/", ...
[ "public", "function", "noAccess", "(", "$", "urlParts", ")", "{", "if", "(", "!", "is_array", "(", "$", "urlParts", ")", ")", "{", "$", "urlParts", "=", "explode", "(", "\".\"", ",", "$", "urlParts", ")", ";", "}", "USession", "::", "set", "(", "\"...
Action called when the user does not have access rights to a requested resource @param array|string $urlParts
[ "Action", "called", "when", "the", "user", "does", "not", "have", "access", "rights", "to", "a", "requested", "resource" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/auth/AuthController.php#L76-L91
train
phpMv/ubiquity
src/Ubiquity/controllers/auth/AuthController.php
AuthController.connect
public function connect() { if (URequest::isPost ()) { if ($connected = $this->_connect ()) { if (isset ( $_POST ["ck-remember"] )) { $this->rememberMe ( $connected ); } if (USession::exists ( $this->_attemptsSessionKey )) { USession::delete ( $this->_attemptsSessionKey ); } $this->on...
php
public function connect() { if (URequest::isPost ()) { if ($connected = $this->_connect ()) { if (isset ( $_POST ["ck-remember"] )) { $this->rememberMe ( $connected ); } if (USession::exists ( $this->_attemptsSessionKey )) { USession::delete ( $this->_attemptsSessionKey ); } $this->on...
[ "public", "function", "connect", "(", ")", "{", "if", "(", "URequest", "::", "isPost", "(", ")", ")", "{", "if", "(", "$", "connected", "=", "$", "this", "->", "_connect", "(", ")", ")", "{", "if", "(", "isset", "(", "$", "_POST", "[", "\"ck-reme...
Override to implement the complete connection procedure
[ "Override", "to", "implement", "the", "complete", "connection", "procedure" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/auth/AuthController.php#L96-L110
train
phpMv/ubiquity
src/Ubiquity/controllers/auth/AuthController.php
AuthController.badLogin
public function badLogin() { $fMessage = new FlashMessage ( "Invalid creditentials!", "Connection problem", "warning", "warning circle" ); $this->badLoginMessage ( $fMessage ); $attemptsMessage = ""; if (($nbAttempsMax = $this->attemptsNumber ()) !== null) { $nb = USession::getTmp ( $this->_attemptsSessionKe...
php
public function badLogin() { $fMessage = new FlashMessage ( "Invalid creditentials!", "Connection problem", "warning", "warning circle" ); $this->badLoginMessage ( $fMessage ); $attemptsMessage = ""; if (($nbAttempsMax = $this->attemptsNumber ()) !== null) { $nb = USession::getTmp ( $this->_attemptsSessionKe...
[ "public", "function", "badLogin", "(", ")", "{", "$", "fMessage", "=", "new", "FlashMessage", "(", "\"Invalid creditentials!\"", ",", "\"Connection problem\"", ",", "\"warning\"", ",", "\"warning circle\"", ")", ";", "$", "this", "->", "badLoginMessage", "(", "$",...
Default Action for invalid creditentials
[ "Default", "Action", "for", "invalid", "creditentials" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/auth/AuthController.php#L115-L137
train
phpMv/ubiquity
src/Ubiquity/controllers/auth/AuthController.php
AuthController.terminate
public function terminate() { USession::terminate (); $fMessage = new FlashMessage ( "You have been properly disconnected!", "Logout", "success", "checkmark" ); $this->terminateMessage ( $fMessage ); $message = $this->fMessage ( $fMessage ); $this->authLoadView ( $this->_getFiles ()->getViewNoAccess (), [ "_m...
php
public function terminate() { USession::terminate (); $fMessage = new FlashMessage ( "You have been properly disconnected!", "Logout", "success", "checkmark" ); $this->terminateMessage ( $fMessage ); $message = $this->fMessage ( $fMessage ); $this->authLoadView ( $this->_getFiles ()->getViewNoAccess (), [ "_m...
[ "public", "function", "terminate", "(", ")", "{", "USession", "::", "terminate", "(", ")", ";", "$", "fMessage", "=", "new", "FlashMessage", "(", "\"You have been properly disconnected!\"", ",", "\"Logout\"", ",", "\"success\"", ",", "\"checkmark\"", ")", ";", "...
Logout action Terminate the session and display a logout message
[ "Logout", "action", "Terminate", "the", "session", "and", "display", "a", "logout", "message" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/auth/AuthController.php#L143-L149
train
phpMv/ubiquity
src/Ubiquity/controllers/auth/AuthController.php
AuthController.info
public function info($force = null) { if (isset ( $force )) { $displayInfoAsString = ($force === true) ? true : false; } else { $displayInfoAsString = $this->_displayInfoAsString (); } return $this->loadView ( $this->_getFiles ()->getViewInfo (), [ "connected" => USession::get ( $this->_getUserSessionKey ...
php
public function info($force = null) { if (isset ( $force )) { $displayInfoAsString = ($force === true) ? true : false; } else { $displayInfoAsString = $this->_displayInfoAsString (); } return $this->loadView ( $this->_getFiles ()->getViewInfo (), [ "connected" => USession::get ( $this->_getUserSessionKey ...
[ "public", "function", "info", "(", "$", "force", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "force", ")", ")", "{", "$", "displayInfoAsString", "=", "(", "$", "force", "===", "true", ")", "?", "true", ":", "false", ";", "}", "else", "{"...
Action displaying the logged user information if _displayInfoAsString returns true, use _infoUser var in views to display user info @return string|null
[ "Action", "displaying", "the", "logged", "user", "information", "if", "_displayInfoAsString", "returns", "true", "use", "_infoUser", "var", "in", "views", "to", "display", "user", "info" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/auth/AuthController.php#L166-L173
train
phpMv/ubiquity
src/Ubiquity/controllers/auth/AuthController.php
AuthController._autoConnect
public function _autoConnect() { $cookie = $this->getCookieUser (); if (isset ( $cookie )) { $user = $this->fromCookie ( $cookie ); if (isset ( $user )) { USession::set ( $this->_getUserSessionKey (), $user ); } } }
php
public function _autoConnect() { $cookie = $this->getCookieUser (); if (isset ( $cookie )) { $user = $this->fromCookie ( $cookie ); if (isset ( $user )) { USession::set ( $this->_getUserSessionKey (), $user ); } } }
[ "public", "function", "_autoConnect", "(", ")", "{", "$", "cookie", "=", "$", "this", "->", "getCookieUser", "(", ")", ";", "if", "(", "isset", "(", "$", "cookie", ")", ")", "{", "$", "user", "=", "$", "this", "->", "fromCookie", "(", "$", "cookie"...
Auto connect the user
[ "Auto", "connect", "the", "user" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/auth/AuthController.php#L204-L212
train
phpMv/ubiquity
src/Ubiquity/contents/transformation/TransformersManager.php
TransformersManager.start
public static function start() { $transformers = [ ]; if (CacheManager::$cache->exists ( self::$key )) { $transformers = CacheManager::$cache->fetch ( self::$key ); } self::$transformers = array_merge ( self::$transformers, $transformers ); }
php
public static function start() { $transformers = [ ]; if (CacheManager::$cache->exists ( self::$key )) { $transformers = CacheManager::$cache->fetch ( self::$key ); } self::$transformers = array_merge ( self::$transformers, $transformers ); }
[ "public", "static", "function", "start", "(", ")", "{", "$", "transformers", "=", "[", "]", ";", "if", "(", "CacheManager", "::", "$", "cache", "->", "exists", "(", "self", "::", "$", "key", ")", ")", "{", "$", "transformers", "=", "CacheManager", ":...
Do not use at runtime !
[ "Do", "not", "use", "at", "runtime", "!" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/contents/transformation/TransformersManager.php#L38-L44
train
phpMv/ubiquity
src/Ubiquity/cache/CacheManager.php
CacheManager.start
public static function start(&$config) { self::$cacheDirectory = self::initialGetCacheDirectory ( $config ); $cacheDirectory = \ROOT . \DS . self::$cacheDirectory; Annotations::$config ['cache'] = new AnnotationCache ( $cacheDirectory . '/annotations' ); self::register ( Annotations::getManager () ); self::ge...
php
public static function start(&$config) { self::$cacheDirectory = self::initialGetCacheDirectory ( $config ); $cacheDirectory = \ROOT . \DS . self::$cacheDirectory; Annotations::$config ['cache'] = new AnnotationCache ( $cacheDirectory . '/annotations' ); self::register ( Annotations::getManager () ); self::ge...
[ "public", "static", "function", "start", "(", "&", "$", "config", ")", "{", "self", "::", "$", "cacheDirectory", "=", "self", "::", "initialGetCacheDirectory", "(", "$", "config", ")", ";", "$", "cacheDirectory", "=", "\\", "ROOT", ".", "\\", "DS", ".", ...
Starts the cache in dev mode, for generating the other caches Do not use in production @param array $config
[ "Starts", "the", "cache", "in", "dev", "mode", "for", "generating", "the", "other", "caches", "Do", "not", "use", "in", "production" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/cache/CacheManager.php#L41-L47
train
phpMv/ubiquity
src/Ubiquity/cache/CacheManager.php
CacheManager.startProd
public static function startProd(&$config) { self::$cacheDirectory = self::initialGetCacheDirectory ( $config ); $cacheDirectory = \ROOT . \DS . self::$cacheDirectory; self::getCacheInstance ( $config, $cacheDirectory, ".cache" ); }
php
public static function startProd(&$config) { self::$cacheDirectory = self::initialGetCacheDirectory ( $config ); $cacheDirectory = \ROOT . \DS . self::$cacheDirectory; self::getCacheInstance ( $config, $cacheDirectory, ".cache" ); }
[ "public", "static", "function", "startProd", "(", "&", "$", "config", ")", "{", "self", "::", "$", "cacheDirectory", "=", "self", "::", "initialGetCacheDirectory", "(", "$", "config", ")", ";", "$", "cacheDirectory", "=", "\\", "ROOT", ".", "\\", "DS", "...
Starts the cache for production @param array $config
[ "Starts", "the", "cache", "for", "production" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/cache/CacheManager.php#L54-L58
train
phpMv/ubiquity
src/Ubiquity/cache/CacheManager.php
CacheManager.checkCache
public static function checkCache(&$config, $silent = false) { $dirs = self::getCacheDirectories ( $config, $silent ); foreach ( $dirs as $dir ) { self::safeMkdir ( $dir ); } return $dirs; }
php
public static function checkCache(&$config, $silent = false) { $dirs = self::getCacheDirectories ( $config, $silent ); foreach ( $dirs as $dir ) { self::safeMkdir ( $dir ); } return $dirs; }
[ "public", "static", "function", "checkCache", "(", "&", "$", "config", ",", "$", "silent", "=", "false", ")", "{", "$", "dirs", "=", "self", "::", "getCacheDirectories", "(", "$", "config", ",", "$", "silent", ")", ";", "foreach", "(", "$", "dirs", "...
Checks the existence of cache subdirectories and returns an array of cache folders @param array $config @param boolean $silent @return string[]
[ "Checks", "the", "existence", "of", "cache", "subdirectories", "and", "returns", "an", "array", "of", "cache", "folders" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/cache/CacheManager.php#L114-L120
train
phpMv/ubiquity
src/Ubiquity/cache/CacheManager.php
CacheManager.clearCache
public static function clearCache(&$config, $type = "all") { $cacheDirectories = self::checkCache ( $config ); $cacheDirs = [ "annotations","controllers","models","queries","views","contents" ]; foreach ( $cacheDirs as $typeRef ) { self::_clearCache ( $cacheDirectories, $type, $typeRef ); } }
php
public static function clearCache(&$config, $type = "all") { $cacheDirectories = self::checkCache ( $config ); $cacheDirs = [ "annotations","controllers","models","queries","views","contents" ]; foreach ( $cacheDirs as $typeRef ) { self::_clearCache ( $cacheDirectories, $type, $typeRef ); } }
[ "public", "static", "function", "clearCache", "(", "&", "$", "config", ",", "$", "type", "=", "\"all\"", ")", "{", "$", "cacheDirectories", "=", "self", "::", "checkCache", "(", "$", "config", ")", ";", "$", "cacheDirs", "=", "[", "\"annotations\"", ",",...
Deletes files from a cache type @param array $config @param string $type
[ "Deletes", "files", "from", "a", "cache", "type" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/cache/CacheManager.php#L160-L166
train
phpMv/ubiquity
src/Ubiquity/utils/git/UGitRepository.php
UGitRepository.getModifiedFiles
public function getModifiedFiles() { try { return $this->extractFromCommand ( 'git diff --name-status HEAD', function ($array) { $array = trim ( preg_replace ( '!\s+!', ' ', $array ) ); return explode ( ' ', $array ); } ); } catch ( \Cz\Git\GitException $e ) { return [ ]; } }
php
public function getModifiedFiles() { try { return $this->extractFromCommand ( 'git diff --name-status HEAD', function ($array) { $array = trim ( preg_replace ( '!\s+!', ' ', $array ) ); return explode ( ' ', $array ); } ); } catch ( \Cz\Git\GitException $e ) { return [ ]; } }
[ "public", "function", "getModifiedFiles", "(", ")", "{", "try", "{", "return", "$", "this", "->", "extractFromCommand", "(", "'git diff --name-status HEAD'", ",", "function", "(", "$", "array", ")", "{", "$", "array", "=", "trim", "(", "preg_replace", "(", "...
Returns list of modified files in repo. @return string[]|NULL NULL => no files modified
[ "Returns", "list", "of", "modified", "files", "in", "repo", "." ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/git/UGitRepository.php#L108-L117
train
phpMv/ubiquity
src/Ubiquity/utils/git/UGitRepository.php
UGitRepository.getRemoteUrl
public function getRemoteUrl() { try { $values = $this->extractFromCommand ( 'git config --get remote.origin.url', function ($str) { return trim ( $str ); } ); if (isset ( $values )) { return implode ( " ", $values ); } } catch ( \Cz\Git\GitException $e ) { return ""; } return ""; }
php
public function getRemoteUrl() { try { $values = $this->extractFromCommand ( 'git config --get remote.origin.url', function ($str) { return trim ( $str ); } ); if (isset ( $values )) { return implode ( " ", $values ); } } catch ( \Cz\Git\GitException $e ) { return ""; } return ""; }
[ "public", "function", "getRemoteUrl", "(", ")", "{", "try", "{", "$", "values", "=", "$", "this", "->", "extractFromCommand", "(", "'git config --get remote.origin.url'", ",", "function", "(", "$", "str", ")", "{", "return", "trim", "(", "$", "str", ")", "...
Returns the remote URL @return string
[ "Returns", "the", "remote", "URL" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/git/UGitRepository.php#L146-L158
train
phpMv/ubiquity
src/Ubiquity/controllers/rest/RestBaseController.php
RestBaseController._get
public function _get($condition = "1=1", $include = false, $useCache = false) { try { $condition = $this->getCondition ( $condition ); $include = $this->getInclude ( $include ); $useCache = UString::isBooleanTrue ( $useCache ); $datas = DAO::getAll ( $this->model, $condition, $include, null, $useCache ); ...
php
public function _get($condition = "1=1", $include = false, $useCache = false) { try { $condition = $this->getCondition ( $condition ); $include = $this->getInclude ( $include ); $useCache = UString::isBooleanTrue ( $useCache ); $datas = DAO::getAll ( $this->model, $condition, $include, null, $useCache ); ...
[ "public", "function", "_get", "(", "$", "condition", "=", "\"1=1\"", ",", "$", "include", "=", "false", ",", "$", "useCache", "=", "false", ")", "{", "try", "{", "$", "condition", "=", "$", "this", "->", "getCondition", "(", "$", "condition", ")", ";...
Returns a list of objects from the server. @param string $condition the sql Where part @param boolean|string $include if true, loads associate members with associations, if string, example : client.*,commands @param boolean $useCache
[ "Returns", "a", "list", "of", "objects", "from", "the", "server", "." ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/rest/RestBaseController.php#L123-L134
train
phpMv/ubiquity
src/Ubiquity/assets/AssetsManager.php
AssetsManager.getUrl
public static function getUrl($resource, $absolute = false) { if (strpos ( $resource, '//' ) !== false) { return $resource; } if ($absolute) { return self::$siteURL . self::ASSETS_FOLDER . $resource; } return ltrim ( self::ASSETS_FOLDER, '/' ) . $resource; }
php
public static function getUrl($resource, $absolute = false) { if (strpos ( $resource, '//' ) !== false) { return $resource; } if ($absolute) { return self::$siteURL . self::ASSETS_FOLDER . $resource; } return ltrim ( self::ASSETS_FOLDER, '/' ) . $resource; }
[ "public", "static", "function", "getUrl", "(", "$", "resource", ",", "$", "absolute", "=", "false", ")", "{", "if", "(", "strpos", "(", "$", "resource", ",", "'//'", ")", "!==", "false", ")", "{", "return", "$", "resource", ";", "}", "if", "(", "$"...
Returns the absolute or relative url to the resource. @param string $resource @param boolean $absolute @return string
[ "Returns", "the", "absolute", "or", "relative", "url", "to", "the", "resource", "." ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/assets/AssetsManager.php#L56-L64
train
phpMv/ubiquity
src/Ubiquity/assets/AssetsManager.php
AssetsManager.getThemeUrl
public static function getThemeUrl($theme, $resource, $absolute = false) { if ($absolute) { return self::$siteURL . self::ASSETS_FOLDER . $theme . '/' . $resource; } return ltrim ( self::ASSETS_FOLDER, '/' ) . $theme . '/' . $resource; }
php
public static function getThemeUrl($theme, $resource, $absolute = false) { if ($absolute) { return self::$siteURL . self::ASSETS_FOLDER . $theme . '/' . $resource; } return ltrim ( self::ASSETS_FOLDER, '/' ) . $theme . '/' . $resource; }
[ "public", "static", "function", "getThemeUrl", "(", "$", "theme", ",", "$", "resource", ",", "$", "absolute", "=", "false", ")", "{", "if", "(", "$", "absolute", ")", "{", "return", "self", "::", "$", "siteURL", ".", "self", "::", "ASSETS_FOLDER", ".",...
Returns the absolute or relative url for a resource in a theme. @param string $theme @param string $resource @param boolean $absolute @return string
[ "Returns", "the", "absolute", "or", "relative", "url", "for", "a", "resource", "in", "a", "theme", "." ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/assets/AssetsManager.php#L86-L91
train
phpMv/ubiquity
src/Ubiquity/assets/AssetsManager.php
AssetsManager.js
public static function js($resource, $attributes = [], $absolute = false) { return self::script ( self::getUrl ( $resource, $absolute ), $attributes ); }
php
public static function js($resource, $attributes = [], $absolute = false) { return self::script ( self::getUrl ( $resource, $absolute ), $attributes ); }
[ "public", "static", "function", "js", "(", "$", "resource", ",", "$", "attributes", "=", "[", "]", ",", "$", "absolute", "=", "false", ")", "{", "return", "self", "::", "script", "(", "self", "::", "getUrl", "(", "$", "resource", ",", "$", "absolute"...
Returns the script inclusion for a javascript resource. @param string $resource The javascript resource to include @param array $attributes The other html attributes of the script element @param boolean $absolute True if url must be absolute (containing siteUrl) @return string
[ "Returns", "the", "script", "inclusion", "for", "a", "javascript", "resource", "." ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/assets/AssetsManager.php#L101-L103
train
phpMv/ubiquity
src/Ubiquity/assets/AssetsManager.php
AssetsManager.css
public static function css($resource, $attributes = [], $absolute = false) { return self::stylesheet ( self::getUrl ( $resource, $absolute ), $attributes ); }
php
public static function css($resource, $attributes = [], $absolute = false) { return self::stylesheet ( self::getUrl ( $resource, $absolute ), $attributes ); }
[ "public", "static", "function", "css", "(", "$", "resource", ",", "$", "attributes", "=", "[", "]", ",", "$", "absolute", "=", "false", ")", "{", "return", "self", "::", "stylesheet", "(", "self", "::", "getUrl", "(", "$", "resource", ",", "$", "abso...
Returns the css inclusion for a stylesheet resource. @param string $resource The css resource to include @param array $attributes The other html attributes of the script element @param boolean $absolute True if url must be absolute (containing siteUrl) @return string
[ "Returns", "the", "css", "inclusion", "for", "a", "stylesheet", "resource", "." ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/assets/AssetsManager.php#L113-L115
train
phpMv/ubiquity
src/Ubiquity/controllers/rest/RestServer.php
RestServer.connect
public function connect() { if (! isset ( $this->apiTokens )) { $this->apiTokens = $this->_loadApiTokens (); } $token = $this->apiTokens->addToken (); $this->_addHeaderToken ( $token ); return [ "access_token" => $token,"token_type" => "Bearer","expires_in" => $this->apiTokens->getDuration () ]; }
php
public function connect() { if (! isset ( $this->apiTokens )) { $this->apiTokens = $this->_loadApiTokens (); } $token = $this->apiTokens->addToken (); $this->_addHeaderToken ( $token ); return [ "access_token" => $token,"token_type" => "Bearer","expires_in" => $this->apiTokens->getDuration () ]; }
[ "public", "function", "connect", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "apiTokens", ")", ")", "{", "$", "this", "->", "apiTokens", "=", "$", "this", "->", "_loadApiTokens", "(", ")", ";", "}", "$", "token", "=", "$", "th...
Establishes the connection with the server, returns an added token in the Authorization header of the request @return array
[ "Establishes", "the", "connection", "with", "the", "server", "returns", "an", "added", "token", "in", "the", "Authorization", "header", "of", "the", "request" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/rest/RestServer.php#L53-L60
train
phpMv/ubiquity
src/Ubiquity/controllers/Controller.php
Controller.redirectToRoute
public function redirectToRoute($routeName, $parameters = [], $initialize = false, $finalize = false) { $path = Router::getRouteByName ( $routeName, $parameters ); if ($path !== false) { $route = Router::getRoute ( $path, false ); if ($route !== false) { $this->forward ( $route [0], $route [1], \array_sli...
php
public function redirectToRoute($routeName, $parameters = [], $initialize = false, $finalize = false) { $path = Router::getRouteByName ( $routeName, $parameters ); if ($path !== false) { $route = Router::getRoute ( $path, false ); if ($route !== false) { $this->forward ( $route [0], $route [1], \array_sli...
[ "public", "function", "redirectToRoute", "(", "$", "routeName", ",", "$", "parameters", "=", "[", "]", ",", "$", "initialize", "=", "false", ",", "$", "finalize", "=", "false", ")", "{", "$", "path", "=", "Router", "::", "getRouteByName", "(", "$", "ro...
Redirect to a route by its name @param string $routeName The route name @param array $parameters The parameters to pass to the route action @param boolean $initialize Call the **initialize** method if true @param boolean $finalize Call the **finalize** method if true @throws RouterException
[ "Redirect", "to", "a", "route", "by", "its", "name" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/Controller.php#L148-L160
train
phpMv/ubiquity
src/Ubiquity/db/Database.php
Database.connect
public function connect() { try { $this->_connect (); return true; } catch ( \PDOException $e ) { throw new DBException ( $e->getMessage (), $e->getCode (), $e->getPrevious () ); } }
php
public function connect() { try { $this->_connect (); return true; } catch ( \PDOException $e ) { throw new DBException ( $e->getMessage (), $e->getCode (), $e->getPrevious () ); } }
[ "public", "function", "connect", "(", ")", "{", "try", "{", "$", "this", "->", "_connect", "(", ")", ";", "return", "true", ";", "}", "catch", "(", "\\", "PDOException", "$", "e", ")", "{", "throw", "new", "DBException", "(", "$", "e", "->", "getMe...
Creates the PDO instance and realize a safe connection. @throws DBException @return boolean
[ "Creates", "the", "PDO", "instance", "and", "realize", "a", "safe", "connection", "." ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/db/Database.php#L72-L79
train
phpMv/ubiquity
src/Ubiquity/controllers/rest/RestController.php
RestController.get
public function get($condition = "1=1", $included = false, $useCache = false) { $this->_get ( $condition, $included, $useCache ); }
php
public function get($condition = "1=1", $included = false, $useCache = false) { $this->_get ( $condition, $included, $useCache ); }
[ "public", "function", "get", "(", "$", "condition", "=", "\"1=1\"", ",", "$", "included", "=", "false", ",", "$", "useCache", "=", "false", ")", "{", "$", "this", "->", "_get", "(", "$", "condition", ",", "$", "included", ",", "$", "useCache", ")", ...
Returns a list of objects from the server @param string $condition the sql Where part @param boolean|string $included if true, loads associate members with associations, if string, example : client.*,commands @param boolean $useCache @route("methods"=>["get"])
[ "Returns", "a", "list", "of", "objects", "from", "the", "server" ]
284fccf0b4af5da817e31a958b5b67844c459b10
https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/rest/RestController.php#L49-L51
train