id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
227,500
alphayax/freebox_api_php
freebox/api/v3/services/config/VPN/Server/User.php
User.getFromLogin
public function getFromLogin( $login){ $rest = $this->getService( self::API_VPN_USER . $login); $rest->GET(); return $rest->getResult( models\VPN\Server\User::class); }
php
public function getFromLogin( $login){ $rest = $this->getService( self::API_VPN_USER . $login); $rest->GET(); return $rest->getResult( models\VPN\Server\User::class); }
[ "public", "function", "getFromLogin", "(", "$", "login", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_VPN_USER", ".", "$", "login", ")", ";", "$", "rest", "->", "GET", "(", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "VPN", "\\", "Server", "\\", "User", "::", "class", ")", ";", "}" ]
Gets the VPNUser with the given login @param $login @return models\VPN\Server\User
[ "Gets", "the", "VPNUser", "with", "the", "given", "login" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/VPN/Server/User.php#L31-L36
227,501
alphayax/freebox_api_php
freebox/api/v3/services/config/VPN/Server/User.php
User.add
public function add( models\VPN\Server\User $user){ $rest = $this->getService( self::API_VPN_USER); $rest->POST( $user); return $rest->getResult( models\VPN\Server\User::class); }
php
public function add( models\VPN\Server\User $user){ $rest = $this->getService( self::API_VPN_USER); $rest->POST( $user); return $rest->getResult( models\VPN\Server\User::class); }
[ "public", "function", "add", "(", "models", "\\", "VPN", "\\", "Server", "\\", "User", "$", "user", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_VPN_USER", ")", ";", "$", "rest", "->", "POST", "(", "$", "user", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "VPN", "\\", "Server", "\\", "User", "::", "class", ")", ";", "}" ]
Creates a new VPNUser @param \alphayax\freebox\api\v3\models\VPN\Server\User $user @return models\VPN\Server\User
[ "Creates", "a", "new", "VPNUser" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/VPN/Server/User.php#L43-L48
227,502
alphayax/freebox_api_php
freebox/api/v3/services/config/VPN/Server/User.php
User.delete
public function delete( models\VPN\Server\User $user){ return $this->deleteFromLogin( $user->getLogin()); }
php
public function delete( models\VPN\Server\User $user){ return $this->deleteFromLogin( $user->getLogin()); }
[ "public", "function", "delete", "(", "models", "\\", "VPN", "\\", "Server", "\\", "User", "$", "user", ")", "{", "return", "$", "this", "->", "deleteFromLogin", "(", "$", "user", "->", "getLogin", "(", ")", ")", ";", "}" ]
Deletes the VPNUser @param \alphayax\freebox\api\v3\models\VPN\Server\User $user @return bool
[ "Deletes", "the", "VPNUser" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/VPN/Server/User.php#L55-L57
227,503
alphayax/freebox_api_php
freebox/api/v3/services/config/VPN/Server/User.php
User.deleteFromLogin
public function deleteFromLogin( $login){ $rest = $this->getService( self::API_VPN_USER . $login); $rest->DELETE(); return $rest->getSuccess(); }
php
public function deleteFromLogin( $login){ $rest = $this->getService( self::API_VPN_USER . $login); $rest->DELETE(); return $rest->getSuccess(); }
[ "public", "function", "deleteFromLogin", "(", "$", "login", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_VPN_USER", ".", "$", "login", ")", ";", "$", "rest", "->", "DELETE", "(", ")", ";", "return", "$", "rest", "->", "getSuccess", "(", ")", ";", "}" ]
Deletes the VPNUser with the given id @param string $login @return bool
[ "Deletes", "the", "VPNUser", "with", "the", "given", "id" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/VPN/Server/User.php#L64-L69
227,504
alphayax/freebox_api_php
freebox/api/v3/services/config/VPN/Server/User.php
User.update
public function update( models\VPN\Server\User $user){ $rest = $this->getService( self::API_VPN_USER . $user->getLogin()); $rest->PUT( $user); return $rest->getResult( models\VPN\Server\User::class); }
php
public function update( models\VPN\Server\User $user){ $rest = $this->getService( self::API_VPN_USER . $user->getLogin()); $rest->PUT( $user); return $rest->getResult( models\VPN\Server\User::class); }
[ "public", "function", "update", "(", "models", "\\", "VPN", "\\", "Server", "\\", "User", "$", "user", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_VPN_USER", ".", "$", "user", "->", "getLogin", "(", ")", ")", ";", "$", "rest", "->", "PUT", "(", "$", "user", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "VPN", "\\", "Server", "\\", "User", "::", "class", ")", ";", "}" ]
Update a VPN Use @param \alphayax\freebox\api\v3\models\VPN\Server\User $user @return models\VPN\Server\User
[ "Update", "a", "VPN", "Use" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/VPN/Server/User.php#L76-L81
227,505
alphayax/freebox_api_php
freebox/api/v3/services/config/VPN/Server/User.php
User.getConfigurationFile
public function getConfigurationFile( $serverName, $login){ $service = sprintf( self::API_VPN_USER_CONFIG, $serverName, $login); $rest = $this->getService( $service); $rest->getConfig()->setIsReturnToJsonDecode( false); $rest->setIsResponseToCheck( false); $rest->GET(); return $rest->getCurlResponse(); }
php
public function getConfigurationFile( $serverName, $login){ $service = sprintf( self::API_VPN_USER_CONFIG, $serverName, $login); $rest = $this->getService( $service); $rest->getConfig()->setIsReturnToJsonDecode( false); $rest->setIsResponseToCheck( false); $rest->GET(); return $rest->getCurlResponse(); }
[ "public", "function", "getConfigurationFile", "(", "$", "serverName", ",", "$", "login", ")", "{", "$", "service", "=", "sprintf", "(", "self", "::", "API_VPN_USER_CONFIG", ",", "$", "serverName", ",", "$", "login", ")", ";", "$", "rest", "=", "$", "this", "->", "getService", "(", "$", "service", ")", ";", "$", "rest", "->", "getConfig", "(", ")", "->", "setIsReturnToJsonDecode", "(", "false", ")", ";", "$", "rest", "->", "setIsResponseToCheck", "(", "false", ")", ";", "$", "rest", "->", "GET", "(", ")", ";", "return", "$", "rest", "->", "getCurlResponse", "(", ")", ";", "}" ]
Generate a new configuration file & download it @param string $serverName @param string $login @return string The content of the configuration file
[ "Generate", "a", "new", "configuration", "file", "&", "download", "it" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/VPN/Server/User.php#L89-L97
227,506
brucepc/sum-up
src/OAuth/AuthenticationHelper.php
AuthenticationHelper.getAuthorizationURL
public static function getAuthorizationURL(ContextInterface $context) { $queryString = [ 'client_id' => $context->getClientId(), 'client_secret' => $context->getClientSecret(), 'redirect_uri' => $context->getRedirectUri(), 'response_type' => 'code', ]; return SumUp::ENTRYPOINT . self::OAUTH_AUTHORIZATION . '?' . http_build_query($queryString); }
php
public static function getAuthorizationURL(ContextInterface $context) { $queryString = [ 'client_id' => $context->getClientId(), 'client_secret' => $context->getClientSecret(), 'redirect_uri' => $context->getRedirectUri(), 'response_type' => 'code', ]; return SumUp::ENTRYPOINT . self::OAUTH_AUTHORIZATION . '?' . http_build_query($queryString); }
[ "public", "static", "function", "getAuthorizationURL", "(", "ContextInterface", "$", "context", ")", "{", "$", "queryString", "=", "[", "'client_id'", "=>", "$", "context", "->", "getClientId", "(", ")", ",", "'client_secret'", "=>", "$", "context", "->", "getClientSecret", "(", ")", ",", "'redirect_uri'", "=>", "$", "context", "->", "getRedirectUri", "(", ")", ",", "'response_type'", "=>", "'code'", ",", "]", ";", "return", "SumUp", "::", "ENTRYPOINT", ".", "self", "::", "OAUTH_AUTHORIZATION", ".", "'?'", ".", "http_build_query", "(", "$", "queryString", ")", ";", "}" ]
Generate an url to merchant authorization. @param ContextInterface $context @return string
[ "Generate", "an", "url", "to", "merchant", "authorization", "." ]
4b9b046b6c629000b74dc762a96cb24208dc758e
https://github.com/brucepc/sum-up/blob/4b9b046b6c629000b74dc762a96cb24208dc758e/src/OAuth/AuthenticationHelper.php#L20-L30
227,507
brucepc/sum-up
src/OAuth/AuthenticationHelper.php
AuthenticationHelper.getAccessToken
public static function getAccessToken( ContextInterface $context, array $scopes = null, array $options = [] ): AccessToken { $formParams = [ 'grant_type' => 'client_credentials', 'client_id' => $context->getClientId(), 'client_secret' => $context->getClientSecret(), ]; if ($scopes !== null) { $formParams['scope'] = implode(',', $scopes); } $client = SumUp::getClient($options); $response = $client->request( 'POST', self::OAUTH_TOKEN, [ 'form_params' => $formParams, ]); $code = $response->getStatusCode(); if ($code !== 200) { $message = " Request code: $code \n Message: " . $response->getReasonPhrase(); throw new BadRequestException($message); } $body = json_decode($response->getBody()->getContents(), true); $token_params = [ $body['access_token'], $body['token_type'], $body['expires_in'], ]; if (isset($body['scope'])) { $token_params[] = $body['scope']; } return new AccessToken(...$token_params); }
php
public static function getAccessToken( ContextInterface $context, array $scopes = null, array $options = [] ): AccessToken { $formParams = [ 'grant_type' => 'client_credentials', 'client_id' => $context->getClientId(), 'client_secret' => $context->getClientSecret(), ]; if ($scopes !== null) { $formParams['scope'] = implode(',', $scopes); } $client = SumUp::getClient($options); $response = $client->request( 'POST', self::OAUTH_TOKEN, [ 'form_params' => $formParams, ]); $code = $response->getStatusCode(); if ($code !== 200) { $message = " Request code: $code \n Message: " . $response->getReasonPhrase(); throw new BadRequestException($message); } $body = json_decode($response->getBody()->getContents(), true); $token_params = [ $body['access_token'], $body['token_type'], $body['expires_in'], ]; if (isset($body['scope'])) { $token_params[] = $body['scope']; } return new AccessToken(...$token_params); }
[ "public", "static", "function", "getAccessToken", "(", "ContextInterface", "$", "context", ",", "array", "$", "scopes", "=", "null", ",", "array", "$", "options", "=", "[", "]", ")", ":", "AccessToken", "{", "$", "formParams", "=", "[", "'grant_type'", "=>", "'client_credentials'", ",", "'client_id'", "=>", "$", "context", "->", "getClientId", "(", ")", ",", "'client_secret'", "=>", "$", "context", "->", "getClientSecret", "(", ")", ",", "]", ";", "if", "(", "$", "scopes", "!==", "null", ")", "{", "$", "formParams", "[", "'scope'", "]", "=", "implode", "(", "','", ",", "$", "scopes", ")", ";", "}", "$", "client", "=", "SumUp", "::", "getClient", "(", "$", "options", ")", ";", "$", "response", "=", "$", "client", "->", "request", "(", "'POST'", ",", "self", "::", "OAUTH_TOKEN", ",", "[", "'form_params'", "=>", "$", "formParams", ",", "]", ")", ";", "$", "code", "=", "$", "response", "->", "getStatusCode", "(", ")", ";", "if", "(", "$", "code", "!==", "200", ")", "{", "$", "message", "=", "\" Request code: $code \\n Message: \"", ".", "$", "response", "->", "getReasonPhrase", "(", ")", ";", "throw", "new", "BadRequestException", "(", "$", "message", ")", ";", "}", "$", "body", "=", "json_decode", "(", "$", "response", "->", "getBody", "(", ")", "->", "getContents", "(", ")", ",", "true", ")", ";", "$", "token_params", "=", "[", "$", "body", "[", "'access_token'", "]", ",", "$", "body", "[", "'token_type'", "]", ",", "$", "body", "[", "'expires_in'", "]", ",", "]", ";", "if", "(", "isset", "(", "$", "body", "[", "'scope'", "]", ")", ")", "{", "$", "token_params", "[", "]", "=", "$", "body", "[", "'scope'", "]", ";", "}", "return", "new", "AccessToken", "(", "...", "$", "token_params", ")", ";", "}" ]
Request an acess token from sumup services. @param ContextInterface $context @param array|null $scopes @param array $options @return \BPCI\SumUp\OAuth\AccessToken
[ "Request", "an", "acess", "token", "from", "sumup", "services", "." ]
4b9b046b6c629000b74dc762a96cb24208dc758e
https://github.com/brucepc/sum-up/blob/4b9b046b6c629000b74dc762a96cb24208dc758e/src/OAuth/AuthenticationHelper.php#L40-L83
227,508
brucepc/sum-up
src/OAuth/AuthenticationHelper.php
AuthenticationHelper.getValidToken
public static function getValidToken( ContextInterface $context, AccessToken $token = null, array $scopes = null, array $options = [] ): AccessToken { if ($token === null || !$token->isValid()) { $token = AuthenticationHelper::getAccessToken($context, $scopes, $options); } return $token; }
php
public static function getValidToken( ContextInterface $context, AccessToken $token = null, array $scopes = null, array $options = [] ): AccessToken { if ($token === null || !$token->isValid()) { $token = AuthenticationHelper::getAccessToken($context, $scopes, $options); } return $token; }
[ "public", "static", "function", "getValidToken", "(", "ContextInterface", "$", "context", ",", "AccessToken", "$", "token", "=", "null", ",", "array", "$", "scopes", "=", "null", ",", "array", "$", "options", "=", "[", "]", ")", ":", "AccessToken", "{", "if", "(", "$", "token", "===", "null", "||", "!", "$", "token", "->", "isValid", "(", ")", ")", "{", "$", "token", "=", "AuthenticationHelper", "::", "getAccessToken", "(", "$", "context", ",", "$", "scopes", ",", "$", "options", ")", ";", "}", "return", "$", "token", ";", "}" ]
If available check token or generate a new token @param ContextInterface $context @param AccessToken $token @param array $scopes @param array $options @return \BPCI\SumUp\OAuth\AccessToken
[ "If", "available", "check", "token", "or", "generate", "a", "new", "token" ]
4b9b046b6c629000b74dc762a96cb24208dc758e
https://github.com/brucepc/sum-up/blob/4b9b046b6c629000b74dc762a96cb24208dc758e/src/OAuth/AuthenticationHelper.php#L95-L107
227,509
E96/yii2-sentry
src/ErrorHandler.php
ErrorHandler.canLogException
public function canLogException(&$e) { if (function_exists('xdebug_get_function_stack')) { if ($e instanceof ErrorException) { return false; } $selectedException = $e; while ($nestedException = $selectedException->getPrevious()) { if ($nestedException instanceof ErrorException) { $ref = new \ReflectionProperty('Exception', 'previous'); $ref->setAccessible(true); $ref->setValue($selectedException, null); return true; } $selectedException = $selectedException->getPrevious(); } } return true; }
php
public function canLogException(&$e) { if (function_exists('xdebug_get_function_stack')) { if ($e instanceof ErrorException) { return false; } $selectedException = $e; while ($nestedException = $selectedException->getPrevious()) { if ($nestedException instanceof ErrorException) { $ref = new \ReflectionProperty('Exception', 'previous'); $ref->setAccessible(true); $ref->setValue($selectedException, null); return true; } $selectedException = $selectedException->getPrevious(); } } return true; }
[ "public", "function", "canLogException", "(", "&", "$", "e", ")", "{", "if", "(", "function_exists", "(", "'xdebug_get_function_stack'", ")", ")", "{", "if", "(", "$", "e", "instanceof", "ErrorException", ")", "{", "return", "false", ";", "}", "$", "selectedException", "=", "$", "e", ";", "while", "(", "$", "nestedException", "=", "$", "selectedException", "->", "getPrevious", "(", ")", ")", "{", "if", "(", "$", "nestedException", "instanceof", "ErrorException", ")", "{", "$", "ref", "=", "new", "\\", "ReflectionProperty", "(", "'Exception'", ",", "'previous'", ")", ";", "$", "ref", "->", "setAccessible", "(", "true", ")", ";", "$", "ref", "->", "setValue", "(", "$", "selectedException", ",", "null", ")", ";", "return", "true", ";", "}", "$", "selectedException", "=", "$", "selectedException", "->", "getPrevious", "(", ")", ";", "}", "}", "return", "true", ";", "}" ]
Filter exception and its previous exceptions for yii\base\ErrorException Raven expects normal stacktrace, but yii\base\ErrorException may have xdebug_get_function_stack @param \Exception $e @return bool
[ "Filter", "exception", "and", "its", "previous", "exceptions", "for", "yii", "\\", "base", "\\", "ErrorException", "Raven", "expects", "normal", "stacktrace", "but", "yii", "\\", "base", "\\", "ErrorException", "may", "have", "xdebug_get_function_stack" ]
d1910816a9b872b043aeab02579c913d0a12e1c5
https://github.com/E96/yii2-sentry/blob/d1910816a9b872b043aeab02579c913d0a12e1c5/src/ErrorHandler.php#L74-L94
227,510
alphayax/freebox_api_php
freebox/api/v3/services/config/SwitchPort/Config.php
Config.update
public function update( models\SwitchPort\Config $config){ $service = sprintf( static::API_SWITCH_PORT_CONFIG, $config->getId()); $rest = $this->getService( $service); $rest->PUT( $config); return $rest->getResult( models\SwitchPort\Config::class); }
php
public function update( models\SwitchPort\Config $config){ $service = sprintf( static::API_SWITCH_PORT_CONFIG, $config->getId()); $rest = $this->getService( $service); $rest->PUT( $config); return $rest->getResult( models\SwitchPort\Config::class); }
[ "public", "function", "update", "(", "models", "\\", "SwitchPort", "\\", "Config", "$", "config", ")", "{", "$", "service", "=", "sprintf", "(", "static", "::", "API_SWITCH_PORT_CONFIG", ",", "$", "config", "->", "getId", "(", ")", ")", ";", "$", "rest", "=", "$", "this", "->", "getService", "(", "$", "service", ")", ";", "$", "rest", "->", "PUT", "(", "$", "config", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "SwitchPort", "\\", "Config", "::", "class", ")", ";", "}" ]
Update a port configuration @param \alphayax\freebox\api\v3\models\SwitchPort\Config $config @return \alphayax\freebox\api\v3\models\SwitchPort\Config
[ "Update", "a", "port", "configuration" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/SwitchPort/Config.php#L32-L38
227,511
alphayax/freebox_api_php
freebox/api/v3/services/config/VPN/Server/Connection.php
Connection.getAll
public function getAll(){ $rest = $this->getService( self::API_VPN_CONNECTION); $rest->GET(); return $rest->getResultAsArray( models\VPN\Server\Connection::class); }
php
public function getAll(){ $rest = $this->getService( self::API_VPN_CONNECTION); $rest->GET(); return $rest->getResultAsArray( models\VPN\Server\Connection::class); }
[ "public", "function", "getAll", "(", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_VPN_CONNECTION", ")", ";", "$", "rest", "->", "GET", "(", ")", ";", "return", "$", "rest", "->", "getResultAsArray", "(", "models", "\\", "VPN", "\\", "Server", "\\", "Connection", "::", "class", ")", ";", "}" ]
Get the list of connections @return models\VPN\Server\Connection::class[]
[ "Get", "the", "list", "of", "connections" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/VPN/Server/Connection.php#L18-L23
227,512
alphayax/freebox_api_php
freebox/api/v3/services/config/VPN/Server/Connection.php
Connection.closeFromId
public function closeFromId( $connectionId){ $rest = $this->getService( self::API_VPN_CONNECTION . $connectionId); $rest->DELETE(); return $rest->getSuccess(); }
php
public function closeFromId( $connectionId){ $rest = $this->getService( self::API_VPN_CONNECTION . $connectionId); $rest->DELETE(); return $rest->getSuccess(); }
[ "public", "function", "closeFromId", "(", "$", "connectionId", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_VPN_CONNECTION", ".", "$", "connectionId", ")", ";", "$", "rest", "->", "DELETE", "(", ")", ";", "return", "$", "rest", "->", "getSuccess", "(", ")", ";", "}" ]
Close a given connection @param $connectionId @return bool
[ "Close", "a", "given", "connection" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/VPN/Server/Connection.php#L30-L35
227,513
pepijnolivier/laravel-yobit
src/Client.php
Client.getTickers
public function getTickers(array $currencyPairs = [], $ignoreInvalid = false) { $impl = implode('-', $currencyPairs); $urlFragment = "ticker/$impl"; return $this->public('v3', $urlFragment, [ 'ignore_invalid' => (int) $ignoreInvalid, ]); }
php
public function getTickers(array $currencyPairs = [], $ignoreInvalid = false) { $impl = implode('-', $currencyPairs); $urlFragment = "ticker/$impl"; return $this->public('v3', $urlFragment, [ 'ignore_invalid' => (int) $ignoreInvalid, ]); }
[ "public", "function", "getTickers", "(", "array", "$", "currencyPairs", "=", "[", "]", ",", "$", "ignoreInvalid", "=", "false", ")", "{", "$", "impl", "=", "implode", "(", "'-'", ",", "$", "currencyPairs", ")", ";", "$", "urlFragment", "=", "\"ticker/$impl\"", ";", "return", "$", "this", "->", "public", "(", "'v3'", ",", "$", "urlFragment", ",", "[", "'ignore_invalid'", "=>", "(", "int", ")", "$", "ignoreInvalid", ",", "]", ")", ";", "}" ]
Provides statistic data for the last 24 hours. @param array $currencyPairs @param bool $ignoreInvalid @return mixed
[ "Provides", "statistic", "data", "for", "the", "last", "24", "hours", "." ]
32afaa5e60c6e9a4339ca0c883b6474e917accdb
https://github.com/pepijnolivier/laravel-yobit/blob/32afaa5e60c6e9a4339ca0c883b6474e917accdb/src/Client.php#L44-L51
227,514
pepijnolivier/laravel-yobit
src/Client.php
Client.trade
public function trade($pair, $type, $rate, $amount) { return $this->tradeRequest('Trade', [ 'pair' => $pair, 'type' => $type, 'rate' => $rate, 'amount' => $amount, ]); }
php
public function trade($pair, $type, $rate, $amount) { return $this->tradeRequest('Trade', [ 'pair' => $pair, 'type' => $type, 'rate' => $rate, 'amount' => $amount, ]); }
[ "public", "function", "trade", "(", "$", "pair", ",", "$", "type", ",", "$", "rate", ",", "$", "amount", ")", "{", "return", "$", "this", "->", "tradeRequest", "(", "'Trade'", ",", "[", "'pair'", "=>", "$", "pair", ",", "'type'", "=>", "$", "type", ",", "'rate'", "=>", "$", "rate", ",", "'amount'", "=>", "$", "amount", ",", "]", ")", ";", "}" ]
Method that allows creating new orders for stock exchange trading @param $pair @param $type @param $rate @param $amount @return mixed
[ "Method", "that", "allows", "creating", "new", "orders", "for", "stock", "exchange", "trading" ]
32afaa5e60c6e9a4339ca0c883b6474e917accdb
https://github.com/pepijnolivier/laravel-yobit/blob/32afaa5e60c6e9a4339ca0c883b6474e917accdb/src/Client.php#L156-L164
227,515
pepijnolivier/laravel-yobit
src/Client.php
Client.getTradeHistory
public function getTradeHistory(array $options = []) { return $this->tradeRequest('TradeHistory', [ 'from' => $options['from'] ?? null, 'count' => $options['count'] ?? null, 'from_id' => $options['from_id'] ?? null, 'end_id' => $options['end_id'] ?? null, 'order' => $options['order'] ?? null, 'since' => $options['since'] ?? null, 'end' => $options['end'] ?? null, 'pair' => $options['pair'] ?? null, ]); }
php
public function getTradeHistory(array $options = []) { return $this->tradeRequest('TradeHistory', [ 'from' => $options['from'] ?? null, 'count' => $options['count'] ?? null, 'from_id' => $options['from_id'] ?? null, 'end_id' => $options['end_id'] ?? null, 'order' => $options['order'] ?? null, 'since' => $options['since'] ?? null, 'end' => $options['end'] ?? null, 'pair' => $options['pair'] ?? null, ]); }
[ "public", "function", "getTradeHistory", "(", "array", "$", "options", "=", "[", "]", ")", "{", "return", "$", "this", "->", "tradeRequest", "(", "'TradeHistory'", ",", "[", "'from'", "=>", "$", "options", "[", "'from'", "]", "??", "null", ",", "'count'", "=>", "$", "options", "[", "'count'", "]", "??", "null", ",", "'from_id'", "=>", "$", "options", "[", "'from_id'", "]", "??", "null", ",", "'end_id'", "=>", "$", "options", "[", "'end_id'", "]", "??", "null", ",", "'order'", "=>", "$", "options", "[", "'order'", "]", "??", "null", ",", "'since'", "=>", "$", "options", "[", "'since'", "]", "??", "null", ",", "'end'", "=>", "$", "options", "[", "'end'", "]", "??", "null", ",", "'pair'", "=>", "$", "options", "[", "'pair'", "]", "??", "null", ",", "]", ")", ";", "}" ]
Returns transaction history. While using option since or end parameter `order` automatically takes the value ASC. While using option since the earliest date available to get transaction history is one week ago. options: from: No. of transaction from which withdrawal starts (value: numeral, on default: 0) count: quantity of withrawal transactions (value: numeral, on default: 1000) from_id: ID of transaction from which withdrawal starts (value: numeral, on default: 0) end_id: ID of transaction at which withdrawal finishes (value: numeral, on default: ∞) order: sorting at withdrawal (value: ASC or DESC, on default: DESC) since: the time to start the display (value: unix time, on default: 0) end: the time to end the display (value: unix time, on default: ∞) pair: pair (example: ltc_btc) @return mixed
[ "Returns", "transaction", "history", ".", "While", "using", "option", "since", "or", "end", "parameter", "order", "automatically", "takes", "the", "value", "ASC", ".", "While", "using", "option", "since", "the", "earliest", "date", "available", "to", "get", "transaction", "history", "is", "one", "week", "ago", "." ]
32afaa5e60c6e9a4339ca0c883b6474e917accdb
https://github.com/pepijnolivier/laravel-yobit/blob/32afaa5e60c6e9a4339ca0c883b6474e917accdb/src/Client.php#L246-L258
227,516
pepijnolivier/laravel-yobit
src/Client.php
Client.getNonceOld
private function getNonceOld() { try { $dir = storage_path('exchange/yobit/'); if(!file_exists($dir)) { mkdir($dir, '0777', true); } $file = $dir . 'nonce.txt'; $nonce = (int) file_get_contents($file); if(empty($nonce)) { $nonce = floor(microtime(true)); } $newNonce = $nonce+1; file_put_contents($file, $newNonce); return $nonce; } catch(\Exception $e) { Log::critical($e); if(config('app.debug')) { throw $e; } } }
php
private function getNonceOld() { try { $dir = storage_path('exchange/yobit/'); if(!file_exists($dir)) { mkdir($dir, '0777', true); } $file = $dir . 'nonce.txt'; $nonce = (int) file_get_contents($file); if(empty($nonce)) { $nonce = floor(microtime(true)); } $newNonce = $nonce+1; file_put_contents($file, $newNonce); return $nonce; } catch(\Exception $e) { Log::critical($e); if(config('app.debug')) { throw $e; } } }
[ "private", "function", "getNonceOld", "(", ")", "{", "try", "{", "$", "dir", "=", "storage_path", "(", "'exchange/yobit/'", ")", ";", "if", "(", "!", "file_exists", "(", "$", "dir", ")", ")", "{", "mkdir", "(", "$", "dir", ",", "'0777'", ",", "true", ")", ";", "}", "$", "file", "=", "$", "dir", ".", "'nonce.txt'", ";", "$", "nonce", "=", "(", "int", ")", "file_get_contents", "(", "$", "file", ")", ";", "if", "(", "empty", "(", "$", "nonce", ")", ")", "{", "$", "nonce", "=", "floor", "(", "microtime", "(", "true", ")", ")", ";", "}", "$", "newNonce", "=", "$", "nonce", "+", "1", ";", "file_put_contents", "(", "$", "file", ",", "$", "newNonce", ")", ";", "return", "$", "nonce", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "Log", "::", "critical", "(", "$", "e", ")", ";", "if", "(", "config", "(", "'app.debug'", ")", ")", "{", "throw", "$", "e", ";", "}", "}", "}" ]
Yobit allows nonces starting from 1 up till 2147483646, which is the end of unix epoch 2147483646 = somewhere in the year 2038 We don't want to limit ourselves to max. 1 request per minute, so let's start at the current unix timestamp time, and manually add 1 on each request. For now, just saving this in the storage folder
[ "Yobit", "allows", "nonces", "starting", "from", "1", "up", "till", "2147483646", "which", "is", "the", "end", "of", "unix", "epoch", "2147483646", "=", "somewhere", "in", "the", "year", "2038" ]
32afaa5e60c6e9a4339ca0c883b6474e917accdb
https://github.com/pepijnolivier/laravel-yobit/blob/32afaa5e60c6e9a4339ca0c883b6474e917accdb/src/Client.php#L437-L463
227,517
codecasts/aws-sdk-php
src/Multipart/AbstractUploadManager.php
AbstractUploadManager.promise
public function promise() { if ($this->promise) { return $this->promise; } return $this->promise = Promise\coroutine(function () { // Initiate the upload. if ($this->state->isCompleted()) { throw new \LogicException('This multipart upload has already ' . 'been completed or aborted.' ); } elseif (!$this->state->isInitiated()) { $result = (yield $this->execCommand('initiate', $this->getInitiateParams())); $this->state->setUploadId( $this->info['id']['upload_id'], $result[$this->info['id']['upload_id']] ); $this->state->setStatus(UploadState::INITIATED); } // Create a command pool from a generator that yields UploadPart // commands for each upload part. $resultHandler = $this->getResultHandler($errors); $commands = new CommandPool( $this->client, $this->getUploadCommands($resultHandler), [ 'concurrency' => $this->config['concurrency'], 'before' => $this->config['before_upload'], ] ); // Execute the pool of commands concurrently, and process errors. yield $commands->promise(); if ($errors) { throw new MultipartUploadException($this->state, $errors); } // Complete the multipart upload. yield $this->execCommand('complete', $this->getCompleteParams()); $this->state->setStatus(UploadState::COMPLETED); })->otherwise(function (\Exception $e) { // Throw errors from the operations as a specific Multipart error. if ($e instanceof AwsException) { $e = new MultipartUploadException($this->state, $e); } throw $e; }); }
php
public function promise() { if ($this->promise) { return $this->promise; } return $this->promise = Promise\coroutine(function () { // Initiate the upload. if ($this->state->isCompleted()) { throw new \LogicException('This multipart upload has already ' . 'been completed or aborted.' ); } elseif (!$this->state->isInitiated()) { $result = (yield $this->execCommand('initiate', $this->getInitiateParams())); $this->state->setUploadId( $this->info['id']['upload_id'], $result[$this->info['id']['upload_id']] ); $this->state->setStatus(UploadState::INITIATED); } // Create a command pool from a generator that yields UploadPart // commands for each upload part. $resultHandler = $this->getResultHandler($errors); $commands = new CommandPool( $this->client, $this->getUploadCommands($resultHandler), [ 'concurrency' => $this->config['concurrency'], 'before' => $this->config['before_upload'], ] ); // Execute the pool of commands concurrently, and process errors. yield $commands->promise(); if ($errors) { throw new MultipartUploadException($this->state, $errors); } // Complete the multipart upload. yield $this->execCommand('complete', $this->getCompleteParams()); $this->state->setStatus(UploadState::COMPLETED); })->otherwise(function (\Exception $e) { // Throw errors from the operations as a specific Multipart error. if ($e instanceof AwsException) { $e = new MultipartUploadException($this->state, $e); } throw $e; }); }
[ "public", "function", "promise", "(", ")", "{", "if", "(", "$", "this", "->", "promise", ")", "{", "return", "$", "this", "->", "promise", ";", "}", "return", "$", "this", "->", "promise", "=", "Promise", "\\", "coroutine", "(", "function", "(", ")", "{", "// Initiate the upload.", "if", "(", "$", "this", "->", "state", "->", "isCompleted", "(", ")", ")", "{", "throw", "new", "\\", "LogicException", "(", "'This multipart upload has already '", ".", "'been completed or aborted.'", ")", ";", "}", "elseif", "(", "!", "$", "this", "->", "state", "->", "isInitiated", "(", ")", ")", "{", "$", "result", "=", "(", "yield", "$", "this", "->", "execCommand", "(", "'initiate'", ",", "$", "this", "->", "getInitiateParams", "(", ")", ")", ")", ";", "$", "this", "->", "state", "->", "setUploadId", "(", "$", "this", "->", "info", "[", "'id'", "]", "[", "'upload_id'", "]", ",", "$", "result", "[", "$", "this", "->", "info", "[", "'id'", "]", "[", "'upload_id'", "]", "]", ")", ";", "$", "this", "->", "state", "->", "setStatus", "(", "UploadState", "::", "INITIATED", ")", ";", "}", "// Create a command pool from a generator that yields UploadPart", "// commands for each upload part.", "$", "resultHandler", "=", "$", "this", "->", "getResultHandler", "(", "$", "errors", ")", ";", "$", "commands", "=", "new", "CommandPool", "(", "$", "this", "->", "client", ",", "$", "this", "->", "getUploadCommands", "(", "$", "resultHandler", ")", ",", "[", "'concurrency'", "=>", "$", "this", "->", "config", "[", "'concurrency'", "]", ",", "'before'", "=>", "$", "this", "->", "config", "[", "'before_upload'", "]", ",", "]", ")", ";", "// Execute the pool of commands concurrently, and process errors.", "yield", "$", "commands", "->", "promise", "(", ")", ";", "if", "(", "$", "errors", ")", "{", "throw", "new", "MultipartUploadException", "(", "$", "this", "->", "state", ",", "$", "errors", ")", ";", "}", "// Complete the multipart upload.", "yield", "$", "this", "->", "execCommand", "(", "'complete'", ",", "$", "this", "->", "getCompleteParams", "(", ")", ")", ";", "$", "this", "->", "state", "->", "setStatus", "(", "UploadState", "::", "COMPLETED", ")", ";", "}", ")", "->", "otherwise", "(", "function", "(", "\\", "Exception", "$", "e", ")", "{", "// Throw errors from the operations as a specific Multipart error.", "if", "(", "$", "e", "instanceof", "AwsException", ")", "{", "$", "e", "=", "new", "MultipartUploadException", "(", "$", "this", "->", "state", ",", "$", "e", ")", ";", "}", "throw", "$", "e", ";", "}", ")", ";", "}" ]
Upload the source asynchronously using multipart upload operations. @return PromiseInterface
[ "Upload", "the", "source", "asynchronously", "using", "multipart", "upload", "operations", "." ]
4f22b5a422c8fbebca46de12ac2422e7cb66ec70
https://github.com/codecasts/aws-sdk-php/blob/4f22b5a422c8fbebca46de12ac2422e7cb66ec70/src/Multipart/AbstractUploadManager.php#L90-L139
227,518
codecasts/aws-sdk-php
src/Multipart/AbstractUploadManager.php
AbstractUploadManager.execCommand
private function execCommand($operation, array $params) { // Create the command. $command = $this->client->getCommand( $this->info['command'][$operation], $params + $this->state->getId() ); // Execute the before callback. if (is_callable($this->config["before_{$operation}"])) { $this->config["before_{$operation}"]($command); } // Execute the command asynchronously and return the promise. return $this->client->executeAsync($command); }
php
private function execCommand($operation, array $params) { // Create the command. $command = $this->client->getCommand( $this->info['command'][$operation], $params + $this->state->getId() ); // Execute the before callback. if (is_callable($this->config["before_{$operation}"])) { $this->config["before_{$operation}"]($command); } // Execute the command asynchronously and return the promise. return $this->client->executeAsync($command); }
[ "private", "function", "execCommand", "(", "$", "operation", ",", "array", "$", "params", ")", "{", "// Create the command.", "$", "command", "=", "$", "this", "->", "client", "->", "getCommand", "(", "$", "this", "->", "info", "[", "'command'", "]", "[", "$", "operation", "]", ",", "$", "params", "+", "$", "this", "->", "state", "->", "getId", "(", ")", ")", ";", "// Execute the before callback.", "if", "(", "is_callable", "(", "$", "this", "->", "config", "[", "\"before_{$operation}\"", "]", ")", ")", "{", "$", "this", "->", "config", "[", "\"before_{$operation}\"", "]", "(", "$", "command", ")", ";", "}", "// Execute the command asynchronously and return the promise.", "return", "$", "this", "->", "client", "->", "executeAsync", "(", "$", "command", ")", ";", "}" ]
Executes a MUP command with all of the parameters for the operation. @param string $operation Name of the operation. @param array $params Service-specific params for the operation. @return PromiseInterface
[ "Executes", "a", "MUP", "command", "with", "all", "of", "the", "parameters", "for", "the", "operation", "." ]
4f22b5a422c8fbebca46de12ac2422e7cb66ec70
https://github.com/codecasts/aws-sdk-php/blob/4f22b5a422c8fbebca46de12ac2422e7cb66ec70/src/Multipart/AbstractUploadManager.php#L233-L248
227,519
codecasts/aws-sdk-php
src/Multipart/AbstractUploadManager.php
AbstractUploadManager.getResultHandler
private function getResultHandler(&$errors = []) { return function (callable $handler) use (&$errors) { return function ( CommandInterface $command, RequestInterface $request = null ) use ($handler, &$errors) { return $handler($command, $request)->then( function (ResultInterface $result) use ($command) { $this->handleResult($command, $result); return $result; }, function (AwsException $e) use (&$errors) { $errors[$e->getCommand()[$this->info['part_num']]] = $e; return new Result(); } ); }; }; }
php
private function getResultHandler(&$errors = []) { return function (callable $handler) use (&$errors) { return function ( CommandInterface $command, RequestInterface $request = null ) use ($handler, &$errors) { return $handler($command, $request)->then( function (ResultInterface $result) use ($command) { $this->handleResult($command, $result); return $result; }, function (AwsException $e) use (&$errors) { $errors[$e->getCommand()[$this->info['part_num']]] = $e; return new Result(); } ); }; }; }
[ "private", "function", "getResultHandler", "(", "&", "$", "errors", "=", "[", "]", ")", "{", "return", "function", "(", "callable", "$", "handler", ")", "use", "(", "&", "$", "errors", ")", "{", "return", "function", "(", "CommandInterface", "$", "command", ",", "RequestInterface", "$", "request", "=", "null", ")", "use", "(", "$", "handler", ",", "&", "$", "errors", ")", "{", "return", "$", "handler", "(", "$", "command", ",", "$", "request", ")", "->", "then", "(", "function", "(", "ResultInterface", "$", "result", ")", "use", "(", "$", "command", ")", "{", "$", "this", "->", "handleResult", "(", "$", "command", ",", "$", "result", ")", ";", "return", "$", "result", ";", "}", ",", "function", "(", "AwsException", "$", "e", ")", "use", "(", "&", "$", "errors", ")", "{", "$", "errors", "[", "$", "e", "->", "getCommand", "(", ")", "[", "$", "this", "->", "info", "[", "'part_num'", "]", "]", "]", "=", "$", "e", ";", "return", "new", "Result", "(", ")", ";", "}", ")", ";", "}", ";", "}", ";", "}" ]
Returns a middleware for processing responses of part upload operations. - Adds an onFulfilled callback that calls the service-specific handleResult method on the Result of the operation. - Adds an onRejected callback that adds the error to an array of errors. - Has a passedByRef $errors arg that the exceptions get added to. The caller should use that &$errors array to do error handling. @param array $errors Errors from upload operations are added to this. @return callable
[ "Returns", "a", "middleware", "for", "processing", "responses", "of", "part", "upload", "operations", "." ]
4f22b5a422c8fbebca46de12ac2422e7cb66ec70
https://github.com/codecasts/aws-sdk-php/blob/4f22b5a422c8fbebca46de12ac2422e7cb66ec70/src/Multipart/AbstractUploadManager.php#L263-L282
227,520
alphayax/freebox_api_php
freebox/api/v3/services/config/VPN/Client/Status.php
Status.getStatus
public function getStatus(){ $rest = $this->getService( self::API_VPN_CLIENT_STATUS); $rest->GET(); return $rest->getResult( models\VPN\Client\Status::class); }
php
public function getStatus(){ $rest = $this->getService( self::API_VPN_CLIENT_STATUS); $rest->GET(); return $rest->getResult( models\VPN\Client\Status::class); }
[ "public", "function", "getStatus", "(", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_VPN_CLIENT_STATUS", ")", ";", "$", "rest", "->", "GET", "(", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "VPN", "\\", "Client", "\\", "Status", "::", "class", ")", ";", "}" ]
Get the VPN client status @return models\VPN\Client\Status
[ "Get", "the", "VPN", "client", "status" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/VPN/Client/Status.php#L19-L24
227,521
alphayax/freebox_api_php
freebox/api/v3/services/config/VPN/Client/Status.php
Status.getLogs
public function getLogs(){ $rest = $this->getService( self::API_VPN_CLIENT_LOGS); $rest->GET(); return $rest->getResult(); }
php
public function getLogs(){ $rest = $this->getService( self::API_VPN_CLIENT_LOGS); $rest->GET(); return $rest->getResult(); }
[ "public", "function", "getLogs", "(", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_VPN_CLIENT_LOGS", ")", ";", "$", "rest", "->", "GET", "(", ")", ";", "return", "$", "rest", "->", "getResult", "(", ")", ";", "}" ]
Get the VPN client Logs @return models\VPN\Client\Status
[ "Get", "the", "VPN", "client", "Logs" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/VPN/Client/Status.php#L30-L35
227,522
gorghoa/ScenarioStateBehatExtension
features/bootstrap/FeatureContext.php
FeatureContext.itShouldFail
public function itShouldFail($success) { if ('fail' === $success) { if (0 === $this->getExitCode()) { echo 'Actual output:'.PHP_EOL.PHP_EOL.$this->getOutput(); } \PHPUnit_Framework_Assert::assertNotEquals(0, $this->getExitCode()); } else { if (0 !== $this->getExitCode()) { echo 'Actual output:'.PHP_EOL.PHP_EOL.$this->getOutput(); } \PHPUnit_Framework_Assert::assertEquals(0, $this->getExitCode()); } }
php
public function itShouldFail($success) { if ('fail' === $success) { if (0 === $this->getExitCode()) { echo 'Actual output:'.PHP_EOL.PHP_EOL.$this->getOutput(); } \PHPUnit_Framework_Assert::assertNotEquals(0, $this->getExitCode()); } else { if (0 !== $this->getExitCode()) { echo 'Actual output:'.PHP_EOL.PHP_EOL.$this->getOutput(); } \PHPUnit_Framework_Assert::assertEquals(0, $this->getExitCode()); } }
[ "public", "function", "itShouldFail", "(", "$", "success", ")", "{", "if", "(", "'fail'", "===", "$", "success", ")", "{", "if", "(", "0", "===", "$", "this", "->", "getExitCode", "(", ")", ")", "{", "echo", "'Actual output:'", ".", "PHP_EOL", ".", "PHP_EOL", ".", "$", "this", "->", "getOutput", "(", ")", ";", "}", "\\", "PHPUnit_Framework_Assert", "::", "assertNotEquals", "(", "0", ",", "$", "this", "->", "getExitCode", "(", ")", ")", ";", "}", "else", "{", "if", "(", "0", "!==", "$", "this", "->", "getExitCode", "(", ")", ")", "{", "echo", "'Actual output:'", ".", "PHP_EOL", ".", "PHP_EOL", ".", "$", "this", "->", "getOutput", "(", ")", ";", "}", "\\", "PHPUnit_Framework_Assert", "::", "assertEquals", "(", "0", ",", "$", "this", "->", "getExitCode", "(", ")", ")", ";", "}", "}" ]
Checks whether previously runned command failed|passed. @Then /^it should (fail|pass)$/ @param string $success "fail" or "pass"
[ "Checks", "whether", "previously", "runned", "command", "failed|passed", "." ]
29be096e3ce4863fa1beb10fa9fb06dbaf70711c
https://github.com/gorghoa/ScenarioStateBehatExtension/blob/29be096e3ce4863fa1beb10fa9fb06dbaf70711c/features/bootstrap/FeatureContext.php#L160-L175
227,523
middlewares/filesystem
src/Reader.php
Reader.read
private function read(ServerRequestInterface $request, string $file): ResponseInterface { $resource = $this->filesystem->readStream($file); if ($resource === false) { throw new RuntimeException(sprintf('Unable to read the file "%s"', $file)); //@codeCoverageIgnore } $response = $this->createResponse()->withBody($this->createStreamFromResource($resource)); return self::range($response, $request->getHeaderLine('Range')); }
php
private function read(ServerRequestInterface $request, string $file): ResponseInterface { $resource = $this->filesystem->readStream($file); if ($resource === false) { throw new RuntimeException(sprintf('Unable to read the file "%s"', $file)); //@codeCoverageIgnore } $response = $this->createResponse()->withBody($this->createStreamFromResource($resource)); return self::range($response, $request->getHeaderLine('Range')); }
[ "private", "function", "read", "(", "ServerRequestInterface", "$", "request", ",", "string", "$", "file", ")", ":", "ResponseInterface", "{", "$", "resource", "=", "$", "this", "->", "filesystem", "->", "readStream", "(", "$", "file", ")", ";", "if", "(", "$", "resource", "===", "false", ")", "{", "throw", "new", "RuntimeException", "(", "sprintf", "(", "'Unable to read the file \"%s\"'", ",", "$", "file", ")", ")", ";", "//@codeCoverageIgnore", "}", "$", "response", "=", "$", "this", "->", "createResponse", "(", ")", "->", "withBody", "(", "$", "this", "->", "createStreamFromResource", "(", "$", "resource", ")", ")", ";", "return", "self", "::", "range", "(", "$", "response", ",", "$", "request", "->", "getHeaderLine", "(", "'Range'", ")", ")", ";", "}" ]
Read a file and returns a stream.
[ "Read", "a", "file", "and", "returns", "a", "stream", "." ]
f25168893ca9b0e3d74228b88576099e29892bdd
https://github.com/middlewares/filesystem/blob/f25168893ca9b0e3d74228b88576099e29892bdd/src/Reader.php#L95-L106
227,524
middlewares/filesystem
src/Reader.php
Reader.range
private static function range(ResponseInterface $response, string $range): ResponseInterface { $response = $response->withHeader('Accept-Ranges', 'bytes'); if (empty($range) || !($range = self::parseRangeHeader($range))) { return $response; } list($first, $last) = $range; $size = $response->getBody()->getSize(); if ($last === null) { $last = $size - 1; } return $response ->withStatus(206) ->withHeader('Content-Length', (string) ($last - $first + 1)) ->withHeader('Content-Range', sprintf('bytes %d-%d/%d', $first, $last, $size)); }
php
private static function range(ResponseInterface $response, string $range): ResponseInterface { $response = $response->withHeader('Accept-Ranges', 'bytes'); if (empty($range) || !($range = self::parseRangeHeader($range))) { return $response; } list($first, $last) = $range; $size = $response->getBody()->getSize(); if ($last === null) { $last = $size - 1; } return $response ->withStatus(206) ->withHeader('Content-Length', (string) ($last - $first + 1)) ->withHeader('Content-Range', sprintf('bytes %d-%d/%d', $first, $last, $size)); }
[ "private", "static", "function", "range", "(", "ResponseInterface", "$", "response", ",", "string", "$", "range", ")", ":", "ResponseInterface", "{", "$", "response", "=", "$", "response", "->", "withHeader", "(", "'Accept-Ranges'", ",", "'bytes'", ")", ";", "if", "(", "empty", "(", "$", "range", ")", "||", "!", "(", "$", "range", "=", "self", "::", "parseRangeHeader", "(", "$", "range", ")", ")", ")", "{", "return", "$", "response", ";", "}", "list", "(", "$", "first", ",", "$", "last", ")", "=", "$", "range", ";", "$", "size", "=", "$", "response", "->", "getBody", "(", ")", "->", "getSize", "(", ")", ";", "if", "(", "$", "last", "===", "null", ")", "{", "$", "last", "=", "$", "size", "-", "1", ";", "}", "return", "$", "response", "->", "withStatus", "(", "206", ")", "->", "withHeader", "(", "'Content-Length'", ",", "(", "string", ")", "(", "$", "last", "-", "$", "first", "+", "1", ")", ")", "->", "withHeader", "(", "'Content-Range'", ",", "sprintf", "(", "'bytes %d-%d/%d'", ",", "$", "first", ",", "$", "last", ",", "$", "size", ")", ")", ";", "}" ]
Handle range requests.
[ "Handle", "range", "requests", "." ]
f25168893ca9b0e3d74228b88576099e29892bdd
https://github.com/middlewares/filesystem/blob/f25168893ca9b0e3d74228b88576099e29892bdd/src/Reader.php#L111-L130
227,525
jk/RestServer
src/JK/RestServer/HttpStatusCodes.php
HttpStatusCodes.getDescription
public static function getDescription($code) { if (array_key_exists($code, self::$codes_to_string_map)) { return self::$codes_to_string_map[$code]; } else { return false; } }
php
public static function getDescription($code) { if (array_key_exists($code, self::$codes_to_string_map)) { return self::$codes_to_string_map[$code]; } else { return false; } }
[ "public", "static", "function", "getDescription", "(", "$", "code", ")", "{", "if", "(", "array_key_exists", "(", "$", "code", ",", "self", "::", "$", "codes_to_string_map", ")", ")", "{", "return", "self", "::", "$", "codes_to_string_map", "[", "$", "code", "]", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Get the description for a given HTTP status code @paramint int $code HTTP status code @return string|bool Description of the status code, otherwise false
[ "Get", "the", "description", "for", "a", "given", "HTTP", "status", "code" ]
477e6a0f0b601008bf96db9767492d5b35637d0b
https://github.com/jk/RestServer/blob/477e6a0f0b601008bf96db9767492d5b35637d0b/src/JK/RestServer/HttpStatusCodes.php#L143-L150
227,526
brucepc/sum-up
src/Customer/CustomerClient.php
CustomerClient.disablePaymentInstrument
public function disablePaymentInstrument( CustomerInterface $customer, PaymentInstrumentInterface $paymentInstrument ): bool { $instrumentClient = new PaymentInstrumentClient($this->getContext(), $this->getOptions()); $instrumentClient->setCustomer($customer); $instrumentClient->setToken($this->getToken()); $response = $instrumentClient->disable($paymentInstrument); $this->setLastResponse($instrumentClient->getLastResponse()); return $response??false; }
php
public function disablePaymentInstrument( CustomerInterface $customer, PaymentInstrumentInterface $paymentInstrument ): bool { $instrumentClient = new PaymentInstrumentClient($this->getContext(), $this->getOptions()); $instrumentClient->setCustomer($customer); $instrumentClient->setToken($this->getToken()); $response = $instrumentClient->disable($paymentInstrument); $this->setLastResponse($instrumentClient->getLastResponse()); return $response??false; }
[ "public", "function", "disablePaymentInstrument", "(", "CustomerInterface", "$", "customer", ",", "PaymentInstrumentInterface", "$", "paymentInstrument", ")", ":", "bool", "{", "$", "instrumentClient", "=", "new", "PaymentInstrumentClient", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getOptions", "(", ")", ")", ";", "$", "instrumentClient", "->", "setCustomer", "(", "$", "customer", ")", ";", "$", "instrumentClient", "->", "setToken", "(", "$", "this", "->", "getToken", "(", ")", ")", ";", "$", "response", "=", "$", "instrumentClient", "->", "disable", "(", "$", "paymentInstrument", ")", ";", "$", "this", "->", "setLastResponse", "(", "$", "instrumentClient", "->", "getLastResponse", "(", ")", ")", ";", "return", "$", "response", "??", "false", ";", "}" ]
Delete a customer card. @param CustomerInterface $customer @param PaymentInstrumentInterface $paymentInstrument @return bool
[ "Delete", "a", "customer", "card", "." ]
4b9b046b6c629000b74dc762a96cb24208dc758e
https://github.com/brucepc/sum-up/blob/4b9b046b6c629000b74dc762a96cb24208dc758e/src/Customer/CustomerClient.php#L108-L120
227,527
brucepc/sum-up
src/Customer/CustomerClient.php
CustomerClient.getPaymentInstruments
public function getPaymentInstruments(CustomerInterface $customer): array { $instrumentClient = new PaymentInstrumentClient($this->getContext(), $this->getOptions()); $instrumentClient->setCustomer($customer); $instrumentClient->setToken($this->getToken()); $response = $instrumentClient->get(); $this->setLastResponse($instrumentClient->getLastResponse()); return $response??[]; }
php
public function getPaymentInstruments(CustomerInterface $customer): array { $instrumentClient = new PaymentInstrumentClient($this->getContext(), $this->getOptions()); $instrumentClient->setCustomer($customer); $instrumentClient->setToken($this->getToken()); $response = $instrumentClient->get(); $this->setLastResponse($instrumentClient->getLastResponse()); return $response??[]; }
[ "public", "function", "getPaymentInstruments", "(", "CustomerInterface", "$", "customer", ")", ":", "array", "{", "$", "instrumentClient", "=", "new", "PaymentInstrumentClient", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getOptions", "(", ")", ")", ";", "$", "instrumentClient", "->", "setCustomer", "(", "$", "customer", ")", ";", "$", "instrumentClient", "->", "setToken", "(", "$", "this", "->", "getToken", "(", ")", ")", ";", "$", "response", "=", "$", "instrumentClient", "->", "get", "(", ")", ";", "$", "this", "->", "setLastResponse", "(", "$", "instrumentClient", "->", "getLastResponse", "(", ")", ")", ";", "return", "$", "response", "??", "[", "]", ";", "}" ]
This must return an Array of PaymentInstrumentInterface @param CustomerInterface $customer @return array
[ "This", "must", "return", "an", "Array", "of", "PaymentInstrumentInterface" ]
4b9b046b6c629000b74dc762a96cb24208dc758e
https://github.com/brucepc/sum-up/blob/4b9b046b6c629000b74dc762a96cb24208dc758e/src/Customer/CustomerClient.php#L171-L180
227,528
alphayax/freebox_api_php
freebox/api/v3/services/config/LCD.php
LCD.getConfiguration
public function getConfiguration(){ $rest = $this->getService( self::API_LCD_CONFIG); $rest->GET(); return $rest->getResult( models\LCDConfig::class); }
php
public function getConfiguration(){ $rest = $this->getService( self::API_LCD_CONFIG); $rest->GET(); return $rest->getResult( models\LCDConfig::class); }
[ "public", "function", "getConfiguration", "(", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_LCD_CONFIG", ")", ";", "$", "rest", "->", "GET", "(", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "LCDConfig", "::", "class", ")", ";", "}" ]
Get the current LCD configuration @return models\LCDConfig
[ "Get", "the", "current", "LCD", "configuration" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/LCD.php#L18-L23
227,529
alphayax/freebox_api_php
freebox/api/v3/services/config/LCD.php
LCD.setConfiguration
public function setConfiguration( models\LCDConfig $lcdConfig){ $rest = $this->getService( self::API_LCD_CONFIG); $rest->PUT( $lcdConfig); return $rest->getResult( models\LCDConfig::class); }
php
public function setConfiguration( models\LCDConfig $lcdConfig){ $rest = $this->getService( self::API_LCD_CONFIG); $rest->PUT( $lcdConfig); return $rest->getResult( models\LCDConfig::class); }
[ "public", "function", "setConfiguration", "(", "models", "\\", "LCDConfig", "$", "lcdConfig", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_LCD_CONFIG", ")", ";", "$", "rest", "->", "PUT", "(", "$", "lcdConfig", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "LCDConfig", "::", "class", ")", ";", "}" ]
Update the LCD configuration @param models\LCDConfig $lcdConfig @return models\LCDConfig
[ "Update", "the", "LCD", "configuration" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/LCD.php#L30-L35
227,530
alphayax/freebox_api_php
freebox/api/v3/services/config/SwitchPort/Status.php
Status.getStatus
public function getStatus() { $rest = $this->getService( self::API_SWITCH_STATUS); $rest->GET(); return $rest->getResult( models\SwitchPort\Status::class); }
php
public function getStatus() { $rest = $this->getService( self::API_SWITCH_STATUS); $rest->GET(); return $rest->getResult( models\SwitchPort\Status::class); }
[ "public", "function", "getStatus", "(", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_SWITCH_STATUS", ")", ";", "$", "rest", "->", "GET", "(", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "SwitchPort", "\\", "Status", "::", "class", ")", ";", "}" ]
Get the current switch status @return \alphayax\freebox\api\v3\models\SwitchPort\Status
[ "Get", "the", "current", "switch", "status" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/SwitchPort/Status.php#L18-L23
227,531
AaronJan/Housekeeper
src/Housekeeper/Abilities/SoftDeletes.php
SoftDeletes.startWithTrashed
public function startWithTrashed() { $this->reset(new Action(__METHOD__, [], Action::INTERNAL)); $this->getCurrentPlan()->startWithTrashed(); return $this; }
php
public function startWithTrashed() { $this->reset(new Action(__METHOD__, [], Action::INTERNAL)); $this->getCurrentPlan()->startWithTrashed(); return $this; }
[ "public", "function", "startWithTrashed", "(", ")", "{", "$", "this", "->", "reset", "(", "new", "Action", "(", "__METHOD__", ",", "[", "]", ",", "Action", "::", "INTERNAL", ")", ")", ";", "$", "this", "->", "getCurrentPlan", "(", ")", "->", "startWithTrashed", "(", ")", ";", "return", "$", "this", ";", "}" ]
Include soft deletes for following use, will triggering a Reset flow. @return $this
[ "Include", "soft", "deletes", "for", "following", "use", "will", "triggering", "a", "Reset", "flow", "." ]
9a5f9547e65532111f839c50cd665e9d4ff6cd3f
https://github.com/AaronJan/Housekeeper/blob/9a5f9547e65532111f839c50cd665e9d4ff6cd3f/src/Housekeeper/Abilities/SoftDeletes.php#L24-L31
227,532
AaronJan/Housekeeper
src/Housekeeper/Abilities/SoftDeletes.php
SoftDeletes.startWithTrashedOnly
public function startWithTrashedOnly() { $this->reset(new Action(__METHOD__, [], Action::INTERNAL)); $this->getCurrentPlan()->startWithTrashedOnly(); return $this; }
php
public function startWithTrashedOnly() { $this->reset(new Action(__METHOD__, [], Action::INTERNAL)); $this->getCurrentPlan()->startWithTrashedOnly(); return $this; }
[ "public", "function", "startWithTrashedOnly", "(", ")", "{", "$", "this", "->", "reset", "(", "new", "Action", "(", "__METHOD__", ",", "[", "]", ",", "Action", "::", "INTERNAL", ")", ")", ";", "$", "this", "->", "getCurrentPlan", "(", ")", "->", "startWithTrashedOnly", "(", ")", ";", "return", "$", "this", ";", "}" ]
Only include soft deletes for following use, will triggering a Reset flow. @return $this
[ "Only", "include", "soft", "deletes", "for", "following", "use", "will", "triggering", "a", "Reset", "flow", "." ]
9a5f9547e65532111f839c50cd665e9d4ff6cd3f
https://github.com/AaronJan/Housekeeper/blob/9a5f9547e65532111f839c50cd665e9d4ff6cd3f/src/Housekeeper/Abilities/SoftDeletes.php#L39-L46
227,533
alphayax/freebox_api_php
freebox/api/v3/services/config/WiFi/Planning.php
Planning.getPlanning
public function getPlanning(){ $rest = $this->getService( self::API_WIFI_PLANNING); $rest->GET(); return $rest->getResult( models\WiFi\Planning::class); }
php
public function getPlanning(){ $rest = $this->getService( self::API_WIFI_PLANNING); $rest->GET(); return $rest->getResult( models\WiFi\Planning::class); }
[ "public", "function", "getPlanning", "(", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_WIFI_PLANNING", ")", ";", "$", "rest", "->", "GET", "(", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "WiFi", "\\", "Planning", "::", "class", ")", ";", "}" ]
Get the wifi planning @return \alphayax\freebox\api\v3\models\WiFi\Planning
[ "Get", "the", "wifi", "planning" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/WiFi/Planning.php#L18-L23
227,534
alphayax/freebox_api_php
freebox/api/v3/services/config/WiFi/Planning.php
Planning.update
public function update( models\WiFi\Planning $planning){ $rest = $this->getService( self::API_WIFI_PLANNING); $rest->PUT( $planning); return $rest->getResult( models\WiFi\Planning::class); }
php
public function update( models\WiFi\Planning $planning){ $rest = $this->getService( self::API_WIFI_PLANNING); $rest->PUT( $planning); return $rest->getResult( models\WiFi\Planning::class); }
[ "public", "function", "update", "(", "models", "\\", "WiFi", "\\", "Planning", "$", "planning", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_WIFI_PLANNING", ")", ";", "$", "rest", "->", "PUT", "(", "$", "planning", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "WiFi", "\\", "Planning", "::", "class", ")", ";", "}" ]
Update the wifi planning @param \alphayax\freebox\api\v3\models\WiFi\Planning $planning @return \alphayax\freebox\api\v3\models\WiFi\Planning
[ "Update", "the", "wifi", "planning" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/WiFi/Planning.php#L30-L35
227,535
fanout/php-gripcontrol
src/websocketmessageformat.php
WebSocketMessageFormat.export
public function export() { $out = array(); if (Encoding::is_binary_data($this->content)) { $out['content-bin'] = base64_encode($this->content); } else { $out['content'] = $this->content; } return $out; }
php
public function export() { $out = array(); if (Encoding::is_binary_data($this->content)) { $out['content-bin'] = base64_encode($this->content); } else { $out['content'] = $this->content; } return $out; }
[ "public", "function", "export", "(", ")", "{", "$", "out", "=", "array", "(", ")", ";", "if", "(", "Encoding", "::", "is_binary_data", "(", "$", "this", "->", "content", ")", ")", "{", "$", "out", "[", "'content-bin'", "]", "=", "base64_encode", "(", "$", "this", "->", "content", ")", ";", "}", "else", "{", "$", "out", "[", "'content'", "]", "=", "$", "this", "->", "content", ";", "}", "return", "$", "out", ";", "}" ]
message content is binary or not.
[ "message", "content", "is", "binary", "or", "not", "." ]
ee187ddcf8b6e4a0e88584ffc5c89cf96a47d3ff
https://github.com/fanout/php-gripcontrol/blob/ee187ddcf8b6e4a0e88584ffc5c89cf96a47d3ff/src/websocketmessageformat.php#L33-L42
227,536
alphayax/freebox_api_php
freebox/api/v3/services/config/Connection/Xdsl.php
Xdsl.getStatus
public function getStatus(){ $rest = $this->getService( self::API_CONNECTION_XDSL); $rest->GET(); return $rest->getResult( models\Connection\Xdsl\XdslInfos::class); }
php
public function getStatus(){ $rest = $this->getService( self::API_CONNECTION_XDSL); $rest->GET(); return $rest->getResult( models\Connection\Xdsl\XdslInfos::class); }
[ "public", "function", "getStatus", "(", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_CONNECTION_XDSL", ")", ";", "$", "rest", "->", "GET", "(", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "Connection", "\\", "Xdsl", "\\", "XdslInfos", "::", "class", ")", ";", "}" ]
Get the current XDSL Connection status @return models\Connection\Status
[ "Get", "the", "current", "XDSL", "Connection", "status" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/Connection/Xdsl.php#L18-L23
227,537
brucepc/sum-up
src/Checkout/CheckoutClient.php
CheckoutClient.getCheckoutBody
protected static function getCheckoutBody(CheckoutInterface $checkout): array { return [ "checkout_reference" => $checkout->getReference(), "amount" => $checkout->getAmount(), "currency" => $checkout->getCurrency(), "fee_amount" => $checkout->getFeeAmount(), "pay_to_email" => $checkout->getPayToEmail(), "pay_from_email" => $checkout->getPayFromEmail(), "description" => $checkout->getDescription(), "return_url" => $checkout->getRedirectUrl(), ]; }
php
protected static function getCheckoutBody(CheckoutInterface $checkout): array { return [ "checkout_reference" => $checkout->getReference(), "amount" => $checkout->getAmount(), "currency" => $checkout->getCurrency(), "fee_amount" => $checkout->getFeeAmount(), "pay_to_email" => $checkout->getPayToEmail(), "pay_from_email" => $checkout->getPayFromEmail(), "description" => $checkout->getDescription(), "return_url" => $checkout->getRedirectUrl(), ]; }
[ "protected", "static", "function", "getCheckoutBody", "(", "CheckoutInterface", "$", "checkout", ")", ":", "array", "{", "return", "[", "\"checkout_reference\"", "=>", "$", "checkout", "->", "getReference", "(", ")", ",", "\"amount\"", "=>", "$", "checkout", "->", "getAmount", "(", ")", ",", "\"currency\"", "=>", "$", "checkout", "->", "getCurrency", "(", ")", ",", "\"fee_amount\"", "=>", "$", "checkout", "->", "getFeeAmount", "(", ")", ",", "\"pay_to_email\"", "=>", "$", "checkout", "->", "getPayToEmail", "(", ")", ",", "\"pay_from_email\"", "=>", "$", "checkout", "->", "getPayFromEmail", "(", ")", ",", "\"description\"", "=>", "$", "checkout", "->", "getDescription", "(", ")", ",", "\"return_url\"", "=>", "$", "checkout", "->", "getRedirectUrl", "(", ")", ",", "]", ";", "}" ]
Generate a body to create a new checkout @param CheckoutInterface $checkout @return array
[ "Generate", "a", "body", "to", "create", "a", "new", "checkout" ]
4b9b046b6c629000b74dc762a96cb24208dc758e
https://github.com/brucepc/sum-up/blob/4b9b046b6c629000b74dc762a96cb24208dc758e/src/Checkout/CheckoutClient.php#L67-L79
227,538
alphayax/freebox_api_php
freebox/api/v3/services/Call/Contact/ContactNumber.php
ContactNumber.create
public function create( models\Call\ContactNumber $ContactNumber){ $rest = $this->getService( self::API_NUMBER); $rest->POST( $ContactNumber); return $rest->getResult( models\Call\ContactNumber::class); }
php
public function create( models\Call\ContactNumber $ContactNumber){ $rest = $this->getService( self::API_NUMBER); $rest->POST( $ContactNumber); return $rest->getResult( models\Call\ContactNumber::class); }
[ "public", "function", "create", "(", "models", "\\", "Call", "\\", "ContactNumber", "$", "ContactNumber", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_NUMBER", ")", ";", "$", "rest", "->", "POST", "(", "$", "ContactNumber", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "Call", "\\", "ContactNumber", "::", "class", ")", ";", "}" ]
Add a new contact number @param models\Call\ContactNumber $ContactNumber @return models\Call\ContactNumber
[ "Add", "a", "new", "contact", "number" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/Call/Contact/ContactNumber.php#L32-L37
227,539
alphayax/freebox_api_php
freebox/api/v3/services/Call/Contact/ContactNumber.php
ContactNumber.update
public function update( models\Call\ContactNumber $ContactNumber){ $rest = $this->getService( self::API_NUMBER . $ContactNumber->getId()); $rest->PUT( $ContactNumber); return $rest->getResult( models\Call\ContactNumber::class); }
php
public function update( models\Call\ContactNumber $ContactNumber){ $rest = $this->getService( self::API_NUMBER . $ContactNumber->getId()); $rest->PUT( $ContactNumber); return $rest->getResult( models\Call\ContactNumber::class); }
[ "public", "function", "update", "(", "models", "\\", "Call", "\\", "ContactNumber", "$", "ContactNumber", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_NUMBER", ".", "$", "ContactNumber", "->", "getId", "(", ")", ")", ";", "$", "rest", "->", "PUT", "(", "$", "ContactNumber", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "Call", "\\", "ContactNumber", "::", "class", ")", ";", "}" ]
Update a contact number @param models\Call\ContactNumber $ContactNumber @return models\Call\ContactNumber
[ "Update", "a", "contact", "number" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/Call/Contact/ContactNumber.php#L65-L70
227,540
alphayax/freebox_api_php
freebox/api/v3/services/config/LAN/LAN.php
LAN.getConfiguration
public function getConfiguration(){ $rest = $this->getService( self::API_LAN_CONFIG); $rest->GET(); return $rest->getResult( models\LAN\LanConfig::class); }
php
public function getConfiguration(){ $rest = $this->getService( self::API_LAN_CONFIG); $rest->GET(); return $rest->getResult( models\LAN\LanConfig::class); }
[ "public", "function", "getConfiguration", "(", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_LAN_CONFIG", ")", ";", "$", "rest", "->", "GET", "(", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "LAN", "\\", "LanConfig", "::", "class", ")", ";", "}" ]
Get the current LAN configuration @return models\LAN\LanConfig
[ "Get", "the", "current", "LAN", "configuration" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/LAN/LAN.php#L19-L24
227,541
alphayax/freebox_api_php
freebox/api/v3/services/config/LAN/LAN.php
LAN.setConfiguration
public function setConfiguration( models\LAN\LanConfig $lanConfig){ $rest = $this->getService( self::API_LAN_CONFIG); $rest->PUT( $lanConfig); return $rest->getResult( models\LAN\LanConfig::class); }
php
public function setConfiguration( models\LAN\LanConfig $lanConfig){ $rest = $this->getService( self::API_LAN_CONFIG); $rest->PUT( $lanConfig); return $rest->getResult( models\LAN\LanConfig::class); }
[ "public", "function", "setConfiguration", "(", "models", "\\", "LAN", "\\", "LanConfig", "$", "lanConfig", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_LAN_CONFIG", ")", ";", "$", "rest", "->", "PUT", "(", "$", "lanConfig", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "LAN", "\\", "LanConfig", "::", "class", ")", ";", "}" ]
Update the LAN configuration @param models\LAN\LanConfig $lanConfig @return models\LAN\LanConfig
[ "Update", "the", "LAN", "configuration" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/LAN/LAN.php#L31-L36
227,542
alphayax/freebox_api_php
freebox/api/v3/services/config/DHCP.php
DHCP.getConfiguration
public function getConfiguration(){ $rest = $this->getService( self::API_DHCP_CONFIG); $rest->GET(); return $rest->getResult( models\DhcpConfig::class); }
php
public function getConfiguration(){ $rest = $this->getService( self::API_DHCP_CONFIG); $rest->GET(); return $rest->getResult( models\DhcpConfig::class); }
[ "public", "function", "getConfiguration", "(", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_DHCP_CONFIG", ")", ";", "$", "rest", "->", "GET", "(", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "DhcpConfig", "::", "class", ")", ";", "}" ]
Get the current DHCP configuration @return models\DhcpConfig
[ "Get", "the", "current", "DHCP", "configuration" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/DHCP.php#L20-L25
227,543
alphayax/freebox_api_php
freebox/api/v3/services/config/DHCP.php
DHCP.setConfiguration
public function setConfiguration( models\DhcpConfig $dhcpConfig){ $rest = $this->getService( self::API_DHCP_CONFIG); $rest->PUT( $dhcpConfig); return $rest->getResult( models\DhcpConfig::class); }
php
public function setConfiguration( models\DhcpConfig $dhcpConfig){ $rest = $this->getService( self::API_DHCP_CONFIG); $rest->PUT( $dhcpConfig); return $rest->getResult( models\DhcpConfig::class); }
[ "public", "function", "setConfiguration", "(", "models", "\\", "DhcpConfig", "$", "dhcpConfig", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_DHCP_CONFIG", ")", ";", "$", "rest", "->", "PUT", "(", "$", "dhcpConfig", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "DhcpConfig", "::", "class", ")", ";", "}" ]
Update the DHCP configuration @param models\DhcpConfig $dhcpConfig @return models\DhcpConfig
[ "Update", "the", "DHCP", "configuration" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/DHCP.php#L32-L37
227,544
activecollab/etcd
src/Client.php
Client.verifySslPeer
public function verifySslPeer($verify_ssl_peer = true, $custom_ca_file = null) { if ($custom_ca_file) { if (!is_file($custom_ca_file)) { throw new \InvalidArgumentException('Custom CA file does not exist'); } if (!$verify_ssl_peer) { throw new \LogicException('Custom CA file should not be set if SSL peer is not verified'); } } $this->verify_ssl_peer = (boolean) $verify_ssl_peer; $this->custom_ca_file = $custom_ca_file; return $this; }
php
public function verifySslPeer($verify_ssl_peer = true, $custom_ca_file = null) { if ($custom_ca_file) { if (!is_file($custom_ca_file)) { throw new \InvalidArgumentException('Custom CA file does not exist'); } if (!$verify_ssl_peer) { throw new \LogicException('Custom CA file should not be set if SSL peer is not verified'); } } $this->verify_ssl_peer = (boolean) $verify_ssl_peer; $this->custom_ca_file = $custom_ca_file; return $this; }
[ "public", "function", "verifySslPeer", "(", "$", "verify_ssl_peer", "=", "true", ",", "$", "custom_ca_file", "=", "null", ")", "{", "if", "(", "$", "custom_ca_file", ")", "{", "if", "(", "!", "is_file", "(", "$", "custom_ca_file", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Custom CA file does not exist'", ")", ";", "}", "if", "(", "!", "$", "verify_ssl_peer", ")", "{", "throw", "new", "\\", "LogicException", "(", "'Custom CA file should not be set if SSL peer is not verified'", ")", ";", "}", "}", "$", "this", "->", "verify_ssl_peer", "=", "(", "boolean", ")", "$", "verify_ssl_peer", ";", "$", "this", "->", "custom_ca_file", "=", "$", "custom_ca_file", ";", "return", "$", "this", ";", "}" ]
Configure SSL connection parameters @param bool|true $verify_ssl_peer @param string|null $custom_ca_file @return $this
[ "Configure", "SSL", "connection", "parameters" ]
16c754323061f14daf2f8e3b2577b8d3e317b5ef
https://github.com/activecollab/etcd/blob/16c754323061f14daf2f8e3b2577b8d3e317b5ef/src/Client.php#L106-L122
227,545
activecollab/etcd
src/Client.php
Client.create
public function create($key, $value, $ttl = 0) { return $request = $this->set($key, $value, $ttl, ['prevExist' => 'false']); }
php
public function create($key, $value, $ttl = 0) { return $request = $this->set($key, $value, $ttl, ['prevExist' => 'false']); }
[ "public", "function", "create", "(", "$", "key", ",", "$", "value", ",", "$", "ttl", "=", "0", ")", "{", "return", "$", "request", "=", "$", "this", "->", "set", "(", "$", "key", ",", "$", "value", ",", "$", "ttl", ",", "[", "'prevExist'", "=>", "'false'", "]", ")", ";", "}" ]
Create a new key with a given value @param string $key @param string $value @param int $ttl @return array $body @throws KeyExistsException
[ "Create", "a", "new", "key", "with", "a", "given", "value" ]
16c754323061f14daf2f8e3b2577b8d3e317b5ef
https://github.com/activecollab/etcd/blob/16c754323061f14daf2f8e3b2577b8d3e317b5ef/src/Client.php#L303-L306
227,546
activecollab/etcd
src/Client.php
Client.httpGet
private function httpGet($url, $query_arguments = []) { if (!empty($query_arguments)) { $url .= '?' . http_build_query($query_arguments); } return $this->executeCurlRequest($this->getCurlHandle($url), $url); }
php
private function httpGet($url, $query_arguments = []) { if (!empty($query_arguments)) { $url .= '?' . http_build_query($query_arguments); } return $this->executeCurlRequest($this->getCurlHandle($url), $url); }
[ "private", "function", "httpGet", "(", "$", "url", ",", "$", "query_arguments", "=", "[", "]", ")", "{", "if", "(", "!", "empty", "(", "$", "query_arguments", ")", ")", "{", "$", "url", ".=", "'?'", ".", "http_build_query", "(", "$", "query_arguments", ")", ";", "}", "return", "$", "this", "->", "executeCurlRequest", "(", "$", "this", "->", "getCurlHandle", "(", "$", "url", ")", ",", "$", "url", ")", ";", "}" ]
Make a GET request @param string $url @param array $query_arguments @return array
[ "Make", "a", "GET", "request" ]
16c754323061f14daf2f8e3b2577b8d3e317b5ef
https://github.com/activecollab/etcd/blob/16c754323061f14daf2f8e3b2577b8d3e317b5ef/src/Client.php#L526-L533
227,547
activecollab/etcd
src/Client.php
Client.httpPut
private function httpPut($url, $payload = [], $query_arguments = []) { if (!empty($query_arguments)) { $url .= '?' . http_build_query($query_arguments); } $curl = $this->getCurlHandle($url); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded']); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($payload)); return $this->executeCurlRequest($curl, $url); }
php
private function httpPut($url, $payload = [], $query_arguments = []) { if (!empty($query_arguments)) { $url .= '?' . http_build_query($query_arguments); } $curl = $this->getCurlHandle($url); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded']); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($payload)); return $this->executeCurlRequest($curl, $url); }
[ "private", "function", "httpPut", "(", "$", "url", ",", "$", "payload", "=", "[", "]", ",", "$", "query_arguments", "=", "[", "]", ")", "{", "if", "(", "!", "empty", "(", "$", "query_arguments", ")", ")", "{", "$", "url", ".=", "'?'", ".", "http_build_query", "(", "$", "query_arguments", ")", ";", "}", "$", "curl", "=", "$", "this", "->", "getCurlHandle", "(", "$", "url", ")", ";", "curl_setopt", "(", "$", "curl", ",", "CURLOPT_CUSTOMREQUEST", ",", "'PUT'", ")", ";", "curl_setopt", "(", "$", "curl", ",", "CURLOPT_HTTPHEADER", ",", "[", "'Content-Type: application/x-www-form-urlencoded'", "]", ")", ";", "curl_setopt", "(", "$", "curl", ",", "CURLOPT_POSTFIELDS", ",", "http_build_query", "(", "$", "payload", ")", ")", ";", "return", "$", "this", "->", "executeCurlRequest", "(", "$", "curl", ",", "$", "url", ")", ";", "}" ]
Make a PUT request @param string $url @param array $payload @param array $query_arguments @return array|mixed @throws EtcdException
[ "Make", "a", "PUT", "request" ]
16c754323061f14daf2f8e3b2577b8d3e317b5ef
https://github.com/activecollab/etcd/blob/16c754323061f14daf2f8e3b2577b8d3e317b5ef/src/Client.php#L568-L581
227,548
activecollab/etcd
src/Client.php
Client.httpDelete
private function httpDelete($url, $query_arguments = []) { if (!empty($query_arguments)) { $url .= '?' . http_build_query($query_arguments); } $curl = $this->getCurlHandle($url); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE'); return $this->executeCurlRequest($curl, $url); }
php
private function httpDelete($url, $query_arguments = []) { if (!empty($query_arguments)) { $url .= '?' . http_build_query($query_arguments); } $curl = $this->getCurlHandle($url); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE'); return $this->executeCurlRequest($curl, $url); }
[ "private", "function", "httpDelete", "(", "$", "url", ",", "$", "query_arguments", "=", "[", "]", ")", "{", "if", "(", "!", "empty", "(", "$", "query_arguments", ")", ")", "{", "$", "url", ".=", "'?'", ".", "http_build_query", "(", "$", "query_arguments", ")", ";", "}", "$", "curl", "=", "$", "this", "->", "getCurlHandle", "(", "$", "url", ")", ";", "curl_setopt", "(", "$", "curl", ",", "CURLOPT_CUSTOMREQUEST", ",", "'DELETE'", ")", ";", "return", "$", "this", "->", "executeCurlRequest", "(", "$", "curl", ",", "$", "url", ")", ";", "}" ]
Make a DELETE request @param string $url @param array $query_arguments @return array|mixed @throws EtcdException
[ "Make", "a", "DELETE", "request" ]
16c754323061f14daf2f8e3b2577b8d3e317b5ef
https://github.com/activecollab/etcd/blob/16c754323061f14daf2f8e3b2577b8d3e317b5ef/src/Client.php#L591-L602
227,549
activecollab/etcd
src/Client.php
Client.getCurlHandle
private function getCurlHandle($url) { if ($curl = curl_init($url)) { curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 15); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); if ($this->is_https && $this->verify_ssl_peer) { curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); if ($this->custom_ca_file) { curl_setopt($curl, CURLOPT_CAINFO, $this->custom_ca_file); } } else { curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); } return $curl; } else { throw new \RuntimeException("Can't create curl handle"); } }
php
private function getCurlHandle($url) { if ($curl = curl_init($url)) { curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 15); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); if ($this->is_https && $this->verify_ssl_peer) { curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); if ($this->custom_ca_file) { curl_setopt($curl, CURLOPT_CAINFO, $this->custom_ca_file); } } else { curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); } return $curl; } else { throw new \RuntimeException("Can't create curl handle"); } }
[ "private", "function", "getCurlHandle", "(", "$", "url", ")", "{", "if", "(", "$", "curl", "=", "curl_init", "(", "$", "url", ")", ")", "{", "curl_setopt", "(", "$", "curl", ",", "CURLOPT_CONNECTTIMEOUT", ",", "15", ")", ";", "curl_setopt", "(", "$", "curl", ",", "CURLOPT_RETURNTRANSFER", ",", "true", ")", ";", "curl_setopt", "(", "$", "curl", ",", "CURLOPT_FOLLOWLOCATION", ",", "true", ")", ";", "if", "(", "$", "this", "->", "is_https", "&&", "$", "this", "->", "verify_ssl_peer", ")", "{", "curl_setopt", "(", "$", "curl", ",", "CURLOPT_SSL_VERIFYPEER", ",", "true", ")", ";", "curl_setopt", "(", "$", "curl", ",", "CURLOPT_SSL_VERIFYHOST", ",", "2", ")", ";", "if", "(", "$", "this", "->", "custom_ca_file", ")", "{", "curl_setopt", "(", "$", "curl", ",", "CURLOPT_CAINFO", ",", "$", "this", "->", "custom_ca_file", ")", ";", "}", "}", "else", "{", "curl_setopt", "(", "$", "curl", ",", "CURLOPT_SSL_VERIFYPEER", ",", "false", ")", ";", "curl_setopt", "(", "$", "curl", ",", "CURLOPT_SSL_VERIFYHOST", ",", "false", ")", ";", "}", "return", "$", "curl", ";", "}", "else", "{", "throw", "new", "\\", "RuntimeException", "(", "\"Can't create curl handle\"", ")", ";", "}", "}" ]
Initialize curl handle @param string $url @return resource
[ "Initialize", "curl", "handle" ]
16c754323061f14daf2f8e3b2577b8d3e317b5ef
https://github.com/activecollab/etcd/blob/16c754323061f14daf2f8e3b2577b8d3e317b5ef/src/Client.php#L610-L633
227,550
alphayax/freebox_api_php
freebox/api/v3/services/config/WiFi/AccessPoint.php
AccessPoint.getAll
public function getAll(){ $rest = $this->getService( self::API_WIFI_AP); $rest->GET(); return $rest->getResultAsArray( models\WiFi\AccessPoint\AP::class); }
php
public function getAll(){ $rest = $this->getService( self::API_WIFI_AP); $rest->GET(); return $rest->getResultAsArray( models\WiFi\AccessPoint\AP::class); }
[ "public", "function", "getAll", "(", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_WIFI_AP", ")", ";", "$", "rest", "->", "GET", "(", ")", ";", "return", "$", "rest", "->", "getResultAsArray", "(", "models", "\\", "WiFi", "\\", "AccessPoint", "\\", "AP", "::", "class", ")", ";", "}" ]
Get all Access Points @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\AP[]
[ "Get", "all", "Access", "Points" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/WiFi/AccessPoint.php#L23-L28
227,551
alphayax/freebox_api_php
freebox/api/v3/services/config/WiFi/AccessPoint.php
AccessPoint.getFromId
public function getFromId( $accessPointId){ $rest = $this->getService( self::API_WIFI_AP . $accessPointId); $rest->GET(); return $rest->getResult( models\WiFi\AccessPoint\AP::class); }
php
public function getFromId( $accessPointId){ $rest = $this->getService( self::API_WIFI_AP . $accessPointId); $rest->GET(); return $rest->getResult( models\WiFi\AccessPoint\AP::class); }
[ "public", "function", "getFromId", "(", "$", "accessPointId", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_WIFI_AP", ".", "$", "accessPointId", ")", ";", "$", "rest", "->", "GET", "(", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "WiFi", "\\", "AccessPoint", "\\", "AP", "::", "class", ")", ";", "}" ]
Get a specific Access Point @param int $accessPointId @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\AP
[ "Get", "a", "specific", "Access", "Point" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/WiFi/AccessPoint.php#L35-L40
227,552
alphayax/freebox_api_php
freebox/api/v3/services/config/WiFi/AccessPoint.php
AccessPoint.update
public function update( models\WiFi\AccessPoint\AP $accessPoint){ $rest = $this->getService( self::API_WIFI_AP . $accessPoint->getId()); $rest->PUT( $accessPoint); return $rest->getResult( models\WiFi\AccessPoint\AP::class); }
php
public function update( models\WiFi\AccessPoint\AP $accessPoint){ $rest = $this->getService( self::API_WIFI_AP . $accessPoint->getId()); $rest->PUT( $accessPoint); return $rest->getResult( models\WiFi\AccessPoint\AP::class); }
[ "public", "function", "update", "(", "models", "\\", "WiFi", "\\", "AccessPoint", "\\", "AP", "$", "accessPoint", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_WIFI_AP", ".", "$", "accessPoint", "->", "getId", "(", ")", ")", ";", "$", "rest", "->", "PUT", "(", "$", "accessPoint", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "WiFi", "\\", "AccessPoint", "\\", "AP", "::", "class", ")", ";", "}" ]
Update an Access Point @param $accessPoint @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\AP
[ "Update", "an", "Access", "Point" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/WiFi/AccessPoint.php#L73-L78
227,553
alphayax/freebox_api_php
freebox/api/v3/services/config/WiFi/AccessPoint.php
AccessPoint.getNeighborsFromId
public function getNeighborsFromId( $accessPointId) { $service = sprintf( self::API_WIFI_AP_NEIGHBORS, $accessPointId); $rest = $this->getService( $service); $rest->GET(); return $rest->getResultAsArray( models\WiFi\Radar\Neighbor::class); }
php
public function getNeighborsFromId( $accessPointId) { $service = sprintf( self::API_WIFI_AP_NEIGHBORS, $accessPointId); $rest = $this->getService( $service); $rest->GET(); return $rest->getResultAsArray( models\WiFi\Radar\Neighbor::class); }
[ "public", "function", "getNeighborsFromId", "(", "$", "accessPointId", ")", "{", "$", "service", "=", "sprintf", "(", "self", "::", "API_WIFI_AP_NEIGHBORS", ",", "$", "accessPointId", ")", ";", "$", "rest", "=", "$", "this", "->", "getService", "(", "$", "service", ")", ";", "$", "rest", "->", "GET", "(", ")", ";", "return", "$", "rest", "->", "getResultAsArray", "(", "models", "\\", "WiFi", "\\", "Radar", "\\", "Neighbor", "::", "class", ")", ";", "}" ]
Get the list of Neighbor seen by the AP @param int $accessPointId @return models\WiFi\Radar\Neighbor[]
[ "Get", "the", "list", "of", "Neighbor", "seen", "by", "the", "AP" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/WiFi/AccessPoint.php#L85-L91
227,554
alphayax/freebox_api_php
freebox/api/v3/services/config/WiFi/AccessPoint.php
AccessPoint.refreshNeighborsScan
public function refreshNeighborsScan( $accessPointId) { $service = sprintf( self::API_WIFI_AP_NEIGHBORS, $accessPointId); $rest = $this->getService( $service); $rest->POST(); return $rest->getSuccess(); }
php
public function refreshNeighborsScan( $accessPointId) { $service = sprintf( self::API_WIFI_AP_NEIGHBORS, $accessPointId); $rest = $this->getService( $service); $rest->POST(); return $rest->getSuccess(); }
[ "public", "function", "refreshNeighborsScan", "(", "$", "accessPointId", ")", "{", "$", "service", "=", "sprintf", "(", "self", "::", "API_WIFI_AP_NEIGHBORS", ",", "$", "accessPointId", ")", ";", "$", "rest", "=", "$", "this", "->", "getService", "(", "$", "service", ")", ";", "$", "rest", "->", "POST", "(", ")", ";", "return", "$", "rest", "->", "getSuccess", "(", ")", ";", "}" ]
WARNING during the scan the AP will be unavailable. Therefore, you should ask for user confirmation prior to launching a scan. Once launched you should wait until the ap state comes back from scanning to get updated info. @param int $accessPointId @return boolean
[ "WARNING", "during", "the", "scan", "the", "AP", "will", "be", "unavailable", ".", "Therefore", "you", "should", "ask", "for", "user", "confirmation", "prior", "to", "launching", "a", "scan", ".", "Once", "launched", "you", "should", "wait", "until", "the", "ap", "state", "comes", "back", "from", "scanning", "to", "get", "updated", "info", "." ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/WiFi/AccessPoint.php#L99-L105
227,555
alphayax/freebox_api_php
freebox/api/v3/services/config/WiFi/AccessPoint.php
AccessPoint.getChannelUsageFromId
public function getChannelUsageFromId( $accessPointId) { $service = sprintf( self::API_WIFI_AP_CHANNEL_USAGE, $accessPointId); $rest = $this->getService( $service); $rest->GET(); return $rest->getResultAsArray( models\WiFi\Radar\ChannelUsage::class); }
php
public function getChannelUsageFromId( $accessPointId) { $service = sprintf( self::API_WIFI_AP_CHANNEL_USAGE, $accessPointId); $rest = $this->getService( $service); $rest->GET(); return $rest->getResultAsArray( models\WiFi\Radar\ChannelUsage::class); }
[ "public", "function", "getChannelUsageFromId", "(", "$", "accessPointId", ")", "{", "$", "service", "=", "sprintf", "(", "self", "::", "API_WIFI_AP_CHANNEL_USAGE", ",", "$", "accessPointId", ")", ";", "$", "rest", "=", "$", "this", "->", "getService", "(", "$", "service", ")", ";", "$", "rest", "->", "GET", "(", ")", ";", "return", "$", "rest", "->", "getResultAsArray", "(", "models", "\\", "WiFi", "\\", "Radar", "\\", "ChannelUsage", "::", "class", ")", ";", "}" ]
List Wi-Fi channels usage @param int $accessPointId @return models\WiFi\Radar\ChannelUsage[]
[ "List", "Wi", "-", "Fi", "channels", "usage" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/WiFi/AccessPoint.php#L112-L118
227,556
canax/database
src/Database/DatabaseDebug.php
DatabaseDebug.dump
public function dump() : string { $html = '<p><i>You have made ' . self::$numQueries . ' database queries.</i></p><pre>'; foreach (self::$queries as $key => $val) { $params = empty(self::$params[$key]) ? null : htmlentities(print_r(self::$params[$key], 1), null, 'UTF-8') . '<br/><br/>'; $html .= htmlentities($val, null, 'UTF-8') . '<br/><br/>' . $params; } return $html . '</pre>'; }
php
public function dump() : string { $html = '<p><i>You have made ' . self::$numQueries . ' database queries.</i></p><pre>'; foreach (self::$queries as $key => $val) { $params = empty(self::$params[$key]) ? null : htmlentities(print_r(self::$params[$key], 1), null, 'UTF-8') . '<br/><br/>'; $html .= htmlentities($val, null, 'UTF-8') . '<br/><br/>' . $params; } return $html . '</pre>'; }
[ "public", "function", "dump", "(", ")", ":", "string", "{", "$", "html", "=", "'<p><i>You have made '", ".", "self", "::", "$", "numQueries", ".", "' database queries.</i></p><pre>'", ";", "foreach", "(", "self", "::", "$", "queries", "as", "$", "key", "=>", "$", "val", ")", "{", "$", "params", "=", "empty", "(", "self", "::", "$", "params", "[", "$", "key", "]", ")", "?", "null", ":", "htmlentities", "(", "print_r", "(", "self", "::", "$", "params", "[", "$", "key", "]", ",", "1", ")", ",", "null", ",", "'UTF-8'", ")", ".", "'<br/><br/>'", ";", "$", "html", ".=", "htmlentities", "(", "$", "val", ",", "null", ",", "'UTF-8'", ")", ".", "'<br/><br/>'", ".", "$", "params", ";", "}", "return", "$", "html", ".", "'</pre>'", ";", "}" ]
Get a HTML representation of all queries made, for debugging and analysing purpose. @return string with HTML.
[ "Get", "a", "HTML", "representation", "of", "all", "queries", "made", "for", "debugging", "and", "analysing", "purpose", "." ]
ea78a5b3eee8998be0e5a401247b9455ff240fb4
https://github.com/canax/database/blob/ea78a5b3eee8998be0e5a401247b9455ff240fb4/src/Database/DatabaseDebug.php#L120-L132
227,557
alphayax/freebox_api_php
freebox/api/v3/services/ParentalControl/Filter.php
Filter.getConfiguration
public function getConfiguration(){ $rest = $this->getService( self::API_PARENTAL_CONFIG); $rest->GET(); return $rest->getResult( models\ParentalControl\FilterConfig::class); }
php
public function getConfiguration(){ $rest = $this->getService( self::API_PARENTAL_CONFIG); $rest->GET(); return $rest->getResult( models\ParentalControl\FilterConfig::class); }
[ "public", "function", "getConfiguration", "(", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_PARENTAL_CONFIG", ")", ";", "$", "rest", "->", "GET", "(", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "ParentalControl", "\\", "FilterConfig", "::", "class", ")", ";", "}" ]
Return the current Filter configuration @return models\ParentalControl\FilterConfig
[ "Return", "the", "current", "Filter", "configuration" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/ParentalControl/Filter.php#L20-L25
227,558
alphayax/freebox_api_php
freebox/api/v3/services/ParentalControl/Filter.php
Filter.setConfiguration
public function setConfiguration( models\ParentalControl\FilterConfig $filterConfig){ $rest = $this->getService( self::API_PARENTAL_CONFIG); $rest->PUT( $filterConfig); return $rest->getResult( models\ParentalControl\FilterConfig::class); }
php
public function setConfiguration( models\ParentalControl\FilterConfig $filterConfig){ $rest = $this->getService( self::API_PARENTAL_CONFIG); $rest->PUT( $filterConfig); return $rest->getResult( models\ParentalControl\FilterConfig::class); }
[ "public", "function", "setConfiguration", "(", "models", "\\", "ParentalControl", "\\", "FilterConfig", "$", "filterConfig", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_PARENTAL_CONFIG", ")", ";", "$", "rest", "->", "PUT", "(", "$", "filterConfig", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "ParentalControl", "\\", "FilterConfig", "::", "class", ")", ";", "}" ]
Update the filter configuration @param models\ParentalControl\FilterConfig $filterConfig @return models\ParentalControl\FilterConfig
[ "Update", "the", "filter", "configuration" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/ParentalControl/Filter.php#L32-L37
227,559
alphayax/freebox_api_php
freebox/api/v3/services/ParentalControl/Filter.php
Filter.getAll
public function getAll(){ $rest = $this->getService( self::API_PARENTAL_FILTER); $rest->GET(); return $rest->getResultAsArray( models\ParentalControl\Filter::class); }
php
public function getAll(){ $rest = $this->getService( self::API_PARENTAL_FILTER); $rest->GET(); return $rest->getResultAsArray( models\ParentalControl\Filter::class); }
[ "public", "function", "getAll", "(", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_PARENTAL_FILTER", ")", ";", "$", "rest", "->", "GET", "(", ")", ";", "return", "$", "rest", "->", "getResultAsArray", "(", "models", "\\", "ParentalControl", "\\", "Filter", "::", "class", ")", ";", "}" ]
Get the list of all filters @throws \Exception @return models\ParentalControl\Filter[]
[ "Get", "the", "list", "of", "all", "filters" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/ParentalControl/Filter.php#L44-L49
227,560
alphayax/freebox_api_php
freebox/api/v3/services/ParentalControl/Filter.php
Filter.getFromId
public function getFromId( $filterId){ $rest = $this->getService( self::API_PARENTAL_FILTER . $filterId); $rest->GET(); return $rest->getResult( models\ParentalControl\Filter::class); }
php
public function getFromId( $filterId){ $rest = $this->getService( self::API_PARENTAL_FILTER . $filterId); $rest->GET(); return $rest->getResult( models\ParentalControl\Filter::class); }
[ "public", "function", "getFromId", "(", "$", "filterId", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_PARENTAL_FILTER", ".", "$", "filterId", ")", ";", "$", "rest", "->", "GET", "(", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "ParentalControl", "\\", "Filter", "::", "class", ")", ";", "}" ]
Get a specific filter from id @param int $filterId @return models\ParentalControl\Filter
[ "Get", "a", "specific", "filter", "from", "id" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/ParentalControl/Filter.php#L56-L61
227,561
alphayax/freebox_api_php
freebox/api/v3/services/ParentalControl/Filter.php
Filter.update
public function update( models\ParentalControl\Filter $filter){ $rest = $this->getService( self::API_PARENTAL_FILTER . $filter->getId()); $rest->PUT( $filter); return $rest->getResult( models\ParentalControl\Filter::class); }
php
public function update( models\ParentalControl\Filter $filter){ $rest = $this->getService( self::API_PARENTAL_FILTER . $filter->getId()); $rest->PUT( $filter); return $rest->getResult( models\ParentalControl\Filter::class); }
[ "public", "function", "update", "(", "models", "\\", "ParentalControl", "\\", "Filter", "$", "filter", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_PARENTAL_FILTER", ".", "$", "filter", "->", "getId", "(", ")", ")", ";", "$", "rest", "->", "PUT", "(", "$", "filter", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "ParentalControl", "\\", "Filter", "::", "class", ")", ";", "}" ]
Update a filter @param models\ParentalControl\Filter $filter @return models\ParentalControl\Filter
[ "Update", "a", "filter" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/ParentalControl/Filter.php#L68-L73
227,562
alphayax/freebox_api_php
freebox/api/v3/services/ParentalControl/Filter.php
Filter.deleteFromId
public function deleteFromId( $filterId){ $rest = $this->getService( self::API_PARENTAL_FILTER . $filterId); $rest->DELETE(); return $rest->getSuccess(); }
php
public function deleteFromId( $filterId){ $rest = $this->getService( self::API_PARENTAL_FILTER . $filterId); $rest->DELETE(); return $rest->getSuccess(); }
[ "public", "function", "deleteFromId", "(", "$", "filterId", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_PARENTAL_FILTER", ".", "$", "filterId", ")", ";", "$", "rest", "->", "DELETE", "(", ")", ";", "return", "$", "rest", "->", "getSuccess", "(", ")", ";", "}" ]
Delete a filter with the specified id @param int $filterId @return bool
[ "Delete", "a", "filter", "with", "the", "specified", "id" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/ParentalControl/Filter.php#L89-L94
227,563
alphayax/freebox_api_php
freebox/api/v3/services/ParentalControl/Filter.php
Filter.add
public function add( models\ParentalControl\Filter $filter){ $rest = $this->getService( self::API_PARENTAL_FILTER); $rest->POST( $filter); return $rest->getResult( models\ParentalControl\Filter::class); }
php
public function add( models\ParentalControl\Filter $filter){ $rest = $this->getService( self::API_PARENTAL_FILTER); $rest->POST( $filter); return $rest->getResult( models\ParentalControl\Filter::class); }
[ "public", "function", "add", "(", "models", "\\", "ParentalControl", "\\", "Filter", "$", "filter", ")", "{", "$", "rest", "=", "$", "this", "->", "getService", "(", "self", "::", "API_PARENTAL_FILTER", ")", ";", "$", "rest", "->", "POST", "(", "$", "filter", ")", ";", "return", "$", "rest", "->", "getResult", "(", "models", "\\", "ParentalControl", "\\", "Filter", "::", "class", ")", ";", "}" ]
Add a new filter @param models\ParentalControl\Filter $filter @return models\ParentalControl\Filter
[ "Add", "a", "new", "filter" ]
6b90f932fca9d74053dc0af9664881664a29cefb
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/ParentalControl/Filter.php#L101-L106
227,564
contao-bootstrap/layout
src/Listener/Dca/LayoutDcaListener.php
LayoutDcaListener.disableFramework
public function disableFramework(DataContainer $dataContainer): void { if ($dataContainer->activeRecord->layoutType === 'bootstrap' && $dataContainer->activeRecord->framework) { $dataContainer->activeRecord->framework = []; $statement = $this->connection->prepare('UPDATE tl_layout SET framework = \'\' WHERE id=?'); $statement->bindValue(1, $dataContainer->id); $statement->execute(); } }
php
public function disableFramework(DataContainer $dataContainer): void { if ($dataContainer->activeRecord->layoutType === 'bootstrap' && $dataContainer->activeRecord->framework) { $dataContainer->activeRecord->framework = []; $statement = $this->connection->prepare('UPDATE tl_layout SET framework = \'\' WHERE id=?'); $statement->bindValue(1, $dataContainer->id); $statement->execute(); } }
[ "public", "function", "disableFramework", "(", "DataContainer", "$", "dataContainer", ")", ":", "void", "{", "if", "(", "$", "dataContainer", "->", "activeRecord", "->", "layoutType", "===", "'bootstrap'", "&&", "$", "dataContainer", "->", "activeRecord", "->", "framework", ")", "{", "$", "dataContainer", "->", "activeRecord", "->", "framework", "=", "[", "]", ";", "$", "statement", "=", "$", "this", "->", "connection", "->", "prepare", "(", "'UPDATE tl_layout SET framework = \\'\\' WHERE id=?'", ")", ";", "$", "statement", "->", "bindValue", "(", "1", ",", "$", "dataContainer", "->", "id", ")", ";", "$", "statement", "->", "execute", "(", ")", ";", "}", "}" ]
Disable contao framework. @param DataContainer $dataContainer Data container driver. @return void
[ "Disable", "contao", "framework", "." ]
9871809d7ed82f8c17c3f84f5944b9291620aad3
https://github.com/contao-bootstrap/layout/blob/9871809d7ed82f8c17c3f84f5944b9291620aad3/src/Listener/Dca/LayoutDcaListener.php#L73-L82
227,565
alhoqbani/ar-php
src/ArUtil/I18N/Soundex.php
Soundex.trimRep
protected function trimRep($word) { $lastChar = null; $cleanWord = null; $max = mb_strlen($word, 'UTF-8'); for ($i = 0; $i < $max; $i++) { $char = mb_substr($word, $i, 1, 'UTF-8'); if ($char != $lastChar) { $cleanWord .= $char; } $lastChar = $char; } return $cleanWord; }
php
protected function trimRep($word) { $lastChar = null; $cleanWord = null; $max = mb_strlen($word, 'UTF-8'); for ($i = 0; $i < $max; $i++) { $char = mb_substr($word, $i, 1, 'UTF-8'); if ($char != $lastChar) { $cleanWord .= $char; } $lastChar = $char; } return $cleanWord; }
[ "protected", "function", "trimRep", "(", "$", "word", ")", "{", "$", "lastChar", "=", "null", ";", "$", "cleanWord", "=", "null", ";", "$", "max", "=", "mb_strlen", "(", "$", "word", ",", "'UTF-8'", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "max", ";", "$", "i", "++", ")", "{", "$", "char", "=", "mb_substr", "(", "$", "word", ",", "$", "i", ",", "1", ",", "'UTF-8'", ")", ";", "if", "(", "$", "char", "!=", "$", "lastChar", ")", "{", "$", "cleanWord", ".=", "$", "char", ";", "}", "$", "lastChar", "=", "$", "char", ";", "}", "return", "$", "cleanWord", ";", "}" ]
Remove any characters replicates @param string $word Arabic word you want to check if it is feminine @return string Same word without any duplicate chracters @author Khaled Al-Sham'aa <khaled@ar-php.org>
[ "Remove", "any", "characters", "replicates" ]
27a451d79591f7e49a300e97e3b32ecf24934c86
https://github.com/alhoqbani/ar-php/blob/27a451d79591f7e49a300e97e3b32ecf24934c86/src/ArUtil/I18N/Soundex.php#L276-L291
227,566
pagekit/razr
src/TokenStream.php
TokenStream.get
public function get($number = 0) { if (isset($this->tokens[$this->current + $number])) { return $this->tokens[$this->current + $number]; } }
php
public function get($number = 0) { if (isset($this->tokens[$this->current + $number])) { return $this->tokens[$this->current + $number]; } }
[ "public", "function", "get", "(", "$", "number", "=", "0", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "tokens", "[", "$", "this", "->", "current", "+", "$", "number", "]", ")", ")", "{", "return", "$", "this", "->", "tokens", "[", "$", "this", "->", "current", "+", "$", "number", "]", ";", "}", "}" ]
Get a token. @param int $number @return Token|null
[ "Get", "a", "token", "." ]
5ba5e580bd71e0907e3966a122ac7b6869bac7f8
https://github.com/pagekit/razr/blob/5ba5e580bd71e0907e3966a122ac7b6869bac7f8/src/TokenStream.php#L41-L46
227,567
pagekit/razr
src/TokenStream.php
TokenStream.next
public function next() { $this->peek = 0; if (isset($this->tokens[$this->current])) { return $this->tokens[$this->current++]; } }
php
public function next() { $this->peek = 0; if (isset($this->tokens[$this->current])) { return $this->tokens[$this->current++]; } }
[ "public", "function", "next", "(", ")", "{", "$", "this", "->", "peek", "=", "0", ";", "if", "(", "isset", "(", "$", "this", "->", "tokens", "[", "$", "this", "->", "current", "]", ")", ")", "{", "return", "$", "this", "->", "tokens", "[", "$", "this", "->", "current", "++", "]", ";", "}", "}" ]
Next token. @return Token|null
[ "Next", "token", "." ]
5ba5e580bd71e0907e3966a122ac7b6869bac7f8
https://github.com/pagekit/razr/blob/5ba5e580bd71e0907e3966a122ac7b6869bac7f8/src/TokenStream.php#L53-L59
227,568
pagekit/razr
src/TokenStream.php
TokenStream.nextIf
public function nextIf($type, $value = null) { if ($this->test($type, $value)) { return $this->next(); } }
php
public function nextIf($type, $value = null) { if ($this->test($type, $value)) { return $this->next(); } }
[ "public", "function", "nextIf", "(", "$", "type", ",", "$", "value", "=", "null", ")", "{", "if", "(", "$", "this", "->", "test", "(", "$", "type", ",", "$", "value", ")", ")", "{", "return", "$", "this", "->", "next", "(", ")", ";", "}", "}" ]
Gets next token if condition is true. @param array|integer $type @param array|string|null $value @return Token|null
[ "Gets", "next", "token", "if", "condition", "is", "true", "." ]
5ba5e580bd71e0907e3966a122ac7b6869bac7f8
https://github.com/pagekit/razr/blob/5ba5e580bd71e0907e3966a122ac7b6869bac7f8/src/TokenStream.php#L78-L83
227,569
pagekit/razr
src/TokenStream.php
TokenStream.expect
public function expect($type, $value = null, $message = null) { $token = $this->tokens[$this->current]; if (!$token->test($type, $value)) { throw new SyntaxErrorException(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s) on line %s', $message ? "$message. " : "", $token, $token->getValue(), Token::getName($type), $value ? sprintf(' with value "%s"', $value) : '', $token->getLine())); } return $token; }
php
public function expect($type, $value = null, $message = null) { $token = $this->tokens[$this->current]; if (!$token->test($type, $value)) { throw new SyntaxErrorException(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s) on line %s', $message ? "$message. " : "", $token, $token->getValue(), Token::getName($type), $value ? sprintf(' with value "%s"', $value) : '', $token->getLine())); } return $token; }
[ "public", "function", "expect", "(", "$", "type", ",", "$", "value", "=", "null", ",", "$", "message", "=", "null", ")", "{", "$", "token", "=", "$", "this", "->", "tokens", "[", "$", "this", "->", "current", "]", ";", "if", "(", "!", "$", "token", "->", "test", "(", "$", "type", ",", "$", "value", ")", ")", "{", "throw", "new", "SyntaxErrorException", "(", "sprintf", "(", "'%sUnexpected token \"%s\" of value \"%s\" (\"%s\" expected%s) on line %s'", ",", "$", "message", "?", "\"$message. \"", ":", "\"\"", ",", "$", "token", ",", "$", "token", "->", "getValue", "(", ")", ",", "Token", "::", "getName", "(", "$", "type", ")", ",", "$", "value", "?", "sprintf", "(", "' with value \"%s\"'", ",", "$", "value", ")", ":", "''", ",", "$", "token", "->", "getLine", "(", ")", ")", ")", ";", "}", "return", "$", "token", ";", "}" ]
Tests the current token for a condition or throws an exception otherwise. @param array|integer $type @param array|string|null $value @param string|null $message @throws SyntaxErrorException @return Token|null
[ "Tests", "the", "current", "token", "for", "a", "condition", "or", "throws", "an", "exception", "otherwise", "." ]
5ba5e580bd71e0907e3966a122ac7b6869bac7f8
https://github.com/pagekit/razr/blob/5ba5e580bd71e0907e3966a122ac7b6869bac7f8/src/TokenStream.php#L106-L115
227,570
pagekit/razr
src/TokenStream.php
TokenStream.peek
public function peek() { if (isset($this->tokens[$this->current + ++$this->peek])) { return $this->tokens[$this->current + $this->peek]; } else { return null; } }
php
public function peek() { if (isset($this->tokens[$this->current + ++$this->peek])) { return $this->tokens[$this->current + $this->peek]; } else { return null; } }
[ "public", "function", "peek", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "tokens", "[", "$", "this", "->", "current", "+", "++", "$", "this", "->", "peek", "]", ")", ")", "{", "return", "$", "this", "->", "tokens", "[", "$", "this", "->", "current", "+", "$", "this", "->", "peek", "]", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Moves the peek token forward. @return Token|null
[ "Moves", "the", "peek", "token", "forward", "." ]
5ba5e580bd71e0907e3966a122ac7b6869bac7f8
https://github.com/pagekit/razr/blob/5ba5e580bd71e0907e3966a122ac7b6869bac7f8/src/TokenStream.php#L130-L137
227,571
pagekit/razr
src/TokenStream.php
TokenStream.peekUntil
public function peekUntil($type, $value = null) { while($token = $this->peek() and !$token->test($type, $value)) { $token = null; } return $token; }
php
public function peekUntil($type, $value = null) { while($token = $this->peek() and !$token->test($type, $value)) { $token = null; } return $token; }
[ "public", "function", "peekUntil", "(", "$", "type", ",", "$", "value", "=", "null", ")", "{", "while", "(", "$", "token", "=", "$", "this", "->", "peek", "(", ")", "and", "!", "$", "token", "->", "test", "(", "$", "type", ",", "$", "value", ")", ")", "{", "$", "token", "=", "null", ";", "}", "return", "$", "token", ";", "}" ]
Peeks until a token with the given type is found. @param array|integer $type @param array|string|null $value @return Token|null
[ "Peeks", "until", "a", "token", "with", "the", "given", "type", "is", "found", "." ]
5ba5e580bd71e0907e3966a122ac7b6869bac7f8
https://github.com/pagekit/razr/blob/5ba5e580bd71e0907e3966a122ac7b6869bac7f8/src/TokenStream.php#L146-L152
227,572
concrete5/doctrine-xml
src/Normalizer.php
Normalizer.getXsltDOMDocument
protected static function getXsltDOMDocument() { static $cache = null; $xsltFile = __DIR__.'/doctrine-xml-0.5.xsl'; if (!isset($cache)) { $s = (is_file($xsltFile) && is_readable($xsltFile)) ? @file_get_contents($xsltFile) : false; if ($s === false) { throw new Exception('Failed to load the xslt file '.$xsltFile); } $cache = $s; } return Utilities::stringToDOMDocument($cache, $xsltFile); }
php
protected static function getXsltDOMDocument() { static $cache = null; $xsltFile = __DIR__.'/doctrine-xml-0.5.xsl'; if (!isset($cache)) { $s = (is_file($xsltFile) && is_readable($xsltFile)) ? @file_get_contents($xsltFile) : false; if ($s === false) { throw new Exception('Failed to load the xslt file '.$xsltFile); } $cache = $s; } return Utilities::stringToDOMDocument($cache, $xsltFile); }
[ "protected", "static", "function", "getXsltDOMDocument", "(", ")", "{", "static", "$", "cache", "=", "null", ";", "$", "xsltFile", "=", "__DIR__", ".", "'/doctrine-xml-0.5.xsl'", ";", "if", "(", "!", "isset", "(", "$", "cache", ")", ")", "{", "$", "s", "=", "(", "is_file", "(", "$", "xsltFile", ")", "&&", "is_readable", "(", "$", "xsltFile", ")", ")", "?", "@", "file_get_contents", "(", "$", "xsltFile", ")", ":", "false", ";", "if", "(", "$", "s", "===", "false", ")", "{", "throw", "new", "Exception", "(", "'Failed to load the xslt file '", ".", "$", "xsltFile", ")", ";", "}", "$", "cache", "=", "$", "s", ";", "}", "return", "Utilities", "::", "stringToDOMDocument", "(", "$", "cache", ",", "$", "xsltFile", ")", ";", "}" ]
Return the XSLT document that fixes a source xml file. @throws Exception Throws an Exception if the xsd file couldn't be read. @return DOMDocument
[ "Return", "the", "XSLT", "document", "that", "fixes", "a", "source", "xml", "file", "." ]
03f1209d42477070a58d29e5af15688b96c66b56
https://github.com/concrete5/doctrine-xml/blob/03f1209d42477070a58d29e5af15688b96c66b56/src/Normalizer.php#L88-L101
227,573
authlete/authlete-php
src/Dto/GrantedScopesGetResponse.php
GrantedScopesGetResponse.setMergedGrantedScopes
public function setMergedGrantedScopes(array $scopes = null) { ValidationUtility::ensureNullOrArrayOfString('$scopes', $scopes); $this->mergedGrantedScopes = $scopes; return $this; }
php
public function setMergedGrantedScopes(array $scopes = null) { ValidationUtility::ensureNullOrArrayOfString('$scopes', $scopes); $this->mergedGrantedScopes = $scopes; return $this; }
[ "public", "function", "setMergedGrantedScopes", "(", "array", "$", "scopes", "=", "null", ")", "{", "ValidationUtility", "::", "ensureNullOrArrayOfString", "(", "'$scopes'", ",", "$", "scopes", ")", ";", "$", "this", "->", "mergedGrantedScopes", "=", "$", "scopes", ";", "return", "$", "this", ";", "}" ]
Set the scopes granted to the client application by all the past authorization processes. @param string[] $scopes The scopes granted to the client application by all the past authorization processes. @return GrantedScopesGetResponse `$this` object.
[ "Set", "the", "scopes", "granted", "to", "the", "client", "application", "by", "all", "the", "past", "authorization", "processes", "." ]
bfa05f52dd39c7be66378770e50e303d12b33fb6
https://github.com/authlete/authlete-php/blob/bfa05f52dd39c7be66378770e50e303d12b33fb6/src/Dto/GrantedScopesGetResponse.php#L219-L226
227,574
mayoz/parasut
src/Client.php
Client.endpointUrl
public function endpointUrl($prefix = null, $includeId = true) { $url = self::API_URL; // push company id if ($includeId) { $url = $url .'/'. $this->getCompanyId(); } // push prefix if ($prefix = trim($prefix, '/')) { $url = $url .'/'. $prefix; } return $url; }
php
public function endpointUrl($prefix = null, $includeId = true) { $url = self::API_URL; // push company id if ($includeId) { $url = $url .'/'. $this->getCompanyId(); } // push prefix if ($prefix = trim($prefix, '/')) { $url = $url .'/'. $prefix; } return $url; }
[ "public", "function", "endpointUrl", "(", "$", "prefix", "=", "null", ",", "$", "includeId", "=", "true", ")", "{", "$", "url", "=", "self", "::", "API_URL", ";", "// push company id", "if", "(", "$", "includeId", ")", "{", "$", "url", "=", "$", "url", ".", "'/'", ".", "$", "this", "->", "getCompanyId", "(", ")", ";", "}", "// push prefix", "if", "(", "$", "prefix", "=", "trim", "(", "$", "prefix", ",", "'/'", ")", ")", "{", "$", "url", "=", "$", "url", ".", "'/'", ".", "$", "prefix", ";", "}", "return", "$", "url", ";", "}" ]
Generate a new endpoint url. @param string $prefix @param bool $includeId @return string
[ "Generate", "a", "new", "endpoint", "url", "." ]
88b45bc3f7f84da9b6028ffd7f02547d9b537506
https://github.com/mayoz/parasut/blob/88b45bc3f7f84da9b6028ffd7f02547d9b537506/src/Client.php#L97-L112
227,575
mayoz/parasut
src/Client.php
Client.authorize
public function authorize() { $response = $this->send(self::API_TOKEN_URL, false, array_only($this->config, [ 'client_id', 'client_secret', 'redirect_uri', 'username', 'password', 'grant_type' ]), 'POST'); if ($token = array_get($response, 'access_token')) { $this->setAccessToken($token); } return $this; }
php
public function authorize() { $response = $this->send(self::API_TOKEN_URL, false, array_only($this->config, [ 'client_id', 'client_secret', 'redirect_uri', 'username', 'password', 'grant_type' ]), 'POST'); if ($token = array_get($response, 'access_token')) { $this->setAccessToken($token); } return $this; }
[ "public", "function", "authorize", "(", ")", "{", "$", "response", "=", "$", "this", "->", "send", "(", "self", "::", "API_TOKEN_URL", ",", "false", ",", "array_only", "(", "$", "this", "->", "config", ",", "[", "'client_id'", ",", "'client_secret'", ",", "'redirect_uri'", ",", "'username'", ",", "'password'", ",", "'grant_type'", "]", ")", ",", "'POST'", ")", ";", "if", "(", "$", "token", "=", "array_get", "(", "$", "response", ",", "'access_token'", ")", ")", "{", "$", "this", "->", "setAccessToken", "(", "$", "token", ")", ";", "}", "return", "$", "this", ";", "}" ]
Send a new authorization request. @return $this
[ "Send", "a", "new", "authorization", "request", "." ]
88b45bc3f7f84da9b6028ffd7f02547d9b537506
https://github.com/mayoz/parasut/blob/88b45bc3f7f84da9b6028ffd7f02547d9b537506/src/Client.php#L119-L130
227,576
mayoz/parasut
src/Client.php
Client.make
public function make($type) { if ($instance = array_get($this->resolved, $type)) { return $instance; } return $this->build($type); }
php
public function make($type) { if ($instance = array_get($this->resolved, $type)) { return $instance; } return $this->build($type); }
[ "public", "function", "make", "(", "$", "type", ")", "{", "if", "(", "$", "instance", "=", "array_get", "(", "$", "this", "->", "resolved", ",", "$", "type", ")", ")", "{", "return", "$", "instance", ";", "}", "return", "$", "this", "->", "build", "(", "$", "type", ")", ";", "}" ]
Retrieve the resolved instance or build an instance of the type. @param string $type @return mixed
[ "Retrieve", "the", "resolved", "instance", "or", "build", "an", "instance", "of", "the", "type", "." ]
88b45bc3f7f84da9b6028ffd7f02547d9b537506
https://github.com/mayoz/parasut/blob/88b45bc3f7f84da9b6028ffd7f02547d9b537506/src/Client.php#L184-L191
227,577
mayoz/parasut
src/Client.php
Client.build
protected function build($type) { if ($concrete = array_get($this->aliases, $type)) { return $this->resolved[$type] = new $concrete($this); } throw new InternalServerErrorException; }
php
protected function build($type) { if ($concrete = array_get($this->aliases, $type)) { return $this->resolved[$type] = new $concrete($this); } throw new InternalServerErrorException; }
[ "protected", "function", "build", "(", "$", "type", ")", "{", "if", "(", "$", "concrete", "=", "array_get", "(", "$", "this", "->", "aliases", ",", "$", "type", ")", ")", "{", "return", "$", "this", "->", "resolved", "[", "$", "type", "]", "=", "new", "$", "concrete", "(", "$", "this", ")", ";", "}", "throw", "new", "InternalServerErrorException", ";", "}" ]
Build an instance of the type. @param string $type @return mixed
[ "Build", "an", "instance", "of", "the", "type", "." ]
88b45bc3f7f84da9b6028ffd7f02547d9b537506
https://github.com/mayoz/parasut/blob/88b45bc3f7f84da9b6028ffd7f02547d9b537506/src/Client.php#L199-L206
227,578
mayoz/parasut
src/Client.php
Client.call
public function call($function, array $params = null, $method = 'GET') { $url = $this->endpointUrl($function); return $this->send($url, true, $params, $method); }
php
public function call($function, array $params = null, $method = 'GET') { $url = $this->endpointUrl($function); return $this->send($url, true, $params, $method); }
[ "public", "function", "call", "(", "$", "function", ",", "array", "$", "params", "=", "null", ",", "$", "method", "=", "'GET'", ")", "{", "$", "url", "=", "$", "this", "->", "endpointUrl", "(", "$", "function", ")", ";", "return", "$", "this", "->", "send", "(", "$", "url", ",", "true", ",", "$", "params", ",", "$", "method", ")", ";", "}" ]
Create a new request with autorization. @param string $function @param array $params @param string $method @return mixed
[ "Create", "a", "new", "request", "with", "autorization", "." ]
88b45bc3f7f84da9b6028ffd7f02547d9b537506
https://github.com/mayoz/parasut/blob/88b45bc3f7f84da9b6028ffd7f02547d9b537506/src/Client.php#L226-L231
227,579
alhoqbani/ar-php
src/ArUtil/I18N/Mktime.php
Mktime.jdToGreg
protected function jdToGreg($julian) { $julian = $julian - 1721119; $calc1 = 4 * $julian - 1; $year = floor($calc1 / 146097); $julian = floor($calc1 - 146097 * $year); $day = floor($julian / 4); $calc2 = 4 * $day + 3; $julian = floor($calc2 / 1461); $day = $calc2 - 1461 * $julian; $day = floor(($day + 4) / 4); $calc3 = 5 * $day - 3; $month = floor($calc3 / 153); $day = $calc3 - 153 * $month; $day = floor(($day + 5) / 5); $year = 100 * $year + $julian; if ($month < 10) { $month = $month + 3; } else { $month = $month - 9; $year = $year + 1; } /* Just to mimic the PHP JDToGregorian output If year is less than 1, subtract one to convert from a zero based date system to the common era system in which the year -1 (1 B.C.E) is followed by year 1 (1 C.E.) */ if ($year < 1) { $year--; } return $month.'/'.$day.'/'.$year; }
php
protected function jdToGreg($julian) { $julian = $julian - 1721119; $calc1 = 4 * $julian - 1; $year = floor($calc1 / 146097); $julian = floor($calc1 - 146097 * $year); $day = floor($julian / 4); $calc2 = 4 * $day + 3; $julian = floor($calc2 / 1461); $day = $calc2 - 1461 * $julian; $day = floor(($day + 4) / 4); $calc3 = 5 * $day - 3; $month = floor($calc3 / 153); $day = $calc3 - 153 * $month; $day = floor(($day + 5) / 5); $year = 100 * $year + $julian; if ($month < 10) { $month = $month + 3; } else { $month = $month - 9; $year = $year + 1; } /* Just to mimic the PHP JDToGregorian output If year is less than 1, subtract one to convert from a zero based date system to the common era system in which the year -1 (1 B.C.E) is followed by year 1 (1 C.E.) */ if ($year < 1) { $year--; } return $month.'/'.$day.'/'.$year; }
[ "protected", "function", "jdToGreg", "(", "$", "julian", ")", "{", "$", "julian", "=", "$", "julian", "-", "1721119", ";", "$", "calc1", "=", "4", "*", "$", "julian", "-", "1", ";", "$", "year", "=", "floor", "(", "$", "calc1", "/", "146097", ")", ";", "$", "julian", "=", "floor", "(", "$", "calc1", "-", "146097", "*", "$", "year", ")", ";", "$", "day", "=", "floor", "(", "$", "julian", "/", "4", ")", ";", "$", "calc2", "=", "4", "*", "$", "day", "+", "3", ";", "$", "julian", "=", "floor", "(", "$", "calc2", "/", "1461", ")", ";", "$", "day", "=", "$", "calc2", "-", "1461", "*", "$", "julian", ";", "$", "day", "=", "floor", "(", "(", "$", "day", "+", "4", ")", "/", "4", ")", ";", "$", "calc3", "=", "5", "*", "$", "day", "-", "3", ";", "$", "month", "=", "floor", "(", "$", "calc3", "/", "153", ")", ";", "$", "day", "=", "$", "calc3", "-", "153", "*", "$", "month", ";", "$", "day", "=", "floor", "(", "(", "$", "day", "+", "5", ")", "/", "5", ")", ";", "$", "year", "=", "100", "*", "$", "year", "+", "$", "julian", ";", "if", "(", "$", "month", "<", "10", ")", "{", "$", "month", "=", "$", "month", "+", "3", ";", "}", "else", "{", "$", "month", "=", "$", "month", "-", "9", ";", "$", "year", "=", "$", "year", "+", "1", ";", "}", "/* \n Just to mimic the PHP JDToGregorian output\n If year is less than 1, subtract one to convert from\n a zero based date system to the common era system in\n which the year -1 (1 B.C.E) is followed by year 1 (1 C.E.)\n */", "if", "(", "$", "year", "<", "1", ")", "{", "$", "year", "--", ";", "}", "return", "$", "month", ".", "'/'", ".", "$", "day", ".", "'/'", ".", "$", "year", ";", "}" ]
Converts Julian Day Count to Gregorian date @param integer $julian A julian day number as integer @return integer The gregorian date as a string in the form "month/day/year" @author Khaled Al-Sham'aa <khaled@ar-php.org>
[ "Converts", "Julian", "Day", "Count", "to", "Gregorian", "date" ]
27a451d79591f7e49a300e97e3b32ecf24934c86
https://github.com/alhoqbani/ar-php/blob/27a451d79591f7e49a300e97e3b32ecf24934c86/src/ArUtil/I18N/Mktime.php#L210-L246
227,580
alhoqbani/ar-php
src/ArUtil/I18N/Mktime.php
Mktime.hijriMonthDays
public function hijriMonthDays ($m, $y, $umAlqoura = true) { if ($y >= 1320 && $y < 1460) { $begin = $this->mktime(0, 0, 0, $m, 1, $y); if ($m == 12) { $m2 = 1; $y2 = $y + 1; } else { $m2 = $m + 1; $y2 = $y; } $end = $this->mktime(0, 0, 0, $m2, 1, $y2); if ($umAlqoura === true) { $c1 = $this->mktimeCorrection($m, $y); $c2 = $this->mktimeCorrection($m2, $y2); } else { $c1 = 0; $c2 = 0; } $days = ($end - $begin) / (3600 * 24); $days = $days - $c1 + $c2; } else { $days = false; } return $days; }
php
public function hijriMonthDays ($m, $y, $umAlqoura = true) { if ($y >= 1320 && $y < 1460) { $begin = $this->mktime(0, 0, 0, $m, 1, $y); if ($m == 12) { $m2 = 1; $y2 = $y + 1; } else { $m2 = $m + 1; $y2 = $y; } $end = $this->mktime(0, 0, 0, $m2, 1, $y2); if ($umAlqoura === true) { $c1 = $this->mktimeCorrection($m, $y); $c2 = $this->mktimeCorrection($m2, $y2); } else { $c1 = 0; $c2 = 0; } $days = ($end - $begin) / (3600 * 24); $days = $days - $c1 + $c2; } else { $days = false; } return $days; }
[ "public", "function", "hijriMonthDays", "(", "$", "m", ",", "$", "y", ",", "$", "umAlqoura", "=", "true", ")", "{", "if", "(", "$", "y", ">=", "1320", "&&", "$", "y", "<", "1460", ")", "{", "$", "begin", "=", "$", "this", "->", "mktime", "(", "0", ",", "0", ",", "0", ",", "$", "m", ",", "1", ",", "$", "y", ")", ";", "if", "(", "$", "m", "==", "12", ")", "{", "$", "m2", "=", "1", ";", "$", "y2", "=", "$", "y", "+", "1", ";", "}", "else", "{", "$", "m2", "=", "$", "m", "+", "1", ";", "$", "y2", "=", "$", "y", ";", "}", "$", "end", "=", "$", "this", "->", "mktime", "(", "0", ",", "0", ",", "0", ",", "$", "m2", ",", "1", ",", "$", "y2", ")", ";", "if", "(", "$", "umAlqoura", "===", "true", ")", "{", "$", "c1", "=", "$", "this", "->", "mktimeCorrection", "(", "$", "m", ",", "$", "y", ")", ";", "$", "c2", "=", "$", "this", "->", "mktimeCorrection", "(", "$", "m2", ",", "$", "y2", ")", ";", "}", "else", "{", "$", "c1", "=", "0", ";", "$", "c2", "=", "0", ";", "}", "$", "days", "=", "(", "$", "end", "-", "$", "begin", ")", "/", "(", "3600", "*", "24", ")", ";", "$", "days", "=", "$", "days", "-", "$", "c1", "+", "$", "c2", ";", "}", "else", "{", "$", "days", "=", "false", ";", "}", "return", "$", "days", ";", "}" ]
Calculate how many days in a given Hijri month @param integer $m Hijri month (Islamic calendar) @param integer $y Hijri year (Islamic calendar), valid range[1320-1459] @param boolean $umAlqoura Should we implement Um-Al-Qura calendar correction in this calculation (default value is true) @return integer Days in a given Hijri month @author Khaled Al-Sham'aa <khaled@ar-php.org>
[ "Calculate", "how", "many", "days", "in", "a", "given", "Hijri", "month" ]
27a451d79591f7e49a300e97e3b32ecf24934c86
https://github.com/alhoqbani/ar-php/blob/27a451d79591f7e49a300e97e3b32ecf24934c86/src/ArUtil/I18N/Mktime.php#L293-L323
227,581
uran1980/yii2-translate-panel
helpers/AppHelper.php
AppHelper.getRequestParams
public static function getRequestParams($type = 'all') { $request = Yii::$app->getRequest(); switch ($type) { case 'get': $params = $request->get(); break; case 'post': $params = $request->post(); break; case 'all': default: $params = ArrayHelper::merge($request->get(), $request->post()); break; } return $params; }
php
public static function getRequestParams($type = 'all') { $request = Yii::$app->getRequest(); switch ($type) { case 'get': $params = $request->get(); break; case 'post': $params = $request->post(); break; case 'all': default: $params = ArrayHelper::merge($request->get(), $request->post()); break; } return $params; }
[ "public", "static", "function", "getRequestParams", "(", "$", "type", "=", "'all'", ")", "{", "$", "request", "=", "Yii", "::", "$", "app", "->", "getRequest", "(", ")", ";", "switch", "(", "$", "type", ")", "{", "case", "'get'", ":", "$", "params", "=", "$", "request", "->", "get", "(", ")", ";", "break", ";", "case", "'post'", ":", "$", "params", "=", "$", "request", "->", "post", "(", ")", ";", "break", ";", "case", "'all'", ":", "default", ":", "$", "params", "=", "ArrayHelper", "::", "merge", "(", "$", "request", "->", "get", "(", ")", ",", "$", "request", "->", "post", "(", ")", ")", ";", "break", ";", "}", "return", "$", "params", ";", "}" ]
Returns the request Params @param string $type - all|get|post (default all) @return array
[ "Returns", "the", "request", "Params" ]
695b3ec0274cb15fe017898875f4c7a421880309
https://github.com/uran1980/yii2-translate-panel/blob/695b3ec0274cb15fe017898875f4c7a421880309/helpers/AppHelper.php#L65-L84
227,582
uran1980/yii2-translate-panel
helpers/AppHelper.php
AppHelper.getRequestParam
public static function getRequestParam($name = null, $defaultValue = null) { $params = self::getRequestParams(); if ( isset($params[$name]) ) { return $params[$name]; } else { return $defaultValue; } }
php
public static function getRequestParam($name = null, $defaultValue = null) { $params = self::getRequestParams(); if ( isset($params[$name]) ) { return $params[$name]; } else { return $defaultValue; } }
[ "public", "static", "function", "getRequestParam", "(", "$", "name", "=", "null", ",", "$", "defaultValue", "=", "null", ")", "{", "$", "params", "=", "self", "::", "getRequestParams", "(", ")", ";", "if", "(", "isset", "(", "$", "params", "[", "$", "name", "]", ")", ")", "{", "return", "$", "params", "[", "$", "name", "]", ";", "}", "else", "{", "return", "$", "defaultValue", ";", "}", "}" ]
Returns GET|POST parameter with a given name. If name isn't specified, returns an array of all Request parameters. @param string $name the parameter name @param mixed $defaultValue the default parameter value if the parameter does not exist. @return array|mixed
[ "Returns", "GET|POST", "parameter", "with", "a", "given", "name", ".", "If", "name", "isn", "t", "specified", "returns", "an", "array", "of", "all", "Request", "parameters", "." ]
695b3ec0274cb15fe017898875f4c7a421880309
https://github.com/uran1980/yii2-translate-panel/blob/695b3ec0274cb15fe017898875f4c7a421880309/helpers/AppHelper.php#L94-L102
227,583
contao-bootstrap/layout
src/View/Template/ReplaceImageClassesFilter.php
ReplaceImageClassesFilter.parseAttributes
private function parseAttributes(string $attributeString): Attributes { $attributes = new Attributes(); array_map( function ($attribute) use ($attributes) { $attribute = trim($attribute); if (!$attribute) { // @codingStandardsIgnoreStart // phpcs thinks this return statement belongs to the method return; // @codingStandardsIgnoreEnd } if (preg_match('/([^=]*)="([^"]*)"/', $attribute, $matches)) { $attributes->setAttribute($matches[1], $matches[2]); } else { $attributes->setAttribute($attribute, true); } }, explode(' ', $attributeString) ); return $attributes; }
php
private function parseAttributes(string $attributeString): Attributes { $attributes = new Attributes(); array_map( function ($attribute) use ($attributes) { $attribute = trim($attribute); if (!$attribute) { // @codingStandardsIgnoreStart // phpcs thinks this return statement belongs to the method return; // @codingStandardsIgnoreEnd } if (preg_match('/([^=]*)="([^"]*)"/', $attribute, $matches)) { $attributes->setAttribute($matches[1], $matches[2]); } else { $attributes->setAttribute($attribute, true); } }, explode(' ', $attributeString) ); return $attributes; }
[ "private", "function", "parseAttributes", "(", "string", "$", "attributeString", ")", ":", "Attributes", "{", "$", "attributes", "=", "new", "Attributes", "(", ")", ";", "array_map", "(", "function", "(", "$", "attribute", ")", "use", "(", "$", "attributes", ")", "{", "$", "attribute", "=", "trim", "(", "$", "attribute", ")", ";", "if", "(", "!", "$", "attribute", ")", "{", "// @codingStandardsIgnoreStart", "// phpcs thinks this return statement belongs to the method", "return", ";", "// @codingStandardsIgnoreEnd", "}", "if", "(", "preg_match", "(", "'/([^=]*)=\"([^\"]*)\"/'", ",", "$", "attribute", ",", "$", "matches", ")", ")", "{", "$", "attributes", "->", "setAttribute", "(", "$", "matches", "[", "1", "]", ",", "$", "matches", "[", "2", "]", ")", ";", "}", "else", "{", "$", "attributes", "->", "setAttribute", "(", "$", "attribute", ",", "true", ")", ";", "}", "}", ",", "explode", "(", "' '", ",", "$", "attributeString", ")", ")", ";", "return", "$", "attributes", ";", "}" ]
Parse given attributes. @param string $attributeString Attributes as string. @return Attributes
[ "Parse", "given", "attributes", "." ]
9871809d7ed82f8c17c3f84f5944b9291620aad3
https://github.com/contao-bootstrap/layout/blob/9871809d7ed82f8c17c3f84f5944b9291620aad3/src/View/Template/ReplaceImageClassesFilter.php#L74-L99
227,584
authlete/authlete-php
src/Dto/IntrospectionResponse.php
IntrospectionResponse.setScopes
public function setScopes(array $scopes = null) { ValidationUtility::ensureNullOrArrayOfString('$scopes', $scopes); $this->scopes = $scopes; return $this; }
php
public function setScopes(array $scopes = null) { ValidationUtility::ensureNullOrArrayOfString('$scopes', $scopes); $this->scopes = $scopes; return $this; }
[ "public", "function", "setScopes", "(", "array", "$", "scopes", "=", "null", ")", "{", "ValidationUtility", "::", "ensureNullOrArrayOfString", "(", "'$scopes'", ",", "$", "scopes", ")", ";", "$", "this", "->", "scopes", "=", "$", "scopes", ";", "return", "$", "this", ";", "}" ]
Set the scopes that are associated with the access token. @param string[] $scopes The scopes associated with the access token. @return IntrospectionResponse `$this` object.
[ "Set", "the", "scopes", "that", "are", "associated", "with", "the", "access", "token", "." ]
bfa05f52dd39c7be66378770e50e303d12b33fb6
https://github.com/authlete/authlete-php/blob/bfa05f52dd39c7be66378770e50e303d12b33fb6/src/Dto/IntrospectionResponse.php#L295-L302
227,585
authlete/authlete-php
src/Dto/IntrospectionResponse.php
IntrospectionResponse.setProperties
public function setProperties(array $properties = null) { ValidationUtility::ensureNullOrArrayOfType( '$properties', $properties, __NAMESPACE__ . '\Property'); $this->properties = $properties; return $this; }
php
public function setProperties(array $properties = null) { ValidationUtility::ensureNullOrArrayOfType( '$properties', $properties, __NAMESPACE__ . '\Property'); $this->properties = $properties; return $this; }
[ "public", "function", "setProperties", "(", "array", "$", "properties", "=", "null", ")", "{", "ValidationUtility", "::", "ensureNullOrArrayOfType", "(", "'$properties'", ",", "$", "properties", ",", "__NAMESPACE__", ".", "'\\Property'", ")", ";", "$", "this", "->", "properties", "=", "$", "properties", ";", "return", "$", "this", ";", "}" ]
Set the properties associated with the access token. @param Property[] $properties Properties. @return IntrospectionResponse `$this` object. @since 1.3
[ "Set", "the", "properties", "associated", "with", "the", "access", "token", "." ]
bfa05f52dd39c7be66378770e50e303d12b33fb6
https://github.com/authlete/authlete-php/blob/bfa05f52dd39c7be66378770e50e303d12b33fb6/src/Dto/IntrospectionResponse.php#L528-L536
227,586
Bubelbub/SmartHome-PHP
SmartHome.php
SmartHome.setLogicalDeviceState
public function setLogicalDeviceState($logicalDeviceId, $on) { $setActuatorStatesRequest = new SetActuatorStatesRequest($this); $setActuatorStatesRequest->addLogicalDeviceState($logicalDeviceId, $on); return $setActuatorStatesRequest->send(); }
php
public function setLogicalDeviceState($logicalDeviceId, $on) { $setActuatorStatesRequest = new SetActuatorStatesRequest($this); $setActuatorStatesRequest->addLogicalDeviceState($logicalDeviceId, $on); return $setActuatorStatesRequest->send(); }
[ "public", "function", "setLogicalDeviceState", "(", "$", "logicalDeviceId", ",", "$", "on", ")", "{", "$", "setActuatorStatesRequest", "=", "new", "SetActuatorStatesRequest", "(", "$", "this", ")", ";", "$", "setActuatorStatesRequest", "->", "addLogicalDeviceState", "(", "$", "logicalDeviceId", ",", "$", "on", ")", ";", "return", "$", "setActuatorStatesRequest", "->", "send", "(", ")", ";", "}" ]
Set the state of an logical device @param string $logicalDeviceId the logical device id @param boolean $on the new state of the device (true = on, false = off) @return \SimpleXMLElement
[ "Set", "the", "state", "of", "an", "logical", "device" ]
fccde832d00ff4ede0497774bd17432bfbf8e390
https://github.com/Bubelbub/SmartHome-PHP/blob/fccde832d00ff4ede0497774bd17432bfbf8e390/SmartHome.php#L622-L627
227,587
Bubelbub/SmartHome-PHP
SmartHome.php
SmartHome.setSwitchActuatorState
public function setSwitchActuatorState($logicalDeviceId, $on) { $setActuatorStatesRequest = new SetActuatorStatesRequest($this); $setActuatorStatesRequest->addSwitchActuatorState($logicalDeviceId, $on); return $setActuatorStatesRequest->send(); }
php
public function setSwitchActuatorState($logicalDeviceId, $on) { $setActuatorStatesRequest = new SetActuatorStatesRequest($this); $setActuatorStatesRequest->addSwitchActuatorState($logicalDeviceId, $on); return $setActuatorStatesRequest->send(); }
[ "public", "function", "setSwitchActuatorState", "(", "$", "logicalDeviceId", ",", "$", "on", ")", "{", "$", "setActuatorStatesRequest", "=", "new", "SetActuatorStatesRequest", "(", "$", "this", ")", ";", "$", "setActuatorStatesRequest", "->", "addSwitchActuatorState", "(", "$", "logicalDeviceId", ",", "$", "on", ")", ";", "return", "$", "setActuatorStatesRequest", "->", "send", "(", ")", ";", "}" ]
Set the state of an adapter for example @param string $logicalDeviceId the logical device id @param boolean $on the new state of the device (true = on, false = off) @return \SimpleXMLElement
[ "Set", "the", "state", "of", "an", "adapter", "for", "example" ]
fccde832d00ff4ede0497774bd17432bfbf8e390
https://github.com/Bubelbub/SmartHome-PHP/blob/fccde832d00ff4ede0497774bd17432bfbf8e390/SmartHome.php#L636-L641
227,588
Bubelbub/SmartHome-PHP
SmartHome.php
SmartHome.getLocations
public function getLocations() { if(!is_array($this->locations) || count($this->locations) < 1) { $this->getEntities(); } return $this->locations; }
php
public function getLocations() { if(!is_array($this->locations) || count($this->locations) < 1) { $this->getEntities(); } return $this->locations; }
[ "public", "function", "getLocations", "(", ")", "{", "if", "(", "!", "is_array", "(", "$", "this", "->", "locations", ")", "||", "count", "(", "$", "this", "->", "locations", ")", "<", "1", ")", "{", "$", "this", "->", "getEntities", "(", ")", ";", "}", "return", "$", "this", "->", "locations", ";", "}" ]
Returns an array of all locations @return array
[ "Returns", "an", "array", "of", "all", "locations" ]
fccde832d00ff4ede0497774bd17432bfbf8e390
https://github.com/Bubelbub/SmartHome-PHP/blob/fccde832d00ff4ede0497774bd17432bfbf8e390/SmartHome.php#L679-L686
227,589
alhoqbani/ar-php
src/ArUtil/I18N/KeySwap.php
KeySwap.checkEn
protected function checkEn($str) { $lines = $this->_enLogodd; $logodd = array(); $line = array_shift($lines); $line = rtrim($line); $second = preg_split("/\t/", $line); $temp = array_shift($second); foreach ($lines as $line) { $line = rtrim($line); $values = preg_split("/\t/", $line); $first = array_shift($values); for ($i=0; $i<27; $i++) { $logodd["$first"]["{$second[$i]}"] = $values[$i]; } } $str = mb_strtolower($str); $max = mb_strlen($str, 'UTF-8'); $rank = 0; for ($i=1; $i<$max; $i++) { $first = mb_substr($str, $i-1, 1, 'UTF-8'); $second = mb_substr($str, $i, 1, 'UTF-8'); if (isset($logodd["$first"]["$second"])) { $rank += $logodd["$first"]["$second"]; } else { $rank -= 10; } } return $rank; }
php
protected function checkEn($str) { $lines = $this->_enLogodd; $logodd = array(); $line = array_shift($lines); $line = rtrim($line); $second = preg_split("/\t/", $line); $temp = array_shift($second); foreach ($lines as $line) { $line = rtrim($line); $values = preg_split("/\t/", $line); $first = array_shift($values); for ($i=0; $i<27; $i++) { $logodd["$first"]["{$second[$i]}"] = $values[$i]; } } $str = mb_strtolower($str); $max = mb_strlen($str, 'UTF-8'); $rank = 0; for ($i=1; $i<$max; $i++) { $first = mb_substr($str, $i-1, 1, 'UTF-8'); $second = mb_substr($str, $i, 1, 'UTF-8'); if (isset($logodd["$first"]["$second"])) { $rank += $logodd["$first"]["$second"]; } else { $rank -= 10; } } return $rank; }
[ "protected", "function", "checkEn", "(", "$", "str", ")", "{", "$", "lines", "=", "$", "this", "->", "_enLogodd", ";", "$", "logodd", "=", "array", "(", ")", ";", "$", "line", "=", "array_shift", "(", "$", "lines", ")", ";", "$", "line", "=", "rtrim", "(", "$", "line", ")", ";", "$", "second", "=", "preg_split", "(", "\"/\\t/\"", ",", "$", "line", ")", ";", "$", "temp", "=", "array_shift", "(", "$", "second", ")", ";", "foreach", "(", "$", "lines", "as", "$", "line", ")", "{", "$", "line", "=", "rtrim", "(", "$", "line", ")", ";", "$", "values", "=", "preg_split", "(", "\"/\\t/\"", ",", "$", "line", ")", ";", "$", "first", "=", "array_shift", "(", "$", "values", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "27", ";", "$", "i", "++", ")", "{", "$", "logodd", "[", "\"$first\"", "]", "[", "\"{$second[$i]}\"", "]", "=", "$", "values", "[", "$", "i", "]", ";", "}", "}", "$", "str", "=", "mb_strtolower", "(", "$", "str", ")", ";", "$", "max", "=", "mb_strlen", "(", "$", "str", ",", "'UTF-8'", ")", ";", "$", "rank", "=", "0", ";", "for", "(", "$", "i", "=", "1", ";", "$", "i", "<", "$", "max", ";", "$", "i", "++", ")", "{", "$", "first", "=", "mb_substr", "(", "$", "str", ",", "$", "i", "-", "1", ",", "1", ",", "'UTF-8'", ")", ";", "$", "second", "=", "mb_substr", "(", "$", "str", ",", "$", "i", ",", "1", ",", "'UTF-8'", ")", ";", "if", "(", "isset", "(", "$", "logodd", "[", "\"$first\"", "]", "[", "\"$second\"", "]", ")", ")", "{", "$", "rank", "+=", "$", "logodd", "[", "\"$first\"", "]", "[", "\"$second\"", "]", ";", "}", "else", "{", "$", "rank", "-=", "10", ";", "}", "}", "return", "$", "rank", ";", "}" ]
Calculate the log odd probability that inserted string from keyboard is in English language @param string $str Inserted string from the keyboard @return float Calculated score for input string as English language @author Khaled Al-Sham'aa
[ "Calculate", "the", "log", "odd", "probability", "that", "inserted", "string", "from", "keyboard", "is", "in", "English", "language" ]
27a451d79591f7e49a300e97e3b32ecf24934c86
https://github.com/alhoqbani/ar-php/blob/27a451d79591f7e49a300e97e3b32ecf24934c86/src/ArUtil/I18N/KeySwap.php#L277-L313
227,590
alhoqbani/ar-php
src/ArUtil/I18N/KeySwap.php
KeySwap.checkAr
protected function checkAr($str) { $lines = $this->_arLogodd; $logodd = array(); $line = array_shift($lines); $line = rtrim($line); $second = preg_split("/\t/", $line); $temp = array_shift($second); foreach ($lines as $line) { $line = rtrim($line); $values = preg_split("/\t/", $line); $first = array_shift($values); for ($i=0; $i<37; $i++) { $logodd["$first"]["{$second[$i]}"] = $values[$i]; } } $max = mb_strlen($str, 'UTF-8'); $rank = 0; for ($i=1; $i<$max; $i++) { $first = mb_substr($str, $i-1, 1, 'UTF-8'); $second = mb_substr($str, $i, 1, 'UTF-8'); if (isset($logodd["$first"]["$second"])) { $rank += $logodd["$first"]["$second"]; } else { $rank -= 10; } } return $rank; }
php
protected function checkAr($str) { $lines = $this->_arLogodd; $logodd = array(); $line = array_shift($lines); $line = rtrim($line); $second = preg_split("/\t/", $line); $temp = array_shift($second); foreach ($lines as $line) { $line = rtrim($line); $values = preg_split("/\t/", $line); $first = array_shift($values); for ($i=0; $i<37; $i++) { $logodd["$first"]["{$second[$i]}"] = $values[$i]; } } $max = mb_strlen($str, 'UTF-8'); $rank = 0; for ($i=1; $i<$max; $i++) { $first = mb_substr($str, $i-1, 1, 'UTF-8'); $second = mb_substr($str, $i, 1, 'UTF-8'); if (isset($logodd["$first"]["$second"])) { $rank += $logodd["$first"]["$second"]; } else { $rank -= 10; } } return $rank; }
[ "protected", "function", "checkAr", "(", "$", "str", ")", "{", "$", "lines", "=", "$", "this", "->", "_arLogodd", ";", "$", "logodd", "=", "array", "(", ")", ";", "$", "line", "=", "array_shift", "(", "$", "lines", ")", ";", "$", "line", "=", "rtrim", "(", "$", "line", ")", ";", "$", "second", "=", "preg_split", "(", "\"/\\t/\"", ",", "$", "line", ")", ";", "$", "temp", "=", "array_shift", "(", "$", "second", ")", ";", "foreach", "(", "$", "lines", "as", "$", "line", ")", "{", "$", "line", "=", "rtrim", "(", "$", "line", ")", ";", "$", "values", "=", "preg_split", "(", "\"/\\t/\"", ",", "$", "line", ")", ";", "$", "first", "=", "array_shift", "(", "$", "values", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "37", ";", "$", "i", "++", ")", "{", "$", "logodd", "[", "\"$first\"", "]", "[", "\"{$second[$i]}\"", "]", "=", "$", "values", "[", "$", "i", "]", ";", "}", "}", "$", "max", "=", "mb_strlen", "(", "$", "str", ",", "'UTF-8'", ")", ";", "$", "rank", "=", "0", ";", "for", "(", "$", "i", "=", "1", ";", "$", "i", "<", "$", "max", ";", "$", "i", "++", ")", "{", "$", "first", "=", "mb_substr", "(", "$", "str", ",", "$", "i", "-", "1", ",", "1", ",", "'UTF-8'", ")", ";", "$", "second", "=", "mb_substr", "(", "$", "str", ",", "$", "i", ",", "1", ",", "'UTF-8'", ")", ";", "if", "(", "isset", "(", "$", "logodd", "[", "\"$first\"", "]", "[", "\"$second\"", "]", ")", ")", "{", "$", "rank", "+=", "$", "logodd", "[", "\"$first\"", "]", "[", "\"$second\"", "]", ";", "}", "else", "{", "$", "rank", "-=", "10", ";", "}", "}", "return", "$", "rank", ";", "}" ]
Calculate the log odd probability that inserted string from keyboard is in Arabic language @param string $str Inserted string from the keyboard @return float Calculated score for input string as Arabic language @author Khaled Al-Sham'aa
[ "Calculate", "the", "log", "odd", "probability", "that", "inserted", "string", "from", "keyboard", "is", "in", "Arabic", "language" ]
27a451d79591f7e49a300e97e3b32ecf24934c86
https://github.com/alhoqbani/ar-php/blob/27a451d79591f7e49a300e97e3b32ecf24934c86/src/ArUtil/I18N/KeySwap.php#L324-L359
227,591
alhoqbani/ar-php
src/ArUtil/I18N/KeySwap.php
KeySwap.fixKeyboardLang
public function fixKeyboardLang($str) { preg_match_all("/([\x{0600}-\x{06FF}])/u", $str, $matches); $arNum = count($matches[0]); $nonArNum = mb_strlen(str_replace(' ', '', $str), 'UTF-8') - $arNum; $capital = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; $small = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; if ($arNum > $nonArNum) { $arStr = $str; $enStr = $this->swapAe($str); $isAr = true; } else { $arStr = $this->swapEa($str); $enStr = $str; $strCaps = strtr($str, $capital, $small); $arStrCaps = $this->swapEa($strCaps); $isAr = false; } $enRank = $this->checkEn($enStr); $arRank = $this->checkAr($arStr); if ($arNum > $nonArNum) { $arCapsRank = $arRank; } else { $arCapsRank = $this->checkAr($arStrCaps); } if ($enRank > $arRank && $enRank > $arCapsRank) { if ($isAr) { $fix = $enStr; } else { preg_match_all("/([A-Z])/u", $enStr, $matches); $capsNum = count($matches[0]); preg_match_all("/([a-z])/u", $enStr, $matches); $nonCapsNum = count($matches[0]); if ($capsNum > $nonCapsNum && $nonCapsNum > 0) { $enCapsStr = strtr($enStr, $capital, $small); $fix = $enCapsStr; } else { $fix = ''; } } } else { if ($arCapsRank > $arRank) { $arStr = $arStrCaps; $arRank = $arCapsRank; } if (!$isAr) { $fix = $arStr; } else { $fix = ''; } } return $fix; }
php
public function fixKeyboardLang($str) { preg_match_all("/([\x{0600}-\x{06FF}])/u", $str, $matches); $arNum = count($matches[0]); $nonArNum = mb_strlen(str_replace(' ', '', $str), 'UTF-8') - $arNum; $capital = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; $small = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; if ($arNum > $nonArNum) { $arStr = $str; $enStr = $this->swapAe($str); $isAr = true; } else { $arStr = $this->swapEa($str); $enStr = $str; $strCaps = strtr($str, $capital, $small); $arStrCaps = $this->swapEa($strCaps); $isAr = false; } $enRank = $this->checkEn($enStr); $arRank = $this->checkAr($arStr); if ($arNum > $nonArNum) { $arCapsRank = $arRank; } else { $arCapsRank = $this->checkAr($arStrCaps); } if ($enRank > $arRank && $enRank > $arCapsRank) { if ($isAr) { $fix = $enStr; } else { preg_match_all("/([A-Z])/u", $enStr, $matches); $capsNum = count($matches[0]); preg_match_all("/([a-z])/u", $enStr, $matches); $nonCapsNum = count($matches[0]); if ($capsNum > $nonCapsNum && $nonCapsNum > 0) { $enCapsStr = strtr($enStr, $capital, $small); $fix = $enCapsStr; } else { $fix = ''; } } } else { if ($arCapsRank > $arRank) { $arStr = $arStrCaps; $arRank = $arCapsRank; } if (!$isAr) { $fix = $arStr; } else { $fix = ''; } } return $fix; }
[ "public", "function", "fixKeyboardLang", "(", "$", "str", ")", "{", "preg_match_all", "(", "\"/([\\x{0600}-\\x{06FF}])/u\"", ",", "$", "str", ",", "$", "matches", ")", ";", "$", "arNum", "=", "count", "(", "$", "matches", "[", "0", "]", ")", ";", "$", "nonArNum", "=", "mb_strlen", "(", "str_replace", "(", "' '", ",", "''", ",", "$", "str", ")", ",", "'UTF-8'", ")", "-", "$", "arNum", ";", "$", "capital", "=", "'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'", ";", "$", "small", "=", "'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'", ";", "if", "(", "$", "arNum", ">", "$", "nonArNum", ")", "{", "$", "arStr", "=", "$", "str", ";", "$", "enStr", "=", "$", "this", "->", "swapAe", "(", "$", "str", ")", ";", "$", "isAr", "=", "true", ";", "}", "else", "{", "$", "arStr", "=", "$", "this", "->", "swapEa", "(", "$", "str", ")", ";", "$", "enStr", "=", "$", "str", ";", "$", "strCaps", "=", "strtr", "(", "$", "str", ",", "$", "capital", ",", "$", "small", ")", ";", "$", "arStrCaps", "=", "$", "this", "->", "swapEa", "(", "$", "strCaps", ")", ";", "$", "isAr", "=", "false", ";", "}", "$", "enRank", "=", "$", "this", "->", "checkEn", "(", "$", "enStr", ")", ";", "$", "arRank", "=", "$", "this", "->", "checkAr", "(", "$", "arStr", ")", ";", "if", "(", "$", "arNum", ">", "$", "nonArNum", ")", "{", "$", "arCapsRank", "=", "$", "arRank", ";", "}", "else", "{", "$", "arCapsRank", "=", "$", "this", "->", "checkAr", "(", "$", "arStrCaps", ")", ";", "}", "if", "(", "$", "enRank", ">", "$", "arRank", "&&", "$", "enRank", ">", "$", "arCapsRank", ")", "{", "if", "(", "$", "isAr", ")", "{", "$", "fix", "=", "$", "enStr", ";", "}", "else", "{", "preg_match_all", "(", "\"/([A-Z])/u\"", ",", "$", "enStr", ",", "$", "matches", ")", ";", "$", "capsNum", "=", "count", "(", "$", "matches", "[", "0", "]", ")", ";", "preg_match_all", "(", "\"/([a-z])/u\"", ",", "$", "enStr", ",", "$", "matches", ")", ";", "$", "nonCapsNum", "=", "count", "(", "$", "matches", "[", "0", "]", ")", ";", "if", "(", "$", "capsNum", ">", "$", "nonCapsNum", "&&", "$", "nonCapsNum", ">", "0", ")", "{", "$", "enCapsStr", "=", "strtr", "(", "$", "enStr", ",", "$", "capital", ",", "$", "small", ")", ";", "$", "fix", "=", "$", "enCapsStr", ";", "}", "else", "{", "$", "fix", "=", "''", ";", "}", "}", "}", "else", "{", "if", "(", "$", "arCapsRank", ">", "$", "arRank", ")", "{", "$", "arStr", "=", "$", "arStrCaps", ";", "$", "arRank", "=", "$", "arCapsRank", ";", "}", "if", "(", "!", "$", "isAr", ")", "{", "$", "fix", "=", "$", "arStr", ";", "}", "else", "{", "$", "fix", "=", "''", ";", "}", "}", "return", "$", "fix", ";", "}" ]
This method will automatically detect the language of content supplied in the input string. It will return the suggestion of correct inserted text. The accuracy of the automatic language detection increases with the amount of text entered. @param string $str Inserted string from the keyboard @return string Fixed string language and letter case to the better guess @author Khaled Al-Sham'aa
[ "This", "method", "will", "automatically", "detect", "the", "language", "of", "content", "supplied", "in", "the", "input", "string", ".", "It", "will", "return", "the", "suggestion", "of", "correct", "inserted", "text", ".", "The", "accuracy", "of", "the", "automatic", "language", "detection", "increases", "with", "the", "amount", "of", "text", "entered", "." ]
27a451d79591f7e49a300e97e3b32ecf24934c86
https://github.com/alhoqbani/ar-php/blob/27a451d79591f7e49a300e97e3b32ecf24934c86/src/ArUtil/I18N/KeySwap.php#L372-L436
227,592
movim/moxl
src/Moxl/Xec/Payload/Payload.php
Payload.prepare
final public function prepare($stanza, $parent = false) { if($parent === false) { $this->packet->from = current(explode('/',(string)$stanza->attributes()->from)); } else { $this->packet->from = current(explode('/',(string)$parent->attributes()->from)); } }
php
final public function prepare($stanza, $parent = false) { if($parent === false) { $this->packet->from = current(explode('/',(string)$stanza->attributes()->from)); } else { $this->packet->from = current(explode('/',(string)$parent->attributes()->from)); } }
[ "final", "public", "function", "prepare", "(", "$", "stanza", ",", "$", "parent", "=", "false", ")", "{", "if", "(", "$", "parent", "===", "false", ")", "{", "$", "this", "->", "packet", "->", "from", "=", "current", "(", "explode", "(", "'/'", ",", "(", "string", ")", "$", "stanza", "->", "attributes", "(", ")", "->", "from", ")", ")", ";", "}", "else", "{", "$", "this", "->", "packet", "->", "from", "=", "current", "(", "explode", "(", "'/'", ",", "(", "string", ")", "$", "parent", "->", "attributes", "(", ")", "->", "from", ")", ")", ";", "}", "}" ]
Prepare the packet @return void
[ "Prepare", "the", "packet" ]
bfe3e1d83ef3bbbd270150f2f1164e8a662ef716
https://github.com/movim/moxl/blob/bfe3e1d83ef3bbbd270150f2f1164e8a662ef716/src/Moxl/Xec/Payload/Payload.php#L51-L58
227,593
movim/moxl
src/Moxl/Xec/Payload/Payload.php
Payload.deliver
final public function deliver() { $action_ns = 'Moxl\Xec\Action'; if(get_parent_class($this) == $action_ns || get_parent_class(get_parent_class($this)) == $action_ns) { $class = str_replace([$action_ns, '\\'], ['', '_'], get_class($this)); $key = strtolower(substr($class, 1)); } else { $class = strtolower(get_class($this)); $pos = strrpos($class, '\\'); $key = substr($class, $pos + 1); } if($this->method) $key = $key . '_' . $this->method; if(!empty($this->packet->from)) { Utils::log('Package : "'.$key.'" from "'.$this->packet->from.'" fired'); } else { Utils::log('Package : "'.$key); } $this->event($key, $this->packet); }
php
final public function deliver() { $action_ns = 'Moxl\Xec\Action'; if(get_parent_class($this) == $action_ns || get_parent_class(get_parent_class($this)) == $action_ns) { $class = str_replace([$action_ns, '\\'], ['', '_'], get_class($this)); $key = strtolower(substr($class, 1)); } else { $class = strtolower(get_class($this)); $pos = strrpos($class, '\\'); $key = substr($class, $pos + 1); } if($this->method) $key = $key . '_' . $this->method; if(!empty($this->packet->from)) { Utils::log('Package : "'.$key.'" from "'.$this->packet->from.'" fired'); } else { Utils::log('Package : "'.$key); } $this->event($key, $this->packet); }
[ "final", "public", "function", "deliver", "(", ")", "{", "$", "action_ns", "=", "'Moxl\\Xec\\Action'", ";", "if", "(", "get_parent_class", "(", "$", "this", ")", "==", "$", "action_ns", "||", "get_parent_class", "(", "get_parent_class", "(", "$", "this", ")", ")", "==", "$", "action_ns", ")", "{", "$", "class", "=", "str_replace", "(", "[", "$", "action_ns", ",", "'\\\\'", "]", ",", "[", "''", ",", "'_'", "]", ",", "get_class", "(", "$", "this", ")", ")", ";", "$", "key", "=", "strtolower", "(", "substr", "(", "$", "class", ",", "1", ")", ")", ";", "}", "else", "{", "$", "class", "=", "strtolower", "(", "get_class", "(", "$", "this", ")", ")", ";", "$", "pos", "=", "strrpos", "(", "$", "class", ",", "'\\\\'", ")", ";", "$", "key", "=", "substr", "(", "$", "class", ",", "$", "pos", "+", "1", ")", ";", "}", "if", "(", "$", "this", "->", "method", ")", "$", "key", "=", "$", "key", ".", "'_'", ".", "$", "this", "->", "method", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "packet", "->", "from", ")", ")", "{", "Utils", "::", "log", "(", "'Package : \"'", ".", "$", "key", ".", "'\" from \"'", ".", "$", "this", "->", "packet", "->", "from", ".", "'\" fired'", ")", ";", "}", "else", "{", "Utils", "::", "log", "(", "'Package : \"'", ".", "$", "key", ")", ";", "}", "$", "this", "->", "event", "(", "$", "key", ",", "$", "this", "->", "packet", ")", ";", "}" ]
Deliver the packet @return void
[ "Deliver", "the", "packet" ]
bfe3e1d83ef3bbbd270150f2f1164e8a662ef716
https://github.com/movim/moxl/blob/bfe3e1d83ef3bbbd270150f2f1164e8a662ef716/src/Moxl/Xec/Payload/Payload.php#L65-L87
227,594
movim/moxl
src/Moxl/Xec/Payload/Payload.php
Payload.event
final public function event($key, $packet = null) { $wrapper = Wrapper::getInstance(); $wrapper->iterate($key, $packet); }
php
final public function event($key, $packet = null) { $wrapper = Wrapper::getInstance(); $wrapper->iterate($key, $packet); }
[ "final", "public", "function", "event", "(", "$", "key", ",", "$", "packet", "=", "null", ")", "{", "$", "wrapper", "=", "Wrapper", "::", "getInstance", "(", ")", ";", "$", "wrapper", "->", "iterate", "(", "$", "key", ",", "$", "packet", ")", ";", "}" ]
Send an event to Movim @return void
[ "Send", "an", "event", "to", "Movim" ]
bfe3e1d83ef3bbbd270150f2f1164e8a662ef716
https://github.com/movim/moxl/blob/bfe3e1d83ef3bbbd270150f2f1164e8a662ef716/src/Moxl/Xec/Payload/Payload.php#L94-L98
227,595
movim/moxl
src/Moxl/Xec/Payload/Payload.php
Payload.pack
final public function pack($content, $from = null) { $this->packet->content = $content; if($from != null) { $this->packet->from = $from; } }
php
final public function pack($content, $from = null) { $this->packet->content = $content; if($from != null) { $this->packet->from = $from; } }
[ "final", "public", "function", "pack", "(", "$", "content", ",", "$", "from", "=", "null", ")", "{", "$", "this", "->", "packet", "->", "content", "=", "$", "content", ";", "if", "(", "$", "from", "!=", "null", ")", "{", "$", "this", "->", "packet", "->", "from", "=", "$", "from", ";", "}", "}" ]
Set the content of the packet @return void
[ "Set", "the", "content", "of", "the", "packet" ]
bfe3e1d83ef3bbbd270150f2f1164e8a662ef716
https://github.com/movim/moxl/blob/bfe3e1d83ef3bbbd270150f2f1164e8a662ef716/src/Moxl/Xec/Payload/Payload.php#L115-L121
227,596
casperboone/zabbix-graph
src/ZabbixGraph.php
ZabbixGraph.find
public function find($graphId) { $this->login(); return $this->httpClient->get('chart2.php', [ 'query' => [ 'graphid' => $graphId, 'width' => $this->width, 'height' => $this->height, 'stime' => $this->startTime->getTimestamp(), 'period' => $this->endTime->getTimestamp() - $this->startTime->getTimestamp(), ], ])->getBody()->getContents(); }
php
public function find($graphId) { $this->login(); return $this->httpClient->get('chart2.php', [ 'query' => [ 'graphid' => $graphId, 'width' => $this->width, 'height' => $this->height, 'stime' => $this->startTime->getTimestamp(), 'period' => $this->endTime->getTimestamp() - $this->startTime->getTimestamp(), ], ])->getBody()->getContents(); }
[ "public", "function", "find", "(", "$", "graphId", ")", "{", "$", "this", "->", "login", "(", ")", ";", "return", "$", "this", "->", "httpClient", "->", "get", "(", "'chart2.php'", ",", "[", "'query'", "=>", "[", "'graphid'", "=>", "$", "graphId", ",", "'width'", "=>", "$", "this", "->", "width", ",", "'height'", "=>", "$", "this", "->", "height", ",", "'stime'", "=>", "$", "this", "->", "startTime", "->", "getTimestamp", "(", ")", ",", "'period'", "=>", "$", "this", "->", "endTime", "->", "getTimestamp", "(", ")", "-", "$", "this", "->", "startTime", "->", "getTimestamp", "(", ")", ",", "]", ",", "]", ")", "->", "getBody", "(", ")", "->", "getContents", "(", ")", ";", "}" ]
Request graph from Zabbix and return a raw image. If an error occurred Zabbix will output this as an image. @param int $graphId ID of the graph to be requested @return string
[ "Request", "graph", "from", "Zabbix", "and", "return", "a", "raw", "image", ".", "If", "an", "error", "occurred", "Zabbix", "will", "output", "this", "as", "an", "image", "." ]
937f10d12cc57b93267d375d2c538d239921c05b
https://github.com/casperboone/zabbix-graph/blob/937f10d12cc57b93267d375d2c538d239921c05b/src/ZabbixGraph.php#L60-L73
227,597
Bubelbub/SmartHome-PHP
Entity/WindowDoorSensor.php
WindowDoorSensor.setInstallationType
function setInstallationType($installationType) { if ($installationType == (self::INSTALLATION_TYPE_WINDOW or self::INSTALLATION_TYPE_DOOR)) { $this->installationType = $installationType; } else { throw new Exception(sprintf("Invalid installationtype. Allowed values: '%s', '%s'",self::INSTALLATION_TYPE_WINDOW, self::INSTALLATION_TYPE_DOOR)); } }
php
function setInstallationType($installationType) { if ($installationType == (self::INSTALLATION_TYPE_WINDOW or self::INSTALLATION_TYPE_DOOR)) { $this->installationType = $installationType; } else { throw new Exception(sprintf("Invalid installationtype. Allowed values: '%s', '%s'",self::INSTALLATION_TYPE_WINDOW, self::INSTALLATION_TYPE_DOOR)); } }
[ "function", "setInstallationType", "(", "$", "installationType", ")", "{", "if", "(", "$", "installationType", "==", "(", "self", "::", "INSTALLATION_TYPE_WINDOW", "or", "self", "::", "INSTALLATION_TYPE_DOOR", ")", ")", "{", "$", "this", "->", "installationType", "=", "$", "installationType", ";", "}", "else", "{", "throw", "new", "Exception", "(", "sprintf", "(", "\"Invalid installationtype. Allowed values: '%s', '%s'\"", ",", "self", "::", "INSTALLATION_TYPE_WINDOW", ",", "self", "::", "INSTALLATION_TYPE_DOOR", ")", ")", ";", "}", "}" ]
Sets the installation Type Valid types are "Window" or "Door". @param string $installationType
[ "Sets", "the", "installation", "Type" ]
fccde832d00ff4ede0497774bd17432bfbf8e390
https://github.com/Bubelbub/SmartHome-PHP/blob/fccde832d00ff4ede0497774bd17432bfbf8e390/Entity/WindowDoorSensor.php#L41-L48
227,598
TimeToogo/RapidRoute
src/Compilation/RouteTree/MatchedRouteDataMap.php
MatchedRouteDataMap.addRoute
public function addRoute(Route $route, array $parameterIndexNameMap) { if ($route->allowsAnyHttpMethod()) { $this->defaultRouteData = MatchedRouteData::from($parameterIndexNameMap, $route); } else { $this->httpMethodRouteDataMap[] = [$route->getHttpMethods(), MatchedRouteData::from($parameterIndexNameMap, $route)]; } }
php
public function addRoute(Route $route, array $parameterIndexNameMap) { if ($route->allowsAnyHttpMethod()) { $this->defaultRouteData = MatchedRouteData::from($parameterIndexNameMap, $route); } else { $this->httpMethodRouteDataMap[] = [$route->getHttpMethods(), MatchedRouteData::from($parameterIndexNameMap, $route)]; } }
[ "public", "function", "addRoute", "(", "Route", "$", "route", ",", "array", "$", "parameterIndexNameMap", ")", "{", "if", "(", "$", "route", "->", "allowsAnyHttpMethod", "(", ")", ")", "{", "$", "this", "->", "defaultRouteData", "=", "MatchedRouteData", "::", "from", "(", "$", "parameterIndexNameMap", ",", "$", "route", ")", ";", "}", "else", "{", "$", "this", "->", "httpMethodRouteDataMap", "[", "]", "=", "[", "$", "route", "->", "getHttpMethods", "(", ")", ",", "MatchedRouteData", "::", "from", "(", "$", "parameterIndexNameMap", ",", "$", "route", ")", "]", ";", "}", "}" ]
Adds the supplied route to the matched route data map @param Route $route @param array $parameterIndexNameMap @return void
[ "Adds", "the", "supplied", "route", "to", "the", "matched", "route", "data", "map" ]
5ef2c90a1ab5f02565c4a22bc0bf979c98f15292
https://github.com/TimeToogo/RapidRoute/blob/5ef2c90a1ab5f02565c4a22bc0bf979c98f15292/src/Compilation/RouteTree/MatchedRouteDataMap.php#L90-L97
227,599
authlete/authlete-php
src/Web/HttpHeaders.php
HttpHeaders.add
public function add($name, $value) { if (is_null($name) || empty($name)) { return $this; } $loweredKey = strtolower($name); $originalKey = null; if (array_key_exists($loweredKey, $this->keyMap) === false) { $originalKey = $name; $this->keyMap[$loweredKey] = $originalKey; $this->headerMap[$originalKey] = array(); } else { $originalKey = $this->keyMap[$loweredKey]; } $this->headerMap[$originalKey][] = $value; return $this; }
php
public function add($name, $value) { if (is_null($name) || empty($name)) { return $this; } $loweredKey = strtolower($name); $originalKey = null; if (array_key_exists($loweredKey, $this->keyMap) === false) { $originalKey = $name; $this->keyMap[$loweredKey] = $originalKey; $this->headerMap[$originalKey] = array(); } else { $originalKey = $this->keyMap[$loweredKey]; } $this->headerMap[$originalKey][] = $value; return $this; }
[ "public", "function", "add", "(", "$", "name", ",", "$", "value", ")", "{", "if", "(", "is_null", "(", "$", "name", ")", "||", "empty", "(", "$", "name", ")", ")", "{", "return", "$", "this", ";", "}", "$", "loweredKey", "=", "strtolower", "(", "$", "name", ")", ";", "$", "originalKey", "=", "null", ";", "if", "(", "array_key_exists", "(", "$", "loweredKey", ",", "$", "this", "->", "keyMap", ")", "===", "false", ")", "{", "$", "originalKey", "=", "$", "name", ";", "$", "this", "->", "keyMap", "[", "$", "loweredKey", "]", "=", "$", "originalKey", ";", "$", "this", "->", "headerMap", "[", "$", "originalKey", "]", "=", "array", "(", ")", ";", "}", "else", "{", "$", "originalKey", "=", "$", "this", "->", "keyMap", "[", "$", "loweredKey", "]", ";", "}", "$", "this", "->", "headerMap", "[", "$", "originalKey", "]", "[", "]", "=", "$", "value", ";", "return", "$", "this", ";", "}" ]
Add a pair of HTTP header name and value. @param string $name HTTP header name. For example, `Location`. @param string $value HTTP header value. @return HttpHeaders `$this` object.
[ "Add", "a", "pair", "of", "HTTP", "header", "name", "and", "value", "." ]
bfa05f52dd39c7be66378770e50e303d12b33fb6
https://github.com/authlete/authlete-php/blob/bfa05f52dd39c7be66378770e50e303d12b33fb6/src/Web/HttpHeaders.php#L64-L88