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
phpffcms/ffcms-core
src/I18n/Translate.php
Translate.getAvailableLangs
public function getAvailableLangs(): array { $langs = ['en']; $scan = Directory::scan(root . '/I18n/' . env_name . '/', GLOB_ONLYDIR, true); foreach ($scan as $row) { $langs[] = trim($row, '/'); } return $langs; }
php
public function getAvailableLangs(): array { $langs = ['en']; $scan = Directory::scan(root . '/I18n/' . env_name . '/', GLOB_ONLYDIR, true); foreach ($scan as $row) { $langs[] = trim($row, '/'); } return $langs; }
[ "public", "function", "getAvailableLangs", "(", ")", ":", "array", "{", "$", "langs", "=", "[", "'en'", "]", ";", "$", "scan", "=", "Directory", "::", "scan", "(", "root", ".", "'/I18n/'", ".", "env_name", ".", "'/'", ",", "GLOB_ONLYDIR", ",", "true", ...
Get available languages in the filesystem @return array
[ "Get", "available", "languages", "in", "the", "filesystem" ]
44a309553ef9f115ccfcfd71f2ac6e381c612082
https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/I18n/Translate.php#L125-L133
train
phpffcms/ffcms-core
src/I18n/Translate.php
Translate.getLocaleText
public function getLocaleText($input, ?string $lang = null, ?string $default = null): ?string { // define language if empty if ($lang === null) { $lang = App::$Request->getLanguage(); } // unserialize from string to array if (Any::isStr($input)) { $inp...
php
public function getLocaleText($input, ?string $lang = null, ?string $default = null): ?string { // define language if empty if ($lang === null) { $lang = App::$Request->getLanguage(); } // unserialize from string to array if (Any::isStr($input)) { $inp...
[ "public", "function", "getLocaleText", "(", "$", "input", ",", "?", "string", "$", "lang", "=", "null", ",", "?", "string", "$", "default", "=", "null", ")", ":", "?", "string", "{", "// define language if empty", "if", "(", "$", "lang", "===", "null", ...
Get locale data from input array or serialized string @param array|string $input @param string|null $lang @param string|null $default @return string|null
[ "Get", "locale", "data", "from", "input", "array", "or", "serialized", "string" ]
44a309553ef9f115ccfcfd71f2ac6e381c612082
https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/I18n/Translate.php#L142-L158
train
RockPhp/Datet
src/Rock/Datet/DateObj.php
Rock_Datet_DateObj.getDate
public function getDate($format = null) { $format = empty($format) ? $this->format : $format; return strftime($format, $this->ts); }
php
public function getDate($format = null) { $format = empty($format) ? $this->format : $format; return strftime($format, $this->ts); }
[ "public", "function", "getDate", "(", "$", "format", "=", "null", ")", "{", "$", "format", "=", "empty", "(", "$", "format", ")", "?", "$", "this", "->", "format", ":", "$", "format", ";", "return", "strftime", "(", "$", "format", ",", "$", "this",...
Retorna data no formato especificado @param string $format não obrigatório. Formato padrão da função strftime() http://php.net/strftime @return string
[ "Retorna", "data", "no", "formato", "especificado" ]
10eb9320efbe0a5c5acb2ffb262b514a36476bf0
https://github.com/RockPhp/Datet/blob/10eb9320efbe0a5c5acb2ffb262b514a36476bf0/src/Rock/Datet/DateObj.php#L86-L91
train
SCLInternet/SclZfGenericMapper
src/SclZfGenericMapper/Doctrine/FlushLock.php
FlushLock.unlock
public function unlock() { $this->count--; if ($this->count < 0) { $this->count = 0; return false; } if (0 === $this->count) { $this->entityManager->flush(); return true; } return false; }
php
public function unlock() { $this->count--; if ($this->count < 0) { $this->count = 0; return false; } if (0 === $this->count) { $this->entityManager->flush(); return true; } return false; }
[ "public", "function", "unlock", "(", ")", "{", "$", "this", "->", "count", "--", ";", "if", "(", "$", "this", "->", "count", "<", "0", ")", "{", "$", "this", "->", "count", "=", "0", ";", "return", "false", ";", "}", "if", "(", "0", "===", "$...
Call this at the end of a persistence function. @return boolean True if flush was called.
[ "Call", "this", "at", "the", "end", "of", "a", "persistence", "function", "." ]
c61c61546bfbc07e9c9a4b425e8e02fd7182d80b
https://github.com/SCLInternet/SclZfGenericMapper/blob/c61c61546bfbc07e9c9a4b425e8e02fd7182d80b/src/SclZfGenericMapper/Doctrine/FlushLock.php#L60-L76
train
AdamB7586/menu-builder
src/Helpers/Levels.php
Levels.getCurrent
public static function getCurrent($navigation, $current) { self::iterateItems($navigation); foreach(self::$navItem as $item) { if($item === $current) { self::getCurrentItem(intval(floor(self::$navItem->getDepth() / 2))); } } ksort(self::$currentIte...
php
public static function getCurrent($navigation, $current) { self::iterateItems($navigation); foreach(self::$navItem as $item) { if($item === $current) { self::getCurrentItem(intval(floor(self::$navItem->getDepth() / 2))); } } ksort(self::$currentIte...
[ "public", "static", "function", "getCurrent", "(", "$", "navigation", ",", "$", "current", ")", "{", "self", "::", "iterateItems", "(", "$", "navigation", ")", ";", "foreach", "(", "self", "::", "$", "navItem", "as", "$", "item", ")", "{", "if", "(", ...
Creates the current menu items which are selected from the navigation item hierarchy
[ "Creates", "the", "current", "menu", "items", "which", "are", "selected", "from", "the", "navigation", "item", "hierarchy" ]
dbc192bca7d59475068c19d1a07a039e5f997ee4
https://github.com/AdamB7586/menu-builder/blob/dbc192bca7d59475068c19d1a07a039e5f997ee4/src/Helpers/Levels.php#L15-L24
train
AdamB7586/menu-builder
src/Helpers/Levels.php
Levels.getCurrentItem
protected static function getCurrentItem($depth){ self::$currentItems[$depth] = iterator_to_array(self::$navItem->getSubIterator((($depth * 2) + 1))); unset(self::$currentItems[$depth]['children']); if($depth >= 1){ self::getCurrentItem(($depth - 1)); } }
php
protected static function getCurrentItem($depth){ self::$currentItems[$depth] = iterator_to_array(self::$navItem->getSubIterator((($depth * 2) + 1))); unset(self::$currentItems[$depth]['children']); if($depth >= 1){ self::getCurrentItem(($depth - 1)); } }
[ "protected", "static", "function", "getCurrentItem", "(", "$", "depth", ")", "{", "self", "::", "$", "currentItems", "[", "$", "depth", "]", "=", "iterator_to_array", "(", "self", "::", "$", "navItem", "->", "getSubIterator", "(", "(", "(", "$", "depth", ...
Gets the current level items from the menu array @param int $depth This should be the depth of the menu item you are setting
[ "Gets", "the", "current", "level", "items", "from", "the", "menu", "array" ]
dbc192bca7d59475068c19d1a07a039e5f997ee4
https://github.com/AdamB7586/menu-builder/blob/dbc192bca7d59475068c19d1a07a039e5f997ee4/src/Helpers/Levels.php#L30-L36
train
juliangut/mapping
src/Driver/Traits/XmlMappingTrait.php
XmlMappingTrait.parseSimpleXML
final protected function parseSimpleXML(\SimpleXMLElement $element) { $elements = []; foreach ($element->attributes() as $attribute => $value) { $elements[$attribute] = $value instanceof \SimpleXMLElement ? $this->parseSimpleXML($value) : $value; } foreach ($element->ch...
php
final protected function parseSimpleXML(\SimpleXMLElement $element) { $elements = []; foreach ($element->attributes() as $attribute => $value) { $elements[$attribute] = $value instanceof \SimpleXMLElement ? $this->parseSimpleXML($value) : $value; } foreach ($element->ch...
[ "final", "protected", "function", "parseSimpleXML", "(", "\\", "SimpleXMLElement", "$", "element", ")", "{", "$", "elements", "=", "[", "]", ";", "foreach", "(", "$", "element", "->", "attributes", "(", ")", "as", "$", "attribute", "=>", "$", "value", ")...
Parse xml to array. @param \SimpleXMLElement $element @return string|float|int|bool|array
[ "Parse", "xml", "to", "array", "." ]
1830ff84c054d8e3759df170a5664a97f7070be9
https://github.com/juliangut/mapping/blob/1830ff84c054d8e3759df170a5664a97f7070be9/src/Driver/Traits/XmlMappingTrait.php#L112-L135
train
juliangut/mapping
src/Driver/Traits/XmlMappingTrait.php
XmlMappingTrait.getTypedValue
private function getTypedValue(string $value) { if (\in_array($value, self::$boolValues, true)) { return \in_array($value, self::$truthlyValues, true); } if (\is_numeric($value)) { return $this->getNumericValue($value); } return $value; }
php
private function getTypedValue(string $value) { if (\in_array($value, self::$boolValues, true)) { return \in_array($value, self::$truthlyValues, true); } if (\is_numeric($value)) { return $this->getNumericValue($value); } return $value; }
[ "private", "function", "getTypedValue", "(", "string", "$", "value", ")", "{", "if", "(", "\\", "in_array", "(", "$", "value", ",", "self", "::", "$", "boolValues", ",", "true", ")", ")", "{", "return", "\\", "in_array", "(", "$", "value", ",", "self...
Transforms string to type. @param string $value @return bool|float|int|string
[ "Transforms", "string", "to", "type", "." ]
1830ff84c054d8e3759df170a5664a97f7070be9
https://github.com/juliangut/mapping/blob/1830ff84c054d8e3759df170a5664a97f7070be9/src/Driver/Traits/XmlMappingTrait.php#L144-L155
train
juliangut/mapping
src/Driver/Traits/XmlMappingTrait.php
XmlMappingTrait.getNumericValue
private function getNumericValue(string $value) { if (\strpos($value, '.') !== false) { return (float) $value; } return (int) $value; }
php
private function getNumericValue(string $value) { if (\strpos($value, '.') !== false) { return (float) $value; } return (int) $value; }
[ "private", "function", "getNumericValue", "(", "string", "$", "value", ")", "{", "if", "(", "\\", "strpos", "(", "$", "value", ",", "'.'", ")", "!==", "false", ")", "{", "return", "(", "float", ")", "$", "value", ";", "}", "return", "(", "int", ")"...
Get numeric value from string. @param string $value @return float|int
[ "Get", "numeric", "value", "from", "string", "." ]
1830ff84c054d8e3759df170a5664a97f7070be9
https://github.com/juliangut/mapping/blob/1830ff84c054d8e3759df170a5664a97f7070be9/src/Driver/Traits/XmlMappingTrait.php#L164-L171
train
QoboLtd/qobo-robo-cakephp
src/Command/Cakephp/Plugins.php
Plugins.cakephpPlugins
public function cakephpPlugins($opts = ['format' => 'table', 'fields' => '']) { $result = $this->taskCakephpPlugins() ->run(); if (!$result->wasSuccessful()) { $this->exitError("Failed to run the command"); } return new PropertyList($result->getData()['data']...
php
public function cakephpPlugins($opts = ['format' => 'table', 'fields' => '']) { $result = $this->taskCakephpPlugins() ->run(); if (!$result->wasSuccessful()) { $this->exitError("Failed to run the command"); } return new PropertyList($result->getData()['data']...
[ "public", "function", "cakephpPlugins", "(", "$", "opts", "=", "[", "'format'", "=>", "'table'", ",", "'fields'", "=>", "''", "]", ")", "{", "$", "result", "=", "$", "this", "->", "taskCakephpPlugins", "(", ")", "->", "run", "(", ")", ";", "if", "(",...
List CakePHP loaded plugins @option string $format Output format (table, list, csv, json, xml) @option string $fields Limit output to given fields, comma-separated @return PropertyList result
[ "List", "CakePHP", "loaded", "plugins" ]
942d1839ad55a26e4aba893bd5bed35ec6edca94
https://github.com/QoboLtd/qobo-robo-cakephp/blob/942d1839ad55a26e4aba893bd5bed35ec6edca94/src/Command/Cakephp/Plugins.php#L27-L36
train
ezra-obiwale/dSCore
src/Core/AUser.php
AUser.check
final public function check(array $options) { foreach ($options as $property => $value) { if ((is_array($value) && !in_array($this->$property, $value)) || (!is_array($value) && $this->$property !== $value)) return false; } return true; }
php
final public function check(array $options) { foreach ($options as $property => $value) { if ((is_array($value) && !in_array($this->$property, $value)) || (!is_array($value) && $this->$property !== $value)) return false; } return true; }
[ "final", "public", "function", "check", "(", "array", "$", "options", ")", "{", "foreach", "(", "$", "options", "as", "$", "property", "=>", "$", "value", ")", "{", "if", "(", "(", "is_array", "(", "$", "value", ")", "&&", "!", "in_array", "(", "$"...
Checks if properties exist and their values are as required @param array $options @return boolean
[ "Checks", "if", "properties", "exist", "and", "their", "values", "are", "as", "required" ]
dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d
https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/AUser.php#L45-L53
train
ARCANESOFT/Blog
src/Seeds/PermissionsTableSeeder.php
PermissionsTableSeeder.getPostsPermissions
private function getPostsPermissions() { return [ [ 'name' => 'Posts - List all posts', 'description' => 'Allow to list all posts.', 'slug' => PostsPolicy::PERMISSION_LIST, ], [ 'name' =>...
php
private function getPostsPermissions() { return [ [ 'name' => 'Posts - List all posts', 'description' => 'Allow to list all posts.', 'slug' => PostsPolicy::PERMISSION_LIST, ], [ 'name' =>...
[ "private", "function", "getPostsPermissions", "(", ")", "{", "return", "[", "[", "'name'", "=>", "'Posts - List all posts'", ",", "'description'", "=>", "'Allow to list all posts.'", ",", "'slug'", "=>", "PostsPolicy", "::", "PERMISSION_LIST", ",", "]", ",", "[", ...
Get the Posts permissions. @return array
[ "Get", "the", "Posts", "permissions", "." ]
2078fdfdcbccda161c02899b9e1f344f011b2859
https://github.com/ARCANESOFT/Blog/blob/2078fdfdcbccda161c02899b9e1f344f011b2859/src/Seeds/PermissionsTableSeeder.php#L70-L99
train
ARCANESOFT/Blog
src/Seeds/PermissionsTableSeeder.php
PermissionsTableSeeder.getCategoriesPermissions
private function getCategoriesPermissions() { return [ [ 'name' => 'Categories - List all categories', 'description' => 'Allow to list all categories.', 'slug' => CategoriesPolicy::PERMISSION_LIST, ], [ ...
php
private function getCategoriesPermissions() { return [ [ 'name' => 'Categories - List all categories', 'description' => 'Allow to list all categories.', 'slug' => CategoriesPolicy::PERMISSION_LIST, ], [ ...
[ "private", "function", "getCategoriesPermissions", "(", ")", "{", "return", "[", "[", "'name'", "=>", "'Categories - List all categories'", ",", "'description'", "=>", "'Allow to list all categories.'", ",", "'slug'", "=>", "CategoriesPolicy", "::", "PERMISSION_LIST", ","...
Get the Categories permissions. @return array
[ "Get", "the", "Categories", "permissions", "." ]
2078fdfdcbccda161c02899b9e1f344f011b2859
https://github.com/ARCANESOFT/Blog/blob/2078fdfdcbccda161c02899b9e1f344f011b2859/src/Seeds/PermissionsTableSeeder.php#L106-L135
train
ARCANESOFT/Blog
src/Seeds/PermissionsTableSeeder.php
PermissionsTableSeeder.getTagsPermissions
private function getTagsPermissions() { return [ [ 'name' => 'Tags - List all tags', 'description' => 'Allow to list all tags.', 'slug' => TagsPolicy::PERMISSION_LIST, ], [ 'name' => 'Tag...
php
private function getTagsPermissions() { return [ [ 'name' => 'Tags - List all tags', 'description' => 'Allow to list all tags.', 'slug' => TagsPolicy::PERMISSION_LIST, ], [ 'name' => 'Tag...
[ "private", "function", "getTagsPermissions", "(", ")", "{", "return", "[", "[", "'name'", "=>", "'Tags - List all tags'", ",", "'description'", "=>", "'Allow to list all tags.'", ",", "'slug'", "=>", "TagsPolicy", "::", "PERMISSION_LIST", ",", "]", ",", "[", "'nam...
Get the Tags permissions. @return array
[ "Get", "the", "Tags", "permissions", "." ]
2078fdfdcbccda161c02899b9e1f344f011b2859
https://github.com/ARCANESOFT/Blog/blob/2078fdfdcbccda161c02899b9e1f344f011b2859/src/Seeds/PermissionsTableSeeder.php#L142-L171
train
ARCANESOFT/Auth
src/ViewComposers/PermissionGroupsFilterComposer.php
PermissionGroupsFilterComposer.getFilters
private function getFilters() { $filters = new Collection; foreach ($this->getCachedPermissionGroups() as $group) { /** @var \Arcanesoft\Auth\Models\PermissionsGroup $group */ $filters->push([ 'name' => $group->name, 'params' => [$group->h...
php
private function getFilters() { $filters = new Collection; foreach ($this->getCachedPermissionGroups() as $group) { /** @var \Arcanesoft\Auth\Models\PermissionsGroup $group */ $filters->push([ 'name' => $group->name, 'params' => [$group->h...
[ "private", "function", "getFilters", "(", ")", "{", "$", "filters", "=", "new", "Collection", ";", "foreach", "(", "$", "this", "->", "getCachedPermissionGroups", "(", ")", "as", "$", "group", ")", "{", "/** @var \\Arcanesoft\\Auth\\Models\\PermissionsGroup $group...
Get the groups filters data. @return \Illuminate\Support\Collection
[ "Get", "the", "groups", "filters", "data", "." ]
b33ca82597a76b1e395071f71ae3e51f1ec67e62
https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/ViewComposers/PermissionGroupsFilterComposer.php#L45-L67
train
Aerendir/PHPTextMatrix
src/PHPTextMatrix.php
PHPTextMatrix.render
public function render(array $options = []): string { // Set the options to use $this->resolveOptions($options); if (false === $this->validate()) { return false; } // Splits the content of the cells to fit into the defined line length $this->splitCellsCo...
php
public function render(array $options = []): string { // Set the options to use $this->resolveOptions($options); if (false === $this->validate()) { return false; } // Splits the content of the cells to fit into the defined line length $this->splitCellsCo...
[ "public", "function", "render", "(", "array", "$", "options", "=", "[", "]", ")", ":", "string", "{", "// Set the options to use", "$", "this", "->", "resolveOptions", "(", "$", "options", ")", ";", "if", "(", "false", "===", "$", "this", "->", "validate...
Renders the table as plain text. @param array $options @return string
[ "Renders", "the", "table", "as", "plain", "text", "." ]
d8b3ce58b7174c6ddd9959e33427aa61862302d6
https://github.com/Aerendir/PHPTextMatrix/blob/d8b3ce58b7174c6ddd9959e33427aa61862302d6/src/PHPTextMatrix.php#L73-L113
train
Aerendir/PHPTextMatrix
src/PHPTextMatrix.php
PHPTextMatrix.validate
public function validate(): bool { // The number of columns $numberOfColumns = null; // Reset the errors $this->errors = []; // Check that there are rows in the data if (0 >= count($this->data)) { $message = 'There are no rows in the table'; ...
php
public function validate(): bool { // The number of columns $numberOfColumns = null; // Reset the errors $this->errors = []; // Check that there are rows in the data if (0 >= count($this->data)) { $message = 'There are no rows in the table'; ...
[ "public", "function", "validate", "(", ")", ":", "bool", "{", "// The number of columns", "$", "numberOfColumns", "=", "null", ";", "// Reset the errors", "$", "this", "->", "errors", "=", "[", "]", ";", "// Check that there are rows in the data", "if", "(", "0", ...
Validates the given array to check all the rows have the same number of columns. Returns false if the validation fails and calling the getErrors() method it is possible to know which are these errors. @return bool False if the validation fails, true if all succeeds
[ "Validates", "the", "given", "array", "to", "check", "all", "the", "rows", "have", "the", "same", "number", "of", "columns", "." ]
d8b3ce58b7174c6ddd9959e33427aa61862302d6
https://github.com/Aerendir/PHPTextMatrix/blob/d8b3ce58b7174c6ddd9959e33427aa61862302d6/src/PHPTextMatrix.php#L123-L159
train
Aerendir/PHPTextMatrix
src/PHPTextMatrix.php
PHPTextMatrix.splitCellsContent
private function splitCellsContent() { // For each row... foreach ($this->data as $rowPosition => $rowContent) { // ... cycle each column to get its content foreach ($rowContent as $columnName => $cellContent) { // Remove extra spaces from the string ...
php
private function splitCellsContent() { // For each row... foreach ($this->data as $rowPosition => $rowContent) { // ... cycle each column to get its content foreach ($rowContent as $columnName => $cellContent) { // Remove extra spaces from the string ...
[ "private", "function", "splitCellsContent", "(", ")", "{", "// For each row...", "foreach", "(", "$", "this", "->", "data", "as", "$", "rowPosition", "=>", "$", "rowContent", ")", "{", "// ... cycle each column to get its content", "foreach", "(", "$", "rowContent",...
Splits the content of each cell into multiple lines according to the set max column width.
[ "Splits", "the", "content", "of", "each", "cell", "into", "multiple", "lines", "according", "to", "the", "set", "max", "column", "width", "." ]
d8b3ce58b7174c6ddd9959e33427aa61862302d6
https://github.com/Aerendir/PHPTextMatrix/blob/d8b3ce58b7174c6ddd9959e33427aa61862302d6/src/PHPTextMatrix.php#L184-L225
train
Aerendir/PHPTextMatrix
src/PHPTextMatrix.php
PHPTextMatrix.calculateSizes
private function calculateSizes() { // For each row... foreach ($this->data as $rowPosition => $rowContent) { // ... cycle each column to get its content ... foreach ($rowContent as $columnName => $cellContent) { // If we don't already know the height of this ...
php
private function calculateSizes() { // For each row... foreach ($this->data as $rowPosition => $rowContent) { // ... cycle each column to get its content ... foreach ($rowContent as $columnName => $cellContent) { // If we don't already know the height of this ...
[ "private", "function", "calculateSizes", "(", ")", "{", "// For each row...", "foreach", "(", "$", "this", "->", "data", "as", "$", "rowPosition", "=>", "$", "rowContent", ")", "{", "// ... cycle each column to get its content ...", "foreach", "(", "$", "rowContent"...
Calculates the width of each column of the table.
[ "Calculates", "the", "width", "of", "each", "column", "of", "the", "table", "." ]
d8b3ce58b7174c6ddd9959e33427aa61862302d6
https://github.com/Aerendir/PHPTextMatrix/blob/d8b3ce58b7174c6ddd9959e33427aa61862302d6/src/PHPTextMatrix.php#L242-L289
train
Aerendir/PHPTextMatrix
src/PHPTextMatrix.php
PHPTextMatrix.calculateTableWidth
private function calculateTableWidth(): int { // Now calculate the total width of the table $tableWidth = 0; // Add the width of the columns foreach ($this->columnsWidths as $width) { $tableWidth += $width; } // Add 1 for the first separator $tab...
php
private function calculateTableWidth(): int { // Now calculate the total width of the table $tableWidth = 0; // Add the width of the columns foreach ($this->columnsWidths as $width) { $tableWidth += $width; } // Add 1 for the first separator $tab...
[ "private", "function", "calculateTableWidth", "(", ")", ":", "int", "{", "// Now calculate the total width of the table", "$", "tableWidth", "=", "0", ";", "// Add the width of the columns", "foreach", "(", "$", "this", "->", "columnsWidths", "as", "$", "width", ")", ...
Calculates the total width of the table. @return int
[ "Calculates", "the", "total", "width", "of", "the", "table", "." ]
d8b3ce58b7174c6ddd9959e33427aa61862302d6
https://github.com/Aerendir/PHPTextMatrix/blob/d8b3ce58b7174c6ddd9959e33427aa61862302d6/src/PHPTextMatrix.php#L296-L316
train
Aerendir/PHPTextMatrix
src/PHPTextMatrix.php
PHPTextMatrix.drawDivider
private function drawDivider(string $prefix = 'sep_'): string { $divider = ''; foreach ($this->columnsWidths as $width) { // Column width position for the xSep + left and rigth padding $times = $width + $this->options['cells_padding'][1] + $this->options['cells_padding'][3]; ...
php
private function drawDivider(string $prefix = 'sep_'): string { $divider = ''; foreach ($this->columnsWidths as $width) { // Column width position for the xSep + left and rigth padding $times = $width + $this->options['cells_padding'][1] + $this->options['cells_padding'][3]; ...
[ "private", "function", "drawDivider", "(", "string", "$", "prefix", "=", "'sep_'", ")", ":", "string", "{", "$", "divider", "=", "''", ";", "foreach", "(", "$", "this", "->", "columnsWidths", "as", "$", "width", ")", "{", "// Column width position for the xS...
Draws the horizontal divider. @param string $prefix @return string
[ "Draws", "the", "horizontal", "divider", "." ]
d8b3ce58b7174c6ddd9959e33427aa61862302d6
https://github.com/Aerendir/PHPTextMatrix/blob/d8b3ce58b7174c6ddd9959e33427aa61862302d6/src/PHPTextMatrix.php#L333-L343
train
Aerendir/PHPTextMatrix
src/PHPTextMatrix.php
PHPTextMatrix.resolveCellsPaddings
private function resolveCellsPaddings(): array { $return = [0, 0, 0, 0]; // If padding is not set, return default values if (false === isset($this->options['cells_padding'])) { return $return; } // Create a resolver to validate passed values $resolver = ...
php
private function resolveCellsPaddings(): array { $return = [0, 0, 0, 0]; // If padding is not set, return default values if (false === isset($this->options['cells_padding'])) { return $return; } // Create a resolver to validate passed values $resolver = ...
[ "private", "function", "resolveCellsPaddings", "(", ")", ":", "array", "{", "$", "return", "=", "[", "0", ",", "0", ",", "0", ",", "0", "]", ";", "// If padding is not set, return default values", "if", "(", "false", "===", "isset", "(", "$", "this", "->",...
Set the padding of the cells. This is the number of spaces to put on the left and on the right and on top and bottom of the content in each cell. This method follows the rules of the padding CSS rule. @see http://www.w3schools.com/css/css_padding.asp @throws \InvalidArgumentException If the value is not an integer ...
[ "Set", "the", "padding", "of", "the", "cells", "." ]
d8b3ce58b7174c6ddd9959e33427aa61862302d6
https://github.com/Aerendir/PHPTextMatrix/blob/d8b3ce58b7174c6ddd9959e33427aa61862302d6/src/PHPTextMatrix.php#L521-L574
train
linpax/microphp-framework
src/logger/drivers/DbDriver.php
DbDriver.sendMessage
public function sendMessage($level, $message) { $this->db->insert($this->tableName, [ 'level' => $level, 'message' => $message, 'date_create' => $_SERVER['REQUEST_TIME'] ]); }
php
public function sendMessage($level, $message) { $this->db->insert($this->tableName, [ 'level' => $level, 'message' => $message, 'date_create' => $_SERVER['REQUEST_TIME'] ]); }
[ "public", "function", "sendMessage", "(", "$", "level", ",", "$", "message", ")", "{", "$", "this", "->", "db", "->", "insert", "(", "$", "this", "->", "tableName", ",", "[", "'level'", "=>", "$", "level", ",", "'message'", "=>", "$", "message", ",",...
Send log message into DB @access public @param integer $level level number @param string $message message to write @return void
[ "Send", "log", "message", "into", "DB" ]
11f3370f3f64c516cce9b84ecd8276c6e9ae8df9
https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/logger/drivers/DbDriver.php#L73-L80
train
JochLAin/symfony-database
src/ORM/Repository.php
Repository.count
public function count(array $constraints = [], QueryBuilder $qb = null) { $qb = !is_null($qb) ? $qb : $this->createQueryBuilder('e'); if (count($constraints)) $qb = $this->_by($qb, $constraints); return $this->arrange($this->_count($qb), Repository::RESULT_SHAPE_SCALAR); }
php
public function count(array $constraints = [], QueryBuilder $qb = null) { $qb = !is_null($qb) ? $qb : $this->createQueryBuilder('e'); if (count($constraints)) $qb = $this->_by($qb, $constraints); return $this->arrange($this->_count($qb), Repository::RESULT_SHAPE_SCALAR); }
[ "public", "function", "count", "(", "array", "$", "constraints", "=", "[", "]", ",", "QueryBuilder", "$", "qb", "=", "null", ")", "{", "$", "qb", "=", "!", "is_null", "(", "$", "qb", ")", "?", "$", "qb", ":", "$", "this", "->", "createQueryBuilder"...
Return number of entities @param Doctrine\ORM\QueryBuilder = null @return integer
[ "Return", "number", "of", "entities" ]
a0fae6e057e142190ef68d0a37898d5f1b16cba9
https://github.com/JochLAin/symfony-database/blob/a0fae6e057e142190ef68d0a37898d5f1b16cba9/src/ORM/Repository.php#L40-L45
train
JochLAin/symfony-database
src/ORM/Repository.php
Repository._paginate
protected function _paginate(QueryBuilder $qb, int $offset, int $limit) { return $qb ->setFirstResult($offset) ->setMaxResults($limit); }
php
protected function _paginate(QueryBuilder $qb, int $offset, int $limit) { return $qb ->setFirstResult($offset) ->setMaxResults($limit); }
[ "protected", "function", "_paginate", "(", "QueryBuilder", "$", "qb", ",", "int", "$", "offset", ",", "int", "$", "limit", ")", "{", "return", "$", "qb", "->", "setFirstResult", "(", "$", "offset", ")", "->", "setMaxResults", "(", "$", "limit", ")", ";...
Improve QueryBuilder with basic paginate request @param Doctrine\ORM\QueryBuilder @param integer $offset @param integer $limit @return Doctrine\ORM\QueryBuilder
[ "Improve", "QueryBuilder", "with", "basic", "paginate", "request" ]
a0fae6e057e142190ef68d0a37898d5f1b16cba9
https://github.com/JochLAin/symfony-database/blob/a0fae6e057e142190ef68d0a37898d5f1b16cba9/src/ORM/Repository.php#L103-L108
train
mylxsw/FocusPHP
src/Server.php
Server.init
public static function init(Container $container = null) { if (empty(self::$_instance)) { // 环境检测 if (version_compare(PHP_VERSION, '5.6.0', '<')) { throw new \ErrorException('NONSUPPORT_PHP_VERSION'); } if (is_null($container)) { ...
php
public static function init(Container $container = null) { if (empty(self::$_instance)) { // 环境检测 if (version_compare(PHP_VERSION, '5.6.0', '<')) { throw new \ErrorException('NONSUPPORT_PHP_VERSION'); } if (is_null($container)) { ...
[ "public", "static", "function", "init", "(", "Container", "$", "container", "=", "null", ")", "{", "if", "(", "empty", "(", "self", "::", "$", "_instance", ")", ")", "{", "// 环境检测", "if", "(", "version_compare", "(", "PHP_VERSION", ",", "'5.6.0'", ",", ...
Initialize the server object. @param Container $container @throws \ErrorException @return Server
[ "Initialize", "the", "server", "object", "." ]
33922bacbea66f11f874d991d7308a36cdf5831a
https://github.com/mylxsw/FocusPHP/blob/33922bacbea66f11f874d991d7308a36cdf5831a/src/Server.php#L58-L74
train
mylxsw/FocusPHP
src/Server.php
Server.registerRouter
public function registerRouter($router, ...$params) { $this->_router->add($router, ...$params); if (defined('FOCUS_DEBUG') && FOCUS_DEBUG) { $this->getLogger()->debug('add new router: ' .(is_string($router) ? $router : get_class($router))); } ...
php
public function registerRouter($router, ...$params) { $this->_router->add($router, ...$params); if (defined('FOCUS_DEBUG') && FOCUS_DEBUG) { $this->getLogger()->debug('add new router: ' .(is_string($router) ? $router : get_class($router))); } ...
[ "public", "function", "registerRouter", "(", "$", "router", ",", "...", "$", "params", ")", "{", "$", "this", "->", "_router", "->", "add", "(", "$", "router", ",", "...", "$", "params", ")", ";", "if", "(", "defined", "(", "'FOCUS_DEBUG'", ")", "&&"...
register router. @param $router @param $params
[ "register", "router", "." ]
33922bacbea66f11f874d991d7308a36cdf5831a
https://github.com/mylxsw/FocusPHP/blob/33922bacbea66f11f874d991d7308a36cdf5831a/src/Server.php#L104-L111
train
mylxsw/FocusPHP
src/Server.php
Server.registerAutoloader
public function registerAutoloader($baseDir, $baseNs) { $baseNs = $baseNs[strlen($baseNs) - 1] == '\\' ? $baseNs : "{$baseNs}\\"; $baseDir = rtrim($baseDir, '/'); spl_autoload_register( function ($class) use ($baseDir, $baseNs) { if (strncmp($baseNs, $class, strl...
php
public function registerAutoloader($baseDir, $baseNs) { $baseNs = $baseNs[strlen($baseNs) - 1] == '\\' ? $baseNs : "{$baseNs}\\"; $baseDir = rtrim($baseDir, '/'); spl_autoload_register( function ($class) use ($baseDir, $baseNs) { if (strncmp($baseNs, $class, strl...
[ "public", "function", "registerAutoloader", "(", "$", "baseDir", ",", "$", "baseNs", ")", "{", "$", "baseNs", "=", "$", "baseNs", "[", "strlen", "(", "$", "baseNs", ")", "-", "1", "]", "==", "'\\\\'", "?", "$", "baseNs", ":", "\"{$baseNs}\\\\\"", ";", ...
register class autoloader. @param string $baseDir Root directory of the project @param string $baseNs Basic namespace
[ "register", "class", "autoloader", "." ]
33922bacbea66f11f874d991d7308a36cdf5831a
https://github.com/mylxsw/FocusPHP/blob/33922bacbea66f11f874d991d7308a36cdf5831a/src/Server.php#L146-L175
train
e-commit/EcommitUtilBundle
Cache/Cache.php
Cache.load
public function load($key) { $data = $this->adapter->getItem($key, $success); if ($success && $this->automaticSerialization) { $data = unserialize($data); if ($data === false) { $this->remove($key); } } return $data; ...
php
public function load($key) { $data = $this->adapter->getItem($key, $success); if ($success && $this->automaticSerialization) { $data = unserialize($data); if ($data === false) { $this->remove($key); } } return $data; ...
[ "public", "function", "load", "(", "$", "key", ")", "{", "$", "data", "=", "$", "this", "->", "adapter", "->", "getItem", "(", "$", "key", ",", "$", "success", ")", ";", "if", "(", "$", "success", "&&", "$", "this", "->", "automaticSerialization", ...
Get an item @param string $key @return mixed Data on success and false on failure @throws \Zend\Cache\Exception
[ "Get", "an", "item" ]
2ee5ddae7709e8ad4412739cbecda28e0590da8b
https://github.com/e-commit/EcommitUtilBundle/blob/2ee5ddae7709e8ad4412739cbecda28e0590da8b/Cache/Cache.php#L67-L80
train
jabernardo/lollipop-php
Library/Security/CsrfToken.php
CsrfToken.isValid
public static function isValid($token) { // Get configuration $expiration = Config::get('security.anti_csrf.expiration', 18000); // Compute for token availablity $computed = microtime(true) - (double)Text::unlock($token, self::getKey()); return $computed <= $expiration; ...
php
public static function isValid($token) { // Get configuration $expiration = Config::get('security.anti_csrf.expiration', 18000); // Compute for token availablity $computed = microtime(true) - (double)Text::unlock($token, self::getKey()); return $computed <= $expiration; ...
[ "public", "static", "function", "isValid", "(", "$", "token", ")", "{", "// Get configuration", "$", "expiration", "=", "Config", "::", "get", "(", "'security.anti_csrf.expiration'", ",", "18000", ")", ";", "// Compute for token availablity", "$", "computed", "=", ...
Check Validity of Token @access public @return bool
[ "Check", "Validity", "of", "Token" ]
004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5
https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/Security/CsrfToken.php#L75-L82
train
WellCommerce/LayoutBundle
Configurator/LayoutBoxConfiguratorCollection.php
LayoutBoxConfiguratorCollection.add
public function add(LayoutBoxConfiguratorInterface $configurator) { $type = $configurator->getType(); if ($this->has($type)) { throw new \InvalidArgumentException(sprintf('Layout box configurator "%s" already exists.', $type)); } $this->items[$configurator->getType()] = $...
php
public function add(LayoutBoxConfiguratorInterface $configurator) { $type = $configurator->getType(); if ($this->has($type)) { throw new \InvalidArgumentException(sprintf('Layout box configurator "%s" already exists.', $type)); } $this->items[$configurator->getType()] = $...
[ "public", "function", "add", "(", "LayoutBoxConfiguratorInterface", "$", "configurator", ")", "{", "$", "type", "=", "$", "configurator", "->", "getType", "(", ")", ";", "if", "(", "$", "this", "->", "has", "(", "$", "type", ")", ")", "{", "throw", "ne...
Adds new configurator to collection @param LayoutBoxConfiguratorInterface $configurator @throws \InvalidArgumentException If such configurator already exists in collection
[ "Adds", "new", "configurator", "to", "collection" ]
470efd187d19827058f88317221cb875b4c9ced3
https://github.com/WellCommerce/LayoutBundle/blob/470efd187d19827058f88317221cb875b4c9ced3/Configurator/LayoutBoxConfiguratorCollection.php#L31-L38
train
geoffroy-aubry/Helpers
src/GAubry/Helpers/Helpers.php
Helpers.isAssociativeArray
public static function isAssociativeArray (array $aArray) { foreach (array_keys($aArray) as $key) { if (! is_int($key)) { return true; } } return false; }
php
public static function isAssociativeArray (array $aArray) { foreach (array_keys($aArray) as $key) { if (! is_int($key)) { return true; } } return false; }
[ "public", "static", "function", "isAssociativeArray", "(", "array", "$", "aArray", ")", "{", "foreach", "(", "array_keys", "(", "$", "aArray", ")", "as", "$", "key", ")", "{", "if", "(", "!", "is_int", "(", "$", "key", ")", ")", "{", "return", "true"...
Returns TRUE iff the specified array is associative. If the specified array is empty, then return FALSE. http://stackoverflow.com/questions/173400/php-arrays-a-good-way-to-check-if-an-array-is-associative-or-sequential @param array $aArray @return bool true ssi iff the specified array is associative
[ "Returns", "TRUE", "iff", "the", "specified", "array", "is", "associative", ".", "If", "the", "specified", "array", "is", "empty", "then", "return", "FALSE", "." ]
09e787e554158d7c2233a27107d2949824cd5602
https://github.com/geoffroy-aubry/Helpers/blob/09e787e554158d7c2233a27107d2949824cd5602/src/GAubry/Helpers/Helpers.php#L291-L299
train
geoffroy-aubry/Helpers
src/GAubry/Helpers/Helpers.php
Helpers.getCurrentTimeWithCS
public static function getCurrentTimeWithCS ($sFormat) { $aMicrotime = explode(' ', microtime()); $sFilledFormat = sprintf($sFormat, $aMicrotime[0]*1000000); $sDate = date($sFilledFormat, $aMicrotime[1]); return $sDate; }
php
public static function getCurrentTimeWithCS ($sFormat) { $aMicrotime = explode(' ', microtime()); $sFilledFormat = sprintf($sFormat, $aMicrotime[0]*1000000); $sDate = date($sFilledFormat, $aMicrotime[1]); return $sDate; }
[ "public", "static", "function", "getCurrentTimeWithCS", "(", "$", "sFormat", ")", "{", "$", "aMicrotime", "=", "explode", "(", "' '", ",", "microtime", "(", ")", ")", ";", "$", "sFilledFormat", "=", "sprintf", "(", "$", "sFormat", ",", "$", "aMicrotime", ...
Returns current time with hundredths of a second. @param string $sFormat including %s for cs, eg: 'Y-m-d H:i:s.%s' @return string current time with hundredths of a second.
[ "Returns", "current", "time", "with", "hundredths", "of", "a", "second", "." ]
09e787e554158d7c2233a27107d2949824cd5602
https://github.com/geoffroy-aubry/Helpers/blob/09e787e554158d7c2233a27107d2949824cd5602/src/GAubry/Helpers/Helpers.php#L307-L313
train
geoffroy-aubry/Helpers
src/GAubry/Helpers/Helpers.php
Helpers.generateMongoId
public static function generateMongoId ($iTimestamp = 0, $bBase32 = true) { static $inc = 0; if ($inc === 0) { // set with microseconds: $inc = (int)substr(microtime(), 2, 6); } $bin = sprintf( '%s%s%s%s', pack('N', $iTimestamp ?: time...
php
public static function generateMongoId ($iTimestamp = 0, $bBase32 = true) { static $inc = 0; if ($inc === 0) { // set with microseconds: $inc = (int)substr(microtime(), 2, 6); } $bin = sprintf( '%s%s%s%s', pack('N', $iTimestamp ?: time...
[ "public", "static", "function", "generateMongoId", "(", "$", "iTimestamp", "=", "0", ",", "$", "bBase32", "=", "true", ")", "{", "static", "$", "inc", "=", "0", ";", "if", "(", "$", "inc", "===", "0", ")", "{", "// set with microseconds:", "$", "inc", ...
Generates a globally unique id generator using Mongo Object ID algorithm. The 12-byte ObjectId value consists of: - a 4-byte value representing the seconds since the Unix epoch, - a 3-byte machine identifier, - a 2-byte process id, and - a 3-byte counter, starting with a random value. @see https://docs.mongodb.org/man...
[ "Generates", "a", "globally", "unique", "id", "generator", "using", "Mongo", "Object", "ID", "algorithm", "." ]
09e787e554158d7c2233a27107d2949824cd5602
https://github.com/geoffroy-aubry/Helpers/blob/09e787e554158d7c2233a27107d2949824cd5602/src/GAubry/Helpers/Helpers.php#L355-L372
train
yasheena/yii2-view
YFormatter.php
YFormatter.asNtext1line
public function asNtext1line($value, $maxlen = null) { if ($value === null) { return $this->nullDisplay; } $suffix = ''; if ((false !== ($n = strpos($value, "\n"))) || (false !== ($n = strpos($value, "\r")))) { if (($n > 0) && (substr($value, $n - 1, 1) ==...
php
public function asNtext1line($value, $maxlen = null) { if ($value === null) { return $this->nullDisplay; } $suffix = ''; if ((false !== ($n = strpos($value, "\n"))) || (false !== ($n = strpos($value, "\r")))) { if (($n > 0) && (substr($value, $n - 1, 1) ==...
[ "public", "function", "asNtext1line", "(", "$", "value", ",", "$", "maxlen", "=", "null", ")", "{", "if", "(", "$", "value", "===", "null", ")", "{", "return", "$", "this", "->", "nullDisplay", ";", "}", "$", "suffix", "=", "''", ";", "if", "(", ...
Formats the value as an HTML-encoded plain text. If the value contains \n or \r the first line will be returned only. @param string $value the value to be formatted. @return string the formatted result.
[ "Formats", "the", "value", "as", "an", "HTML", "-", "encoded", "plain", "text", ".", "If", "the", "value", "contains", "\\", "n", "or", "\\", "r", "the", "first", "line", "will", "be", "returned", "only", "." ]
b75a24efc9bbf463c0fce8e2e4477ff3ae169559
https://github.com/yasheena/yii2-view/blob/b75a24efc9bbf463c0fce8e2e4477ff3ae169559/YFormatter.php#L30-L50
train
dms-org/common.structure
src/DateTime/TimezonedDateTimeRange.php
TimezonedDateTimeRange.overlaps
public function overlaps(TimezonedDateTimeRange $otherRange) : bool { return $this->contains($otherRange->start) || $this->contains($otherRange->end) || $this->encompasses($otherRange) || $otherRange->encompasses($this); }
php
public function overlaps(TimezonedDateTimeRange $otherRange) : bool { return $this->contains($otherRange->start) || $this->contains($otherRange->end) || $this->encompasses($otherRange) || $otherRange->encompasses($this); }
[ "public", "function", "overlaps", "(", "TimezonedDateTimeRange", "$", "otherRange", ")", ":", "bool", "{", "return", "$", "this", "->", "contains", "(", "$", "otherRange", "->", "start", ")", "||", "$", "this", "->", "contains", "(", "$", "otherRange", "->...
Returns whether the supplied timezoned date time range overlaps this date time range. @param TimezonedDateTimeRange $otherRange @return bool
[ "Returns", "whether", "the", "supplied", "timezoned", "date", "time", "range", "overlaps", "this", "date", "time", "range", "." ]
23f122182f60df5ec847047a81a39c8aab019ff1
https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/DateTime/TimezonedDateTimeRange.php#L105-L110
train
Raphhh/puppy-static-route
src/StaticModule.php
StaticModule.init
public function init(Application $application) { $application->addService('staticController', new StaticControllerService()); $application->any(':all', $application->getService('staticController')); }
php
public function init(Application $application) { $application->addService('staticController', new StaticControllerService()); $application->any(':all', $application->getService('staticController')); }
[ "public", "function", "init", "(", "Application", "$", "application", ")", "{", "$", "application", "->", "addService", "(", "'staticController'", ",", "new", "StaticControllerService", "(", ")", ")", ";", "$", "application", "->", "any", "(", "':all'", ",", ...
init the module. @param Application $application
[ "init", "the", "module", "." ]
08d94ffdd9cc58fff1b0cae6982cc51b6e4ece5a
https://github.com/Raphhh/puppy-static-route/blob/08d94ffdd9cc58fff1b0cae6982cc51b6e4ece5a/src/StaticModule.php#L20-L24
train
inc2734/wp-page-speed-optimization
src/App/Controller/Assets.php
Assets._builded
public function _builded( $tag, $handle, $src ) { $handles = apply_filters( 'inc2734_wp_page_speed_optimization_builded_scripts', [] ); if ( ! in_array( $handle, $handles ) ) { return $tag; } return sprintf( '<script> document.addEventListener("DOMContentLoaded", function(event) { var s=document....
php
public function _builded( $tag, $handle, $src ) { $handles = apply_filters( 'inc2734_wp_page_speed_optimization_builded_scripts', [] ); if ( ! in_array( $handle, $handles ) ) { return $tag; } return sprintf( '<script> document.addEventListener("DOMContentLoaded", function(event) { var s=document....
[ "public", "function", "_builded", "(", "$", "tag", ",", "$", "handle", ",", "$", "src", ")", "{", "$", "handles", "=", "apply_filters", "(", "'inc2734_wp_page_speed_optimization_builded_scripts'", ",", "[", "]", ")", ";", "if", "(", "!", "in_array", "(", "...
Re-build script tag only in_footer param is true @param string $tag @param string handle @param string src @return string
[ "Re", "-", "build", "script", "tag", "only", "in_footer", "param", "is", "true" ]
219963582b592eef4bde6cdd4ed1cf0dc71a6114
https://github.com/inc2734/wp-page-speed-optimization/blob/219963582b592eef4bde6cdd4ed1cf0dc71a6114/src/App/Controller/Assets.php#L69-L86
train
inc2734/wp-page-speed-optimization
src/App/Controller/Assets.php
Assets._set_preload_stylesheet
public function _set_preload_stylesheet( $tag, $handle, $src ) { $handles = apply_filters( 'inc2734_wp_page_speed_optimization_output_head_styles', [] ); if ( in_array( $handle, $handles ) && 0 === strpos( $src, site_url() ) ) { $sitepath = site_url( '', 'relative' ); $abspath = untrailingslashit( ABSPATH );...
php
public function _set_preload_stylesheet( $tag, $handle, $src ) { $handles = apply_filters( 'inc2734_wp_page_speed_optimization_output_head_styles', [] ); if ( in_array( $handle, $handles ) && 0 === strpos( $src, site_url() ) ) { $sitepath = site_url( '', 'relative' ); $abspath = untrailingslashit( ABSPATH );...
[ "public", "function", "_set_preload_stylesheet", "(", "$", "tag", ",", "$", "handle", ",", "$", "src", ")", "{", "$", "handles", "=", "apply_filters", "(", "'inc2734_wp_page_speed_optimization_output_head_styles'", ",", "[", "]", ")", ";", "if", "(", "in_array",...
Set rel="preload" for stylesheet @param string $tag @param string handle @param string src @return string
[ "Set", "rel", "=", "preload", "for", "stylesheet" ]
219963582b592eef4bde6cdd4ed1cf0dc71a6114
https://github.com/inc2734/wp-page-speed-optimization/blob/219963582b592eef4bde6cdd4ed1cf0dc71a6114/src/App/Controller/Assets.php#L96-L124
train
inc2734/wp-page-speed-optimization
src/App/Controller/Assets.php
Assets._optimize_jquery_loading
public function _optimize_jquery_loading() { $optimize_loading = apply_filters( 'inc2734_wp_page_speed_optimization_optimize_jquery_loading', false ); if ( ! $optimize_loading ) { return; } if ( is_admin() || in_array( $GLOBALS['pagenow'], [ 'wp-login.php', 'wp-register.php' ] ) ) { return; } global...
php
public function _optimize_jquery_loading() { $optimize_loading = apply_filters( 'inc2734_wp_page_speed_optimization_optimize_jquery_loading', false ); if ( ! $optimize_loading ) { return; } if ( is_admin() || in_array( $GLOBALS['pagenow'], [ 'wp-login.php', 'wp-register.php' ] ) ) { return; } global...
[ "public", "function", "_optimize_jquery_loading", "(", ")", "{", "$", "optimize_loading", "=", "apply_filters", "(", "'inc2734_wp_page_speed_optimization_optimize_jquery_loading'", ",", "false", ")", ";", "if", "(", "!", "$", "optimize_loading", ")", "{", "return", ";...
Optimize jQuery loading jQuery loads in footer and Invalidate jquery-migrate @return void
[ "Optimize", "jQuery", "loading" ]
219963582b592eef4bde6cdd4ed1cf0dc71a6114
https://github.com/inc2734/wp-page-speed-optimization/blob/219963582b592eef4bde6cdd4ed1cf0dc71a6114/src/App/Controller/Assets.php#L161-L182
train
geega/php-simple-orm
src/Model.php
Model.find
static public function find($id) { $model = new static; $result = $model->execute('SELECT * FROM '.$model->table.' WHERE '.$model->key.' = ?', [$id]); if (is_array($result)) { $result = current($result); } return $result; }
php
static public function find($id) { $model = new static; $result = $model->execute('SELECT * FROM '.$model->table.' WHERE '.$model->key.' = ?', [$id]); if (is_array($result)) { $result = current($result); } return $result; }
[ "static", "public", "function", "find", "(", "$", "id", ")", "{", "$", "model", "=", "new", "static", ";", "$", "result", "=", "$", "model", "->", "execute", "(", "'SELECT * FROM '", ".", "$", "model", "->", "table", ".", "' WHERE '", ".", "$", "mode...
Find record by pk @param $id @return array|mixed
[ "Find", "record", "by", "pk" ]
8ef636fd181c16ee3936d630d99e232c53883447
https://github.com/geega/php-simple-orm/blob/8ef636fd181c16ee3936d630d99e232c53883447/src/Model.php#L60-L68
train
geega/php-simple-orm
src/Model.php
Model.findByQuery
static public function findByQuery($sqlQuery, array $params, $fetchMode = \PDO::FETCH_OBJ) { $model = new static; if($model->table) { $sqlQuery = str_replace(':table', $model->table, $sqlQuery); } $result = $model->execute($sqlQuery); return $result; }
php
static public function findByQuery($sqlQuery, array $params, $fetchMode = \PDO::FETCH_OBJ) { $model = new static; if($model->table) { $sqlQuery = str_replace(':table', $model->table, $sqlQuery); } $result = $model->execute($sqlQuery); return $result; }
[ "static", "public", "function", "findByQuery", "(", "$", "sqlQuery", ",", "array", "$", "params", ",", "$", "fetchMode", "=", "\\", "PDO", "::", "FETCH_OBJ", ")", "{", "$", "model", "=", "new", "static", ";", "if", "(", "$", "model", "->", "table", "...
Find by query @param $sqlQuery @param array $params @param int $fetchMode @return mixed
[ "Find", "by", "query" ]
8ef636fd181c16ee3936d630d99e232c53883447
https://github.com/geega/php-simple-orm/blob/8ef636fd181c16ee3936d630d99e232c53883447/src/Model.php#L96-L105
train
erenmustafaozdal/laravel-modules-base
src/Controllers/OperationNodeTrait.php
OperationNodeTrait.getNodes
protected function getNodes($class, $id) { $records = []; $records['nodes'] = []; $models = $this->getNodeModels($class, $id); foreach ($models as $model) { $records['nodes'][] = $this->getNodeValues($model); } return $records; }
php
protected function getNodes($class, $id) { $records = []; $records['nodes'] = []; $models = $this->getNodeModels($class, $id); foreach ($models as $model) { $records['nodes'][] = $this->getNodeValues($model); } return $records; }
[ "protected", "function", "getNodes", "(", "$", "class", ",", "$", "id", ")", "{", "$", "records", "=", "[", "]", ";", "$", "records", "[", "'nodes'", "]", "=", "[", "]", ";", "$", "models", "=", "$", "this", "->", "getNodeModels", "(", "$", "clas...
get nestable nodes @param $class @param integer|null $id @return array
[ "get", "nestable", "nodes" ]
c26600543817642926bcf16ada84009e00d784e0
https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Controllers/OperationNodeTrait.php#L38-L47
train
erenmustafaozdal/laravel-modules-base
src/Controllers/OperationNodeTrait.php
OperationNodeTrait.storeNode
protected function storeNode($class, $path = null, $id = null) { DB::beginTransaction(); try { $datas = $this->request->parent != 0 || $this->request->related != 0 ? $this->getDefineDatas($class) : $this->request->all(); $this->model = $class::create($datas); $thi...
php
protected function storeNode($class, $path = null, $id = null) { DB::beginTransaction(); try { $datas = $this->request->parent != 0 || $this->request->related != 0 ? $this->getDefineDatas($class) : $this->request->all(); $this->model = $class::create($datas); $thi...
[ "protected", "function", "storeNode", "(", "$", "class", ",", "$", "path", "=", "null", ",", "$", "id", "=", "null", ")", "{", "DB", "::", "beginTransaction", "(", ")", ";", "try", "{", "$", "datas", "=", "$", "this", "->", "request", "->", "parent...
store nestable node @param $class @param string|null $path @param integer|null $id @throws StoreException @return array
[ "store", "nestable", "node" ]
c26600543817642926bcf16ada84009e00d784e0
https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Controllers/OperationNodeTrait.php#L58-L94
train
erenmustafaozdal/laravel-modules-base
src/Controllers/OperationNodeTrait.php
OperationNodeTrait.moveModel
protected function moveModel($model) { $this->model = $model; DB::beginTransaction(); try { if ($this->request->position === 'firstChild' || $this->request->position === 'lastChild') { $this->model->fill($this->getDefineDatas($this->model))->save(); } ...
php
protected function moveModel($model) { $this->model = $model; DB::beginTransaction(); try { if ($this->request->position === 'firstChild' || $this->request->position === 'lastChild') { $this->model->fill($this->getDefineDatas($this->model))->save(); } ...
[ "protected", "function", "moveModel", "(", "$", "model", ")", "{", "$", "this", "->", "model", "=", "$", "model", ";", "DB", "::", "beginTransaction", "(", ")", ";", "try", "{", "if", "(", "$", "this", "->", "request", "->", "position", "===", "'firs...
move nestable node @param $model @throws StoreException @return array
[ "move", "nestable", "node" ]
c26600543817642926bcf16ada84009e00d784e0
https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Controllers/OperationNodeTrait.php#L103-L130
train
erenmustafaozdal/laravel-modules-base
src/Controllers/OperationNodeTrait.php
OperationNodeTrait.getNodeModels
private function getNodeModels($class, $relation_id) { if ($this->request->id === '0') { return is_null($relation_id) ? $class::all()->toHierarchy() : $class::where('parent_id',$relation_id)->get()->toHierarchy(); } return $class::findOrFail($this...
php
private function getNodeModels($class, $relation_id) { if ($this->request->id === '0') { return is_null($relation_id) ? $class::all()->toHierarchy() : $class::where('parent_id',$relation_id)->get()->toHierarchy(); } return $class::findOrFail($this...
[ "private", "function", "getNodeModels", "(", "$", "class", ",", "$", "relation_id", ")", "{", "if", "(", "$", "this", "->", "request", "->", "id", "===", "'0'", ")", "{", "return", "is_null", "(", "$", "relation_id", ")", "?", "$", "class", "::", "al...
get node models @param $class @param integer $relation_id @return \Illuminate\Database\Eloquent\Collection
[ "get", "node", "models" ]
c26600543817642926bcf16ada84009e00d784e0
https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Controllers/OperationNodeTrait.php#L139-L148
train
erenmustafaozdal/laravel-modules-base
src/Controllers/OperationNodeTrait.php
OperationNodeTrait.getNodeValues
private function getNodeValues($model) { $attribute = "{$this->name}_uc_first"; return [ 'id' => $model->id, 'parent' => $model->parent_id, 'name' => $model->$attribute, 'level' => $model->depth, 'type' => $model->is...
php
private function getNodeValues($model) { $attribute = "{$this->name}_uc_first"; return [ 'id' => $model->id, 'parent' => $model->parent_id, 'name' => $model->$attribute, 'level' => $model->depth, 'type' => $model->is...
[ "private", "function", "getNodeValues", "(", "$", "model", ")", "{", "$", "attribute", "=", "\"{$this->name}_uc_first\"", ";", "return", "[", "'id'", "=>", "$", "model", "->", "id", ",", "'parent'", "=>", "$", "model", "->", "parent_id", ",", "'name'", "=>...
get node values for return data @param \Illuminate\Database\Eloquent\Model $model @return array
[ "get", "node", "values", "for", "return", "data" ]
c26600543817642926bcf16ada84009e00d784e0
https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Controllers/OperationNodeTrait.php#L156-L166
train
erenmustafaozdal/laravel-modules-base
src/Controllers/OperationNodeTrait.php
OperationNodeTrait.getDefineDatas
protected function getDefineDatas($class) { $class = is_string($class) ? $class : get_class($class); $id = $this->request->has('parent') && $this->request->parent != 0 ? $this->request->parent : $this->request->related; $parent = $class::findOrFail($id); $datas = $this->request->all(...
php
protected function getDefineDatas($class) { $class = is_string($class) ? $class : get_class($class); $id = $this->request->has('parent') && $this->request->parent != 0 ? $this->request->parent : $this->request->related; $parent = $class::findOrFail($id); $datas = $this->request->all(...
[ "protected", "function", "getDefineDatas", "(", "$", "class", ")", "{", "$", "class", "=", "is_string", "(", "$", "class", ")", "?", "$", "class", ":", "get_class", "(", "$", "class", ")", ";", "$", "id", "=", "$", "this", "->", "request", "->", "h...
get the define datas @param $class @return array
[ "get", "the", "define", "datas" ]
c26600543817642926bcf16ada84009e00d784e0
https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Controllers/OperationNodeTrait.php#L185-L195
train
ContaoBlackForest/contao-doctrine-orm-timestampable
src/Timestampable/Bridge.php
Bridge.duplicateEntity
public static function duplicateEntity(DuplicateEntity $event) { if ($event->getWithoutKeys()) { $entity = $event->getEntity(); if (isset($GLOBALS['TL_DCA'][$entity->entityTableName()]['fields'])) { /** @var EntityAccessor $entityAccessor */ $entityAc...
php
public static function duplicateEntity(DuplicateEntity $event) { if ($event->getWithoutKeys()) { $entity = $event->getEntity(); if (isset($GLOBALS['TL_DCA'][$entity->entityTableName()]['fields'])) { /** @var EntityAccessor $entityAccessor */ $entityAc...
[ "public", "static", "function", "duplicateEntity", "(", "DuplicateEntity", "$", "event", ")", "{", "if", "(", "$", "event", "->", "getWithoutKeys", "(", ")", ")", "{", "$", "entity", "=", "$", "event", "->", "getEntity", "(", ")", ";", "if", "(", "isse...
Clean timestamp able entries from duplicated entities. @param DuplicateEntity $event The event. @return void @SuppressWarnings(PHPMD.Superglobals)
[ "Clean", "timestamp", "able", "entries", "from", "duplicated", "entities", "." ]
5322a2a4325dfbc4091c9a8ead010f882da13007
https://github.com/ContaoBlackForest/contao-doctrine-orm-timestampable/blob/5322a2a4325dfbc4091c9a8ead010f882da13007/src/Timestampable/Bridge.php#L56-L73
train
itkg/core
src/Itkg/Core/EntityAbstract.php
EntityAbstract.setDataForSubEntitiy
private function setDataForSubEntitiy($propertyKey, $value) { $subKey = strtolower(strstr($propertyKey, '_', true)); $getterMethodName = 'get' . ucfirst($subKey); if (!empty($subKey) && method_exists($this, $getterMethodName)) { $subObject = $this->$getterMethodName(); ...
php
private function setDataForSubEntitiy($propertyKey, $value) { $subKey = strtolower(strstr($propertyKey, '_', true)); $getterMethodName = 'get' . ucfirst($subKey); if (!empty($subKey) && method_exists($this, $getterMethodName)) { $subObject = $this->$getterMethodName(); ...
[ "private", "function", "setDataForSubEntitiy", "(", "$", "propertyKey", ",", "$", "value", ")", "{", "$", "subKey", "=", "strtolower", "(", "strstr", "(", "$", "propertyKey", ",", "'_'", ",", "true", ")", ")", ";", "$", "getterMethodName", "=", "'get'", ...
Process sub entity to set data recursively @param string $propertyKey @param mixed $value @return void
[ "Process", "sub", "entity", "to", "set", "data", "recursively" ]
e5e4efb05feb4d23b0df41f2b21fd095103e593b
https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/EntityAbstract.php#L129-L144
train
itkg/core
src/Itkg/Core/EntityAbstract.php
EntityAbstract.getPropertyValue
protected function getPropertyValue($propertyName) { $desiredKey = $this->trimPrefixKey($propertyName); $getter = 'get' . ucfirst($this->getPropertyName($desiredKey)); if (method_exists($this, $getter)) { return $this->$getter(); } // Otherwise, try to get sub o...
php
protected function getPropertyValue($propertyName) { $desiredKey = $this->trimPrefixKey($propertyName); $getter = 'get' . ucfirst($this->getPropertyName($desiredKey)); if (method_exists($this, $getter)) { return $this->$getter(); } // Otherwise, try to get sub o...
[ "protected", "function", "getPropertyValue", "(", "$", "propertyName", ")", "{", "$", "desiredKey", "=", "$", "this", "->", "trimPrefixKey", "(", "$", "propertyName", ")", ";", "$", "getter", "=", "'get'", ".", "ucfirst", "(", "$", "this", "->", "getProper...
Get method name for getter @param string $propertyName @throws \InvalidArgumentException @return string
[ "Get", "method", "name", "for", "getter" ]
e5e4efb05feb4d23b0df41f2b21fd095103e593b
https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/EntityAbstract.php#L216-L242
train
itkg/core
src/Itkg/Core/EntityAbstract.php
EntityAbstract.getDataForCache
public function getDataForCache() { $reflectionClass = new \ReflectionObject($this); $array = array(); $excludes = array_flip($this->excludedPropertiesForCache); $excludes['excludedPropertiesForCache'] = true; foreach ($reflectionClass->getProperties() as $property) { ...
php
public function getDataForCache() { $reflectionClass = new \ReflectionObject($this); $array = array(); $excludes = array_flip($this->excludedPropertiesForCache); $excludes['excludedPropertiesForCache'] = true; foreach ($reflectionClass->getProperties() as $property) { ...
[ "public", "function", "getDataForCache", "(", ")", "{", "$", "reflectionClass", "=", "new", "\\", "ReflectionObject", "(", "$", "this", ")", ";", "$", "array", "=", "array", "(", ")", ";", "$", "excludes", "=", "array_flip", "(", "$", "this", "->", "ex...
Get data from entity for cache set @return mixed
[ "Get", "data", "from", "entity", "for", "cache", "set" ]
e5e4efb05feb4d23b0df41f2b21fd095103e593b
https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/EntityAbstract.php#L270-L285
train
itkg/core
src/Itkg/Core/EntityAbstract.php
EntityAbstract.processPropertyForCache
protected function processPropertyForCache($propertyName) { $value = $this->$propertyName; if ($value instanceof CacheableInterface) { $value = $value->getDataForCache(); } elseif (is_object($value)) { $value = null; } return $value; }
php
protected function processPropertyForCache($propertyName) { $value = $this->$propertyName; if ($value instanceof CacheableInterface) { $value = $value->getDataForCache(); } elseif (is_object($value)) { $value = null; } return $value; }
[ "protected", "function", "processPropertyForCache", "(", "$", "propertyName", ")", "{", "$", "value", "=", "$", "this", "->", "$", "propertyName", ";", "if", "(", "$", "value", "instanceof", "CacheableInterface", ")", "{", "$", "value", "=", "$", "value", ...
Process a property to get data for caching flow @param string $propertyName @return mixed|null
[ "Process", "a", "property", "to", "get", "data", "for", "caching", "flow" ]
e5e4efb05feb4d23b0df41f2b21fd095103e593b
https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/EntityAbstract.php#L316-L327
train
wb-crowdfusion/crowdfusion
system/core/classes/mvc/controllers/NodeCliController.php
NodeCliController.deleteAll
protected function deleteAll() { $elements = $this->Request->getRequiredParameter('elements'); $interval = 1000; $elementSlugs = StringUtils::smartExplode($elements); $elements = array(); foreach($elementSlugs as $eSlug) $elements[] = $this->ElementService->getB...
php
protected function deleteAll() { $elements = $this->Request->getRequiredParameter('elements'); $interval = 1000; $elementSlugs = StringUtils::smartExplode($elements); $elements = array(); foreach($elementSlugs as $eSlug) $elements[] = $this->ElementService->getB...
[ "protected", "function", "deleteAll", "(", ")", "{", "$", "elements", "=", "$", "this", "->", "Request", "->", "getRequiredParameter", "(", "'elements'", ")", ";", "$", "interval", "=", "1000", ";", "$", "elementSlugs", "=", "StringUtils", "::", "smartExplod...
Deletes all nodes for specified elements. @param elements A comma delimited list of the elements to delete nodes in @param offset An integer value for the offset to begin deleting nodes from @return void
[ "Deletes", "all", "nodes", "for", "specified", "elements", "." ]
8cad7988f046a6fefbed07d026cb4ae6706c1217
https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/controllers/NodeCliController.php#L404-L467
train
fridge-project/dbal
src/Fridge/DBAL/Schema/Sequence.php
Sequence.setInitialValue
public function setInitialValue($initialValue) { if (!is_int($initialValue) || ($initialValue <= 0)) { throw SchemaException::invalidSequenceInitialValue($this->getName()); } $this->initialValue = $initialValue; }
php
public function setInitialValue($initialValue) { if (!is_int($initialValue) || ($initialValue <= 0)) { throw SchemaException::invalidSequenceInitialValue($this->getName()); } $this->initialValue = $initialValue; }
[ "public", "function", "setInitialValue", "(", "$", "initialValue", ")", "{", "if", "(", "!", "is_int", "(", "$", "initialValue", ")", "||", "(", "$", "initialValue", "<=", "0", ")", ")", "{", "throw", "SchemaException", "::", "invalidSequenceInitialValue", "...
Sets the initial value. @param integer $initialValue The initial value. @throws \Fridge\DBAL\Exception\SchemaException If the initial value is not a positive integer.
[ "Sets", "the", "initial", "value", "." ]
d0b8c3551922d696836487aa0eb1bd74014edcd4
https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/Sequence.php#L61-L68
train
fridge-project/dbal
src/Fridge/DBAL/Schema/Sequence.php
Sequence.setIncrementSize
public function setIncrementSize($incrementSize) { if (!is_int($incrementSize) || ($incrementSize <= 0)) { throw SchemaException::invalidSequenceIncrementSize($this->getName()); } $this->incrementSize = $incrementSize; }
php
public function setIncrementSize($incrementSize) { if (!is_int($incrementSize) || ($incrementSize <= 0)) { throw SchemaException::invalidSequenceIncrementSize($this->getName()); } $this->incrementSize = $incrementSize; }
[ "public", "function", "setIncrementSize", "(", "$", "incrementSize", ")", "{", "if", "(", "!", "is_int", "(", "$", "incrementSize", ")", "||", "(", "$", "incrementSize", "<=", "0", ")", ")", "{", "throw", "SchemaException", "::", "invalidSequenceIncrementSize"...
Sets the increment size. @param integer $incrementSize The increment size. @throws \Fridge\DBAL\Exception\SchemaException If the increment size is not a positive integer.
[ "Sets", "the", "increment", "size", "." ]
d0b8c3551922d696836487aa0eb1bd74014edcd4
https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/Sequence.php#L87-L94
train
CalderaWP/caldera-interop
src/Traits/CollectsModels.php
CollectsModels.addItem
public function addItem(Model $item) : Collection { call_user_func([$this,$this->setterName()], $item); return $this; }
php
public function addItem(Model $item) : Collection { call_user_func([$this,$this->setterName()], $item); return $this; }
[ "public", "function", "addItem", "(", "Model", "$", "item", ")", ":", "Collection", "{", "call_user_func", "(", "[", "$", "this", ",", "$", "this", "->", "setterName", "(", ")", "]", ",", "$", "item", ")", ";", "return", "$", "this", ";", "}" ]
Add item to collection @param Model $item @return Collection
[ "Add", "item", "to", "collection" ]
d25c4bc930200b314fbd42d084080b5d85261c94
https://github.com/CalderaWP/caldera-interop/blob/d25c4bc930200b314fbd42d084080b5d85261c94/src/Traits/CollectsModels.php#L27-L31
train
CalderaWP/caldera-interop
src/Traits/CollectsModels.php
CollectsModels.removeItem
public function removeItem(Model $item) : Collection { if ($this->has($item->getId())) { unset($this->items[$item->getId()]); } return $this; }
php
public function removeItem(Model $item) : Collection { if ($this->has($item->getId())) { unset($this->items[$item->getId()]); } return $this; }
[ "public", "function", "removeItem", "(", "Model", "$", "item", ")", ":", "Collection", "{", "if", "(", "$", "this", "->", "has", "(", "$", "item", "->", "getId", "(", ")", ")", ")", "{", "unset", "(", "$", "this", "->", "items", "[", "$", "item",...
Remove an item from collection @param Model $item @return Collection
[ "Remove", "an", "item", "from", "collection" ]
d25c4bc930200b314fbd42d084080b5d85261c94
https://github.com/CalderaWP/caldera-interop/blob/d25c4bc930200b314fbd42d084080b5d85261c94/src/Traits/CollectsModels.php#L56-L63
train
CalderaWP/caldera-interop
src/Traits/CollectsModels.php
CollectsModels.toArray
public function toArray() : array { $items= is_array($this->items)? $this->items : []; foreach ($items as $itemIndex => $item) { if (is_object($item)&& is_callable([$item,'toArray'])) { try { $items[ $itemIndex ] = $item->toArray(); } catch (\Exception $e) { throw $e; } } } return $...
php
public function toArray() : array { $items= is_array($this->items)? $this->items : []; foreach ($items as $itemIndex => $item) { if (is_object($item)&& is_callable([$item,'toArray'])) { try { $items[ $itemIndex ] = $item->toArray(); } catch (\Exception $e) { throw $e; } } } return $...
[ "public", "function", "toArray", "(", ")", ":", "array", "{", "$", "items", "=", "is_array", "(", "$", "this", "->", "items", ")", "?", "$", "this", "->", "items", ":", "[", "]", ";", "foreach", "(", "$", "items", "as", "$", "itemIndex", "=>", "$...
Get items in collection @return array
[ "Get", "items", "in", "collection" ]
d25c4bc930200b314fbd42d084080b5d85261c94
https://github.com/CalderaWP/caldera-interop/blob/d25c4bc930200b314fbd42d084080b5d85261c94/src/Traits/CollectsModels.php#L70-L83
train
JamesMcAvoy/PsrRouter
src/Route.php
Route.call
public function call(Request $request, Response $response) : Response { return call_user_func($this->callable, $request, $response, $this->slugs); }
php
public function call(Request $request, Response $response) : Response { return call_user_func($this->callable, $request, $response, $this->slugs); }
[ "public", "function", "call", "(", "Request", "$", "request", ",", "Response", "$", "response", ")", ":", "Response", "{", "return", "call_user_func", "(", "$", "this", "->", "callable", ",", "$", "request", ",", "$", "response", ",", "$", "this", "->", ...
Call the callback function of the route @param RequestInterface @param ResponseInterface @return mixed
[ "Call", "the", "callback", "function", "of", "the", "route" ]
00a3e15f8d1f87aef0eadde1074bea2179cd53fe
https://github.com/JamesMcAvoy/PsrRouter/blob/00a3e15f8d1f87aef0eadde1074bea2179cd53fe/src/Route.php#L95-L99
train
kambalabs/KmbPuppetDb
src/KmbPuppetDb/Request.php
Request.getFullUri
public function getFullUri() { $queryString = ''; $params = array(); if ($this->hasQuery()) { $params[] = $this->getQueryParam(); } if ($this->hasOrderBy()) { $params[] = $this->getOrderByParam(); } if ($this->hasSummarizeBy()) { ...
php
public function getFullUri() { $queryString = ''; $params = array(); if ($this->hasQuery()) { $params[] = $this->getQueryParam(); } if ($this->hasOrderBy()) { $params[] = $this->getOrderByParam(); } if ($this->hasSummarizeBy()) { ...
[ "public", "function", "getFullUri", "(", ")", "{", "$", "queryString", "=", "''", ";", "$", "params", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "hasQuery", "(", ")", ")", "{", "$", "params", "[", "]", "=", "$", "this", "->", "g...
Get full constructed URI. @return string
[ "Get", "full", "constructed", "URI", "." ]
df56a275cf00f4402cf121a2e99149168f1f8b2d
https://github.com/kambalabs/KmbPuppetDb/blob/df56a275cf00f4402cf121a2e99149168f1f8b2d/src/KmbPuppetDb/Request.php#L70-L104
train
Wedeto/Util
src/DI/Injector.php
Injector.getInstance
public function getInstance(string $class, string $selector = Injector::DEFAULT_SELECTOR) { if (array_search($class, $this->instance_stack, true)) throw new DIException("Cyclic dependencies in creating $class: " . WF::str($this->instance_stack)); array_push($this->instance_stack, $class...
php
public function getInstance(string $class, string $selector = Injector::DEFAULT_SELECTOR) { if (array_search($class, $this->instance_stack, true)) throw new DIException("Cyclic dependencies in creating $class: " . WF::str($this->instance_stack)); array_push($this->instance_stack, $class...
[ "public", "function", "getInstance", "(", "string", "$", "class", ",", "string", "$", "selector", "=", "Injector", "::", "DEFAULT_SELECTOR", ")", "{", "if", "(", "array_search", "(", "$", "class", ",", "$", "this", "->", "instance_stack", ",", "true", ")",...
Get an instance of the object @param string $class The class to get an instance of @param string $selector Where multiple instances may exist, they can be categorized by a selector @return Object an instance of the class
[ "Get", "an", "instance", "of", "the", "object" ]
0e080251bbaa8e7d91ae8d02eb79c029c976744a
https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/DI/Injector.php#L77-L120
train
Wedeto/Util
src/DI/Injector.php
Injector.hasInstance
public function hasInstance(string $class, string $selector = Injector::DEFAULT_SELECTOR) { return isset($this->objects[$class][$selector]); }
php
public function hasInstance(string $class, string $selector = Injector::DEFAULT_SELECTOR) { return isset($this->objects[$class][$selector]); }
[ "public", "function", "hasInstance", "(", "string", "$", "class", ",", "string", "$", "selector", "=", "Injector", "::", "DEFAULT_SELECTOR", ")", "{", "return", "isset", "(", "$", "this", "->", "objects", "[", "$", "class", "]", "[", "$", "selector", "]"...
Check if an instance for the class is available. @param string $class The class to check for an instance @param string $selector The selector to use to find an instance. Defaults to DEFAULT_SELECTOR @return bool True if an instance is available, false if not
[ "Check", "if", "an", "instance", "for", "the", "class", "is", "available", "." ]
0e080251bbaa8e7d91ae8d02eb79c029c976744a
https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/DI/Injector.php#L129-L132
train
Wedeto/Util
src/DI/Injector.php
Injector.registerFactory
public function registerFactory(string $produced_class, Factory $factory) { $this->factories[$produced_class] = $factory; return $this; }
php
public function registerFactory(string $produced_class, Factory $factory) { $this->factories[$produced_class] = $factory; return $this; }
[ "public", "function", "registerFactory", "(", "string", "$", "produced_class", ",", "Factory", "$", "factory", ")", "{", "$", "this", "->", "factories", "[", "$", "produced_class", "]", "=", "$", "factory", ";", "return", "$", "this", ";", "}" ]
Register a factory for a class name @param string $produced_class The class produced by the factory @param Wedeto\Util\DI\Factory $factory The factory to register @return $this Provides fluent interface
[ "Register", "a", "factory", "for", "a", "class", "name" ]
0e080251bbaa8e7d91ae8d02eb79c029c976744a
https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/DI/Injector.php#L161-L165
train
Wedeto/Util
src/DI/Injector.php
Injector.setInstance
public function setInstance(string $class, $instance, string $selector = Injector::DEFAULT_SELECTOR) { if (!is_a($instance, $class)) throw new DIException("Instance should be a subclass of $class"); if (!isset($this->objects[$class])) $this->objects[$class] = []; $t...
php
public function setInstance(string $class, $instance, string $selector = Injector::DEFAULT_SELECTOR) { if (!is_a($instance, $class)) throw new DIException("Instance should be a subclass of $class"); if (!isset($this->objects[$class])) $this->objects[$class] = []; $t...
[ "public", "function", "setInstance", "(", "string", "$", "class", ",", "$", "instance", ",", "string", "$", "selector", "=", "Injector", "::", "DEFAULT_SELECTOR", ")", "{", "if", "(", "!", "is_a", "(", "$", "instance", ",", "$", "class", ")", ")", "thr...
Set a specific instance of class @param string $class The name of the class @param string $selector Where multiple instances may exist, they can be caterogized by a selector @param object $instance The instance to set for this class
[ "Set", "a", "specific", "instance", "of", "class" ]
0e080251bbaa8e7d91ae8d02eb79c029c976744a
https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/DI/Injector.php#L174-L183
train
Wedeto/Util
src/DI/Injector.php
Injector.clearInstance
public function clearInstance(string $class, string $selector = Injector::DEFAULT_SELECTOR) { if (!isset($this->objects[$class])) return; unset($this->objects[$class][$selector]); }
php
public function clearInstance(string $class, string $selector = Injector::DEFAULT_SELECTOR) { if (!isset($this->objects[$class])) return; unset($this->objects[$class][$selector]); }
[ "public", "function", "clearInstance", "(", "string", "$", "class", ",", "string", "$", "selector", "=", "Injector", "::", "DEFAULT_SELECTOR", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "objects", "[", "$", "class", "]", ")", ")", "retu...
Remove an instance from the repository @param string $class The name of the class @param string $selector The selector to clear
[ "Remove", "an", "instance", "from", "the", "repository" ]
0e080251bbaa8e7d91ae8d02eb79c029c976744a
https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/DI/Injector.php#L190-L196
train
shrink0r/php-schema
src/Property/BoolProperty.php
BoolProperty.validate
public function validate($value) { return is_bool($value) ? Ok::unit() : Error::unit([ Error::NON_BOOL ]); }
php
public function validate($value) { return is_bool($value) ? Ok::unit() : Error::unit([ Error::NON_BOOL ]); }
[ "public", "function", "validate", "(", "$", "value", ")", "{", "return", "is_bool", "(", "$", "value", ")", "?", "Ok", "::", "unit", "(", ")", ":", "Error", "::", "unit", "(", "[", "Error", "::", "NON_BOOL", "]", ")", ";", "}" ]
Tells if a given value is a valid bool. @param mixed $value @return ResultInterface Returns Ok if the value is valid, otherwise an Error is returned.
[ "Tells", "if", "a", "given", "value", "is", "a", "valid", "bool", "." ]
94293fe897af376dd9d05962e2c516079409dd29
https://github.com/shrink0r/php-schema/blob/94293fe897af376dd9d05962e2c516079409dd29/src/Property/BoolProperty.php#L18-L21
train
oziks/XHProfServiceProvider
src/Oziks/Lib/XHProfRun.php
XHProfRun.end
public function end() { if (!extension_loaded('xhprof')) { throw new Exception("XHProf extension is not loaded.", 1); } if ($this->started) { $this->data = xhprof_disable(); require_once(sprintf('%s/xhprof_lib/utils/xhprof_runs.php', $this->dir)); ...
php
public function end() { if (!extension_loaded('xhprof')) { throw new Exception("XHProf extension is not loaded.", 1); } if ($this->started) { $this->data = xhprof_disable(); require_once(sprintf('%s/xhprof_lib/utils/xhprof_runs.php', $this->dir)); ...
[ "public", "function", "end", "(", ")", "{", "if", "(", "!", "extension_loaded", "(", "'xhprof'", ")", ")", "{", "throw", "new", "Exception", "(", "\"XHProf extension is not loaded.\"", ",", "1", ")", ";", "}", "if", "(", "$", "this", "->", "started", ")"...
Triggers the end of the run @return boolean True if the run is started before call end method
[ "Triggers", "the", "end", "of", "the", "run" ]
2b262b242bb29a5627c5a9f61545a10035414ae7
https://github.com/oziks/XHProfServiceProvider/blob/2b262b242bb29a5627c5a9f61545a10035414ae7/src/Oziks/Lib/XHProfRun.php#L66-L81
train
oziks/XHProfServiceProvider
src/Oziks/Lib/XHProfRun.php
XHProfRun.getReport
public function getReport($id = null) { if ($id === null) { $id = $this->id; } return array('runId' => $id, 'report' => sprintf('%s?run=%s&source=%s', $this->host, $id, $this->namespace)); }
php
public function getReport($id = null) { if ($id === null) { $id = $this->id; } return array('runId' => $id, 'report' => sprintf('%s?run=%s&source=%s', $this->host, $id, $this->namespace)); }
[ "public", "function", "getReport", "(", "$", "id", "=", "null", ")", "{", "if", "(", "$", "id", "===", "null", ")", "{", "$", "id", "=", "$", "this", "->", "id", ";", "}", "return", "array", "(", "'runId'", "=>", "$", "id", ",", "'report'", "=>...
Gets the current report. @return array The current report
[ "Gets", "the", "current", "report", "." ]
2b262b242bb29a5627c5a9f61545a10035414ae7
https://github.com/oziks/XHProfServiceProvider/blob/2b262b242bb29a5627c5a9f61545a10035414ae7/src/Oziks/Lib/XHProfRun.php#L88-L95
train
oziks/XHProfServiceProvider
src/Oziks/Lib/XHProfRun.php
XHProfRun.getReports
public function getReports() { $reports = array(); $dir = ini_get("xhprof.output_dir"); if (is_dir($dir)) { $finder = new Finder(); $finder ->files() ->name('*.'.$this->namespace) ->notName($this->id.'.'.$this->namespac...
php
public function getReports() { $reports = array(); $dir = ini_get("xhprof.output_dir"); if (is_dir($dir)) { $finder = new Finder(); $finder ->files() ->name('*.'.$this->namespace) ->notName($this->id.'.'.$this->namespac...
[ "public", "function", "getReports", "(", ")", "{", "$", "reports", "=", "array", "(", ")", ";", "$", "dir", "=", "ini_get", "(", "\"xhprof.output_dir\"", ")", ";", "if", "(", "is_dir", "(", "$", "dir", ")", ")", "{", "$", "finder", "=", "new", "Fin...
Gets the last reports. @return array The last reports
[ "Gets", "the", "last", "reports", "." ]
2b262b242bb29a5627c5a9f61545a10035414ae7
https://github.com/oziks/XHProfServiceProvider/blob/2b262b242bb29a5627c5a9f61545a10035414ae7/src/Oziks/Lib/XHProfRun.php#L102-L132
train
cloudtek/dynamodm
lib/Cloudtek/DynamoDM/Expression/Operand/Path.php
Path.funcCondition
private function funcCondition($name, $arg = null) { $this->getExpr()->addCondition(new ConditionFunc( $name, $this, $arg !== null ? $this->getExpr()->value($arg) : null )); return $this->getExpr(); }
php
private function funcCondition($name, $arg = null) { $this->getExpr()->addCondition(new ConditionFunc( $name, $this, $arg !== null ? $this->getExpr()->value($arg) : null )); return $this->getExpr(); }
[ "private", "function", "funcCondition", "(", "$", "name", ",", "$", "arg", "=", "null", ")", "{", "$", "this", "->", "getExpr", "(", ")", "->", "addCondition", "(", "new", "ConditionFunc", "(", "$", "name", ",", "$", "this", ",", "$", "arg", "!==", ...
Add a function call to the current expression. @param string $name @param string|null $arg @return QueryBuilder|Expr
[ "Add", "a", "function", "call", "to", "the", "current", "expression", "." ]
119d355e2c5cbaef1f867970349b4432f5704fcd
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Expression/Operand/Path.php#L84-L93
train
cloudtek/dynamodm
lib/Cloudtek/DynamoDM/Expression/Operand/Path.php
Path.prime
public function prime($primer = true) { if (!is_bool($primer) && !is_callable($primer)) { throw new \InvalidArgumentException('$primer is not a boolean or callable'); } if ($primer === false) { unset($this->getExpr()->qb->primers[$this->getExpression()]); ...
php
public function prime($primer = true) { if (!is_bool($primer) && !is_callable($primer)) { throw new \InvalidArgumentException('$primer is not a boolean or callable'); } if ($primer === false) { unset($this->getExpr()->qb->primers[$this->getExpression()]); ...
[ "public", "function", "prime", "(", "$", "primer", "=", "true", ")", "{", "if", "(", "!", "is_bool", "(", "$", "primer", ")", "&&", "!", "is_callable", "(", "$", "primer", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'$primer ...
Use a primer to eagerly load all references in this path segment. If $primer is true or a callable is provided, referenced documents for this attribute will loaded into UnitOfWork immediately after the query is executed. This will avoid multiple queries due to lazy initialization of Proxy objects. If $primer is false...
[ "Use", "a", "primer", "to", "eagerly", "load", "all", "references", "in", "this", "path", "segment", "." ]
119d355e2c5cbaef1f867970349b4432f5704fcd
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Expression/Operand/Path.php#L242-L257
train
anime-db/catalog-bundle
src/Controller/RefillController.php
RefillController.refillAction
public function refillAction($plugin, $field, Request $request) { /* @var $refiller RefillerInterface */ if (!($refiller = $this->get('anime_db.plugin.refiller')->getPlugin($plugin))) { throw $this->createNotFoundException('Plugin \''.$plugin.'\' is not found'); } $item =...
php
public function refillAction($plugin, $field, Request $request) { /* @var $refiller RefillerInterface */ if (!($refiller = $this->get('anime_db.plugin.refiller')->getPlugin($plugin))) { throw $this->createNotFoundException('Plugin \''.$plugin.'\' is not found'); } $item =...
[ "public", "function", "refillAction", "(", "$", "plugin", ",", "$", "field", ",", "Request", "$", "request", ")", "{", "/* @var $refiller RefillerInterface */", "if", "(", "!", "(", "$", "refiller", "=", "$", "this", "->", "get", "(", "'anime_db.plugin.refille...
Refill item. @param string $plugin @param string $field @param Request $request @return Response
[ "Refill", "item", "." ]
631b6f92a654e91bee84f46218c52cf42bdb8606
https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Controller/RefillController.php#L47-L63
train
anime-db/catalog-bundle
src/Controller/RefillController.php
RefillController.searchAction
public function searchAction($plugin, $field, Request $request) { /* @var $refiller RefillerInterface */ if (!($refiller = $this->get('anime_db.plugin.refiller')->getPlugin($plugin))) { throw $this->createNotFoundException('Plugin \''.$plugin.'\' is not found'); } $item =...
php
public function searchAction($plugin, $field, Request $request) { /* @var $refiller RefillerInterface */ if (!($refiller = $this->get('anime_db.plugin.refiller')->getPlugin($plugin))) { throw $this->createNotFoundException('Plugin \''.$plugin.'\' is not found'); } $item =...
[ "public", "function", "searchAction", "(", "$", "plugin", ",", "$", "field", ",", "Request", "$", "request", ")", "{", "/* @var $refiller RefillerInterface */", "if", "(", "!", "(", "$", "refiller", "=", "$", "this", "->", "get", "(", "'anime_db.plugin.refille...
Search for refill. @param string $plugin @param string $field @param Request $request @return Response
[ "Search", "for", "refill", "." ]
631b6f92a654e91bee84f46218c52cf42bdb8606
https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Controller/RefillController.php#L74-L108
train
mekras/class-helpers
src/Traits/LoggingHelperTrait.php
LoggingHelperTrait.logException
protected function logException(\Exception $e, $action = null, $level = LogLevel::ERROR) { $message = $action ? sprintf('%s failed: %s', $action, $e->getMessage()) : sprintf('%s: %s', get_class($e), $e->getMessage()); $this->getLogger()->log($level, $message, ['backtrace' => ...
php
protected function logException(\Exception $e, $action = null, $level = LogLevel::ERROR) { $message = $action ? sprintf('%s failed: %s', $action, $e->getMessage()) : sprintf('%s: %s', get_class($e), $e->getMessage()); $this->getLogger()->log($level, $message, ['backtrace' => ...
[ "protected", "function", "logException", "(", "\\", "Exception", "$", "e", ",", "$", "action", "=", "null", ",", "$", "level", "=", "LogLevel", "::", "ERROR", ")", "{", "$", "message", "=", "$", "action", "?", "sprintf", "(", "'%s failed: %s'", ",", "$...
Log exception. @param \Exception $e Exception. @param string|null $action Failed action short description. @param mixed $level Log level (default to LogLevel::ERROR). @since 1.1 Default log level is LogLevel::ERROR @since 1.0
[ "Log", "exception", "." ]
4b00db6cba814cb5f8973a5929c167fce555c172
https://github.com/mekras/class-helpers/blob/4b00db6cba814cb5f8973a5929c167fce555c172/src/Traits/LoggingHelperTrait.php#L68-L74
train
PatrolServer/patrolsdk-php
lib/PatrolObject.php
PatrolObject.defaults
public function defaults($defaults) { $this->defaults = $defaults; foreach ($defaults as $k => $v) { if (property_exists($this, $k)) { $this->{$k} = $v; } } }
php
public function defaults($defaults) { $this->defaults = $defaults; foreach ($defaults as $k => $v) { if (property_exists($this, $k)) { $this->{$k} = $v; } } }
[ "public", "function", "defaults", "(", "$", "defaults", ")", "{", "$", "this", "->", "defaults", "=", "$", "defaults", ";", "foreach", "(", "$", "defaults", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "property_exists", "(", "$", "this", "...
Sets the default values for this PatrolObject @param array $defaults
[ "Sets", "the", "default", "values", "for", "this", "PatrolObject" ]
2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2
https://github.com/PatrolServer/patrolsdk-php/blob/2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2/lib/PatrolObject.php#L108-L116
train
PatrolServer/patrolsdk-php
lib/PatrolObject.php
PatrolObject.mergeValues
public function mergeValues($object) { $values = $object->__toArray(); foreach ($values as $k => $v) { $this->values[$k] = $v; } if ($object->id) $this->id = $object->id; $this->dirty_values = []; }
php
public function mergeValues($object) { $values = $object->__toArray(); foreach ($values as $k => $v) { $this->values[$k] = $v; } if ($object->id) $this->id = $object->id; $this->dirty_values = []; }
[ "public", "function", "mergeValues", "(", "$", "object", ")", "{", "$", "values", "=", "$", "object", "->", "__toArray", "(", ")", ";", "foreach", "(", "$", "values", "as", "$", "k", "=>", "$", "v", ")", "{", "$", "this", "->", "values", "[", "$"...
Merges values from another PatrolObject @param PatrolObject
[ "Merges", "values", "from", "another", "PatrolObject" ]
2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2
https://github.com/PatrolServer/patrolsdk-php/blob/2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2/lib/PatrolObject.php#L123-L131
train
zarathustra323/modlr-data
src/Zarathustra/ModlrData/Metadata/MetadataFactory.php
MetadataFactory.isChildOf
public function isChildOf($child, $parent) { $childMeta = $this->getMetadataForType($child); if (false === $childMeta->isChildEntity()) { return false; } return $childMeta->getParentEntityType() === $parent; }
php
public function isChildOf($child, $parent) { $childMeta = $this->getMetadataForType($child); if (false === $childMeta->isChildEntity()) { return false; } return $childMeta->getParentEntityType() === $parent; }
[ "public", "function", "isChildOf", "(", "$", "child", ",", "$", "parent", ")", "{", "$", "childMeta", "=", "$", "this", "->", "getMetadataForType", "(", "$", "child", ")", ";", "if", "(", "false", "===", "$", "childMeta", "->", "isChildEntity", "(", ")...
Determines if a type is direct child of another type. @param string $child @param string $parent @return bool
[ "Determines", "if", "a", "type", "is", "direct", "child", "of", "another", "type", "." ]
7c2c767216055f75abf8cf22e2200f11998ed24e
https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Metadata/MetadataFactory.php#L205-L212
train
zarathustra323/modlr-data
src/Zarathustra/ModlrData/Metadata/MetadataFactory.php
MetadataFactory.isDescendantOf
public function isDescendantOf($child, $parent) { $childMeta = $this->getMetadataForType($child); if (false === $childMeta->isChildEntity()) { return false; } if ($childMeta->getParentEntityType() === $parent) { return true; } return $this->isD...
php
public function isDescendantOf($child, $parent) { $childMeta = $this->getMetadataForType($child); if (false === $childMeta->isChildEntity()) { return false; } if ($childMeta->getParentEntityType() === $parent) { return true; } return $this->isD...
[ "public", "function", "isDescendantOf", "(", "$", "child", ",", "$", "parent", ")", "{", "$", "childMeta", "=", "$", "this", "->", "getMetadataForType", "(", "$", "child", ")", ";", "if", "(", "false", "===", "$", "childMeta", "->", "isChildEntity", "(",...
Determines if a type is a descendant of another type. @param string $child @param string $parent @return bool
[ "Determines", "if", "a", "type", "is", "a", "descendant", "of", "another", "type", "." ]
7c2c767216055f75abf8cf22e2200f11998ed24e
https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Metadata/MetadataFactory.php#L233-L243
train
zarathustra323/modlr-data
src/Zarathustra/ModlrData/Metadata/MetadataFactory.php
MetadataFactory.mergeMetadata
private function mergeMetadata(EntityMetadata &$metadata = null, EntityMetadata $toAdd) { if (null === $metadata) { $metadata = clone $toAdd; } else { $metadata->merge($toAdd); } }
php
private function mergeMetadata(EntityMetadata &$metadata = null, EntityMetadata $toAdd) { if (null === $metadata) { $metadata = clone $toAdd; } else { $metadata->merge($toAdd); } }
[ "private", "function", "mergeMetadata", "(", "EntityMetadata", "&", "$", "metadata", "=", "null", ",", "EntityMetadata", "$", "toAdd", ")", "{", "if", "(", "null", "===", "$", "metadata", ")", "{", "$", "metadata", "=", "clone", "$", "toAdd", ";", "}", ...
Merges two sets of EntityMetadata. Is used for applying inheritance information. @param EntityMetadata &$metadata @param EntityMetadata $toAdd
[ "Merges", "two", "sets", "of", "EntityMetadata", ".", "Is", "used", "for", "applying", "inheritance", "information", "." ]
7c2c767216055f75abf8cf22e2200f11998ed24e
https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Metadata/MetadataFactory.php#L252-L259
train
zarathustra323/modlr-data
src/Zarathustra/ModlrData/Metadata/MetadataFactory.php
MetadataFactory.formatEntityType
private function formatEntityType($type) { $delim = EntityMetadata::NAMESPACE_DELIM; if (false === stristr($type, $delim)) { return $this->inflector->studlify($type); } $parts = explode($delim, $type); foreach ($parts as &$part) { $part = $this->infle...
php
private function formatEntityType($type) { $delim = EntityMetadata::NAMESPACE_DELIM; if (false === stristr($type, $delim)) { return $this->inflector->studlify($type); } $parts = explode($delim, $type); foreach ($parts as &$part) { $part = $this->infle...
[ "private", "function", "formatEntityType", "(", "$", "type", ")", "{", "$", "delim", "=", "EntityMetadata", "::", "NAMESPACE_DELIM", ";", "if", "(", "false", "===", "stristr", "(", "$", "type", ",", "$", "delim", ")", ")", "{", "return", "$", "this", "...
Formats the entity type. @param string $type @return string
[ "Formats", "the", "entity", "type", "." ]
7c2c767216055f75abf8cf22e2200f11998ed24e
https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Metadata/MetadataFactory.php#L267-L279
train
zarathustra323/modlr-data
src/Zarathustra/ModlrData/Metadata/MetadataFactory.php
MetadataFactory.getFromMemory
private function getFromMemory($type) { if (isset($this->loaded[$type])) { return $this->loaded[$type]; } return null; }
php
private function getFromMemory($type) { if (isset($this->loaded[$type])) { return $this->loaded[$type]; } return null; }
[ "private", "function", "getFromMemory", "(", "$", "type", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "loaded", "[", "$", "type", "]", ")", ")", "{", "return", "$", "this", "->", "loaded", "[", "$", "type", "]", ";", "}", "return", "nul...
Gets a Metadata instance for a type from memory. @return EntityMetadata|null
[ "Gets", "a", "Metadata", "instance", "for", "a", "type", "from", "memory", "." ]
7c2c767216055f75abf8cf22e2200f11998ed24e
https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Metadata/MetadataFactory.php#L333-L339
train
zarathustra323/modlr-data
src/Zarathustra/ModlrData/Metadata/MetadataFactory.php
MetadataFactory.getFromCache
private function getFromCache($type) { if (false === $this->hasCache()) { return null; } return $this->cache->loadMetadataFromCache($type); }
php
private function getFromCache($type) { if (false === $this->hasCache()) { return null; } return $this->cache->loadMetadataFromCache($type); }
[ "private", "function", "getFromCache", "(", "$", "type", ")", "{", "if", "(", "false", "===", "$", "this", "->", "hasCache", "(", ")", ")", "{", "return", "null", ";", "}", "return", "$", "this", "->", "cache", "->", "loadMetadataFromCache", "(", "$", ...
Retrieves a Metadata instance for a type from cache. @return EntityMetadata|null
[ "Retrieves", "a", "Metadata", "instance", "for", "a", "type", "from", "cache", "." ]
7c2c767216055f75abf8cf22e2200f11998ed24e
https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Metadata/MetadataFactory.php#L358-L364
train
wearenolte/assets
src/Assets.php
Assets.set_up_environment
private function set_up_environment() { if ( $this->it_has( 'environment' ) ) { $this->environment = $this->options['environment']; } else { $this->environment = defined( 'WP_DEBUG' ) && WP_DEBUG ? 'development' : 'production'; } }
php
private function set_up_environment() { if ( $this->it_has( 'environment' ) ) { $this->environment = $this->options['environment']; } else { $this->environment = defined( 'WP_DEBUG' ) && WP_DEBUG ? 'development' : 'production'; } }
[ "private", "function", "set_up_environment", "(", ")", "{", "if", "(", "$", "this", "->", "it_has", "(", "'environment'", ")", ")", "{", "$", "this", "->", "environment", "=", "$", "this", "->", "options", "[", "'environment'", "]", ";", "}", "else", "...
Setup the environment based on options given. @since 1.1.0 @access private @return void
[ "Setup", "the", "environment", "based", "on", "options", "given", "." ]
2082a8085a4d3731c530aed0f2fa183e4aa4b6e8
https://github.com/wearenolte/assets/blob/2082a8085a4d3731c530aed0f2fa183e4aa4b6e8/src/Assets.php#L135-L143
train
wearenolte/assets
src/Assets.php
Assets.set_up_version_numbers
private function set_up_version_numbers() { if ( $this->it_has( 'js_version' ) ) { $this->js_version = $this->options['js_version']; } if ( $this->it_has( 'css_version' ) ) { $this->css_version = $this->options['css_version']; } if ( $this->it_has( 'jquery_version' ) ) { $this->jquery_version = $this...
php
private function set_up_version_numbers() { if ( $this->it_has( 'js_version' ) ) { $this->js_version = $this->options['js_version']; } if ( $this->it_has( 'css_version' ) ) { $this->css_version = $this->options['css_version']; } if ( $this->it_has( 'jquery_version' ) ) { $this->jquery_version = $this...
[ "private", "function", "set_up_version_numbers", "(", ")", "{", "if", "(", "$", "this", "->", "it_has", "(", "'js_version'", ")", ")", "{", "$", "this", "->", "js_version", "=", "$", "this", "->", "options", "[", "'js_version'", "]", ";", "}", "if", "(...
Setup JS and CSS version numbers based on options given. @since 1.1.0 @access private @return void
[ "Setup", "JS", "and", "CSS", "version", "numbers", "based", "on", "options", "given", "." ]
2082a8085a4d3731c530aed0f2fa183e4aa4b6e8
https://github.com/wearenolte/assets/blob/2082a8085a4d3731c530aed0f2fa183e4aa4b6e8/src/Assets.php#L153-L163
train
wearenolte/assets
src/Assets.php
Assets.it_has
private function it_has( $option_name ) { return array_key_exists( $option_name, $this->options ) && ! empty( $this->options[ $option_name ] ); }
php
private function it_has( $option_name ) { return array_key_exists( $option_name, $this->options ) && ! empty( $this->options[ $option_name ] ); }
[ "private", "function", "it_has", "(", "$", "option_name", ")", "{", "return", "array_key_exists", "(", "$", "option_name", ",", "$", "this", "->", "options", ")", "&&", "!", "empty", "(", "$", "this", "->", "options", "[", "$", "option_name", "]", ")", ...
Check whether a given option exists in the options array. @since 1.1.0 @access private @param string $option_name The name of the option to check for existence. @return bool Whether the given option key exists.
[ "Check", "whether", "a", "given", "option", "exists", "in", "the", "options", "array", "." ]
2082a8085a4d3731c530aed0f2fa183e4aa4b6e8
https://github.com/wearenolte/assets/blob/2082a8085a4d3731c530aed0f2fa183e4aa4b6e8/src/Assets.php#L174-L176
train
wearenolte/assets
src/Assets.php
Assets.load
public function load() { $this->load_comments = $this->it_has( 'load_coments', $this->options ) ? $this->options['load_comments'] : false; $this->enqueue_assets(); }
php
public function load() { $this->load_comments = $this->it_has( 'load_coments', $this->options ) ? $this->options['load_comments'] : false; $this->enqueue_assets(); }
[ "public", "function", "load", "(", ")", "{", "$", "this", "->", "load_comments", "=", "$", "this", "->", "it_has", "(", "'load_coments'", ",", "$", "this", "->", "options", ")", "?", "$", "this", "->", "options", "[", "'load_comments'", "]", ":", "fals...
Enqueues the theme assets. @since 1.1.0 @return void
[ "Enqueues", "the", "theme", "assets", "." ]
2082a8085a4d3731c530aed0f2fa183e4aa4b6e8
https://github.com/wearenolte/assets/blob/2082a8085a4d3731c530aed0f2fa183e4aa4b6e8/src/Assets.php#L185-L190
train
wearenolte/assets
src/Assets.php
Assets.setup_assets
public function setup_assets() { $suffix = $this->get_assets_suffix(); if ( ! is_admin() ) { if ( ! empty( $this->jquery_uri ) ) { $this->update_jquery(); } $remove_emoji_exists = array_key_exists( 'remove_emoji', $this->options ); if ( ! $remove_emoji_exists || ( $remove_emoji_exists && $this-...
php
public function setup_assets() { $suffix = $this->get_assets_suffix(); if ( ! is_admin() ) { if ( ! empty( $this->jquery_uri ) ) { $this->update_jquery(); } $remove_emoji_exists = array_key_exists( 'remove_emoji', $this->options ); if ( ! $remove_emoji_exists || ( $remove_emoji_exists && $this-...
[ "public", "function", "setup_assets", "(", ")", "{", "$", "suffix", "=", "$", "this", "->", "get_assets_suffix", "(", ")", ";", "if", "(", "!", "is_admin", "(", ")", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "jquery_uri", ")", ")",...
Enqueues JS and CSS assets based on options passed. @since 1.1.0 @return void
[ "Enqueues", "JS", "and", "CSS", "assets", "based", "on", "options", "passed", "." ]
2082a8085a4d3731c530aed0f2fa183e4aa4b6e8
https://github.com/wearenolte/assets/blob/2082a8085a4d3731c530aed0f2fa183e4aa4b6e8/src/Assets.php#L214-L253
train
wearenolte/assets
src/Assets.php
Assets.update_jquery
private function update_jquery() { wp_deregister_script( 'jquery' ); if ( apply_filters( self::HOOK_PREFIX . 'include_jquery', false ) ) { wp_register_script( // Handle. 'jquery', // Source path. $this->jquery_uri, // No dependencies. false, // Version number. $this->jquery_versio...
php
private function update_jquery() { wp_deregister_script( 'jquery' ); if ( apply_filters( self::HOOK_PREFIX . 'include_jquery', false ) ) { wp_register_script( // Handle. 'jquery', // Source path. $this->jquery_uri, // No dependencies. false, // Version number. $this->jquery_versio...
[ "private", "function", "update_jquery", "(", ")", "{", "wp_deregister_script", "(", "'jquery'", ")", ";", "if", "(", "apply_filters", "(", "self", "::", "HOOK_PREFIX", ".", "'include_jquery'", ",", "false", ")", ")", "{", "wp_register_script", "(", "// Handle.",...
Enqueues theme-bundled jQuery instead of default one in WordPress. @since 1.1.0 @access private @return void
[ "Enqueues", "theme", "-", "bundled", "jQuery", "instead", "of", "default", "one", "in", "WordPress", "." ]
2082a8085a4d3731c530aed0f2fa183e4aa4b6e8
https://github.com/wearenolte/assets/blob/2082a8085a4d3731c530aed0f2fa183e4aa4b6e8/src/Assets.php#L263-L282
train
phossa/phossa-di
src/Phossa/Di/Extension/Decorate/DecorateExtension.php
DecorateExtension.decorateService
public function decorateService($service) { try { foreach ($this->rules as $rule) { // if closure returns true if ($rule[0]($service)) { // execute the decorate callable $rule[1]($service); } } ...
php
public function decorateService($service) { try { foreach ($this->rules as $rule) { // if closure returns true if ($rule[0]($service)) { // execute the decorate callable $rule[1]($service); } } ...
[ "public", "function", "decorateService", "(", "$", "service", ")", "{", "try", "{", "foreach", "(", "$", "this", "->", "rules", "as", "$", "rule", ")", "{", "// if closure returns true", "if", "(", "$", "rule", "[", "0", "]", "(", "$", "service", ")", ...
Apply decorating rules to a service object if matches @param object $service @return void @throws LogicException if something goes wrong @access public @internal
[ "Apply", "decorating", "rules", "to", "a", "service", "object", "if", "matches" ]
bbe1e95b081068e2bc49c6cd465f38aab0374be5
https://github.com/phossa/phossa-di/blob/bbe1e95b081068e2bc49c6cd465f38aab0374be5/src/Phossa/Di/Extension/Decorate/DecorateExtension.php#L57-L70
train
phossa/phossa-di
src/Phossa/Di/Extension/Decorate/DecorateExtension.php
DecorateExtension.setDecorate
public function setDecorate( /*# string */ $ruleName, $interfaceOrClosure, $decorateCallable ) { // create closure it it is a interface name if (!is_callable($interfaceOrClosure)) { $interfaceOrClosure = function ($service) use ($interfaceOrClosure) { ...
php
public function setDecorate( /*# string */ $ruleName, $interfaceOrClosure, $decorateCallable ) { // create closure it it is a interface name if (!is_callable($interfaceOrClosure)) { $interfaceOrClosure = function ($service) use ($interfaceOrClosure) { ...
[ "public", "function", "setDecorate", "(", "/*# string */", "$", "ruleName", ",", "$", "interfaceOrClosure", ",", "$", "decorateCallable", ")", "{", "// create closure it it is a interface name", "if", "(", "!", "is_callable", "(", "$", "interfaceOrClosure", ")", ")", ...
Set up docorating rules @param string $ruleName decorate rule name @param string|callable $interfaceOrClosure callable or interface/class @param array|callable $decorateCallable callable or [method, arguments] @return void @throws LogicException if something goes wrong @access public @internal
[ "Set", "up", "docorating", "rules" ]
bbe1e95b081068e2bc49c6cd465f38aab0374be5
https://github.com/phossa/phossa-di/blob/bbe1e95b081068e2bc49c6cd465f38aab0374be5/src/Phossa/Di/Extension/Decorate/DecorateExtension.php#L83-L107
train
nicodevs/laito
src/Laito/View.php
View.render
public function render($view, $values = array()) { // Setup the template path $folder = $this->app->config('templates.path'); $view = $folder . $view . '.php'; // Check if the template exists if (!file_exists($view)) { throw new \Exception('Template not found: ' ...
php
public function render($view, $values = array()) { // Setup the template path $folder = $this->app->config('templates.path'); $view = $folder . $view . '.php'; // Check if the template exists if (!file_exists($view)) { throw new \Exception('Template not found: ' ...
[ "public", "function", "render", "(", "$", "view", ",", "$", "values", "=", "array", "(", ")", ")", "{", "// Setup the template path", "$", "folder", "=", "$", "this", "->", "app", "->", "config", "(", "'templates.path'", ")", ";", "$", "view", "=", "$"...
Renders a template with optional data @param string $template Name of the template @param array $values Array of values to replace in the template @return string Rendered HTML
[ "Renders", "a", "template", "with", "optional", "data" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/View.php#L15-L35
train
ScaraMVC/Framework
src/Scara/Mail/MailerServiceProvider.php
MailerServiceProvider.register
public function register() { $this->create('mail', function () { // return new Mailer(); $c = new Configuration(); $config = $c->from('mail'); $mail = new Mailer($config->get('host'), $config->get('port'), $config->get('smtp_auth'), $config->g...
php
public function register() { $this->create('mail', function () { // return new Mailer(); $c = new Configuration(); $config = $c->from('mail'); $mail = new Mailer($config->get('host'), $config->get('port'), $config->get('smtp_auth'), $config->g...
[ "public", "function", "register", "(", ")", "{", "$", "this", "->", "create", "(", "'mail'", ",", "function", "(", ")", "{", "// return new Mailer();", "$", "c", "=", "new", "Configuration", "(", ")", ";", "$", "config", "=", "$", "c", "->", "from", ...
Registers the Mailer Service Provider. @return void
[ "Registers", "the", "Mailer", "Service", "Provider", "." ]
199b08b45fadf5dae14ac4732af03b36e15bbef2
https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Mail/MailerServiceProvider.php#L18-L30
train
RocketPropelledTortoise/Core
src/Translation/I18N.php
I18N.setCurrentLanguage
public function setCurrentLanguage($language) { if (!$this->isAvailable($language)) { return false; } $this->session->put('language', $language); $this->setLanguage($language); return true; }
php
public function setCurrentLanguage($language) { if (!$this->isAvailable($language)) { return false; } $this->session->put('language', $language); $this->setLanguage($language); return true; }
[ "public", "function", "setCurrentLanguage", "(", "$", "language", ")", "{", "if", "(", "!", "$", "this", "->", "isAvailable", "(", "$", "language", ")", ")", "{", "return", "false", ";", "}", "$", "this", "->", "session", "->", "put", "(", "'language'"...
Set the current language @param string $language @return bool
[ "Set", "the", "current", "language" ]
78b65663fc463e21e494257140ddbed0a9ccb3c3
https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Translation/I18N.php#L172-L183
train
RocketPropelledTortoise/Core
src/Translation/I18N.php
I18N.setLanguage
public function setLanguage($language) { if ($language == $this->currentLanguage) { return; } if (!$this->isLoaded($language)) { $this->loadLanguage($language); } switch ($language) { case 'fr': setlocale(LC_ALL, 'fr_FR.ut...
php
public function setLanguage($language) { if ($language == $this->currentLanguage) { return; } if (!$this->isLoaded($language)) { $this->loadLanguage($language); } switch ($language) { case 'fr': setlocale(LC_ALL, 'fr_FR.ut...
[ "public", "function", "setLanguage", "(", "$", "language", ")", "{", "if", "(", "$", "language", "==", "$", "this", "->", "currentLanguage", ")", "{", "return", ";", "}", "if", "(", "!", "$", "this", "->", "isLoaded", "(", "$", "language", ")", ")", ...
Set the language to use @param string $language @return bool
[ "Set", "the", "language", "to", "use" ]
78b65663fc463e21e494257140ddbed0a9ccb3c3
https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Translation/I18N.php#L233-L257
train
RocketPropelledTortoise/Core
src/Translation/I18N.php
I18N.languages
public function languages($key = null, $subkey = null) { if ($key === null) { return $this->languagesIso; } if (is_int($key)) { if (is_null($subkey)) { return $this->languagesId[$key]; } return $this->languagesId[$key][$subkey...
php
public function languages($key = null, $subkey = null) { if ($key === null) { return $this->languagesIso; } if (is_int($key)) { if (is_null($subkey)) { return $this->languagesId[$key]; } return $this->languagesId[$key][$subkey...
[ "public", "function", "languages", "(", "$", "key", "=", "null", ",", "$", "subkey", "=", "null", ")", "{", "if", "(", "$", "key", "===", "null", ")", "{", "return", "$", "this", "->", "languagesIso", ";", "}", "if", "(", "is_int", "(", "$", "key...
Retrieve languages. this is a hybrid method. I18N::languages(); returns ['fr' => ['id' => 1, 'name' => 'francais', 'iso' => 'fr'], 'en' => ...] I18N::languages('fr'); returns ['id' => 1, 'name' => 'francais', 'iso' => 'fr'] I18N::languages(1); returns ['id' => 1, 'name' => 'francais', 'iso' => 'fr'] I18N::lang...
[ "Retrieve", "languages", "." ]
78b65663fc463e21e494257140ddbed0a9ccb3c3
https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Translation/I18N.php#L321-L340
train
RocketPropelledTortoise/Core
src/Translation/I18N.php
I18N.translate
public function translate($string, $context = 'default', $language = 'default') { if ($this->isDefault($language)) { $language = $this->currentLanguage; } else { $this->setLanguage($language); } //get string from cache if (array_key_exists($context, $...
php
public function translate($string, $context = 'default', $language = 'default') { if ($this->isDefault($language)) { $language = $this->currentLanguage; } else { $this->setLanguage($language); } //get string from cache if (array_key_exists($context, $...
[ "public", "function", "translate", "(", "$", "string", ",", "$", "context", "=", "'default'", ",", "$", "language", "=", "'default'", ")", "{", "if", "(", "$", "this", "->", "isDefault", "(", "$", "language", ")", ")", "{", "$", "language", "=", "$",...
Retreive a string to translate if it doesn't find it, put it in the database @param string $string @param string $context @param string $language @return string
[ "Retreive", "a", "string", "to", "translate" ]
78b65663fc463e21e494257140ddbed0a9ccb3c3
https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Translation/I18N.php#L395-L429
train
RocketPropelledTortoise/Core
src/Translation/I18N.php
I18N.getContext
public function getContext() { if ($this->pageContext) { return $this->pageContext; } $current = \Route::getCurrentRoute(); if (!$current) { return 'default'; } if ($current->getName()) { return $this->pageContext = $current->get...
php
public function getContext() { if ($this->pageContext) { return $this->pageContext; } $current = \Route::getCurrentRoute(); if (!$current) { return 'default'; } if ($current->getName()) { return $this->pageContext = $current->get...
[ "public", "function", "getContext", "(", ")", "{", "if", "(", "$", "this", "->", "pageContext", ")", "{", "return", "$", "this", "->", "pageContext", ";", "}", "$", "current", "=", "\\", "Route", "::", "getCurrentRoute", "(", ")", ";", "if", "(", "!"...
Get the page's context @return string
[ "Get", "the", "page", "s", "context" ]
78b65663fc463e21e494257140ddbed0a9ccb3c3
https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Translation/I18N.php#L446-L468
train
tw88/sso
src/Broker.php
Broker.getAttachUrl
public function getAttachUrl($params = [], $cookieBased = null) { $this->generateToken($cookieBased); $data = [ 'command' => 'attach', 'broker' => $this->broker, 'token' => $this->token, 'checksum' => hash('sha256', 'attach' . $this->token . $this->se...
php
public function getAttachUrl($params = [], $cookieBased = null) { $this->generateToken($cookieBased); $data = [ 'command' => 'attach', 'broker' => $this->broker, 'token' => $this->token, 'checksum' => hash('sha256', 'attach' . $this->token . $this->se...
[ "public", "function", "getAttachUrl", "(", "$", "params", "=", "[", "]", ",", "$", "cookieBased", "=", "null", ")", "{", "$", "this", "->", "generateToken", "(", "$", "cookieBased", ")", ";", "$", "data", "=", "[", "'command'", "=>", "'attach'", ",", ...
Get URL to attach session at SSO server. @param array $params @return string
[ "Get", "URL", "to", "attach", "session", "at", "SSO", "server", "." ]
746323f3087af5a06769f7c207ab4ed5124a14bb
https://github.com/tw88/sso/blob/746323f3087af5a06769f7c207ab4ed5124a14bb/src/Broker.php#L152-L164
train
tw88/sso
src/Broker.php
Broker.request
protected function request($method, $command, $data = null) { if (!$this->isAttached()) { throw new NotAttachedException('No token'); } $url = $this->getRequestUrl($command, !$data || $method === 'POST' ? [] : $data); $ch = curl_init($url); curl_setopt($ch, CURLO...
php
protected function request($method, $command, $data = null) { if (!$this->isAttached()) { throw new NotAttachedException('No token'); } $url = $this->getRequestUrl($command, !$data || $method === 'POST' ? [] : $data); $ch = curl_init($url); curl_setopt($ch, CURLO...
[ "protected", "function", "request", "(", "$", "method", ",", "$", "command", ",", "$", "data", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "isAttached", "(", ")", ")", "{", "throw", "new", "NotAttachedException", "(", "'No token'", ")", ...
Execute on SSO server. @param string $method HTTP method: 'GET', 'POST', 'DELETE' @param string $command Command @param array|string $data Query or post parameters @return array|object
[ "Execute", "on", "SSO", "server", "." ]
746323f3087af5a06769f7c207ab4ed5124a14bb
https://github.com/tw88/sso/blob/746323f3087af5a06769f7c207ab4ed5124a14bb/src/Broker.php#L227-L269
train