repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
liuguangw/mvc | src/http/action/ActionResult.php | ActionResult.executeResult | public function executeResult(): void
{
// 状态码
http_response_code($this->statusCode);
// Content-Type
if ($this->contentType != '') {
header('Content-Type: ' . $this->contentType);
}
// 额外HTTP头
if (! empty($this->extraHeaders)) {
foreac... | php | public function executeResult(): void
{
// 状态码
http_response_code($this->statusCode);
// Content-Type
if ($this->contentType != '') {
header('Content-Type: ' . $this->contentType);
}
// 额外HTTP头
if (! empty($this->extraHeaders)) {
foreac... | [
"public",
"function",
"executeResult",
"(",
")",
":",
"void",
"{",
"// 状态码",
"http_response_code",
"(",
"$",
"this",
"->",
"statusCode",
")",
";",
"// Content-Type",
"if",
"(",
"$",
"this",
"->",
"contentType",
"!=",
"''",
")",
"{",
"header",
"(",
"'Conten... | 执行响应结果
@return void | [
"执行响应结果"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/http/action/ActionResult.php#L58-L78 |
attm2x/m2x-php | src/Distribution.php | Distribution.addDevice | public function addDevice($serial) {
$data = array('serial' => $serial);
$response = $this->client->post($this->path() . '/devices', $data);
return new Device($this->client, $response->json());
} | php | public function addDevice($serial) {
$data = array('serial' => $serial);
$response = $this->client->post($this->path() . '/devices', $data);
return new Device($this->client, $response->json());
} | [
"public",
"function",
"addDevice",
"(",
"$",
"serial",
")",
"{",
"$",
"data",
"=",
"array",
"(",
"'serial'",
"=>",
"$",
"serial",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"$",
"this",
"->",
"path",
"(",
")",
... | Method for {@link https://m2x.att.com/developer/documentation/v2/distribution#add-device-to-an-existing-distribution Add Device to a Distribution} endpoint.
@param string $serial The unique (account-wide) serial for the DistributionDevice being added to the Distribution
@return Device The newly created DistributionDev... | [
"Method",
"for",
"{",
"@link",
"https",
":",
"//",
"m2x",
".",
"att",
".",
"com",
"/",
"developer",
"/",
"documentation",
"/",
"v2",
"/",
"distribution#add",
"-",
"device",
"-",
"to",
"-",
"an",
"-",
"existing",
"-",
"distribution",
"Add",
"Device",
"t... | train | https://github.com/attm2x/m2x-php/blob/4c2ff6d70af50538818855e648af24bf5cf16ead/src/Distribution.php#L49-L53 |
attm2x/m2x-php | src/Distribution.php | Distribution.updateStream | public function updateStream($name, $data = array()) {
return Stream::createStream($this->client, $this, $name, $data);
} | php | public function updateStream($name, $data = array()) {
return Stream::createStream($this->client, $this, $name, $data);
} | [
"public",
"function",
"updateStream",
"(",
"$",
"name",
",",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"return",
"Stream",
"::",
"createStream",
"(",
"$",
"this",
"->",
"client",
",",
"$",
"this",
",",
"$",
"name",
",",
"$",
"data",
")",
";",
... | Method for {@link https://m2x.att.com/developer/documentation/v2/device#Create-Update-Data-Stream Create/Update Data Stream} endpoint.
@param string $name Name of the the stream
@param array $data Query parameters passed as keyword arguments. View M2X API Docs for listing of available parameters.
@return Stream The St... | [
"Method",
"for",
"{",
"@link",
"https",
":",
"//",
"m2x",
".",
"att",
".",
"com",
"/",
"developer",
"/",
"documentation",
"/",
"v2",
"/",
"device#Create",
"-",
"Update",
"-",
"Data",
"-",
"Stream",
"Create",
"/",
"Update",
"Data",
"Stream",
"}",
"endpo... | train | https://github.com/attm2x/m2x-php/blob/4c2ff6d70af50538818855e648af24bf5cf16ead/src/Distribution.php#L81-L83 |
attm2x/m2x-php | src/Distribution.php | Distribution.metadataField | public function metadataField($key, $params = array()) {
return $this->client->get($this->path() . '/metadata/' . $key, $params);
} | php | public function metadataField($key, $params = array()) {
return $this->client->get($this->path() . '/metadata/' . $key, $params);
} | [
"public",
"function",
"metadataField",
"(",
"$",
"key",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"$",
"this",
"->",
"path",
"(",
")",
".",
"'/metadata/'",
".",
"$",
"key",
",",
... | Method for {@link https://m2x.att.com/developer/documentation/v2/distribution#Read-Distribution-Metadata-Field Read Distribution Metadata Field} endpoint.
@param string $key The metadata field to be read
@param array $params Query parameters passed as keyword arguments. View M2X API Docs for listing of available param... | [
"Method",
"for",
"{",
"@link",
"https",
":",
"//",
"m2x",
".",
"att",
".",
"com",
"/",
"developer",
"/",
"documentation",
"/",
"v2",
"/",
"distribution#Read",
"-",
"Distribution",
"-",
"Metadata",
"-",
"Field",
"Read",
"Distribution",
"Metadata",
"Field",
... | train | https://github.com/attm2x/m2x-php/blob/4c2ff6d70af50538818855e648af24bf5cf16ead/src/Distribution.php#L102-L104 |
attm2x/m2x-php | src/Distribution.php | Distribution.updateMetadataField | public function updateMetadataField($key, $value) {
return $this->client->put($this->path() . '/metadata/' . $key , array('value' => $value));
} | php | public function updateMetadataField($key, $value) {
return $this->client->put($this->path() . '/metadata/' . $key , array('value' => $value));
} | [
"public",
"function",
"updateMetadataField",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"return",
"$",
"this",
"->",
"client",
"->",
"put",
"(",
"$",
"this",
"->",
"path",
"(",
")",
".",
"'/metadata/'",
".",
"$",
"key",
",",
"array",
"(",
"'value'... | Method for {@link https://m2x.att.com/developer/documentation/v2/distribution#Update-Distribution-Metadata-Field Update Distribution Metadata Field} endpoint.
@param string $key The metadata field to be updated
@param string $value The value to be updated
@return HttpResponse The API response, see M2X API docs for det... | [
"Method",
"for",
"{",
"@link",
"https",
":",
"//",
"m2x",
".",
"att",
".",
"com",
"/",
"developer",
"/",
"documentation",
"/",
"v2",
"/",
"distribution#Update",
"-",
"Distribution",
"-",
"Metadata",
"-",
"Field",
"Update",
"Distribution",
"Metadata",
"Field"... | train | https://github.com/attm2x/m2x-php/blob/4c2ff6d70af50538818855e648af24bf5cf16ead/src/Distribution.php#L123-L125 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/CacheHelper.php | CacheHelper.hashMap | public static function hashMap($map)
{
$cache = '';
foreach ($map as $key => $value) {
$cache .= 0xAB01 . $key . 0xAB02;
if (is_array($value)) {
$cache .= 0xAB04 . static::hashMap($value);
} else {
$cache .= 0xAB03 . $value;
... | php | public static function hashMap($map)
{
$cache = '';
foreach ($map as $key => $value) {
$cache .= 0xAB01 . $key . 0xAB02;
if (is_array($value)) {
$cache .= 0xAB04 . static::hashMap($value);
} else {
$cache .= 0xAB03 . $value;
... | [
"public",
"static",
"function",
"hashMap",
"(",
"$",
"map",
")",
"{",
"$",
"cache",
"=",
"''",
";",
"foreach",
"(",
"$",
"map",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"cache",
".=",
"0xAB01",
".",
"$",
"key",
".",
"0xAB02",
";",
"... | Hashes multidimensional map for using in cache key
@param array $map
@return string | [
"Hashes",
"multidimensional",
"map",
"for",
"using",
"in",
"cache",
"key",
"@param",
"array",
"$map"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/CacheHelper.php#L15-L27 |
csun-metalab/laravel-directory-authentication | src/Authentication/MetaUser.php | MetaUser.findForAuthToken | public static function findForAuthToken($identifier, $token) {
return self::where(self::META_USER_PRIMARY_KEY, '=', $identifier)
->where('remember_token', '=', $token)
->first();
} | php | public static function findForAuthToken($identifier, $token) {
return self::where(self::META_USER_PRIMARY_KEY, '=', $identifier)
->where('remember_token', '=', $token)
->first();
} | [
"public",
"static",
"function",
"findForAuthToken",
"(",
"$",
"identifier",
",",
"$",
"token",
")",
"{",
"return",
"self",
"::",
"where",
"(",
"self",
"::",
"META_USER_PRIMARY_KEY",
",",
"'='",
",",
"$",
"identifier",
")",
"->",
"where",
"(",
"'remember_toke... | implements MetaAuthenticatableContract#findForAuthToken | [
"implements",
"MetaAuthenticatableContract#findForAuthToken"
] | train | https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/MetaUser.php#L76-L80 |
csun-metalab/laravel-directory-authentication | src/Authentication/MetaUser.php | MetaUser.masqueradeAsUser | public function masqueradeAsUser($user) {
// if this user is authenticated, then we can masquerade as the
// user that has been passed as the parameter
if(Auth::check()) {
// write the authenticated user into the session and then
// authenticate as the passed user instanc... | php | public function masqueradeAsUser($user) {
// if this user is authenticated, then we can masquerade as the
// user that has been passed as the parameter
if(Auth::check()) {
// write the authenticated user into the session and then
// authenticate as the passed user instanc... | [
"public",
"function",
"masqueradeAsUser",
"(",
"$",
"user",
")",
"{",
"// if this user is authenticated, then we can masquerade as the",
"// user that has been passed as the parameter",
"if",
"(",
"Auth",
"::",
"check",
"(",
")",
")",
"{",
"// write the authenticated user into ... | Allows a logged-in user to masquerade as the passed User. Returns true
on success or false otherwise.
@param MetaUser $user The user instance to become
@return boolean | [
"Allows",
"a",
"logged",
"-",
"in",
"user",
"to",
"masquerade",
"as",
"the",
"passed",
"User",
".",
"Returns",
"true",
"on",
"success",
"or",
"false",
"otherwise",
"."
] | train | https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/MetaUser.php#L127-L142 |
csun-metalab/laravel-directory-authentication | src/Authentication/MetaUser.php | MetaUser.stopMasquerading | public function stopMasquerading() {
if($this->isMasquerading()) {
// become the real user again
Auth::logout();
Auth::login(session('masquerading_user'));
session(['masquerading_user' => null]);
// success!
return true;
}
... | php | public function stopMasquerading() {
if($this->isMasquerading()) {
// become the real user again
Auth::logout();
Auth::login(session('masquerading_user'));
session(['masquerading_user' => null]);
// success!
return true;
}
... | [
"public",
"function",
"stopMasquerading",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isMasquerading",
"(",
")",
")",
"{",
"// become the real user again",
"Auth",
"::",
"logout",
"(",
")",
";",
"Auth",
"::",
"login",
"(",
"session",
"(",
"'masquerading_us... | Stops masquerading as another user if we are currently masquerading.
Returns true on success or false otherwise.
@return boolean | [
"Stops",
"masquerading",
"as",
"another",
"user",
"if",
"we",
"are",
"currently",
"masquerading",
".",
"Returns",
"true",
"on",
"success",
"or",
"false",
"otherwise",
"."
] | train | https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/MetaUser.php#L150-L162 |
mimmi20/Wurfl | src/Handlers/WindowsPhoneHandler.php | WindowsPhoneHandler.canHandle | public function canHandle($userAgent)
{
if (Utils::isDesktopBrowser($userAgent)) {
return false;
}
// Capturing WP desktop mode UAs but not Windows RT UAs
if (Utils::checkIfContainsAnyOf($userAgent, array('WPDesktop', 'ZuneWP7'))
|| Utils::checkIfContainsAll(... | php | public function canHandle($userAgent)
{
if (Utils::isDesktopBrowser($userAgent)) {
return false;
}
// Capturing WP desktop mode UAs but not Windows RT UAs
if (Utils::checkIfContainsAnyOf($userAgent, array('WPDesktop', 'ZuneWP7'))
|| Utils::checkIfContainsAll(... | [
"public",
"function",
"canHandle",
"(",
"$",
"userAgent",
")",
"{",
"if",
"(",
"Utils",
"::",
"isDesktopBrowser",
"(",
"$",
"userAgent",
")",
")",
"{",
"return",
"false",
";",
"}",
"// Capturing WP desktop mode UAs but not Windows RT UAs",
"if",
"(",
"Utils",
":... | @param string $userAgent
@return bool | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/WindowsPhoneHandler.php#L61-L75 |
mimmi20/Wurfl | src/Handlers/WindowsPhoneHandler.php | WindowsPhoneHandler.applyRecoveryMatch | public function applyRecoveryMatch($userAgent)
{
if (Utils::checkIfContainsAnyOf($userAgent, array('WPDesktop', 'ZuneWP7'))
|| Utils::checkIfContainsAll($userAgent, array('Mozilla/5.0 (Windows NT ', ' ARM;', ' Edge/'))
) {
if (Utils::checkIfContainsAll($userAgent, array('Mozi... | php | public function applyRecoveryMatch($userAgent)
{
if (Utils::checkIfContainsAnyOf($userAgent, array('WPDesktop', 'ZuneWP7'))
|| Utils::checkIfContainsAll($userAgent, array('Mozilla/5.0 (Windows NT ', ' ARM;', ' Edge/'))
) {
if (Utils::checkIfContainsAll($userAgent, array('Mozi... | [
"public",
"function",
"applyRecoveryMatch",
"(",
"$",
"userAgent",
")",
"{",
"if",
"(",
"Utils",
"::",
"checkIfContainsAnyOf",
"(",
"$",
"userAgent",
",",
"array",
"(",
"'WPDesktop'",
",",
"'ZuneWP7'",
")",
")",
"||",
"Utils",
"::",
"checkIfContainsAll",
"(",
... | @param string $userAgent
@return null|string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/WindowsPhoneHandler.php#L101-L157 |
mimmi20/Wurfl | src/Handlers/WindowsPhoneHandler.php | WindowsPhoneHandler.getWindowsPhoneModel | public static function getWindowsPhoneModel($userAgent)
{
// Normalize spaces in UA before capturing parts
$userAgent = preg_replace('|;(?! )|', '; ', $userAgent);
// This regex is relatively fast because there is not much backtracking, and almost all UAs will match
if (preg_match('|... | php | public static function getWindowsPhoneModel($userAgent)
{
// Normalize spaces in UA before capturing parts
$userAgent = preg_replace('|;(?! )|', '; ', $userAgent);
// This regex is relatively fast because there is not much backtracking, and almost all UAs will match
if (preg_match('|... | [
"public",
"static",
"function",
"getWindowsPhoneModel",
"(",
"$",
"userAgent",
")",
"{",
"// Normalize spaces in UA before capturing parts",
"$",
"userAgent",
"=",
"preg_replace",
"(",
"'|;(?! )|'",
",",
"'; '",
",",
"$",
"userAgent",
")",
";",
"// This regex is relativ... | @param string $userAgent
@return mixed|null | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/WindowsPhoneHandler.php#L164-L200 |
mimmi20/Wurfl | src/Handlers/WindowsPhoneHandler.php | WindowsPhoneHandler.getWindowsPhoneAdClientModel | public static function getWindowsPhoneAdClientModel($userAgent)
{
// Normalize spaces in UA before capturing parts
$userAgent = preg_replace('|;(?! )|', '; ', $userAgent);
if (preg_match(
'|Windows ?Phone ?Ad ?Client/[0-9\.]+ ?\(.+; ?Windows ?Phone(?: ?OS)? ?[0-9\.]+; ?([^;\)]+(;... | php | public static function getWindowsPhoneAdClientModel($userAgent)
{
// Normalize spaces in UA before capturing parts
$userAgent = preg_replace('|;(?! )|', '; ', $userAgent);
if (preg_match(
'|Windows ?Phone ?Ad ?Client/[0-9\.]+ ?\(.+; ?Windows ?Phone(?: ?OS)? ?[0-9\.]+; ?([^;\)]+(;... | [
"public",
"static",
"function",
"getWindowsPhoneAdClientModel",
"(",
"$",
"userAgent",
")",
"{",
"// Normalize spaces in UA before capturing parts",
"$",
"userAgent",
"=",
"preg_replace",
"(",
"'|;(?! )|'",
",",
"'; '",
",",
"$",
"userAgent",
")",
";",
"if",
"(",
"p... | @param string $userAgent
@return mixed|null | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/WindowsPhoneHandler.php#L207-L226 |
mimmi20/Wurfl | src/Handlers/WindowsPhoneHandler.php | WindowsPhoneHandler.getWindowsPhoneVersion | public static function getWindowsPhoneVersion($userAgent)
{
if (preg_match('|Windows ?Phone(?: ?OS)? ?(\d+\.\d+)|', $userAgent, $matches)) {
if (strpos($matches[1], '10.0') !== false) {
return '10.0';
} elseif (strpos($matches[1], '6.3') !== false || strpos($matches[1... | php | public static function getWindowsPhoneVersion($userAgent)
{
if (preg_match('|Windows ?Phone(?: ?OS)? ?(\d+\.\d+)|', $userAgent, $matches)) {
if (strpos($matches[1], '10.0') !== false) {
return '10.0';
} elseif (strpos($matches[1], '6.3') !== false || strpos($matches[1... | [
"public",
"static",
"function",
"getWindowsPhoneVersion",
"(",
"$",
"userAgent",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'|Windows ?Phone(?: ?OS)? ?(\\d+\\.\\d+)|'",
",",
"$",
"userAgent",
",",
"$",
"matches",
")",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"ma... | @param string $userAgent
@return null|string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/WindowsPhoneHandler.php#L233-L254 |
mimmi20/Wurfl | src/Handlers/WindowsPhoneHandler.php | WindowsPhoneHandler.getWindowsPhoneDesktopModel | public static function getWindowsPhoneDesktopModel($userAgent)
{
// Normalize spaces in UA before capturing parts
$userAgent = preg_replace('|;(?! )|', '; ', $userAgent);
if (preg_match('|\(Windows NT [\d\.]+?; ARM; ([^;\)]+(; ?[^;\)]+)?).+?Edge/\d|', $userAgent, $matches)
|| pre... | php | public static function getWindowsPhoneDesktopModel($userAgent)
{
// Normalize spaces in UA before capturing parts
$userAgent = preg_replace('|;(?! )|', '; ', $userAgent);
if (preg_match('|\(Windows NT [\d\.]+?; ARM; ([^;\)]+(; ?[^;\)]+)?).+?Edge/\d|', $userAgent, $matches)
|| pre... | [
"public",
"static",
"function",
"getWindowsPhoneDesktopModel",
"(",
"$",
"userAgent",
")",
"{",
"// Normalize spaces in UA before capturing parts",
"$",
"userAgent",
"=",
"preg_replace",
"(",
"'|;(?! )|'",
",",
"'; '",
",",
"$",
"userAgent",
")",
";",
"if",
"(",
"pr... | @param string $userAgent
@return mixed|null | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/WindowsPhoneHandler.php#L261-L281 |
mimmi20/Wurfl | src/Handlers/WindowsPhoneHandler.php | WindowsPhoneHandler.getWindowsPhoneDesktopVersion | public static function getWindowsPhoneDesktopVersion($userAgent)
{
if (preg_match('|Windows NT (\d+\.\d+)|', $userAgent, $matches)) {
if (strpos($matches[1], '10.0') !== false) {
return '10.0';
} elseif (strpos($matches[1], '6.3') !== false || strpos($matches[1], '8.1... | php | public static function getWindowsPhoneDesktopVersion($userAgent)
{
if (preg_match('|Windows NT (\d+\.\d+)|', $userAgent, $matches)) {
if (strpos($matches[1], '10.0') !== false) {
return '10.0';
} elseif (strpos($matches[1], '6.3') !== false || strpos($matches[1], '8.1... | [
"public",
"static",
"function",
"getWindowsPhoneDesktopVersion",
"(",
"$",
"userAgent",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'|Windows NT (\\d+\\.\\d+)|'",
",",
"$",
"userAgent",
",",
"$",
"matches",
")",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"matches",... | @param string $userAgent
@return null|string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/WindowsPhoneHandler.php#L288-L301 |
cpliakas/search-framework | src/Search/Framework/Indexer.php | Indexer.newCollector | public function newCollector()
{
$collector = new Collector($this->getDispatcher());
// Pass services and settings to collector.
$collector
->setCollections($this->_collections)
->setLogger($this->getLogger())
->setQueue($this->getQueue())
->s... | php | public function newCollector()
{
$collector = new Collector($this->getDispatcher());
// Pass services and settings to collector.
$collector
->setCollections($this->_collections)
->setLogger($this->getLogger())
->setQueue($this->getQueue())
->s... | [
"public",
"function",
"newCollector",
"(",
")",
"{",
"$",
"collector",
"=",
"new",
"Collector",
"(",
"$",
"this",
"->",
"getDispatcher",
"(",
")",
")",
";",
"// Pass services and settings to collector.",
"$",
"collector",
"->",
"setCollections",
"(",
"$",
"this"... | Returns a Collector object that the Indexer class injects itself as a
service into.
@return Collector | [
"Returns",
"a",
"Collector",
"object",
"that",
"the",
"Indexer",
"class",
"injects",
"itself",
"as",
"a",
"service",
"into",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/Indexer.php#L87-L100 |
cpliakas/search-framework | src/Search/Framework/Indexer.php | Indexer.normalizeField | public function normalizeField(IndexField $field)
{
$id = $field->getId();
$value = $field->getValue();
$log = $this->getLogger();
$context = array('field' => $id);
if (isset($this->_fieldTypes[$id])) {
if ($this->_searchEngine->hasNormalizer($this->_fieldTypes[... | php | public function normalizeField(IndexField $field)
{
$id = $field->getId();
$value = $field->getValue();
$log = $this->getLogger();
$context = array('field' => $id);
if (isset($this->_fieldTypes[$id])) {
if ($this->_searchEngine->hasNormalizer($this->_fieldTypes[... | [
"public",
"function",
"normalizeField",
"(",
"IndexField",
"$",
"field",
")",
"{",
"$",
"id",
"=",
"$",
"field",
"->",
"getId",
"(",
")",
";",
"$",
"value",
"=",
"$",
"field",
"->",
"getValue",
"(",
")",
";",
"$",
"log",
"=",
"$",
"this",
"->",
"... | Apply the serivce specific normalizers to a field's value.
@param IndexField $field
The field being normalized.
@return string|array | [
"Apply",
"the",
"serivce",
"specific",
"normalizers",
"to",
"a",
"field",
"s",
"value",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/Indexer.php#L110-L130 |
cpliakas/search-framework | src/Search/Framework/Indexer.php | Indexer.indexQueuedItems | public function indexQueuedItems()
{
$dispatcher = $this->getDispatcher();
$log = $this->getLogger();
$context = array('engine' => get_class($this->_searchEngine));
$log->info('Indexing operation started', $context);
try {
// Ensure the schema object is populat... | php | public function indexQueuedItems()
{
$dispatcher = $this->getDispatcher();
$log = $this->getLogger();
$context = array('engine' => get_class($this->_searchEngine));
$log->info('Indexing operation started', $context);
try {
// Ensure the schema object is populat... | [
"public",
"function",
"indexQueuedItems",
"(",
")",
"{",
"$",
"dispatcher",
"=",
"$",
"this",
"->",
"getDispatcher",
"(",
")",
";",
"$",
"log",
"=",
"$",
"this",
"->",
"getLogger",
"(",
")",
";",
"$",
"context",
"=",
"array",
"(",
"'engine'",
"=>",
"... | Indexes the items that are queued for indexing into the search engine. | [
"Indexes",
"the",
"items",
"that",
"are",
"queued",
"for",
"indexing",
"into",
"the",
"search",
"engine",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/Indexer.php#L156-L202 |
cpliakas/search-framework | src/Search/Framework/Indexer.php | Indexer.indexQueuedItem | public function indexQueuedItem(QueueMessage $message)
{
$log = $this->getLogger();
$context = array(
'engine' => get_class($this->_searchEngine),
'item' => $message->getBody(),
);
// Load the source data form the message. The message usually contains a
... | php | public function indexQueuedItem(QueueMessage $message)
{
$log = $this->getLogger();
$context = array(
'engine' => get_class($this->_searchEngine),
'item' => $message->getBody(),
);
// Load the source data form the message. The message usually contains a
... | [
"public",
"function",
"indexQueuedItem",
"(",
"QueueMessage",
"$",
"message",
")",
"{",
"$",
"log",
"=",
"$",
"this",
"->",
"getLogger",
"(",
")",
";",
"$",
"context",
"=",
"array",
"(",
"'engine'",
"=>",
"get_class",
"(",
"$",
"this",
"->",
"_searchEngi... | Indexes an item that is queued for indexing into the search engine. | [
"Indexes",
"an",
"item",
"that",
"is",
"queued",
"for",
"indexing",
"into",
"the",
"search",
"engine",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/Indexer.php#L207-L241 |
ptlis/conneg | src/Negotiator/Matcher/WildcardMatcher.php | WildcardMatcher.getMatchingIndexes | private function getMatchingIndexes(array $matchingList, PreferenceInterface $clientPref)
{
$matchingIndexList = array();
foreach ($matchingList as $key => $matching) {
if ($clientPref->getPrecedence() > $matching->getClientPreference()->getPrecedence()) {
$matchingIndex... | php | private function getMatchingIndexes(array $matchingList, PreferenceInterface $clientPref)
{
$matchingIndexList = array();
foreach ($matchingList as $key => $matching) {
if ($clientPref->getPrecedence() > $matching->getClientPreference()->getPrecedence()) {
$matchingIndex... | [
"private",
"function",
"getMatchingIndexes",
"(",
"array",
"$",
"matchingList",
",",
"PreferenceInterface",
"$",
"clientPref",
")",
"{",
"$",
"matchingIndexList",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"matchingList",
"as",
"$",
"key",
"=>",
"$",
... | Returns an array of indexes for of matches of higher precedence than the existing pairing.
@param MatchedPreferenceInterface[] $matchingList
@param PreferenceInterface $clientPref
@return int[] | [
"Returns",
"an",
"array",
"of",
"indexes",
"for",
"of",
"matches",
"of",
"higher",
"precedence",
"than",
"the",
"existing",
"pairing",
"."
] | train | https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Negotiator/Matcher/WildcardMatcher.php#L55-L66 |
kherge-abandoned/php-object-storage | src/lib/Herrera/Util/ObjectStorage.php | ObjectStorage.attach | public function attach($object, $data = null)
{
if (!$this->isSupported($object)) {
throw new UnexpectedValueException(
sprintf(
'The object, %s, is not supported.',
get_class($object)
)
);
}
par... | php | public function attach($object, $data = null)
{
if (!$this->isSupported($object)) {
throw new UnexpectedValueException(
sprintf(
'The object, %s, is not supported.',
get_class($object)
)
);
}
par... | [
"public",
"function",
"attach",
"(",
"$",
"object",
",",
"$",
"data",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isSupported",
"(",
"$",
"object",
")",
")",
"{",
"throw",
"new",
"UnexpectedValueException",
"(",
"sprintf",
"(",
"'The obj... | @override
@throws UnexpectedValueException If the object is not supported. | [
"@override"
] | train | https://github.com/kherge-abandoned/php-object-storage/blob/005fd064ce56854882327ba401730030091d676f/src/lib/Herrera/Util/ObjectStorage.php#L44-L56 |
todstoychev/icr | src/Manager/FileManager.php | FileManager.uploadFile | public function uploadFile($file, $extension, $context = null, $sizeName = null, $fileName = null)
{
if (!$this->filesystemAdapter instanceof FilesystemAdapter) {
throw new IcrRuntimeException('File manager has no file system adapter no set!');
}
$path = $this->path($context, $s... | php | public function uploadFile($file, $extension, $context = null, $sizeName = null, $fileName = null)
{
if (!$this->filesystemAdapter instanceof FilesystemAdapter) {
throw new IcrRuntimeException('File manager has no file system adapter no set!');
}
$path = $this->path($context, $s... | [
"public",
"function",
"uploadFile",
"(",
"$",
"file",
",",
"$",
"extension",
",",
"$",
"context",
"=",
"null",
",",
"$",
"sizeName",
"=",
"null",
",",
"$",
"fileName",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"filesystemAdapter",
"in... | Uploads a file
@param string $file File contents
@param string $extension File extension
@param null|string $context File context
@param null|string $sizeName Size directory name
@param null|string $fileName Predefined filename
@return string | [
"Uploads",
"a",
"file"
] | train | https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/Manager/FileManager.php#L44-L71 |
todstoychev/icr | src/Manager/FileManager.php | FileManager.path | public function path($context = null, $sizeName = null)
{
$path = '/';
$path .= (null !== $context) ? $context . '/' : null;
$path .= (null !== $sizeName) ? $sizeName . '/' : null;
return $path;
} | php | public function path($context = null, $sizeName = null)
{
$path = '/';
$path .= (null !== $context) ? $context . '/' : null;
$path .= (null !== $sizeName) ? $sizeName . '/' : null;
return $path;
} | [
"public",
"function",
"path",
"(",
"$",
"context",
"=",
"null",
",",
"$",
"sizeName",
"=",
"null",
")",
"{",
"$",
"path",
"=",
"'/'",
";",
"$",
"path",
".=",
"(",
"null",
"!==",
"$",
"context",
")",
"?",
"$",
"context",
".",
"'/'",
":",
"null",
... | Define path
@param null|string $context File context
@param null|string $sizeName Size name
@return string | [
"Define",
"path"
] | train | https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/Manager/FileManager.php#L81-L88 |
todstoychev/icr | src/Manager/FileManager.php | FileManager.generate | public function generate(FilesystemAdapter $filesystemAdapter, $extension, $path = null)
{
$hash = sha1(time() + microtime());
$exists = $filesystemAdapter->exists($path . '/' . $hash . '.' . $extension);
if ($exists) {
$this->generate($filesystemAdapter, $extension, $path);
... | php | public function generate(FilesystemAdapter $filesystemAdapter, $extension, $path = null)
{
$hash = sha1(time() + microtime());
$exists = $filesystemAdapter->exists($path . '/' . $hash . '.' . $extension);
if ($exists) {
$this->generate($filesystemAdapter, $extension, $path);
... | [
"public",
"function",
"generate",
"(",
"FilesystemAdapter",
"$",
"filesystemAdapter",
",",
"$",
"extension",
",",
"$",
"path",
"=",
"null",
")",
"{",
"$",
"hash",
"=",
"sha1",
"(",
"time",
"(",
")",
"+",
"microtime",
"(",
")",
")",
";",
"$",
"exists",
... | Generates unique filename
@param FilesystemAdapter $filesystemAdapter
@param string $extension File extension
@param null|string $path Directory path
@return string | [
"Generates",
"unique",
"filename"
] | train | https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/Manager/FileManager.php#L99-L110 |
dphn/ScContent | src/ScContent/Listener/Theme/AbstractThemeStrategy.php | AbstractThemeStrategy.injectContentTemplate | protected function injectContentTemplate(MvcEvent $event)
{
$model = $event->getResult();
if (! $model instanceof ViewModel) {
return $this;
}
if ($model->getTemplate()) {
return $this;
}
$routeMatch = $event->getRouteMatch();
$them... | php | protected function injectContentTemplate(MvcEvent $event)
{
$model = $event->getResult();
if (! $model instanceof ViewModel) {
return $this;
}
if ($model->getTemplate()) {
return $this;
}
$routeMatch = $event->getRouteMatch();
$them... | [
"protected",
"function",
"injectContentTemplate",
"(",
"MvcEvent",
"$",
"event",
")",
"{",
"$",
"model",
"=",
"$",
"event",
"->",
"getResult",
"(",
")",
";",
"if",
"(",
"!",
"$",
"model",
"instanceof",
"ViewModel",
")",
"{",
"return",
"$",
"this",
";",
... | Inject a template into the content view model, if none present
@param \Zend\Mvc\MvcEvent
@return AbstractThemeStrategy | [
"Inject",
"a",
"template",
"into",
"the",
"content",
"view",
"model",
"if",
"none",
"present"
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Listener/Theme/AbstractThemeStrategy.php#L119-L166 |
dphn/ScContent | src/ScContent/Listener/Theme/AbstractThemeStrategy.php | AbstractThemeStrategy.injectLayoutTemplate | protected function injectLayoutTemplate(MvcEvent $event)
{
$model = $event->getResult();
if (! $model instanceof ViewModel) {
return $this;
}
if ($model->terminate()) {
return $this;
}
$viewManager = $this->getViewManager();
$rendere... | php | protected function injectLayoutTemplate(MvcEvent $event)
{
$model = $event->getResult();
if (! $model instanceof ViewModel) {
return $this;
}
if ($model->terminate()) {
return $this;
}
$viewManager = $this->getViewManager();
$rendere... | [
"protected",
"function",
"injectLayoutTemplate",
"(",
"MvcEvent",
"$",
"event",
")",
"{",
"$",
"model",
"=",
"$",
"event",
"->",
"getResult",
"(",
")",
";",
"if",
"(",
"!",
"$",
"model",
"instanceof",
"ViewModel",
")",
"{",
"return",
"$",
"this",
";",
... | Inject a template into the layout view model, if none present
@param \Zend\Mvc\MvcEvent
@return AbstractThemeStrategy | [
"Inject",
"a",
"template",
"into",
"the",
"layout",
"view",
"model",
"if",
"none",
"present"
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Listener/Theme/AbstractThemeStrategy.php#L174-L221 |
kriskbx/mikado | src/Formatters/Formatter.php | Formatter.formatAble | protected function formatAble(&$object)
{
if (!is_object($object) || is_array($object)) {
throw new InvalidArgumentException('The given argument is not an object/array.');
}
if (!is_object($object) && $object instanceof FormatAble) {
return;
}
$objec... | php | protected function formatAble(&$object)
{
if (!is_object($object) || is_array($object)) {
throw new InvalidArgumentException('The given argument is not an object/array.');
}
if (!is_object($object) && $object instanceof FormatAble) {
return;
}
$objec... | [
"protected",
"function",
"formatAble",
"(",
"&",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
"||",
"is_array",
"(",
"$",
"object",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'The given argument is not ... | Make an object formatAble.
@param object|array $object
@return object | [
"Make",
"an",
"object",
"formatAble",
"."
] | train | https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Formatters/Formatter.php#L22-L33 |
kriskbx/mikado | src/Formatters/Formatter.php | Formatter.regex | public function regex($array = [])
{
$filtered = [];
foreach ($array as $key => $value) {
if ($this->isRegex($key)) {
$filtered[$key] = $value;
}
}
return $filtered;
} | php | public function regex($array = [])
{
$filtered = [];
foreach ($array as $key => $value) {
if ($this->isRegex($key)) {
$filtered[$key] = $value;
}
}
return $filtered;
} | [
"public",
"function",
"regex",
"(",
"$",
"array",
"=",
"[",
"]",
")",
"{",
"$",
"filtered",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isRegex",
"(",
"$",
"... | Filter an array where the key is a regex string.
@param array $array
@return array | [
"Filter",
"an",
"array",
"where",
"the",
"key",
"is",
"a",
"regex",
"string",
"."
] | train | https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Formatters/Formatter.php#L42-L52 |
kriskbx/mikado | src/Formatters/Formatter.php | Formatter.getRegexProperty | protected function getRegexProperty($matches, $value)
{
foreach ($matches as $index => $match) {
if (is_numeric($index) && $index != 0) {
$value = str_replace('$'.$index, $match, $value);
}
}
return $value;
} | php | protected function getRegexProperty($matches, $value)
{
foreach ($matches as $index => $match) {
if (is_numeric($index) && $index != 0) {
$value = str_replace('$'.$index, $match, $value);
}
}
return $value;
} | [
"protected",
"function",
"getRegexProperty",
"(",
"$",
"matches",
",",
"$",
"value",
")",
"{",
"foreach",
"(",
"$",
"matches",
"as",
"$",
"index",
"=>",
"$",
"match",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"index",
")",
"&&",
"$",
"index",
"!="... | Get regex property.
@param array $matches
@param string $value
@return string | [
"Get",
"regex",
"property",
"."
] | train | https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Formatters/Formatter.php#L80-L89 |
kriskbx/mikado | src/Formatters/Formatter.php | Formatter.pregMatchArray | protected function pregMatchArray($input, $rules, $flags = 0)
{
if (!is_array($rules)) {
return false;
}
foreach ($rules as $rule => $value) {
if (preg_match($rule, $input, $matches, $flags)) {
return array_merge($matches, ['value' => $value]);
... | php | protected function pregMatchArray($input, $rules, $flags = 0)
{
if (!is_array($rules)) {
return false;
}
foreach ($rules as $rule => $value) {
if (preg_match($rule, $input, $matches, $flags)) {
return array_merge($matches, ['value' => $value]);
... | [
"protected",
"function",
"pregMatchArray",
"(",
"$",
"input",
",",
"$",
"rules",
",",
"$",
"flags",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"rules",
")",
")",
"{",
"return",
"false",
";",
"}",
"foreach",
"(",
"$",
"rules",
"as",
... | Applies the regular expressions stored in the keys of the given array to the given input string.
Returns the first match including the matching value.
@param string $input
@param array $rules
@param int $flags
@return array|bool | [
"Applies",
"the",
"regular",
"expressions",
"stored",
"in",
"the",
"keys",
"of",
"the",
"given",
"array",
"to",
"the",
"given",
"input",
"string",
".",
"Returns",
"the",
"first",
"match",
"including",
"the",
"matching",
"value",
"."
] | train | https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Formatters/Formatter.php#L101-L114 |
liuguangw/mvc | src/event/EventDispatcher.php | EventDispatcher.addEventListener | public function addEventListener(string $eventClass, callable $handler):void
{
if (! isset($this->eventListenerMap[$eventClass])) {
$this->eventListenerMap[$eventClass] = [];
}
$this->eventListenerMap[$eventClass][] = $handler;
} | php | public function addEventListener(string $eventClass, callable $handler):void
{
if (! isset($this->eventListenerMap[$eventClass])) {
$this->eventListenerMap[$eventClass] = [];
}
$this->eventListenerMap[$eventClass][] = $handler;
} | [
"public",
"function",
"addEventListener",
"(",
"string",
"$",
"eventClass",
",",
"callable",
"$",
"handler",
")",
":",
"void",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"eventListenerMap",
"[",
"$",
"eventClass",
"]",
")",
")",
"{",
"$",
"t... | 添加事件处理器
@param string $eventClass
事件类
@param callable $handler
事件处理器
@return void | [
"添加事件处理器"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/event/EventDispatcher.php#L17-L23 |
liuguangw/mvc | src/event/EventDispatcher.php | EventDispatcher.dispatchEvent | public function dispatchEvent(EventArgs $eventArgs)
{
if ($eventArgs->sender === null) {
$eventArgs->sender = $this;
}
// 标记开始传播
$eventArgs->propagationStopped = false;
$eventClass = get_class($eventArgs);
if (isset($this->eventListenerMap[$eventClass])) {... | php | public function dispatchEvent(EventArgs $eventArgs)
{
if ($eventArgs->sender === null) {
$eventArgs->sender = $this;
}
// 标记开始传播
$eventArgs->propagationStopped = false;
$eventClass = get_class($eventArgs);
if (isset($this->eventListenerMap[$eventClass])) {... | [
"public",
"function",
"dispatchEvent",
"(",
"EventArgs",
"$",
"eventArgs",
")",
"{",
"if",
"(",
"$",
"eventArgs",
"->",
"sender",
"===",
"null",
")",
"{",
"$",
"eventArgs",
"->",
"sender",
"=",
"$",
"this",
";",
"}",
"// 标记开始传播",
"$",
"eventArgs",
"->",
... | 发送事件
@param EventArgs $eventArgs
事件参数
@return void | [
"发送事件"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/event/EventDispatcher.php#L32-L50 |
wshafer/assetmanager-core | src/Resolver/PrivateCollectionResolver.php | PrivateCollectionResolver.resolve | public function resolve($name)
{
$collectionMap = $this->getCollections();
if (!isset($collectionMap[$name])) {
return null;
}
if (!is_array($collectionMap[$name])) {
throw new Exception\RuntimeException(
"Collection with name $name is not an... | php | public function resolve($name)
{
$collectionMap = $this->getCollections();
if (!isset($collectionMap[$name])) {
return null;
}
if (!is_array($collectionMap[$name])) {
throw new Exception\RuntimeException(
"Collection with name $name is not an... | [
"public",
"function",
"resolve",
"(",
"$",
"name",
")",
"{",
"$",
"collectionMap",
"=",
"$",
"this",
"->",
"getCollections",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"collectionMap",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"null",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/wshafer/assetmanager-core/blob/b1bf9b3ab3b28f847fbe3f57d6c2c32b98c1431d/src/Resolver/PrivateCollectionResolver.php#L40-L65 |
wshafer/assetmanager-core | src/Resolver/PrivateCollectionResolver.php | PrivateCollectionResolver.getCollectionAsset | public function getCollectionAsset($path)
{
if (!is_string($path)) {
throw new Exception\RuntimeException(
'Asset should be of type string. got ' . gettype($path)
);
}
$asset = $this->resolveFile($path);
if (empty($asset)) {
throw... | php | public function getCollectionAsset($path)
{
if (!is_string($path)) {
throw new Exception\RuntimeException(
'Asset should be of type string. got ' . gettype($path)
);
}
$asset = $this->resolveFile($path);
if (empty($asset)) {
throw... | [
"public",
"function",
"getCollectionAsset",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"RuntimeException",
"(",
"'Asset should be of type string. got '",
".",
"gettype",
"(",
"$"... | @param string $path
@return \Assetic\Asset\FileAsset|\Assetic\Asset\HttpAsset|null | [
"@param",
"string",
"$path"
] | train | https://github.com/wshafer/assetmanager-core/blob/b1bf9b3ab3b28f847fbe3f57d6c2c32b98c1431d/src/Resolver/PrivateCollectionResolver.php#L72-L91 |
cpliakas/search-framework | src/Search/Framework/IndexDocument.php | IndexDocument.addField | public function addField($id, $value, $name = null)
{
$field = $this->_service->newField($id, $value, $name);
return $this->attachField($field);
} | php | public function addField($id, $value, $name = null)
{
$field = $this->_service->newField($id, $value, $name);
return $this->attachField($field);
} | [
"public",
"function",
"addField",
"(",
"$",
"id",
",",
"$",
"value",
",",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"field",
"=",
"$",
"this",
"->",
"_service",
"->",
"newField",
"(",
"$",
"id",
",",
"$",
"value",
",",
"$",
"name",
")",
";",
"re... | Instantiates and attaches a field to this document.
@return IndexField
@see SearchServiceAbstract::newField() | [
"Instantiates",
"and",
"attaches",
"a",
"field",
"to",
"this",
"document",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/IndexDocument.php#L80-L84 |
cpliakas/search-framework | src/Search/Framework/IndexDocument.php | IndexDocument.attachField | public function attachField(IndexField $field)
{
// Enrich the field here, agent will probably do this.
// Throw the SearchEvents::FIELD_ENRICH event, reset the field's value
// with the enriched value.
// $event = new SearchFieldEvent($this->_service, $this, $field);
// $this... | php | public function attachField(IndexField $field)
{
// Enrich the field here, agent will probably do this.
// Throw the SearchEvents::FIELD_ENRICH event, reset the field's value
// with the enriched value.
// $event = new SearchFieldEvent($this->_service, $this, $field);
// $this... | [
"public",
"function",
"attachField",
"(",
"IndexField",
"$",
"field",
")",
"{",
"// Enrich the field here, agent will probably do this.",
"// Throw the SearchEvents::FIELD_ENRICH event, reset the field's value",
"// with the enriched value.",
"// $event = new SearchFieldEvent($this->_... | Adds a field to the document.
This method throws the SearchEvents::FIELD_ENRICH event and stores the
enriched value as the field's value.
@param IndexField $field
The field being added to this document.
@return SearchIndexDocument | [
"Adds",
"a",
"field",
"to",
"the",
"document",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/IndexDocument.php#L97-L111 |
cpliakas/search-framework | src/Search/Framework/IndexDocument.php | IndexDocument.getField | public function getField($id)
{
if (!isset($this->_fields[$id])) {
$this->$id = ''; // @see SearchIndexDocument::__set()
}
return $this->_fields[$id];
} | php | public function getField($id)
{
if (!isset($this->_fields[$id])) {
$this->$id = ''; // @see SearchIndexDocument::__set()
}
return $this->_fields[$id];
} | [
"public",
"function",
"getField",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_fields",
"[",
"$",
"id",
"]",
")",
")",
"{",
"$",
"this",
"->",
"$",
"id",
"=",
"''",
";",
"// @see SearchIndexDocument::__set()",
"}",
"... | Returns a field that is attached to this document.
If the field is not attached to this document, a field is attached with
an empty string as it's value.
@param string $id
The unique identifier of the field.
@return IndexField | [
"Returns",
"a",
"field",
"that",
"is",
"attached",
"to",
"this",
"document",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/IndexDocument.php#L124-L130 |
fuelphp/filesystem | src/Handler.php | Handler.renameTo | public function renameTo($name)
{
if (strpos($name, DIRECTORY_SEPARATOR) !== 0)
{
$name = pathinfo($this->path, PATHINFO_DIRNAME).DIRECTORY_SEPARATOR.$name;
}
if ( ! pathinfo($name, PATHINFO_EXTENSION))
{
$name .= '.'.pathinfo($this->path, PATHINFO_EXTENSION);
}
if ($result = rename($this->path, ... | php | public function renameTo($name)
{
if (strpos($name, DIRECTORY_SEPARATOR) !== 0)
{
$name = pathinfo($this->path, PATHINFO_DIRNAME).DIRECTORY_SEPARATOR.$name;
}
if ( ! pathinfo($name, PATHINFO_EXTENSION))
{
$name .= '.'.pathinfo($this->path, PATHINFO_EXTENSION);
}
if ($result = rename($this->path, ... | [
"public",
"function",
"renameTo",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"name",
",",
"DIRECTORY_SEPARATOR",
")",
"!==",
"0",
")",
"{",
"$",
"name",
"=",
"pathinfo",
"(",
"$",
"this",
"->",
"path",
",",
"PATHINFO_DIRNAME",
")",
".... | Renames a file/dir
@return boolean | [
"Renames",
"a",
"file",
"/",
"dir"
] | train | https://github.com/fuelphp/filesystem/blob/770a8cb04caca920af8029d7aad7208bc0592743/src/Handler.php#L63-L81 |
fuelphp/filesystem | src/Handler.php | Handler.setPermissions | public function setPermissions($permissions)
{
if (is_string($permissions))
{
$permissions = '0'.ltrim($permissions, '0');
$permissions = octdec($permissions);
}
return chmod($this->path, $permissions);
} | php | public function setPermissions($permissions)
{
if (is_string($permissions))
{
$permissions = '0'.ltrim($permissions, '0');
$permissions = octdec($permissions);
}
return chmod($this->path, $permissions);
} | [
"public",
"function",
"setPermissions",
"(",
"$",
"permissions",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"permissions",
")",
")",
"{",
"$",
"permissions",
"=",
"'0'",
".",
"ltrim",
"(",
"$",
"permissions",
",",
"'0'",
")",
";",
"$",
"permissions",
... | Sets the permissions
@return boolean | [
"Sets",
"the",
"permissions"
] | train | https://github.com/fuelphp/filesystem/blob/770a8cb04caca920af8029d7aad7208bc0592743/src/Handler.php#L168-L177 |
chadicus/test-helpers | src/FunctionRegistry.php | FunctionRegistry.reset | public static function reset($namespace = null, array $extensions = array())
{
self::$functions = array();
foreach ($extensions as $extension) {
foreach (\get_extension_funcs($extension) as $name) {
self::evaluate($namespace, $name);
}
}
} | php | public static function reset($namespace = null, array $extensions = array())
{
self::$functions = array();
foreach ($extensions as $extension) {
foreach (\get_extension_funcs($extension) as $name) {
self::evaluate($namespace, $name);
}
}
} | [
"public",
"static",
"function",
"reset",
"(",
"$",
"namespace",
"=",
"null",
",",
"array",
"$",
"extensions",
"=",
"array",
"(",
")",
")",
"{",
"self",
"::",
"$",
"functions",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"extensions",
"as",
"$",... | Sets all custom function properties to null.
@param string $namespace The namespace from which the global function will be called.
@param array $extensions Array of PHP extensions whose functions will be mocked.
@return void | [
"Sets",
"all",
"custom",
"function",
"properties",
"to",
"null",
"."
] | train | https://github.com/chadicus/test-helpers/blob/e6718f5b62e0f1e0851ad2cd344e44a1fdb0b9bf/src/FunctionRegistry.php#L56-L64 |
KejawenLab/PetrukUsername | Util/CharacterShifter.php | CharacterShifter.replace | public static function replace(string $username, string $base): string
{
return preg_replace(sprintf('/%s/', $base), '', $username, 1);
} | php | public static function replace(string $username, string $base): string
{
return preg_replace(sprintf('/%s/', $base), '', $username, 1);
} | [
"public",
"static",
"function",
"replace",
"(",
"string",
"$",
"username",
",",
"string",
"$",
"base",
")",
":",
"string",
"{",
"return",
"preg_replace",
"(",
"sprintf",
"(",
"'/%s/'",
",",
"$",
"base",
")",
",",
"''",
",",
"$",
"username",
",",
"1",
... | @param string $username
@param string $base
@return string | [
"@param",
"string",
"$username",
"@param",
"string",
"$base"
] | train | https://github.com/KejawenLab/PetrukUsername/blob/a602cf9976415c94c2346a22b5df87fd53069b99/Util/CharacterShifter.php#L40-L43 |
CloudObjects/RDFUtilities | Parser.php | Parser.parseToIndex | public static function parseToIndex($input) {
if (($input[0] == '{' || $input[0] == '[')) {
return Arc2JsonLdConverter::jsonLdToIndex($input);
} else {
$parser = \ARC2::getRDFParser();
$parser->parse('', $input);
return $parser->getSimpleIndex(false);
}
... | php | public static function parseToIndex($input) {
if (($input[0] == '{' || $input[0] == '[')) {
return Arc2JsonLdConverter::jsonLdToIndex($input);
} else {
$parser = \ARC2::getRDFParser();
$parser->parse('', $input);
return $parser->getSimpleIndex(false);
}
... | [
"public",
"static",
"function",
"parseToIndex",
"(",
"$",
"input",
")",
"{",
"if",
"(",
"(",
"$",
"input",
"[",
"0",
"]",
"==",
"'{'",
"||",
"$",
"input",
"[",
"0",
"]",
"==",
"'['",
")",
")",
"{",
"return",
"Arc2JsonLdConverter",
"::",
"jsonLdToInde... | Parses the given input and returns an ARC2 index.
If the input is JsonLD the JsonLD parser is used, otherwise ARC2 is used.
@param string $input | [
"Parses",
"the",
"given",
"input",
"and",
"returns",
"an",
"ARC2",
"index",
".",
"If",
"the",
"input",
"is",
"JsonLD",
"the",
"JsonLD",
"parser",
"is",
"used",
"otherwise",
"ARC2",
"is",
"used",
"."
] | train | https://github.com/CloudObjects/RDFUtilities/blob/cd086981557352073b18b9e2fec1d99cfaacd285/Parser.php#L17-L25 |
terdia/legato-framework | src/View/Twig.php | Twig.getExtensions | protected function getExtensions()
{
if (file_exists(realpath(__DIR__.'/../../../../../config/twig.php'))) {
$this->config = require realpath(__DIR__.'/../../../../../config/twig.php');
} else {
$this->config = require realpath(__DIR__.'/../../config/twig.php');
}
... | php | protected function getExtensions()
{
if (file_exists(realpath(__DIR__.'/../../../../../config/twig.php'))) {
$this->config = require realpath(__DIR__.'/../../../../../config/twig.php');
} else {
$this->config = require realpath(__DIR__.'/../../config/twig.php');
}
... | [
"protected",
"function",
"getExtensions",
"(",
")",
"{",
"if",
"(",
"file_exists",
"(",
"realpath",
"(",
"__DIR__",
".",
"'/../../../../../config/twig.php'",
")",
")",
")",
"{",
"$",
"this",
"->",
"config",
"=",
"require",
"realpath",
"(",
"__DIR__",
".",
"'... | Get extensions defined by application developer.
@return array | [
"Get",
"extensions",
"defined",
"by",
"application",
"developer",
"."
] | train | https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/View/Twig.php#L54-L63 |
terdia/legato-framework | src/View/Twig.php | Twig.registerExtension | private function registerExtension(\Twig_Environment $twig)
{
$extensions = $this->getExtensions();
if (count($extensions)) {
foreach ($extensions as $key => $extension) {
$this->load($twig, $key, $extension);
}
}
} | php | private function registerExtension(\Twig_Environment $twig)
{
$extensions = $this->getExtensions();
if (count($extensions)) {
foreach ($extensions as $key => $extension) {
$this->load($twig, $key, $extension);
}
}
} | [
"private",
"function",
"registerExtension",
"(",
"\\",
"Twig_Environment",
"$",
"twig",
")",
"{",
"$",
"extensions",
"=",
"$",
"this",
"->",
"getExtensions",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"extensions",
")",
")",
"{",
"foreach",
"(",
"$",
... | Register twig extensions.
@param \Twig_Environment $twig | [
"Register",
"twig",
"extensions",
"."
] | train | https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/View/Twig.php#L70-L78 |
mimmi20/Wurfl | src/Handlers/HTCHandler.php | HTCHandler.applyConclusiveMatch | public function applyConclusiveMatch($userAgent)
{
if (preg_match('#^.*?HTC.+?[/ ;]#', $userAgent, $matches)) {
// The length of the complete match (from the beginning) is the tolerance
$tolerance = strlen($matches[0]);
} else {
$tolerance = strlen($userAgent);
... | php | public function applyConclusiveMatch($userAgent)
{
if (preg_match('#^.*?HTC.+?[/ ;]#', $userAgent, $matches)) {
// The length of the complete match (from the beginning) is the tolerance
$tolerance = strlen($matches[0]);
} else {
$tolerance = strlen($userAgent);
... | [
"public",
"function",
"applyConclusiveMatch",
"(",
"$",
"userAgent",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'#^.*?HTC.+?[/ ;]#'",
",",
"$",
"userAgent",
",",
"$",
"matches",
")",
")",
"{",
"// The length of the complete match (from the beginning) is the tolerance",
"$... | @param string $userAgent
@return null|string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/HTCHandler.php#L59-L69 |
liuguangw/mvc | src/services/UrlAsset.php | UrlAsset.getUrl | public function getUrl(string $path, ?string $packageName = null): string
{
if ($this->status == self::NOT_LOADED) {
$namedPackages = $this->getNamedPackages();
if (empty($namedPackages)) {
$this->package = $this->getDefaultPackage();
$this->status = s... | php | public function getUrl(string $path, ?string $packageName = null): string
{
if ($this->status == self::NOT_LOADED) {
$namedPackages = $this->getNamedPackages();
if (empty($namedPackages)) {
$this->package = $this->getDefaultPackage();
$this->status = s... | [
"public",
"function",
"getUrl",
"(",
"string",
"$",
"path",
",",
"?",
"string",
"$",
"packageName",
"=",
"null",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"status",
"==",
"self",
"::",
"NOT_LOADED",
")",
"{",
"$",
"namedPackages",
"=",
"... | 获取url
@param string $path
路径
@param string $packageName
包名称
@return string | [
"获取url"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/services/UrlAsset.php#L59-L77 |
Im0rtality/Underscore | src/Functions.php | Functions.memoize | public static function memoize($payload)
{
$function = function () use ($payload) {
static $cache = [];
$args = func_get_args();
$hash = md5(serialize($args));
if (!array_key_exists($hash, $cache)) {
$cache[$hash] = call_user_func_array($paylo... | php | public static function memoize($payload)
{
$function = function () use ($payload) {
static $cache = [];
$args = func_get_args();
$hash = md5(serialize($args));
if (!array_key_exists($hash, $cache)) {
$cache[$hash] = call_user_func_array($paylo... | [
"public",
"static",
"function",
"memoize",
"(",
"$",
"payload",
")",
"{",
"$",
"function",
"=",
"function",
"(",
")",
"use",
"(",
"$",
"payload",
")",
"{",
"static",
"$",
"cache",
"=",
"[",
"]",
";",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";"... | Creates a function that memoizes the result of the $payload
@param callable $payload
@return \Closure | [
"Creates",
"a",
"function",
"that",
"memoizes",
"the",
"result",
"of",
"the",
"$payload"
] | train | https://github.com/Im0rtality/Underscore/blob/2deb95cfd340761d00ecd0f033e67ce600f2b535/src/Functions.php#L14-L29 |
Im0rtality/Underscore | src/Functions.php | Functions.once | public static function once($function)
{
$called = false;
$value = null;
return function () use ($function, &$called, &$value) {
if (!$called) {
$args = func_get_args();
$value = call_user_func_array($function, $args);
$called = tr... | php | public static function once($function)
{
$called = false;
$value = null;
return function () use ($function, &$called, &$value) {
if (!$called) {
$args = func_get_args();
$value = call_user_func_array($function, $args);
$called = tr... | [
"public",
"static",
"function",
"once",
"(",
"$",
"function",
")",
"{",
"$",
"called",
"=",
"false",
";",
"$",
"value",
"=",
"null",
";",
"return",
"function",
"(",
")",
"use",
"(",
"$",
"function",
",",
"&",
"$",
"called",
",",
"&",
"$",
"value",
... | Creates a version of the function that can only be called one time.
Repeated calls to the modified function will have no effect, returning
the value from the original call. Useful for initialization functions,
instead of having to set a boolean flag and then check it later.
@param callable $function
@return \Closure | [
"Creates",
"a",
"version",
"of",
"the",
"function",
"that",
"can",
"only",
"be",
"called",
"one",
"time",
"."
] | train | https://github.com/Im0rtality/Underscore/blob/2deb95cfd340761d00ecd0f033e67ce600f2b535/src/Functions.php#L53-L67 |
Im0rtality/Underscore | src/Functions.php | Functions.partial | public static function partial($function, $arg)
{
$bound = func_get_args();
array_shift($bound); // remove $function
$placeholder = static::p();
return function () use ($function, $bound, $placeholder) {
$inject = func_get_args();
$args = [];
fo... | php | public static function partial($function, $arg)
{
$bound = func_get_args();
array_shift($bound); // remove $function
$placeholder = static::p();
return function () use ($function, $bound, $placeholder) {
$inject = func_get_args();
$args = [];
fo... | [
"public",
"static",
"function",
"partial",
"(",
"$",
"function",
",",
"$",
"arg",
")",
"{",
"$",
"bound",
"=",
"func_get_args",
"(",
")",
";",
"array_shift",
"(",
"$",
"bound",
")",
";",
"// remove $function",
"$",
"placeholder",
"=",
"static",
"::",
"p"... | Partially apply a function by filling in any number of its arguments.
You may pass p() in your list of arguments to specify an argument that
should not be pre-filled, but left open to supply at call-time.
@param callable $function
@param mixed $arg
@param mixed ...
@return \Closure | [
"Partially",
"apply",
"a",
"function",
"by",
"filling",
"in",
"any",
"number",
"of",
"its",
"arguments",
"."
] | train | https://github.com/Im0rtality/Underscore/blob/2deb95cfd340761d00ecd0f033e67ce600f2b535/src/Functions.php#L97-L121 |
Im0rtality/Underscore | src/Functions.php | Functions.compose | public static function compose($function)
{
$functions = array_reverse(func_get_args());
return function ($value) use ($functions) {
foreach ($functions as $function) {
$value = $function($value);
}
return $value;
};
} | php | public static function compose($function)
{
$functions = array_reverse(func_get_args());
return function ($value) use ($functions) {
foreach ($functions as $function) {
$value = $function($value);
}
return $value;
};
} | [
"public",
"static",
"function",
"compose",
"(",
"$",
"function",
")",
"{",
"$",
"functions",
"=",
"array_reverse",
"(",
"func_get_args",
"(",
")",
")",
";",
"return",
"function",
"(",
"$",
"value",
")",
"use",
"(",
"$",
"functions",
")",
"{",
"foreach",
... | Returns the composition of a list of functions.
Each function consumes the return value of the function that follows.
In math terms, composing the functions f(), g(), and h() produces f(g(h())).
@param callable $function
@param callable ...
@return \Closure | [
"Returns",
"the",
"composition",
"of",
"a",
"list",
"of",
"functions",
"."
] | train | https://github.com/Im0rtality/Underscore/blob/2deb95cfd340761d00ecd0f033e67ce600f2b535/src/Functions.php#L133-L144 |
Im0rtality/Underscore | src/Functions.php | Functions.wrap | public static function wrap($function, $wrapper)
{
return function () use ($function, $wrapper) {
$args = func_get_args();
array_unshift($args, $function); // make $function the first argument
return call_user_func_array($wrapper, $args);
};
} | php | public static function wrap($function, $wrapper)
{
return function () use ($function, $wrapper) {
$args = func_get_args();
array_unshift($args, $function); // make $function the first argument
return call_user_func_array($wrapper, $args);
};
} | [
"public",
"static",
"function",
"wrap",
"(",
"$",
"function",
",",
"$",
"wrapper",
")",
"{",
"return",
"function",
"(",
")",
"use",
"(",
"$",
"function",
",",
"$",
"wrapper",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"array_unshift",
... | Wraps the first function inside of the wrapper function, passing it as the first argument.
This allows the wrapper to execute code before and after the function runs,
adjust the arguments, and execute it conditionally.
@param callable $function
@param callable $wrapper
@return \Closure | [
"Wraps",
"the",
"first",
"function",
"inside",
"of",
"the",
"wrapper",
"function",
"passing",
"it",
"as",
"the",
"first",
"argument",
"."
] | train | https://github.com/Im0rtality/Underscore/blob/2deb95cfd340761d00ecd0f033e67ce600f2b535/src/Functions.php#L156-L163 |
Im0rtality/Underscore | src/Functions.php | Functions.throttle | public static function throttle($function, $wait, array $options = [])
{
$options += [
'leading' => true,
]; // @codeCoverageIgnore
$previous = 0;
$callback = function () use ($function, $wait, &$previous) {
$now = floor(microtime(true) * 1000); // convert f... | php | public static function throttle($function, $wait, array $options = [])
{
$options += [
'leading' => true,
]; // @codeCoverageIgnore
$previous = 0;
$callback = function () use ($function, $wait, &$previous) {
$now = floor(microtime(true) * 1000); // convert f... | [
"public",
"static",
"function",
"throttle",
"(",
"$",
"function",
",",
"$",
"wait",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"[",
"'leading'",
"=>",
"true",
",",
"]",
";",
"// @codeCoverageIgnore",
"$",
"previous",
"... | Creates and returns a new, throttled version of the passed function.
When invoked repeatedly, will only actually call the original function at
most once per every wait milliseconds. Useful for rate-limiting events that
occur faster than you can keep up with.
By default, throttle will execute the function as soon as y... | [
"Creates",
"and",
"returns",
"a",
"new",
"throttled",
"version",
"of",
"the",
"passed",
"function",
"."
] | train | https://github.com/Im0rtality/Underscore/blob/2deb95cfd340761d00ecd0f033e67ce600f2b535/src/Functions.php#L187-L210 |
Im0rtality/Underscore | src/Functions.php | Functions.before | public static function before($count, $function)
{
$memo = null;
return function () use ($function, &$count, &$memo) {
if (--$count > 0) {
$args = func_get_args();
$memo = call_user_func_array($function, $args);
}
return $memo;
... | php | public static function before($count, $function)
{
$memo = null;
return function () use ($function, &$count, &$memo) {
if (--$count > 0) {
$args = func_get_args();
$memo = call_user_func_array($function, $args);
}
return $memo;
... | [
"public",
"static",
"function",
"before",
"(",
"$",
"count",
",",
"$",
"function",
")",
"{",
"$",
"memo",
"=",
"null",
";",
"return",
"function",
"(",
")",
"use",
"(",
"$",
"function",
",",
"&",
"$",
"count",
",",
"&",
"$",
"memo",
")",
"{",
"if"... | Creates a version of the function that can be called no more than count times.
The result of the last function call is memoized and returned when count has been reached.
@param integer $count
@param callable $function
@return \Closure | [
"Creates",
"a",
"version",
"of",
"the",
"function",
"that",
"can",
"be",
"called",
"no",
"more",
"than",
"count",
"times",
"."
] | train | https://github.com/Im0rtality/Underscore/blob/2deb95cfd340761d00ecd0f033e67ce600f2b535/src/Functions.php#L242-L254 |
todstoychev/icr | src/Handler/OpenImageHandler.php | OpenImageHandler.loadImage | public function loadImage($image)
{
$imageLibrary = ucfirst($this->imageLibrary);
$functionName = 'loadWith' . $imageLibrary;
$this->image = $image;
if (!method_exists($this, $functionName)) {
throw new IcrRuntimeException('Wrong image library name provided!');
}... | php | public function loadImage($image)
{
$imageLibrary = ucfirst($this->imageLibrary);
$functionName = 'loadWith' . $imageLibrary;
$this->image = $image;
if (!method_exists($this, $functionName)) {
throw new IcrRuntimeException('Wrong image library name provided!');
}... | [
"public",
"function",
"loadImage",
"(",
"$",
"image",
")",
"{",
"$",
"imageLibrary",
"=",
"ucfirst",
"(",
"$",
"this",
"->",
"imageLibrary",
")",
";",
"$",
"functionName",
"=",
"'loadWith'",
".",
"$",
"imageLibrary",
";",
"$",
"this",
"->",
"image",
"=",... | Loads image from data string with imagine based on the driver name
@param string $image Image as string
@return AbstractImage | [
"Loads",
"image",
"from",
"data",
"string",
"with",
"imagine",
"based",
"on",
"the",
"driver",
"name"
] | train | https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/Handler/OpenImageHandler.php#L61-L72 |
todstoychev/icr | src/Handler/OpenImageHandler.php | OpenImageHandler.openImage | public function openImage($path)
{
$imageLibrary = ucfirst($this->imageLibrary);
$functionName = 'openWith' . $imageLibrary;
$this->path = $path;
if (!method_exists($this, $functionName)) {
throw new IcrRuntimeException('Wrong image library name provided!');
}
... | php | public function openImage($path)
{
$imageLibrary = ucfirst($this->imageLibrary);
$functionName = 'openWith' . $imageLibrary;
$this->path = $path;
if (!method_exists($this, $functionName)) {
throw new IcrRuntimeException('Wrong image library name provided!');
}
... | [
"public",
"function",
"openImage",
"(",
"$",
"path",
")",
"{",
"$",
"imageLibrary",
"=",
"ucfirst",
"(",
"$",
"this",
"->",
"imageLibrary",
")",
";",
"$",
"functionName",
"=",
"'openWith'",
".",
"$",
"imageLibrary",
";",
"$",
"this",
"->",
"path",
"=",
... | Open image from path with imagine library
@param string $path
@return AbstractImage | [
"Open",
"image",
"from",
"path",
"with",
"imagine",
"library"
] | train | https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/Handler/OpenImageHandler.php#L81-L92 |
Commercie/currency-exchange | src/FixedExchangeRateProviderTrait.php | FixedExchangeRateProviderTrait.load | public function load($sourceCurrencyCode, $destinationCurrencyCode)
{
$rate = null;
$exchangeRates = $this->loadAll();
if (isset($exchangeRates[$sourceCurrencyCode][$destinationCurrencyCode])) {
$rate = $exchangeRates[$sourceCurrencyCode][$destinationCurrencyCode];
} //... | php | public function load($sourceCurrencyCode, $destinationCurrencyCode)
{
$rate = null;
$exchangeRates = $this->loadAll();
if (isset($exchangeRates[$sourceCurrencyCode][$destinationCurrencyCode])) {
$rate = $exchangeRates[$sourceCurrencyCode][$destinationCurrencyCode];
} //... | [
"public",
"function",
"load",
"(",
"$",
"sourceCurrencyCode",
",",
"$",
"destinationCurrencyCode",
")",
"{",
"$",
"rate",
"=",
"null",
";",
"$",
"exchangeRates",
"=",
"$",
"this",
"->",
"loadAll",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"exchangeRat... | Implements \Commercie\CurrencyExchange\ExchangeRateProviderInterface::load(). | [
"Implements",
"\\",
"Commercie",
"\\",
"CurrencyExchange",
"\\",
"ExchangeRateProviderInterface",
"::",
"load",
"()",
"."
] | train | https://github.com/Commercie/currency-exchange/blob/bb6a0c3b682aaed2eda205ceda5582673cb444af/src/FixedExchangeRateProviderTrait.php#L30-L51 |
Commercie/currency-exchange | src/FixedExchangeRateProviderTrait.php | FixedExchangeRateProviderTrait.loadMultiple | public function loadMultiple(array $currencyCodes)
{
$rates = [];
foreach ($currencyCodes as $sourceCurrencyCode => $destinationCurrencyCodes) {
foreach ($destinationCurrencyCodes as $destinationCurrencyCode) {
$rates[$sourceCurrencyCode][$destinationCurrencyCode] = $this... | php | public function loadMultiple(array $currencyCodes)
{
$rates = [];
foreach ($currencyCodes as $sourceCurrencyCode => $destinationCurrencyCodes) {
foreach ($destinationCurrencyCodes as $destinationCurrencyCode) {
$rates[$sourceCurrencyCode][$destinationCurrencyCode] = $this... | [
"public",
"function",
"loadMultiple",
"(",
"array",
"$",
"currencyCodes",
")",
"{",
"$",
"rates",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"currencyCodes",
"as",
"$",
"sourceCurrencyCode",
"=>",
"$",
"destinationCurrencyCodes",
")",
"{",
"foreach",
"(",
"$",... | Implements \Commercie\CurrencyExchange\ExchangeRateProviderInterface::loadMultiple(). | [
"Implements",
"\\",
"Commercie",
"\\",
"CurrencyExchange",
"\\",
"ExchangeRateProviderInterface",
"::",
"loadMultiple",
"()",
"."
] | train | https://github.com/Commercie/currency-exchange/blob/bb6a0c3b682aaed2eda205ceda5582673cb444af/src/FixedExchangeRateProviderTrait.php#L56-L67 |
mamuz/MamuzBlog | src/MamuzBlog/Controller/Plugin/ViewModelFactory.php | ViewModelFactory.create | public function create($variables = null, $options = null)
{
$viewModel = new ViewModel($variables, $options);
$viewModel->setTerminal($this->isTerminal());
$viewModel->setVariable('isTerminal', $viewModel->terminate());
return $viewModel;
} | php | public function create($variables = null, $options = null)
{
$viewModel = new ViewModel($variables, $options);
$viewModel->setTerminal($this->isTerminal());
$viewModel->setVariable('isTerminal', $viewModel->terminate());
return $viewModel;
} | [
"public",
"function",
"create",
"(",
"$",
"variables",
"=",
"null",
",",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"viewModel",
"=",
"new",
"ViewModel",
"(",
"$",
"variables",
",",
"$",
"options",
")",
";",
"$",
"viewModel",
"->",
"setTerminal",
"(",... | Create ViewModel instance
and set terminal mode by HttpRequest
@param null|array|\Traversable $variables
@param null|array|\Traversable $options
@return ModelInterface | [
"Create",
"ViewModel",
"instance",
"and",
"set",
"terminal",
"mode",
"by",
"HttpRequest"
] | train | https://github.com/mamuz/MamuzBlog/blob/cb43be5c39031e3dcc939283e284824c4d07da38/src/MamuzBlog/Controller/Plugin/ViewModelFactory.php#L19-L26 |
joomla-projects/jorobo | src/Tasks/Build/Library.php | Library.run | public function run()
{
$this->say("Building library folder " . $this->libName);
if (!file_exists($this->source))
{
$this->say("Folder " . $this->source . " does not exist!");
return true;
}
$this->prepareDirectory();
// Libaries are problematic.. we have libraries/name/libraries/name in the end ... | php | public function run()
{
$this->say("Building library folder " . $this->libName);
if (!file_exists($this->source))
{
$this->say("Folder " . $this->source . " does not exist!");
return true;
}
$this->prepareDirectory();
// Libaries are problematic.. we have libraries/name/libraries/name in the end ... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Building library folder \"",
".",
"$",
"this",
"->",
"libName",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"source",
")",
")",
"{",
"$",
"this",
"->",... | Runs the library build tasks, just copying files currently
@return bool
@since 1.0 | [
"Runs",
"the",
"library",
"build",
"tasks",
"just",
"copying",
"files",
"currently"
] | train | https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Build/Library.php#L67-L112 |
joomla-projects/jorobo | src/Tasks/Build/Library.php | Library.createInstaller | private function createInstaller($files)
{
$this->say("Creating library installer");
$xmlFile = $this->target . "/" . $this->libName . ".xml";
// Version & Date Replace
$this->replaceInFile($xmlFile);
// Files and folders
$f = $this->generateFileList($files);
$this->taskReplaceInFile($xmlFile)
->f... | php | private function createInstaller($files)
{
$this->say("Creating library installer");
$xmlFile = $this->target . "/" . $this->libName . ".xml";
// Version & Date Replace
$this->replaceInFile($xmlFile);
// Files and folders
$f = $this->generateFileList($files);
$this->taskReplaceInFile($xmlFile)
->f... | [
"private",
"function",
"createInstaller",
"(",
"$",
"files",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Creating library installer\"",
")",
";",
"$",
"xmlFile",
"=",
"$",
"this",
"->",
"target",
".",
"\"/\"",
".",
"$",
"this",
"->",
"libName",
".",
"\".... | Generate the installer xml file for the library
@param array $files The library files
@return void
@since 1.0 | [
"Generate",
"the",
"installer",
"xml",
"file",
"for",
"the",
"library"
] | train | https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Build/Library.php#L135-L175 |
o2system/parser | src/Template/Abstracts/AbstractAdapter.php | AbstractAdapter.loadFile | public function loadFile($filePath)
{
if ($filePath instanceof \SplFileInfo) {
$filePath = $filePath->getRealPath();
}
if (is_file($filePath)) {
return $this->loadString(file_get_contents($filePath));
}
return false;
} | php | public function loadFile($filePath)
{
if ($filePath instanceof \SplFileInfo) {
$filePath = $filePath->getRealPath();
}
if (is_file($filePath)) {
return $this->loadString(file_get_contents($filePath));
}
return false;
} | [
"public",
"function",
"loadFile",
"(",
"$",
"filePath",
")",
"{",
"if",
"(",
"$",
"filePath",
"instanceof",
"\\",
"SplFileInfo",
")",
"{",
"$",
"filePath",
"=",
"$",
"filePath",
"->",
"getRealPath",
"(",
")",
";",
"}",
"if",
"(",
"is_file",
"(",
"$",
... | AbstractAdapter::loadFile
@param string $filePath
@return bool | [
"AbstractAdapter",
"::",
"loadFile"
] | train | https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/Template/Abstracts/AbstractAdapter.php#L92-L103 |
o2system/parser | src/Template/Abstracts/AbstractAdapter.php | AbstractAdapter.loadString | public function loadString($string)
{
$this->string = htmlspecialchars_decode($string);
if ($this->config[ 'allowPhpScripts' ] === false) {
$this->string = preg_replace(
'/<\\?.*(\\?>|$)/Us',
'',
str_replace('<?=', '<?php echo ', $... | php | public function loadString($string)
{
$this->string = htmlspecialchars_decode($string);
if ($this->config[ 'allowPhpScripts' ] === false) {
$this->string = preg_replace(
'/<\\?.*(\\?>|$)/Us',
'',
str_replace('<?=', '<?php echo ', $... | [
"public",
"function",
"loadString",
"(",
"$",
"string",
")",
"{",
"$",
"this",
"->",
"string",
"=",
"htmlspecialchars_decode",
"(",
"$",
"string",
")",
";",
"if",
"(",
"$",
"this",
"->",
"config",
"[",
"'allowPhpScripts'",
"]",
"===",
"false",
")",
"{",
... | AbstractAdapter::loadString
@param string $string
@return bool | [
"AbstractAdapter",
"::",
"loadString"
] | train | https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/Template/Abstracts/AbstractAdapter.php#L114-L127 |
o2system/parser | src/Template/Abstracts/AbstractAdapter.php | AbstractAdapter.setEngine | public function setEngine($engine)
{
if ($this->isValidEngine($engine)) {
$this->engine =& $engine;
return true;
}
return false;
} | php | public function setEngine($engine)
{
if ($this->isValidEngine($engine)) {
$this->engine =& $engine;
return true;
}
return false;
} | [
"public",
"function",
"setEngine",
"(",
"$",
"engine",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isValidEngine",
"(",
"$",
"engine",
")",
")",
"{",
"$",
"this",
"->",
"engine",
"=",
"&",
"$",
"engine",
";",
"return",
"true",
";",
"}",
"return",
"fal... | AbstractAdapter::setEngine
@param object $engine
@return bool | [
"AbstractAdapter",
"::",
"setEngine"
] | train | https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/Template/Abstracts/AbstractAdapter.php#L150-L159 |
iP1SMS/ip1-php-sdk | src/Core/Communicator.php | Communicator.add | public function add(ProcessableComponentInterface $component)
{
switch (get_class($component)) {
case "IP1\RESTClient\Recipient\Contact":
$response = $this->sendRequest("api/contacts", "POST", json_encode($component));
return RecipientFactory::createProcessedConta... | php | public function add(ProcessableComponentInterface $component)
{
switch (get_class($component)) {
case "IP1\RESTClient\Recipient\Contact":
$response = $this->sendRequest("api/contacts", "POST", json_encode($component));
return RecipientFactory::createProcessedConta... | [
"public",
"function",
"add",
"(",
"ProcessableComponentInterface",
"$",
"component",
")",
"{",
"switch",
"(",
"get_class",
"(",
"$",
"component",
")",
")",
"{",
"case",
"\"IP1\\RESTClient\\Recipient\\Contact\"",
":",
"$",
"response",
"=",
"$",
"this",
"->",
"sen... | Adds the param to the API and returns the response as the corresponding object.
@param ProcessableComponentInterface $component A Contact, Group, Membership or OutGoingSMS.
@return ProcessedComponentInterface ProcessedContact, ProcessedGroup, PrcessedMembership or a ClassValidatinArray
filled with ProcessedOutGoingSMS.... | [
"Adds",
"the",
"param",
"to",
"the",
"API",
"and",
"returns",
"the",
"response",
"as",
"the",
"corresponding",
"object",
"."
] | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Core/Communicator.php#L60-L86 |
iP1SMS/ip1-php-sdk | src/Core/Communicator.php | Communicator.remove | public function remove(ProcessedComponentInterface $component): ProcessedComponentInterface
{
switch (get_class($component)) {
case "IP1\RESTClient\Recipient\ProcessedContact":
$response = $this->sendRequest("api/contacts/".$component->getID(), "DELETE");
return R... | php | public function remove(ProcessedComponentInterface $component): ProcessedComponentInterface
{
switch (get_class($component)) {
case "IP1\RESTClient\Recipient\ProcessedContact":
$response = $this->sendRequest("api/contacts/".$component->getID(), "DELETE");
return R... | [
"public",
"function",
"remove",
"(",
"ProcessedComponentInterface",
"$",
"component",
")",
":",
"ProcessedComponentInterface",
"{",
"switch",
"(",
"get_class",
"(",
"$",
"component",
")",
")",
"{",
"case",
"\"IP1\\RESTClient\\Recipient\\ProcessedContact\"",
":",
"$",
... | Removes the param to the API and returns the response as the corresponding object.
@param ProcessedComponentInterface $component A Contact, Group, Membership.
@return ProcessedComponentInterface ProcessedContact, ProcessedGroup, PrcessedMembership or a ClassValidatinArray
filled with ProcessedOutGoingSMS.
@throws \Inva... | [
"Removes",
"the",
"param",
"to",
"the",
"API",
"and",
"returns",
"the",
"response",
"as",
"the",
"corresponding",
"object",
"."
] | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Core/Communicator.php#L94-L118 |
iP1SMS/ip1-php-sdk | src/Core/Communicator.php | Communicator.edit | public function edit(UpdatableComponentInterface $component): UpdatableComponentInterface
{
switch (get_class($component)) {
case "IP1\RESTClient\Recipient\ProcessedContact":
$response = $this->sendRequest(
"api/contacts/".$component->getID(),
... | php | public function edit(UpdatableComponentInterface $component): UpdatableComponentInterface
{
switch (get_class($component)) {
case "IP1\RESTClient\Recipient\ProcessedContact":
$response = $this->sendRequest(
"api/contacts/".$component->getID(),
... | [
"public",
"function",
"edit",
"(",
"UpdatableComponentInterface",
"$",
"component",
")",
":",
"UpdatableComponentInterface",
"{",
"switch",
"(",
"get_class",
"(",
"$",
"component",
")",
")",
"{",
"case",
"\"IP1\\RESTClient\\Recipient\\ProcessedContact\"",
":",
"$",
"r... | Edits the param to the API and returns the response as the corresponding object.
@param UpdatableComponentInterface $component A Contact, Group, Membership.
@return UpdatableComponentInterface ProcessedContact, ProcessedGroup or PrcessedMembership.
@throws \InvalidArgumentException When param isn't any of the classes l... | [
"Edits",
"the",
"param",
"to",
"the",
"API",
"and",
"returns",
"the",
"response",
"as",
"the",
"corresponding",
"object",
"."
] | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Core/Communicator.php#L125-L146 |
iP1SMS/ip1-php-sdk | src/Core/Communicator.php | Communicator.get | public function get(string $endPoint)
{
$parsedEndPoint = self::parseEndPoint($endPoint);
return $this->sendRequest($parsedEndPoint, "GET");
} | php | public function get(string $endPoint)
{
$parsedEndPoint = self::parseEndPoint($endPoint);
return $this->sendRequest($parsedEndPoint, "GET");
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"endPoint",
")",
"{",
"$",
"parsedEndPoint",
"=",
"self",
"::",
"parseEndPoint",
"(",
"$",
"endPoint",
")",
";",
"return",
"$",
"this",
"->",
"sendRequest",
"(",
"$",
"parsedEndPoint",
",",
"\"GET\"",
")",
... | Fetches a ProcessedComponentInterface(s) from the given URI.
@param string $endPoint API URI.
@return string JSON API Response. | [
"Fetches",
"a",
"ProcessedComponentInterface",
"(",
"s",
")",
"from",
"the",
"given",
"URI",
"."
] | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Core/Communicator.php#L153-L157 |
iP1SMS/ip1-php-sdk | src/Core/Communicator.php | Communicator.post | public function post(string $endPoint, \JsonSerializable $content): string
{
$parsedEndPoint = self::parseEndPoint($endPoint);
return $this->sendRequest($parsedEndPoint, "POST", json_encode($content));
} | php | public function post(string $endPoint, \JsonSerializable $content): string
{
$parsedEndPoint = self::parseEndPoint($endPoint);
return $this->sendRequest($parsedEndPoint, "POST", json_encode($content));
} | [
"public",
"function",
"post",
"(",
"string",
"$",
"endPoint",
",",
"\\",
"JsonSerializable",
"$",
"content",
")",
":",
"string",
"{",
"$",
"parsedEndPoint",
"=",
"self",
"::",
"parseEndPoint",
"(",
"$",
"endPoint",
")",
";",
"return",
"$",
"this",
"->",
... | Adds the content object to the endpoint and returns a processed version of given object.
@param string $endPoint API URI.
@param \JsonSerializable $content The ProcessableComponentInterface that is to be posted to the API.
@return string JSON API Response. | [
"Adds",
"the",
"content",
"object",
"to",
"the",
"endpoint",
"and",
"returns",
"a",
"processed",
"version",
"of",
"given",
"object",
"."
] | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Core/Communicator.php#L164-L168 |
iP1SMS/ip1-php-sdk | src/Core/Communicator.php | Communicator.delete | public function delete(string $endPoint): string
{
$parsedEndPoint = self::parseEndPoint($endPoint);
return $this->sendRequest($parsedEndPoint, "DELETE");
} | php | public function delete(string $endPoint): string
{
$parsedEndPoint = self::parseEndPoint($endPoint);
return $this->sendRequest($parsedEndPoint, "DELETE");
} | [
"public",
"function",
"delete",
"(",
"string",
"$",
"endPoint",
")",
":",
"string",
"{",
"$",
"parsedEndPoint",
"=",
"self",
"::",
"parseEndPoint",
"(",
"$",
"endPoint",
")",
";",
"return",
"$",
"this",
"->",
"sendRequest",
"(",
"$",
"parsedEndPoint",
",",... | Deletes the object at the given endpoint
@param string $endPoint API URI.
@return string JSON string of what got deleted. | [
"Deletes",
"the",
"object",
"at",
"the",
"given",
"endpoint"
] | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Core/Communicator.php#L174-L178 |
iP1SMS/ip1-php-sdk | src/Core/Communicator.php | Communicator.parseEndPoint | private static function parseEndPoint(string $endPoint)
{
$endPoint = trim($endPoint, '/');
$endPointArray = explode('/', $endPoint);
if ($endPointArray[0] == "api") {
return $endPoint;
}
array_unshift($endPointArray, "api");
return implode('/', array_fil... | php | private static function parseEndPoint(string $endPoint)
{
$endPoint = trim($endPoint, '/');
$endPointArray = explode('/', $endPoint);
if ($endPointArray[0] == "api") {
return $endPoint;
}
array_unshift($endPointArray, "api");
return implode('/', array_fil... | [
"private",
"static",
"function",
"parseEndPoint",
"(",
"string",
"$",
"endPoint",
")",
"{",
"$",
"endPoint",
"=",
"trim",
"(",
"$",
"endPoint",
",",
"'/'",
")",
";",
"$",
"endPointArray",
"=",
"explode",
"(",
"'/'",
",",
"$",
"endPoint",
")",
";",
"if"... | Turns the given endPoint string into a usable.
@param string $endPoint API URI.
@return string Fixed endpoint string. | [
"Turns",
"the",
"given",
"endPoint",
"string",
"into",
"a",
"usable",
"."
] | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Core/Communicator.php#L195-L205 |
iP1SMS/ip1-php-sdk | src/Core/Communicator.php | Communicator.sendRequest | private function sendRequest(string $endPoint, string $method, string $content = "", bool $https = true): Response
{
$url = ($https ? "https://" : "http://") . self::DOMAIN . "/" .$endPoint;
$request = \Httpful\Request::init($method, 'application/json');
$request->basicAuth($this->accountTok... | php | private function sendRequest(string $endPoint, string $method, string $content = "", bool $https = true): Response
{
$url = ($https ? "https://" : "http://") . self::DOMAIN . "/" .$endPoint;
$request = \Httpful\Request::init($method, 'application/json');
$request->basicAuth($this->accountTok... | [
"private",
"function",
"sendRequest",
"(",
"string",
"$",
"endPoint",
",",
"string",
"$",
"method",
",",
"string",
"$",
"content",
"=",
"\"\"",
",",
"bool",
"$",
"https",
"=",
"true",
")",
":",
"Response",
"{",
"$",
"url",
"=",
"(",
"$",
"https",
"?"... | Sends a HTTP request to the RESTful API and returns the result as a JSON string.
@param string $endPoint The URI that the function should use.
@param string $method The HTTP method that should be used, valid ones are:
METH_POST, METH_GET, METH_DELETE and METH_PUT.
@param string $content A JSON string containing ... | [
"Sends",
"a",
"HTTP",
"request",
"to",
"the",
"RESTful",
"API",
"and",
"returns",
"the",
"result",
"as",
"a",
"JSON",
"string",
"."
] | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Core/Communicator.php#L216-L233 |
mimmi20/Wurfl | src/CustomDevice.php | CustomDevice.isSpecific | public function isSpecific()
{
foreach ($this->modelDevices as $modelDevice) {
if ($modelDevice->specific === true || $modelDevice->actualDeviceRoot === true) {
return true;
}
}
return false;
} | php | public function isSpecific()
{
foreach ($this->modelDevices as $modelDevice) {
if ($modelDevice->specific === true || $modelDevice->actualDeviceRoot === true) {
return true;
}
}
return false;
} | [
"public",
"function",
"isSpecific",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"modelDevices",
"as",
"$",
"modelDevice",
")",
"{",
"if",
"(",
"$",
"modelDevice",
"->",
"specific",
"===",
"true",
"||",
"$",
"modelDevice",
"->",
"actualDeviceRoot",
"=... | Device is a specific or actual WURFL device as defined by its capabilities
@return bool | [
"Device",
"is",
"a",
"specific",
"or",
"actual",
"WURFL",
"device",
"as",
"defined",
"by",
"its",
"capabilities"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/CustomDevice.php#L148-L157 |
mimmi20/Wurfl | src/CustomDevice.php | CustomDevice.getCapability | public function getCapability($capabilityName)
{
if (empty($capabilityName)) {
throw new \InvalidArgumentException('capability name must not be empty');
}
if (!$this->getRootDevice()->isCapabilityDefined($capabilityName)) {
throw new \InvalidArgumentException('no cap... | php | public function getCapability($capabilityName)
{
if (empty($capabilityName)) {
throw new \InvalidArgumentException('capability name must not be empty');
}
if (!$this->getRootDevice()->isCapabilityDefined($capabilityName)) {
throw new \InvalidArgumentException('no cap... | [
"public",
"function",
"getCapability",
"(",
"$",
"capabilityName",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"capabilityName",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'capability name must not be empty'",
")",
";",
"}",
"if",
"(",
... | Returns the value of a given capability name
for the current device
@param string $capabilityName must be a valid capability name
@throws \InvalidArgumentException The $capabilityName is is not defined in the loaded WURFL.
@return string|null Capability value
@see \Wurfl\Device\ModelDeviceInterface::getCapability() | [
"Returns",
"the",
"value",
"of",
"a",
"given",
"capability",
"name",
"for",
"the",
"current",
"device"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/CustomDevice.php#L171-L190 |
mimmi20/Wurfl | src/CustomDevice.php | CustomDevice.getAllCapabilities | public function getAllCapabilities()
{
$capabilities = array();
foreach (array_reverse($this->modelDevices) as $modelDevice) {
/* @var Device\ModelDeviceInterface $modelDevice */
$capabilities = array_merge($capabilities, $modelDevice->getCapabilities());
}
$... | php | public function getAllCapabilities()
{
$capabilities = array();
foreach (array_reverse($this->modelDevices) as $modelDevice) {
/* @var Device\ModelDeviceInterface $modelDevice */
$capabilities = array_merge($capabilities, $modelDevice->getCapabilities());
}
$... | [
"public",
"function",
"getAllCapabilities",
"(",
")",
"{",
"$",
"capabilities",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"array_reverse",
"(",
"$",
"this",
"->",
"modelDevices",
")",
"as",
"$",
"modelDevice",
")",
"{",
"/* @var Device\\ModelDeviceInterface $... | Returns capabilities and their values for the current device
@return array Device capabilities array
@see \Wurfl\Device\ModelDeviceInterface::getCapabilities() | [
"Returns",
"capabilities",
"and",
"their",
"values",
"for",
"the",
"current",
"device"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/CustomDevice.php#L248-L259 |
unimapper/unimapper | src/Query.php | Query.run | final public function run(Connection $connection)
{
$start = microtime(true);
foreach (QueryBuilder::getBeforeRun() as $callback) {
// function(\UniMapper\Query $query)
$callback($this);
}
$result = $this->onExecute($connection);
foreach (QueryBuild... | php | final public function run(Connection $connection)
{
$start = microtime(true);
foreach (QueryBuilder::getBeforeRun() as $callback) {
// function(\UniMapper\Query $query)
$callback($this);
}
$result = $this->onExecute($connection);
foreach (QueryBuild... | [
"final",
"public",
"function",
"run",
"(",
"Connection",
"$",
"connection",
")",
"{",
"$",
"start",
"=",
"microtime",
"(",
"true",
")",
";",
"foreach",
"(",
"QueryBuilder",
"::",
"getBeforeRun",
"(",
")",
"as",
"$",
"callback",
")",
"{",
"// function(\\Uni... | Executes query
@param \UniMapper\Connection $connection
@return mixed | [
"Executes",
"query"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Query.php#L43-L61 |
christophe-brachet/aspi-framework | src/Framework/Form/Element/Input/Datalist.php | Datalist.render | public function render($depth = 0, $indent = null, $inner = false)
{
return parent::render($depth, $indent, $inner) . $this->datalist->render($depth, $indent, $inner);
} | php | public function render($depth = 0, $indent = null, $inner = false)
{
return parent::render($depth, $indent, $inner) . $this->datalist->render($depth, $indent, $inner);
} | [
"public",
"function",
"render",
"(",
"$",
"depth",
"=",
"0",
",",
"$",
"indent",
"=",
"null",
",",
"$",
"inner",
"=",
"false",
")",
"{",
"return",
"parent",
"::",
"render",
"(",
"$",
"depth",
",",
"$",
"indent",
",",
"$",
"inner",
")",
".",
"$",
... | Render the datalist element
@param int $depth
@param string $indent
@param boolean $inner
@return mixed | [
"Render",
"the",
"datalist",
"element"
] | train | https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/Input/Datalist.php#L61-L64 |
incraigulous/contentful-sdk | src/ManagementResources/Assets.php | Assets.process | function process($id, $language = null)
{
if (!$language && defined('CONTENTFUL_DEFAULT_LANGUAGE')) {
$language = CONTENTFUL_DEFAULT_LANGUAGE;
} else {
$language = 'en-US';
}
$this->requestDecorator->setId($id . '/files/' . $language . '/process');
$r... | php | function process($id, $language = null)
{
if (!$language && defined('CONTENTFUL_DEFAULT_LANGUAGE')) {
$language = CONTENTFUL_DEFAULT_LANGUAGE;
} else {
$language = 'en-US';
}
$this->requestDecorator->setId($id . '/files/' . $language . '/process');
$r... | [
"function",
"process",
"(",
"$",
"id",
",",
"$",
"language",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"language",
"&&",
"defined",
"(",
"'CONTENTFUL_DEFAULT_LANGUAGE'",
")",
")",
"{",
"$",
"language",
"=",
"CONTENTFUL_DEFAULT_LANGUAGE",
";",
"}",
"else"... | Process an asset.
@param $id
@param string $language
@return mixed | [
"Process",
"an",
"asset",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/ManagementResources/Assets.php#L18-L29 |
PandaPlatform/framework | src/Panda/Http/Request.php | Request.getInputSource | protected function getInputSource()
{
if ($this->isJson()) {
return $this->getPayloadJSON();
}
return $this->getMethod() == 'GET' ? $this->query : $this->request;
} | php | protected function getInputSource()
{
if ($this->isJson()) {
return $this->getPayloadJSON();
}
return $this->getMethod() == 'GET' ? $this->query : $this->request;
} | [
"protected",
"function",
"getInputSource",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isJson",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getPayloadJSON",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"getMethod",
"(",
")",
"==",
"'GET'"... | Get the input source for the request.
@return ParameterBag
@throws \LogicException | [
"Get",
"the",
"input",
"source",
"for",
"the",
"request",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Http/Request.php#L79-L86 |
PandaPlatform/framework | src/Panda/Http/Request.php | Request.getInputValue | public function getInputValue($key = null, $default = null)
{
$input = $this->getInputSource()->all() + $this->query->all();
return ArrayHelper::get($input, $key, $default);
} | php | public function getInputValue($key = null, $default = null)
{
$input = $this->getInputSource()->all() + $this->query->all();
return ArrayHelper::get($input, $key, $default);
} | [
"public",
"function",
"getInputValue",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"input",
"=",
"$",
"this",
"->",
"getInputSource",
"(",
")",
"->",
"all",
"(",
")",
"+",
"$",
"this",
"->",
"query",
"->",
"all",
... | Get an input item from the request.
@param string $key
@param string|array|null $default
@return array|string
@throws \LogicException | [
"Get",
"an",
"input",
"item",
"from",
"the",
"request",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Http/Request.php#L97-L102 |
PandaPlatform/framework | src/Panda/Http/Request.php | Request.getObjectValue | protected function getObjectValue($source, $key, $default)
{
if (is_null($key)) {
return $this->$source->all();
}
return $this->$source->get($key, $default);
} | php | protected function getObjectValue($source, $key, $default)
{
if (is_null($key)) {
return $this->$source->all();
}
return $this->$source->get($key, $default);
} | [
"protected",
"function",
"getObjectValue",
"(",
"$",
"source",
",",
"$",
"key",
",",
"$",
"default",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"key",
")",
")",
"{",
"return",
"$",
"this",
"->",
"$",
"source",
"->",
"all",
"(",
")",
";",
"}",
"ret... | Retrieve a parameter item from a given source.
@param string $source
@param string $key
@param string|array|null $default
@return string|array | [
"Retrieve",
"a",
"parameter",
"item",
"from",
"a",
"given",
"source",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Http/Request.php#L136-L143 |
PandaPlatform/framework | src/Panda/Http/Request.php | Request.getPayloadJSON | public function getPayloadJSON($key = null, $default = null)
{
if (!isset($this->json)) {
$this->json = new ParameterBag((array)json_decode($this->getContent(), true));
}
if (is_null($key)) {
return $this->json;
}
return ArrayHelper::get($this->json-... | php | public function getPayloadJSON($key = null, $default = null)
{
if (!isset($this->json)) {
$this->json = new ParameterBag((array)json_decode($this->getContent(), true));
}
if (is_null($key)) {
return $this->json;
}
return ArrayHelper::get($this->json-... | [
"public",
"function",
"getPayloadJSON",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"json",
")",
")",
"{",
"$",
"this",
"->",
"json",
"=",
"new",
"ParameterBag",
"(",
... | Get the JSON payload for the request.
@param string $key
@param mixed $default
@return mixed
@throws \LogicException | [
"Get",
"the",
"JSON",
"payload",
"for",
"the",
"request",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Http/Request.php#L176-L187 |
PandaPlatform/framework | src/Panda/Http/Request.php | Request.get | public function get($key, $default = null, $includeCookies = true)
{
if ($includeCookies) {
if ($this !== $result = $this->cookies->get($key, $this)) {
return $result;
}
}
return parent::get($key, $default);
} | php | public function get($key, $default = null, $includeCookies = true)
{
if ($includeCookies) {
if ($this !== $result = $this->cookies->get($key, $this)) {
return $result;
}
}
return parent::get($key, $default);
} | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
",",
"$",
"includeCookies",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"includeCookies",
")",
"{",
"if",
"(",
"$",
"this",
"!==",
"$",
"result",
"=",
"$",
"this",
"->",
"... | Gets a "parameter" value from any bag.
You can include the cookies bag. It is included by default.
@param string $key
@param null $default
@param bool $includeCookies
@return mixed | [
"Gets",
"a",
"parameter",
"value",
"from",
"any",
"bag",
".",
"You",
"can",
"include",
"the",
"cookies",
"bag",
".",
"It",
"is",
"included",
"by",
"default",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Http/Request.php#L209-L218 |
unimapper/unimapper | src/Association/OneToMany.php | OneToMany.saveChanges | public function saveChanges(
$primaryValue,
Connection $connection,
Collection $collection
) {
if ($collection->getEntityClass() !== $this->targetReflection->getClassName()) {
throw new AssociationException(
"Input collection should be type of "
... | php | public function saveChanges(
$primaryValue,
Connection $connection,
Collection $collection
) {
if ($collection->getEntityClass() !== $this->targetReflection->getClassName()) {
throw new AssociationException(
"Input collection should be type of "
... | [
"public",
"function",
"saveChanges",
"(",
"$",
"primaryValue",
",",
"Connection",
"$",
"connection",
",",
"Collection",
"$",
"collection",
")",
"{",
"if",
"(",
"$",
"collection",
"->",
"getEntityClass",
"(",
")",
"!==",
"$",
"this",
"->",
"targetReflection",
... | Save changes in target collection
@param string $primaryValue Primary value from source entity
@param Connection $connection
@param Collection $collection Target collection
@throws AssociationException | [
"Save",
"changes",
"in",
"target",
"collection"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Association/OneToMany.php#L79-L145 |
transfer-framework/transfer | src/Transfer/Console/Command/Manifest/ManifestCommand.php | ManifestCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$file = $input->getOption('chain');
if ($file !== null) {
if (!file_exists($file)) {
throw new \InvalidArgumentException(sprintf('File "%s" could not be located.', $file));
}
... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$file = $input->getOption('chain');
if ($file !== null) {
if (!file_exists($file)) {
throw new \InvalidArgumentException(sprintf('File "%s" could not be located.', $file));
}
... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"file",
"=",
"$",
"input",
"->",
"getOption",
"(",
"'chain'",
")",
";",
"if",
"(",
"$",
"file",
"!==",
"null",
")",
"{",
"if"... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Console/Command/Manifest/ManifestCommand.php#L50-L66 |
venta/framework | src/Routing/src/UrlGenerator.php | UrlGenerator.addPortToUri | private function addPortToUri(UriInterface $uri): UriInterface
{
$requestPort = $this->request->getUri()->getPort();
if (!in_array($requestPort, [80, 443])) {
$uri = $uri->withPort($requestPort);
}
return $uri;
} | php | private function addPortToUri(UriInterface $uri): UriInterface
{
$requestPort = $this->request->getUri()->getPort();
if (!in_array($requestPort, [80, 443])) {
$uri = $uri->withPort($requestPort);
}
return $uri;
} | [
"private",
"function",
"addPortToUri",
"(",
"UriInterface",
"$",
"uri",
")",
":",
"UriInterface",
"{",
"$",
"requestPort",
"=",
"$",
"this",
"->",
"request",
"->",
"getUri",
"(",
")",
"->",
"getPort",
"(",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$"... | Adds port to URI if it is needed.
@param UriInterface $uri
@return UriInterface | [
"Adds",
"port",
"to",
"URI",
"if",
"it",
"is",
"needed",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Routing/src/UrlGenerator.php#L99-L108 |
venta/framework | src/Routing/src/UrlGenerator.php | UrlGenerator.buildRouteUri | private function buildRouteUri(RouteContract $route, array $variables = [], array $query = []): UriInterface
{
$uri = $this->uri
->withScheme($route->scheme() ?: $this->request->getUri()->getScheme())
->withHost($route->host() ?: $this->request->getUri()->getHost())
->wit... | php | private function buildRouteUri(RouteContract $route, array $variables = [], array $query = []): UriInterface
{
$uri = $this->uri
->withScheme($route->scheme() ?: $this->request->getUri()->getScheme())
->withHost($route->host() ?: $this->request->getUri()->getHost())
->wit... | [
"private",
"function",
"buildRouteUri",
"(",
"RouteContract",
"$",
"route",
",",
"array",
"$",
"variables",
"=",
"[",
"]",
",",
"array",
"$",
"query",
"=",
"[",
"]",
")",
":",
"UriInterface",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"uri",
"->",
"wit... | Builds URI for provided route instance.
@param RouteContract $route
@param array $variables
@param array $query
@return UriInterface | [
"Builds",
"URI",
"for",
"provided",
"route",
"instance",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Routing/src/UrlGenerator.php#L118-L130 |
pantera-digital/yii2-seo | components/SlugCache.php | SlugCache.get | public function get(ActiveRecord $model)
{
$key = $model::className() . '-' . $model->getPrimaryKey();
return ArrayHelper::getValue($this->_storage, $key);
} | php | public function get(ActiveRecord $model)
{
$key = $model::className() . '-' . $model->getPrimaryKey();
return ArrayHelper::getValue($this->_storage, $key);
} | [
"public",
"function",
"get",
"(",
"ActiveRecord",
"$",
"model",
")",
"{",
"$",
"key",
"=",
"$",
"model",
"::",
"className",
"(",
")",
".",
"'-'",
".",
"$",
"model",
"->",
"getPrimaryKey",
"(",
")",
";",
"return",
"ArrayHelper",
"::",
"getValue",
"(",
... | Получить модель с алиасом
@param ActiveRecord $model Модель для которой пытаемся найти алиас
@return mixed | [
"Получить",
"модель",
"с",
"алиасом"
] | train | https://github.com/pantera-digital/yii2-seo/blob/7673224ef601bfbccc57c96e7413ceb43d8332b2/components/SlugCache.php#L26-L30 |
pantera-digital/yii2-seo | components/SlugCache.php | SlugCache.set | public function set(ActiveRecord $model, SeoSlug $slug)
{
$key = $model::className() . '-' . $model->getPrimaryKey();
$this->_storage[$key] = $slug;
} | php | public function set(ActiveRecord $model, SeoSlug $slug)
{
$key = $model::className() . '-' . $model->getPrimaryKey();
$this->_storage[$key] = $slug;
} | [
"public",
"function",
"set",
"(",
"ActiveRecord",
"$",
"model",
",",
"SeoSlug",
"$",
"slug",
")",
"{",
"$",
"key",
"=",
"$",
"model",
"::",
"className",
"(",
")",
".",
"'-'",
".",
"$",
"model",
"->",
"getPrimaryKey",
"(",
")",
";",
"$",
"this",
"->... | Положить модель с алиасом
@param ActiveRecord $model Модель к которой принадлежит алиас
@param SeoSlug $slug Модель с алиасом которую нужно закешировать
@return mixed | [
"Положить",
"модель",
"с",
"алиасом"
] | train | https://github.com/pantera-digital/yii2-seo/blob/7673224ef601bfbccc57c96e7413ceb43d8332b2/components/SlugCache.php#L38-L42 |
raphaelstolt/composer-travis-lint | src/Travis.php | Travis.hasStaleCacheFile | protected static function hasStaleCacheFile()
{
$composerTravisLintCache = getcwd()
. DIRECTORY_SEPARATOR
. self::CTL_CACHE;
$travisConfiguration = getcwd()
. DIRECTORY_SEPARATOR
. self::TRAVIS_CONFIGURATION;
if (file_exists($composerTravisLi... | php | protected static function hasStaleCacheFile()
{
$composerTravisLintCache = getcwd()
. DIRECTORY_SEPARATOR
. self::CTL_CACHE;
$travisConfiguration = getcwd()
. DIRECTORY_SEPARATOR
. self::TRAVIS_CONFIGURATION;
if (file_exists($composerTravisLi... | [
"protected",
"static",
"function",
"hasStaleCacheFile",
"(",
")",
"{",
"$",
"composerTravisLintCache",
"=",
"getcwd",
"(",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"self",
"::",
"CTL_CACHE",
";",
"$",
"travisConfiguration",
"=",
"getcwd",
"(",
")",
".",
"DIRECTORY_... | Check if composer travis lint cache is stale.
@return boolean | [
"Check",
"if",
"composer",
"travis",
"lint",
"cache",
"is",
"stale",
"."
] | train | https://github.com/raphaelstolt/composer-travis-lint/blob/e6e005350b3c8981826aa718bc2282ddfd03caef/src/Travis.php#L20-L40 |
raphaelstolt/composer-travis-lint | src/Travis.php | Travis.lint | public static function lint(Event $event, Api $api = null)
{
$composerTravisLintCache = getcwd()
. DIRECTORY_SEPARATOR
. self::CTL_CACHE;
$io = $event->getIO();
if (!file_exists(self::TRAVIS_CONFIGURATION)) {
$io->writeError("Travis CI configuration doesn... | php | public static function lint(Event $event, Api $api = null)
{
$composerTravisLintCache = getcwd()
. DIRECTORY_SEPARATOR
. self::CTL_CACHE;
$io = $event->getIO();
if (!file_exists(self::TRAVIS_CONFIGURATION)) {
$io->writeError("Travis CI configuration doesn... | [
"public",
"static",
"function",
"lint",
"(",
"Event",
"$",
"event",
",",
"Api",
"$",
"api",
"=",
"null",
")",
"{",
"$",
"composerTravisLintCache",
"=",
"getcwd",
"(",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"self",
"::",
"CTL_CACHE",
";",
"$",
"io",
"=",
... | The Composer script to lint a Travis CI configuration file.
@param Event $event
@param Api|null $api
@return boolean | [
"The",
"Composer",
"script",
"to",
"lint",
"a",
"Travis",
"CI",
"configuration",
"file",
"."
] | train | https://github.com/raphaelstolt/composer-travis-lint/blob/e6e005350b3c8981826aa718bc2282ddfd03caef/src/Travis.php#L49-L118 |
crysalead/net | src/Http/Auth.php | Auth.header | public static function header($data)
{
if (empty($data['response'])) {
throw new NetException("Can't create Authorization headers from an empty response.");
}
if (!isset($data['nonce'])) {
return "Basic " . $data['response'];
}
$defaults = [
... | php | public static function header($data)
{
if (empty($data['response'])) {
throw new NetException("Can't create Authorization headers from an empty response.");
}
if (!isset($data['nonce'])) {
return "Basic " . $data['response'];
}
$defaults = [
... | [
"public",
"static",
"function",
"header",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
"[",
"'response'",
"]",
")",
")",
"{",
"throw",
"new",
"NetException",
"(",
"\"Can't create Authorization headers from an empty response.\"",
")",
";",
... | Returns the proper header string. Accepts the data from the `encode` method.
@param array $data
@return string | [
"Returns",
"the",
"proper",
"header",
"string",
".",
"Accepts",
"the",
"data",
"from",
"the",
"encode",
"method",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Auth.php#L24-L44 |
crysalead/net | src/Http/Auth.php | Auth.encode | public static function encode($username, $password, $data = [])
{
if (!isset($data['nonce'])) {
$response = base64_encode("{$username}:{$password}");
return compact('username', 'response');
}
$defaults = [
'realm' => 'app', 'method' => 'GET', 'uri' => '/',... | php | public static function encode($username, $password, $data = [])
{
if (!isset($data['nonce'])) {
$response = base64_encode("{$username}:{$password}");
return compact('username', 'response');
}
$defaults = [
'realm' => 'app', 'method' => 'GET', 'uri' => '/',... | [
"public",
"static",
"function",
"encode",
"(",
"$",
"username",
",",
"$",
"password",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"data",
"[",
"'nonce'",
"]",
")",
")",
"{",
"$",
"response",
"=",
"base64_encode",
... | Encodes the data with username and password to create the proper response. Returns an array
containing the username and encoded response.
@param string $username Username to authenticate with
@param string $password Password to authenticate with
@param array $data Params needed to hash the response
@return array | [
"Encodes",
"the",
"data",
"with",
"username",
"and",
"password",
"to",
"create",
"the",
"proper",
"response",
".",
"Returns",
"an",
"array",
"containing",
"the",
"username",
"and",
"encoded",
"response",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Auth.php#L55-L71 |
crysalead/net | src/Http/Auth.php | Auth.decode | public static function decode($header)
{
$data = [
'realm' => null,
'username' => null,
'uri' => null,
'nonce' => null,
'opaque' => null,
'qop' => null,
'cnonce' => null,
'nc' => null,
... | php | public static function decode($header)
{
$data = [
'realm' => null,
'username' => null,
'uri' => null,
'nonce' => null,
'opaque' => null,
'qop' => null,
'cnonce' => null,
'nc' => null,
... | [
"public",
"static",
"function",
"decode",
"(",
"$",
"header",
")",
"{",
"$",
"data",
"=",
"[",
"'realm'",
"=>",
"null",
",",
"'username'",
"=>",
"null",
",",
"'uri'",
"=>",
"null",
",",
"'nonce'",
"=>",
"null",
",",
"'opaque'",
"=>",
"null",
",",
"'q... | Takes the header string and parses out the params needed for a digest authentication.
@param string $header
@return array | [
"Takes",
"the",
"header",
"string",
"and",
"parses",
"out",
"the",
"params",
"needed",
"for",
"a",
"digest",
"authentication",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Auth.php#L79-L100 |
fuelphp/filesystem | src/Finder.php | Finder.setRoot | public function setRoot($root)
{
if ( ! $path = realpath($root))
{
throw new \Exception('Location does not exist: '.$root);
}
$this->root = $path;
} | php | public function setRoot($root)
{
if ( ! $path = realpath($root))
{
throw new \Exception('Location does not exist: '.$root);
}
$this->root = $path;
} | [
"public",
"function",
"setRoot",
"(",
"$",
"root",
")",
"{",
"if",
"(",
"!",
"$",
"path",
"=",
"realpath",
"(",
"$",
"root",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Location does not exist: '",
".",
"$",
"root",
")",
";",
"}",
"$",
... | Sets a root restriction
@param string $root | [
"Sets",
"a",
"root",
"restriction"
] | train | https://github.com/fuelphp/filesystem/blob/770a8cb04caca920af8029d7aad7208bc0592743/src/Finder.php#L107-L115 |
fuelphp/filesystem | src/Finder.php | Finder.addPaths | public function addPaths(array $paths, $clearCache = true, $group = '__DEFAULT__')
{
array_map([$this, 'addPath'], $paths, [[$clearCache, $group]]);
} | php | public function addPaths(array $paths, $clearCache = true, $group = '__DEFAULT__')
{
array_map([$this, 'addPath'], $paths, [[$clearCache, $group]]);
} | [
"public",
"function",
"addPaths",
"(",
"array",
"$",
"paths",
",",
"$",
"clearCache",
"=",
"true",
",",
"$",
"group",
"=",
"'__DEFAULT__'",
")",
"{",
"array_map",
"(",
"[",
"$",
"this",
",",
"'addPath'",
"]",
",",
"$",
"paths",
",",
"[",
"[",
"$",
... | Adds paths to look in
@param array $paths
@param boolean $clearCache | [
"Adds",
"paths",
"to",
"look",
"in"
] | train | https://github.com/fuelphp/filesystem/blob/770a8cb04caca920af8029d7aad7208bc0592743/src/Finder.php#L123-L126 |
fuelphp/filesystem | src/Finder.php | Finder.addPath | public function addPath($path, $clearCache = true, $group = '__DEFAULT__')
{
//var_dump(func_get_args());
$path = $this->normalizePath($path);
// This is done for easy reference and
// eliminates the need to check for doubles
$this->paths[$group][$path] = $path;
if ($clearCache)
{
$this->cache = [];... | php | public function addPath($path, $clearCache = true, $group = '__DEFAULT__')
{
//var_dump(func_get_args());
$path = $this->normalizePath($path);
// This is done for easy reference and
// eliminates the need to check for doubles
$this->paths[$group][$path] = $path;
if ($clearCache)
{
$this->cache = [];... | [
"public",
"function",
"addPath",
"(",
"$",
"path",
",",
"$",
"clearCache",
"=",
"true",
",",
"$",
"group",
"=",
"'__DEFAULT__'",
")",
"{",
"//var_dump(func_get_args());",
"$",
"path",
"=",
"$",
"this",
"->",
"normalizePath",
"(",
"$",
"path",
")",
";",
"... | Adds a path
@param string $path
@param boolean $clearCache | [
"Adds",
"a",
"path"
] | train | https://github.com/fuelphp/filesystem/blob/770a8cb04caca920af8029d7aad7208bc0592743/src/Finder.php#L134-L147 |
fuelphp/filesystem | src/Finder.php | Finder.removePaths | public function removePaths(array $paths, $clearCache = true, $group = '__DEFAULT__')
{
array_map([$this, 'removePath'], $paths, [[$clearCache, $group]]);
} | php | public function removePaths(array $paths, $clearCache = true, $group = '__DEFAULT__')
{
array_map([$this, 'removePath'], $paths, [[$clearCache, $group]]);
} | [
"public",
"function",
"removePaths",
"(",
"array",
"$",
"paths",
",",
"$",
"clearCache",
"=",
"true",
",",
"$",
"group",
"=",
"'__DEFAULT__'",
")",
"{",
"array_map",
"(",
"[",
"$",
"this",
",",
"'removePath'",
"]",
",",
"$",
"paths",
",",
"[",
"[",
"... | Removes paths to look in
@param array $paths | [
"Removes",
"paths",
"to",
"look",
"in"
] | train | https://github.com/fuelphp/filesystem/blob/770a8cb04caca920af8029d7aad7208bc0592743/src/Finder.php#L154-L157 |
fuelphp/filesystem | src/Finder.php | Finder.removePath | public function removePath($path, $clearCache = true, $group = '__DEFAULT__')
{
$path = $this->normalizePath($path);
if ($path and isset($this->paths[$group][$path]))
{
unset($this->paths[$group][$path]);
if ($clearCache) $this->removePathCache($path);
}
} | php | public function removePath($path, $clearCache = true, $group = '__DEFAULT__')
{
$path = $this->normalizePath($path);
if ($path and isset($this->paths[$group][$path]))
{
unset($this->paths[$group][$path]);
if ($clearCache) $this->removePathCache($path);
}
} | [
"public",
"function",
"removePath",
"(",
"$",
"path",
",",
"$",
"clearCache",
"=",
"true",
",",
"$",
"group",
"=",
"'__DEFAULT__'",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"normalizePath",
"(",
"$",
"path",
")",
";",
"if",
"(",
"$",
"path",
... | Removes a path
@param string $path | [
"Removes",
"a",
"path"
] | train | https://github.com/fuelphp/filesystem/blob/770a8cb04caca920af8029d7aad7208bc0592743/src/Finder.php#L164-L174 |
fuelphp/filesystem | src/Finder.php | Finder.removePathCache | public function removePathCache($path)
{
foreach ($this->cache as $key => $cache)
{
if (in_array($path, $cache['used']))
{
unset($this->cache[$key]);
}
}
} | php | public function removePathCache($path)
{
foreach ($this->cache as $key => $cache)
{
if (in_array($path, $cache['used']))
{
unset($this->cache[$key]);
}
}
} | [
"public",
"function",
"removePathCache",
"(",
"$",
"path",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"cache",
"as",
"$",
"key",
"=>",
"$",
"cache",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"path",
",",
"$",
"cache",
"[",
"'used'",
"]",
")",
... | Removes path cache
@param string $path | [
"Removes",
"path",
"cache"
] | train | https://github.com/fuelphp/filesystem/blob/770a8cb04caca920af8029d7aad7208bc0592743/src/Finder.php#L181-L190 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.