repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
appzcoder/laravel-admin
src/Setting.php
Setting.get
public function get($key) { $setting = SettingModel::where('key', $key)->first(); return $setting ? $setting->value : false; }
php
public function get($key) { $setting = SettingModel::where('key', $key)->first(); return $setting ? $setting->value : false; }
[ "public", "function", "get", "(", "$", "key", ")", "{", "$", "setting", "=", "SettingModel", "::", "where", "(", "'key'", ",", "$", "key", ")", "->", "first", "(", ")", ";", "return", "$", "setting", "?", "$", "setting", "->", "value", ":", "false"...
Get value by a key. @param string $key @return mixed
[ "Get", "value", "by", "a", "key", "." ]
70fcbbd82a267b5bbd462e23945dbcf13cab43b2
https://github.com/appzcoder/laravel-admin/blob/70fcbbd82a267b5bbd462e23945dbcf13cab43b2/src/Setting.php#L37-L42
train
bshaffer/oauth2-server-php
src/OAuth2/Storage/CouchbaseDB.php
CouchbaseDB.deleteObjectByType
protected function deleteObjectByType($name,$id) { $this->db->delete($this->config[$name].'-'.$id,"",1); }
php
protected function deleteObjectByType($name,$id) { $this->db->delete($this->config[$name].'-'.$id,"",1); }
[ "protected", "function", "deleteObjectByType", "(", "$", "name", ",", "$", "id", ")", "{", "$", "this", "->", "db", "->", "delete", "(", "$", "this", "->", "config", "[", "$", "name", "]", ".", "'-'", ".", "$", "id", ",", "\"\"", ",", "1", ")", ...
Helper function to delete couchbase item by type, wait for persist to at least 1 node
[ "Helper", "function", "to", "delete", "couchbase", "item", "by", "type", "wait", "for", "persist", "to", "at", "least", "1", "node" ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Storage/CouchbaseDB.php#L65-L68
train
bshaffer/oauth2-server-php
src/OAuth2/Server.php
Server.handleAuthorizeRequest
public function handleAuthorizeRequest(RequestInterface $request, ResponseInterface $response, $is_authorized, $user_id = null) { $this->response = $response; $this->getAuthorizeController()->handleAuthorizeRequest($request, $this->response, $is_authorized, $user_id); return $this->response...
php
public function handleAuthorizeRequest(RequestInterface $request, ResponseInterface $response, $is_authorized, $user_id = null) { $this->response = $response; $this->getAuthorizeController()->handleAuthorizeRequest($request, $this->response, $is_authorized, $user_id); return $this->response...
[ "public", "function", "handleAuthorizeRequest", "(", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ",", "$", "is_authorized", ",", "$", "user_id", "=", "null", ")", "{", "$", "this", "->", "response", "=", "$", "response", ";",...
Redirect the user appropriately after approval. After the user has approved or denied the resource request the authorization server should call this function to redirect the user appropriately. @param RequestInterface $request - The request should have the follow parameters set in the querystring: - response_type: T...
[ "Redirect", "the", "user", "appropriately", "after", "approval", "." ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Server.php#L380-L386
train
bshaffer/oauth2-server-php
src/OAuth2/Server.php
Server.addStorage
public function addStorage($storage, $key = null) { // if explicitly set to a valid key, do not "magically" set below if (isset($this->storageMap[$key])) { if (!is_null($storage) && !$storage instanceof $this->storageMap[$key]) { throw new \InvalidArgumentException(sprint...
php
public function addStorage($storage, $key = null) { // if explicitly set to a valid key, do not "magically" set below if (isset($this->storageMap[$key])) { if (!is_null($storage) && !$storage instanceof $this->storageMap[$key]) { throw new \InvalidArgumentException(sprint...
[ "public", "function", "addStorage", "(", "$", "storage", ",", "$", "key", "=", "null", ")", "{", "// if explicitly set to a valid key, do not \"magically\" set below", "if", "(", "isset", "(", "$", "this", "->", "storageMap", "[", "$", "key", "]", ")", ")", "{...
Set a storage object for the server @param object $storage - An object implementing one of the Storage interfaces @param mixed $key - If null, the storage is set to the key of each storage interface it implements @throws InvalidArgumentException @see storageMap
[ "Set", "a", "storage", "object", "for", "the", "server" ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Server.php#L472-L506
train
bshaffer/oauth2-server-php
src/OAuth2/Server.php
Server.createDefaultJwtAccessTokenStorage
protected function createDefaultJwtAccessTokenStorage() { if (!isset($this->storages['public_key'])) { throw new \LogicException('You must supply a storage object implementing OAuth2\Storage\PublicKeyInterface to use crypto tokens'); } $tokenStorage = null; if (!empty($th...
php
protected function createDefaultJwtAccessTokenStorage() { if (!isset($this->storages['public_key'])) { throw new \LogicException('You must supply a storage object implementing OAuth2\Storage\PublicKeyInterface to use crypto tokens'); } $tokenStorage = null; if (!empty($th...
[ "protected", "function", "createDefaultJwtAccessTokenStorage", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "storages", "[", "'public_key'", "]", ")", ")", "{", "throw", "new", "\\", "LogicException", "(", "'You must supply a storage object impl...
For Resource Controller @return JwtAccessTokenStorage @throws LogicException
[ "For", "Resource", "Controller" ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Server.php#L809-L820
train
bshaffer/oauth2-server-php
src/OAuth2/Server.php
Server.createDefaultJwtAccessTokenResponseType
protected function createDefaultJwtAccessTokenResponseType() { if (!isset($this->storages['public_key'])) { throw new \LogicException('You must supply a storage object implementing OAuth2\Storage\PublicKeyInterface to use crypto tokens'); } $tokenStorage = null; if (isse...
php
protected function createDefaultJwtAccessTokenResponseType() { if (!isset($this->storages['public_key'])) { throw new \LogicException('You must supply a storage object implementing OAuth2\Storage\PublicKeyInterface to use crypto tokens'); } $tokenStorage = null; if (isse...
[ "protected", "function", "createDefaultJwtAccessTokenResponseType", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "storages", "[", "'public_key'", "]", ")", ")", "{", "throw", "new", "\\", "LogicException", "(", "'You must supply a storage object...
For Authorize and Token Controllers @return JwtAccessToken @throws LogicException
[ "For", "Authorize", "and", "Token", "Controllers" ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Server.php#L828-L847
train
bshaffer/oauth2-server-php
src/OAuth2/Storage/DynamoDB.php
DynamoDB.dynamo2array
private function dynamo2array($dynamodbResult) { $result = array(); foreach ($dynamodbResult["Item"] as $key => $val) { $result[$key] = $val["S"]; $result[] = $val["S"]; } return $result; }
php
private function dynamo2array($dynamodbResult) { $result = array(); foreach ($dynamodbResult["Item"] as $key => $val) { $result[$key] = $val["S"]; $result[] = $val["S"]; } return $result; }
[ "private", "function", "dynamo2array", "(", "$", "dynamodbResult", ")", "{", "$", "result", "=", "array", "(", ")", ";", "foreach", "(", "$", "dynamodbResult", "[", "\"Item\"", "]", "as", "$", "key", "=>", "$", "val", ")", "{", "$", "result", "[", "$...
Transform dynamodb resultset to an array. @param $dynamodbResult @return $array
[ "Transform", "dynamodb", "resultset", "to", "an", "array", "." ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Storage/DynamoDB.php#L525-L534
train
bshaffer/oauth2-server-php
src/OAuth2/ClientAssertionType/HttpBasic.php
HttpBasic.getClientCredentials
public function getClientCredentials(RequestInterface $request, ResponseInterface $response = null) { if (!is_null($request->headers('PHP_AUTH_USER')) && !is_null($request->headers('PHP_AUTH_PW'))) { return array('client_id' => $request->headers('PHP_AUTH_USER'), 'client_secret' => $request->hea...
php
public function getClientCredentials(RequestInterface $request, ResponseInterface $response = null) { if (!is_null($request->headers('PHP_AUTH_USER')) && !is_null($request->headers('PHP_AUTH_PW'))) { return array('client_id' => $request->headers('PHP_AUTH_USER'), 'client_secret' => $request->hea...
[ "public", "function", "getClientCredentials", "(", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "request", "->", "headers", "(", "'PHP_AUTH_USER'", ")", ")", "&&", ...
Internal function used to get the client credentials from HTTP basic auth or POST data. According to the spec (draft 20), the client_id can be provided in the Basic Authorization header (recommended) or via GET/POST. @param RequestInterface $request @param ResponseInterface $response @return array|null A list contai...
[ "Internal", "function", "used", "to", "get", "the", "client", "credentials", "from", "HTTP", "basic", "auth", "or", "POST", "data", "." ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/ClientAssertionType/HttpBasic.php#L115-L138
train
bshaffer/oauth2-server-php
src/OAuth2/ResponseType/AccessToken.php
AccessToken.getAuthorizeResponse
public function getAuthorizeResponse($params, $user_id = null) { // build the URL to redirect to $result = array('query' => array()); $params += array('scope' => null, 'state' => null); /* * a refresh token MUST NOT be included in the fragment * * @see ht...
php
public function getAuthorizeResponse($params, $user_id = null) { // build the URL to redirect to $result = array('query' => array()); $params += array('scope' => null, 'state' => null); /* * a refresh token MUST NOT be included in the fragment * * @see ht...
[ "public", "function", "getAuthorizeResponse", "(", "$", "params", ",", "$", "user_id", "=", "null", ")", "{", "// build the URL to redirect to", "$", "result", "=", "array", "(", "'query'", "=>", "array", "(", ")", ")", ";", "$", "params", "+=", "array", "...
Get authorize response @param array $params @param mixed $user_id @return array
[ "Get", "authorize", "response" ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/ResponseType/AccessToken.php#L60-L80
train
bshaffer/oauth2-server-php
src/OAuth2/Storage/JwtAccessToken.php
JwtAccessToken.convertJwtToOAuth2
protected function convertJwtToOAuth2($tokenData) { $keyMapping = array( 'aud' => 'client_id', 'exp' => 'expires', 'sub' => 'user_id' ); foreach ($keyMapping as $jwtKey => $oauth2Key) { if (isset($tokenData[$jwtKey])) { $tokenD...
php
protected function convertJwtToOAuth2($tokenData) { $keyMapping = array( 'aud' => 'client_id', 'exp' => 'expires', 'sub' => 'user_id' ); foreach ($keyMapping as $jwtKey => $oauth2Key) { if (isset($tokenData[$jwtKey])) { $tokenD...
[ "protected", "function", "convertJwtToOAuth2", "(", "$", "tokenData", ")", "{", "$", "keyMapping", "=", "array", "(", "'aud'", "=>", "'client_id'", ",", "'exp'", "=>", "'expires'", ",", "'sub'", "=>", "'user_id'", ")", ";", "foreach", "(", "$", "keyMapping",...
converts a JWT access token into an OAuth2-friendly format
[ "converts", "a", "JWT", "access", "token", "into", "an", "OAuth2", "-", "friendly", "format" ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Storage/JwtAccessToken.php#L70-L86
train
bshaffer/oauth2-server-php
src/OAuth2/OpenID/Controller/AuthorizeController.php
AuthorizeController.getValidResponseTypes
protected function getValidResponseTypes() { return array( self::RESPONSE_TYPE_ACCESS_TOKEN, self::RESPONSE_TYPE_AUTHORIZATION_CODE, self::RESPONSE_TYPE_ID_TOKEN, self::RESPONSE_TYPE_ID_TOKEN_TOKEN, self::RESPONSE_TYPE_CODE_ID_TOKEN, ); ...
php
protected function getValidResponseTypes() { return array( self::RESPONSE_TYPE_ACCESS_TOKEN, self::RESPONSE_TYPE_AUTHORIZATION_CODE, self::RESPONSE_TYPE_ID_TOKEN, self::RESPONSE_TYPE_ID_TOKEN_TOKEN, self::RESPONSE_TYPE_CODE_ID_TOKEN, ); ...
[ "protected", "function", "getValidResponseTypes", "(", ")", "{", "return", "array", "(", "self", "::", "RESPONSE_TYPE_ACCESS_TOKEN", ",", "self", "::", "RESPONSE_TYPE_AUTHORIZATION_CODE", ",", "self", "::", "RESPONSE_TYPE_ID_TOKEN", ",", "self", "::", "RESPONSE_TYPE_ID_...
Array of valid response types @return array
[ "Array", "of", "valid", "response", "types" ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/OpenID/Controller/AuthorizeController.php#L101-L110
train
bshaffer/oauth2-server-php
src/OAuth2/ResponseType/JwtAccessToken.php
JwtAccessToken.createPayload
protected function createPayload($client_id, $user_id, $scope = null) { // token to encrypt $expires = time() + $this->config['access_lifetime']; $id = $this->generateAccessToken(); $payload = array( 'id' => $id, // for BC (see #591) 'jti' => $...
php
protected function createPayload($client_id, $user_id, $scope = null) { // token to encrypt $expires = time() + $this->config['access_lifetime']; $id = $this->generateAccessToken(); $payload = array( 'id' => $id, // for BC (see #591) 'jti' => $...
[ "protected", "function", "createPayload", "(", "$", "client_id", ",", "$", "user_id", ",", "$", "scope", "=", "null", ")", "{", "// token to encrypt", "$", "expires", "=", "time", "(", ")", "+", "$", "this", "->", "config", "[", "'access_lifetime'", "]", ...
This function can be used to create custom JWT payloads @param mixed $client_id - Client identifier related to the access token. @param mixed $user_id - User ID associated with the access token @param string $scope - (optional) Scopes to be stored in space-separated string. @retur...
[ "This", "function", "can", "be", "used", "to", "create", "custom", "JWT", "payloads" ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/ResponseType/JwtAccessToken.php#L125-L158
train
bshaffer/oauth2-server-php
src/OAuth2/OpenID/Controller/UserInfoController.php
UserInfoController.handleUserInfoRequest
public function handleUserInfoRequest(RequestInterface $request, ResponseInterface $response) { if (!$this->verifyResourceRequest($request, $response, 'openid')) { return; } $token = $this->getToken(); $claims = $this->userClaimsStorage->getUserClaims($token['user_id'], ...
php
public function handleUserInfoRequest(RequestInterface $request, ResponseInterface $response) { if (!$this->verifyResourceRequest($request, $response, 'openid')) { return; } $token = $this->getToken(); $claims = $this->userClaimsStorage->getUserClaims($token['user_id'], ...
[ "public", "function", "handleUserInfoRequest", "(", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ")", "{", "if", "(", "!", "$", "this", "->", "verifyResourceRequest", "(", "$", "request", ",", "$", "response", ",", "'openid'", ...
Handle the user info request @param RequestInterface $request @param ResponseInterface $response @return void
[ "Handle", "the", "user", "info", "request" ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/OpenID/Controller/UserInfoController.php#L47-L61
train
bshaffer/oauth2-server-php
src/OAuth2/Controller/AuthorizeController.php
AuthorizeController.handleAuthorizeRequest
public function handleAuthorizeRequest(RequestInterface $request, ResponseInterface $response, $is_authorized, $user_id = null) { if (!is_bool($is_authorized)) { throw new InvalidArgumentException('Argument "is_authorized" must be a boolean. This method must know if the user has granted access ...
php
public function handleAuthorizeRequest(RequestInterface $request, ResponseInterface $response, $is_authorized, $user_id = null) { if (!is_bool($is_authorized)) { throw new InvalidArgumentException('Argument "is_authorized" must be a boolean. This method must know if the user has granted access ...
[ "public", "function", "handleAuthorizeRequest", "(", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ",", "$", "is_authorized", ",", "$", "user_id", "=", "null", ")", "{", "if", "(", "!", "is_bool", "(", "$", "is_authorized", ")"...
Handle the authorization request @param RequestInterface $request @param ResponseInterface $response @param boolean $is_authorized @param mixed $user_id @return mixed|void @throws InvalidArgumentException
[ "Handle", "the", "authorization", "request" ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Controller/AuthorizeController.php#L108-L151
train
bshaffer/oauth2-server-php
src/OAuth2/Controller/ResourceController.php
ResourceController.verifyResourceRequest
public function verifyResourceRequest(RequestInterface $request, ResponseInterface $response, $scope = null) { $token = $this->getAccessTokenData($request, $response); // Check if we have token data if (is_null($token)) { return false; } /** * Check sco...
php
public function verifyResourceRequest(RequestInterface $request, ResponseInterface $response, $scope = null) { $token = $this->getAccessTokenData($request, $response); // Check if we have token data if (is_null($token)) { return false; } /** * Check sco...
[ "public", "function", "verifyResourceRequest", "(", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ",", "$", "scope", "=", "null", ")", "{", "$", "token", "=", "$", "this", "->", "getAccessTokenData", "(", "$", "request", ",", ...
Verify the resource request @param RequestInterface $request @param ResponseInterface $response @param null $scope @return bool
[ "Verify", "the", "resource", "request" ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Controller/ResourceController.php#L73-L106
train
bshaffer/oauth2-server-php
src/OAuth2/Controller/ResourceController.php
ResourceController.getAccessTokenData
public function getAccessTokenData(RequestInterface $request, ResponseInterface $response) { // Get the token parameter if ($token_param = $this->tokenType->getAccessTokenParameter($request, $response)) { // Get the stored token data (from the implementing subclass) // Check ...
php
public function getAccessTokenData(RequestInterface $request, ResponseInterface $response) { // Get the token parameter if ($token_param = $this->tokenType->getAccessTokenParameter($request, $response)) { // Get the stored token data (from the implementing subclass) // Check ...
[ "public", "function", "getAccessTokenData", "(", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ")", "{", "// Get the token parameter", "if", "(", "$", "token_param", "=", "$", "this", "->", "tokenType", "->", "getAccessTokenParameter",...
Get access token data. @param RequestInterface $request @param ResponseInterface $response @return array|null
[ "Get", "access", "token", "data", "." ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Controller/ResourceController.php#L115-L145
train
bshaffer/oauth2-server-php
src/OAuth2/Controller/TokenController.php
TokenController.addGrantType
public function addGrantType(GrantTypeInterface $grantType, $identifier = null) { if (is_null($identifier) || is_numeric($identifier)) { $identifier = $grantType->getQueryStringIdentifier(); } $this->grantTypes[$identifier] = $grantType; }
php
public function addGrantType(GrantTypeInterface $grantType, $identifier = null) { if (is_null($identifier) || is_numeric($identifier)) { $identifier = $grantType->getQueryStringIdentifier(); } $this->grantTypes[$identifier] = $grantType; }
[ "public", "function", "addGrantType", "(", "GrantTypeInterface", "$", "grantType", ",", "$", "identifier", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "identifier", ")", "||", "is_numeric", "(", "$", "identifier", ")", ")", "{", "$", "identifier...
Add grant type @param GrantTypeInterface $grantType - the grant type to add for the specified identifier @param string|null $identifier - a string passed in as "grant_type" in the response that will call this grantType
[ "Add", "grant", "type" ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Controller/TokenController.php#L260-L267
train
bshaffer/oauth2-server-php
src/OAuth2/Controller/TokenController.php
TokenController.revokeToken
public function revokeToken(RequestInterface $request, ResponseInterface $response) { if (strtolower($request->server('REQUEST_METHOD')) === 'options') { $response->addHttpHeaders(array('Allow' => 'POST, OPTIONS')); return null; } if (strtolower($request->server('RE...
php
public function revokeToken(RequestInterface $request, ResponseInterface $response) { if (strtolower($request->server('REQUEST_METHOD')) === 'options') { $response->addHttpHeaders(array('Allow' => 'POST, OPTIONS')); return null; } if (strtolower($request->server('RE...
[ "public", "function", "revokeToken", "(", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ")", "{", "if", "(", "strtolower", "(", "$", "request", "->", "server", "(", "'REQUEST_METHOD'", ")", ")", "===", "'options'", ")", "{", ...
Revoke a refresh or access token. Returns true on success and when tokens are invalid Note: invalid tokens do not cause an error response since the client cannot handle such an error in a reasonable way. Moreover, the purpose of the revocation request, invalidating the particular token, is already achieved. @param R...
[ "Revoke", "a", "refresh", "or", "access", "token", ".", "Returns", "true", "on", "success", "and", "when", "tokens", "are", "invalid" ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Controller/TokenController.php#L294-L332
train
bshaffer/oauth2-server-php
src/OAuth2/Response.php
Response.getHttpHeadersAsString
private function getHttpHeadersAsString($headers) { if (count($headers) == 0) { return ''; } $max = max(array_map('strlen', array_keys($headers))) + 1; $content = ''; ksort($headers); foreach ($headers as $name => $values) { foreach ($values a...
php
private function getHttpHeadersAsString($headers) { if (count($headers) == 0) { return ''; } $max = max(array_map('strlen', array_keys($headers))) + 1; $content = ''; ksort($headers); foreach ($headers as $name => $values) { foreach ($values a...
[ "private", "function", "getHttpHeadersAsString", "(", "$", "headers", ")", "{", "if", "(", "count", "(", "$", "headers", ")", "==", "0", ")", "{", "return", "''", ";", "}", "$", "max", "=", "max", "(", "array_map", "(", "'strlen'", ",", "array_keys", ...
Function from Symfony2 HttpFoundation - output pretty header @param array $headers @return string
[ "Function", "from", "Symfony2", "HttpFoundation", "-", "output", "pretty", "header" ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Response.php#L448-L464
train
bshaffer/oauth2-server-php
src/OAuth2/Scope.php
Scope.checkScope
public function checkScope($required_scope, $available_scope) { $required_scope = explode(' ', trim($required_scope)); $available_scope = explode(' ', trim($available_scope)); return (count(array_diff($required_scope, $available_scope)) == 0); }
php
public function checkScope($required_scope, $available_scope) { $required_scope = explode(' ', trim($required_scope)); $available_scope = explode(' ', trim($available_scope)); return (count(array_diff($required_scope, $available_scope)) == 0); }
[ "public", "function", "checkScope", "(", "$", "required_scope", ",", "$", "available_scope", ")", "{", "$", "required_scope", "=", "explode", "(", "' '", ",", "trim", "(", "$", "required_scope", ")", ")", ";", "$", "available_scope", "=", "explode", "(", "...
Check if everything in required scope is contained in available scope. @param string $required_scope - A space-separated string of scopes. @param string $available_scope - A space-separated string of scopes. @return bool - TRUE if everything in required scope is contained in available scope and FALS...
[ "Check", "if", "everything", "in", "required", "scope", "is", "contained", "in", "available", "scope", "." ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Scope.php#L48-L54
train
bshaffer/oauth2-server-php
src/OAuth2/Scope.php
Scope.scopeExists
public function scopeExists($scope) { // Check reserved scopes first. $scope = explode(' ', trim($scope)); $reservedScope = $this->getReservedScopes(); $nonReservedScopes = array_diff($scope, $reservedScope); if (count($nonReservedScopes) == 0) { return true; ...
php
public function scopeExists($scope) { // Check reserved scopes first. $scope = explode(' ', trim($scope)); $reservedScope = $this->getReservedScopes(); $nonReservedScopes = array_diff($scope, $reservedScope); if (count($nonReservedScopes) == 0) { return true; ...
[ "public", "function", "scopeExists", "(", "$", "scope", ")", "{", "// Check reserved scopes first.", "$", "scope", "=", "explode", "(", "' '", ",", "trim", "(", "$", "scope", ")", ")", ";", "$", "reservedScope", "=", "$", "this", "->", "getReservedScopes", ...
Check if the provided scope exists in storage. @param string $scope - A space-separated string of scopes. @return bool - TRUE if it exists, FALSE otherwise.
[ "Check", "if", "the", "provided", "scope", "exists", "in", "storage", "." ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Scope.php#L62-L76
train
bshaffer/oauth2-server-php
src/OAuth2/ResponseType/AuthorizationCode.php
AuthorizationCode.createAuthorizationCode
public function createAuthorizationCode($client_id, $user_id, $redirect_uri, $scope = null) { $code = $this->generateAuthorizationCode(); $this->storage->setAuthorizationCode($code, $client_id, $user_id, $redirect_uri, time() + $this->config['auth_code_lifetime'], $scope); return $code; ...
php
public function createAuthorizationCode($client_id, $user_id, $redirect_uri, $scope = null) { $code = $this->generateAuthorizationCode(); $this->storage->setAuthorizationCode($code, $client_id, $user_id, $redirect_uri, time() + $this->config['auth_code_lifetime'], $scope); return $code; ...
[ "public", "function", "createAuthorizationCode", "(", "$", "client_id", ",", "$", "user_id", ",", "$", "redirect_uri", ",", "$", "scope", "=", "null", ")", "{", "$", "code", "=", "$", "this", "->", "generateAuthorizationCode", "(", ")", ";", "$", "this", ...
Handle the creation of the authorization code. @param $client_id Client identifier related to the authorization code @param $user_id User ID associated with the authorization code @param $redirect_uri An absolute URI to which the authorization server will redirect the user-agent to when the end-user authorization step...
[ "Handle", "the", "creation", "of", "the", "authorization", "code", "." ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/ResponseType/AuthorizationCode.php#L56-L62
train
bshaffer/oauth2-server-php
src/OAuth2/ResponseType/AuthorizationCode.php
AuthorizationCode.generateAuthorizationCode
protected function generateAuthorizationCode() { $tokenLen = 40; if (function_exists('random_bytes')) { $randomData = random_bytes(100); } elseif (function_exists('openssl_random_pseudo_bytes')) { $randomData = openssl_random_pseudo_bytes(100); } elseif (funct...
php
protected function generateAuthorizationCode() { $tokenLen = 40; if (function_exists('random_bytes')) { $randomData = random_bytes(100); } elseif (function_exists('openssl_random_pseudo_bytes')) { $randomData = openssl_random_pseudo_bytes(100); } elseif (funct...
[ "protected", "function", "generateAuthorizationCode", "(", ")", "{", "$", "tokenLen", "=", "40", ";", "if", "(", "function_exists", "(", "'random_bytes'", ")", ")", "{", "$", "randomData", "=", "random_bytes", "(", "100", ")", ";", "}", "elseif", "(", "fun...
Generates an unique auth code. Implementing classes may want to override this function to implement other auth code generation schemes. @return An unique auth code. @ingroup oauth2_section_4
[ "Generates", "an", "unique", "auth", "code", "." ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/ResponseType/AuthorizationCode.php#L84-L100
train
bshaffer/oauth2-server-php
src/OAuth2/OpenID/ResponseType/IdToken.php
IdToken.createIdToken
public function createIdToken($client_id, $userInfo, $nonce = null, $userClaims = null, $access_token = null) { // pull auth_time from user info if supplied list($user_id, $auth_time) = $this->getUserIdAndAuthTime($userInfo); $token = array( 'iss' => $this->config['issuer...
php
public function createIdToken($client_id, $userInfo, $nonce = null, $userClaims = null, $access_token = null) { // pull auth_time from user info if supplied list($user_id, $auth_time) = $this->getUserIdAndAuthTime($userInfo); $token = array( 'iss' => $this->config['issuer...
[ "public", "function", "createIdToken", "(", "$", "client_id", ",", "$", "userInfo", ",", "$", "nonce", "=", "null", ",", "$", "userClaims", "=", "null", ",", "$", "access_token", "=", "null", ")", "{", "// pull auth_time from user info if supplied", "list", "(...
Create id token @param string $client_id @param mixed $userInfo @param mixed $nonce @param mixed $userClaims @param mixed $access_token @return mixed|string
[ "Create", "id", "token" ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/OpenID/ResponseType/IdToken.php#L92-L119
train
bshaffer/oauth2-server-php
src/OAuth2/TokenType/Bearer.php
Bearer.requestHasToken
public function requestHasToken(RequestInterface $request) { $headers = $request->headers('AUTHORIZATION'); // check the header, then the querystring, then the request body return !empty($headers) || (bool) ($request->request($this->config['token_param_name'])) || (bool) ($request->query($t...
php
public function requestHasToken(RequestInterface $request) { $headers = $request->headers('AUTHORIZATION'); // check the header, then the querystring, then the request body return !empty($headers) || (bool) ($request->request($this->config['token_param_name'])) || (bool) ($request->query($t...
[ "public", "function", "requestHasToken", "(", "RequestInterface", "$", "request", ")", "{", "$", "headers", "=", "$", "request", "->", "headers", "(", "'AUTHORIZATION'", ")", ";", "// check the header, then the querystring, then the request body", "return", "!", "empty"...
Check if the request has supplied token @see https://github.com/bshaffer/oauth2-server-php/issues/349#issuecomment-37993588
[ "Check", "if", "the", "request", "has", "supplied", "token" ]
5a0c8000d4763b276919e2106f54eddda6bc50fa
https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/TokenType/Bearer.php#L33-L39
train
saleem-hadad/larecipe
src/Models/Documentation.php
Documentation.getIndex
public function getIndex($version) { return $this->cache->remember(function() use($version) { $path = base_path(config('larecipe.docs.path').'/'.$version.'/index.md'); if ($this->files->exists($path)) { $parsedContent = $this->parse($this->files->get($path)); ...
php
public function getIndex($version) { return $this->cache->remember(function() use($version) { $path = base_path(config('larecipe.docs.path').'/'.$version.'/index.md'); if ($this->files->exists($path)) { $parsedContent = $this->parse($this->files->get($path)); ...
[ "public", "function", "getIndex", "(", "$", "version", ")", "{", "return", "$", "this", "->", "cache", "->", "remember", "(", "function", "(", ")", "use", "(", "$", "version", ")", "{", "$", "path", "=", "base_path", "(", "config", "(", "'larecipe.docs...
Get the documentation index page. @param string $version @return string
[ "Get", "the", "documentation", "index", "page", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/Models/Documentation.php#L47-L60
train
saleem-hadad/larecipe
src/Models/Documentation.php
Documentation.get
public function get($version, $page, $data = []) { return $this->cache->remember(function() use($version, $page, $data) { $path = base_path(config('larecipe.docs.path').'/'.$version.'/'.$page.'.md'); if ($this->files->exists($path)) { $parsedContent = $this->parse($t...
php
public function get($version, $page, $data = []) { return $this->cache->remember(function() use($version, $page, $data) { $path = base_path(config('larecipe.docs.path').'/'.$version.'/'.$page.'.md'); if ($this->files->exists($path)) { $parsedContent = $this->parse($t...
[ "public", "function", "get", "(", "$", "version", ",", "$", "page", ",", "$", "data", "=", "[", "]", ")", "{", "return", "$", "this", "->", "cache", "->", "remember", "(", "function", "(", ")", "use", "(", "$", "version", ",", "$", "page", ",", ...
Get the given documentation page. @param $version @param $page @param array $data @return mixed
[ "Get", "the", "given", "documentation", "page", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/Models/Documentation.php#L70-L85
train
saleem-hadad/larecipe
src/Models/Documentation.php
Documentation.replaceLinks
public static function replaceLinks($version, $content) { $content = str_replace('{{version}}', $version, $content); $content = str_replace('{{route}}', trim(config('larecipe.docs.route'), '/'), $content); return $content; }
php
public static function replaceLinks($version, $content) { $content = str_replace('{{version}}', $version, $content); $content = str_replace('{{route}}', trim(config('larecipe.docs.route'), '/'), $content); return $content; }
[ "public", "static", "function", "replaceLinks", "(", "$", "version", ",", "$", "content", ")", "{", "$", "content", "=", "str_replace", "(", "'{{version}}'", ",", "$", "version", ",", "$", "content", ")", ";", "$", "content", "=", "str_replace", "(", "'{...
Replace the version and route placeholders. @param string $version @param string $content @return string
[ "Replace", "the", "version", "and", "route", "placeholders", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/Models/Documentation.php#L94-L101
train
saleem-hadad/larecipe
src/Models/Documentation.php
Documentation.sectionExists
public function sectionExists($version, $page) { return $this->files->exists( base_path(config('larecipe.docs.path').'/'.$version.'/'.$page.'.md') ); }
php
public function sectionExists($version, $page) { return $this->files->exists( base_path(config('larecipe.docs.path').'/'.$version.'/'.$page.'.md') ); }
[ "public", "function", "sectionExists", "(", "$", "version", ",", "$", "page", ")", "{", "return", "$", "this", "->", "files", "->", "exists", "(", "base_path", "(", "config", "(", "'larecipe.docs.path'", ")", ".", "'/'", ".", "$", "version", ".", "'/'", ...
Check if the given section exists. @param string $version @param string $page @return bool
[ "Check", "if", "the", "given", "section", "exists", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/Models/Documentation.php#L110-L115
train
saleem-hadad/larecipe
src/Commands/AssetCommand.php
AssetCommand.runCommand
protected function runCommand($command, $path) { $process = (new Process($command, $path))->setTimeout(null); if ('\\' !== DIRECTORY_SEPARATOR && file_exists('/dev/tty') && is_readable('/dev/tty')) { $process->setTty(true); } $process->run(function ($type, $line) { ...
php
protected function runCommand($command, $path) { $process = (new Process($command, $path))->setTimeout(null); if ('\\' !== DIRECTORY_SEPARATOR && file_exists('/dev/tty') && is_readable('/dev/tty')) { $process->setTty(true); } $process->run(function ($type, $line) { ...
[ "protected", "function", "runCommand", "(", "$", "command", ",", "$", "path", ")", "{", "$", "process", "=", "(", "new", "Process", "(", "$", "command", ",", "$", "path", ")", ")", "->", "setTimeout", "(", "null", ")", ";", "if", "(", "'\\\\'", "!=...
Run the given command as a process. @param string $command @param string $path @return void
[ "Run", "the", "given", "command", "as", "a", "process", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/Commands/AssetCommand.php#L180-L191
train
saleem-hadad/larecipe
src/Commands/AssetCommand.php
AssetCommand.hasValidNameArgument
public function hasValidNameArgument() { $name = $this->argument('name'); if (! Str::contains($name, '/')) { $this->error("The name argument expects a vendor and name in 'Composer' format. Here's an example: `vendor/name`."); return false; } return true; ...
php
public function hasValidNameArgument() { $name = $this->argument('name'); if (! Str::contains($name, '/')) { $this->error("The name argument expects a vendor and name in 'Composer' format. Here's an example: `vendor/name`."); return false; } return true; ...
[ "public", "function", "hasValidNameArgument", "(", ")", "{", "$", "name", "=", "$", "this", "->", "argument", "(", "'name'", ")", ";", "if", "(", "!", "Str", "::", "contains", "(", "$", "name", ",", "'/'", ")", ")", "{", "$", "this", "->", "error",...
Determine if the name argument is valid. @return bool
[ "Determine", "if", "the", "name", "argument", "is", "valid", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/Commands/AssetCommand.php#L281-L292
train
saleem-hadad/larecipe
src/Commands/AssetCommand.php
AssetCommand.renameStubs
protected function renameStubs() { foreach ($this->stubsToRename() as $stub) { (new Filesystem)->move($stub, str_replace('.stub', '.php', $stub)); } }
php
protected function renameStubs() { foreach ($this->stubsToRename() as $stub) { (new Filesystem)->move($stub, str_replace('.stub', '.php', $stub)); } }
[ "protected", "function", "renameStubs", "(", ")", "{", "foreach", "(", "$", "this", "->", "stubsToRename", "(", ")", "as", "$", "stub", ")", "{", "(", "new", "Filesystem", ")", "->", "move", "(", "$", "stub", ",", "str_replace", "(", "'.stub'", ",", ...
Rename the stubs with PHP file extensions. @return void
[ "Rename", "the", "stubs", "with", "PHP", "file", "extensions", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/Commands/AssetCommand.php#L299-L304
train
saleem-hadad/larecipe
src/LaRecipeServiceProvider.php
LaRecipeServiceProvider.registerConsoleCommands
protected function registerConsoleCommands() { $this->commands(AssetCommand::class); $this->commands(ThemeCommand::class); $this->commands(InstallCommand::class); $this->commands(GenerateDocumentationCommand::class); }
php
protected function registerConsoleCommands() { $this->commands(AssetCommand::class); $this->commands(ThemeCommand::class); $this->commands(InstallCommand::class); $this->commands(GenerateDocumentationCommand::class); }
[ "protected", "function", "registerConsoleCommands", "(", ")", "{", "$", "this", "->", "commands", "(", "AssetCommand", "::", "class", ")", ";", "$", "this", "->", "commands", "(", "ThemeCommand", "::", "class", ")", ";", "$", "this", "->", "commands", "(",...
Register the commands accessible from the Console.
[ "Register", "the", "commands", "accessible", "from", "the", "Console", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/LaRecipeServiceProvider.php#L102-L108
train
saleem-hadad/larecipe
src/DocumentationRepository.php
DocumentationRepository.prepareNotFound
protected function prepareNotFound() { $this->title = 'Page not found'; $this->content = view('larecipe::partials.404'); $this->currentSection = ''; $this->canonical = ''; $this->statusCode = 404; return $this; }
php
protected function prepareNotFound() { $this->title = 'Page not found'; $this->content = view('larecipe::partials.404'); $this->currentSection = ''; $this->canonical = ''; $this->statusCode = 404; return $this; }
[ "protected", "function", "prepareNotFound", "(", ")", "{", "$", "this", "->", "title", "=", "'Page not found'", ";", "$", "this", "->", "content", "=", "view", "(", "'larecipe::partials.404'", ")", ";", "$", "this", "->", "currentSection", "=", "''", ";", ...
If the docs content is empty then show 404 page. @return $this
[ "If", "the", "docs", "content", "is", "empty", "then", "show", "404", "page", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/DocumentationRepository.php#L66-L75
train
saleem-hadad/larecipe
src/DocumentationRepository.php
DocumentationRepository.prepareTitle
protected function prepareTitle() { $this->title = (new Crawler($this->content))->filterXPath('//h1'); $this->title = count($this->title) ? $this->title->text() : null; return $this; }
php
protected function prepareTitle() { $this->title = (new Crawler($this->content))->filterXPath('//h1'); $this->title = count($this->title) ? $this->title->text() : null; return $this; }
[ "protected", "function", "prepareTitle", "(", ")", "{", "$", "this", "->", "title", "=", "(", "new", "Crawler", "(", "$", "this", "->", "content", ")", ")", "->", "filterXPath", "(", "'//h1'", ")", ";", "$", "this", "->", "title", "=", "count", "(", ...
Prepare the page title from the first h1 found. @return $this
[ "Prepare", "the", "page", "title", "from", "the", "first", "h1", "found", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/DocumentationRepository.php#L82-L88
train
saleem-hadad/larecipe
src/DocumentationRepository.php
DocumentationRepository.prepareSection
protected function prepareSection($version, $page) { if ($this->documentation->sectionExists($version, $page)) { $this->currentSection = '/'.$page; } return $this; }
php
protected function prepareSection($version, $page) { if ($this->documentation->sectionExists($version, $page)) { $this->currentSection = '/'.$page; } return $this; }
[ "protected", "function", "prepareSection", "(", "$", "version", ",", "$", "page", ")", "{", "if", "(", "$", "this", "->", "documentation", "->", "sectionExists", "(", "$", "version", ",", "$", "page", ")", ")", "{", "$", "this", "->", "currentSection", ...
Prepare the current section page. @param $version @param $page @return $this
[ "Prepare", "the", "current", "section", "page", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/DocumentationRepository.php#L97-L104
train
saleem-hadad/larecipe
src/DocumentationRepository.php
DocumentationRepository.prepareCanonical
protected function prepareCanonical() { if ($this->documentation->sectionExists($this->defaultVersion, $this->sectionPage)) { $this->canonical = $this->docsRoute.'/'.$this->defaultVersion.'/'.$this->sectionPage; } return $this; }
php
protected function prepareCanonical() { if ($this->documentation->sectionExists($this->defaultVersion, $this->sectionPage)) { $this->canonical = $this->docsRoute.'/'.$this->defaultVersion.'/'.$this->sectionPage; } return $this; }
[ "protected", "function", "prepareCanonical", "(", ")", "{", "if", "(", "$", "this", "->", "documentation", "->", "sectionExists", "(", "$", "this", "->", "defaultVersion", ",", "$", "this", "->", "sectionPage", ")", ")", "{", "$", "this", "->", "canonical"...
Prepare the canonical link. @return $this
[ "Prepare", "the", "canonical", "link", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/DocumentationRepository.php#L111-L118
train
saleem-hadad/larecipe
src/Commands/GenerateDocumentationCommand.php
GenerateDocumentationCommand.createVersionDirectory
protected function createVersionDirectory($versionDirectory) { if (! $this->filesystem->isDirectory($versionDirectory)) { $this->filesystem->makeDirectory($versionDirectory, 0755, true); return true; } return false; }
php
protected function createVersionDirectory($versionDirectory) { if (! $this->filesystem->isDirectory($versionDirectory)) { $this->filesystem->makeDirectory($versionDirectory, 0755, true); return true; } return false; }
[ "protected", "function", "createVersionDirectory", "(", "$", "versionDirectory", ")", "{", "if", "(", "!", "$", "this", "->", "filesystem", "->", "isDirectory", "(", "$", "versionDirectory", ")", ")", "{", "$", "this", "->", "filesystem", "->", "makeDirectory"...
Create a new directory for the given version if not exists. @return bool
[ "Create", "a", "new", "directory", "for", "the", "given", "version", "if", "not", "exists", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/Commands/GenerateDocumentationCommand.php#L90-L99
train
saleem-hadad/larecipe
src/Commands/GenerateDocumentationCommand.php
GenerateDocumentationCommand.createVersionIndex
protected function createVersionIndex($versionDirectory) { $indexPath = $versionDirectory.'/index.md'; if (! $this->filesystem->exists($indexPath)) { $content = $this->generateIndexContent($this->getStub('index')); $this->filesystem->put($indexPath, $content); r...
php
protected function createVersionIndex($versionDirectory) { $indexPath = $versionDirectory.'/index.md'; if (! $this->filesystem->exists($indexPath)) { $content = $this->generateIndexContent($this->getStub('index')); $this->filesystem->put($indexPath, $content); r...
[ "protected", "function", "createVersionIndex", "(", "$", "versionDirectory", ")", "{", "$", "indexPath", "=", "$", "versionDirectory", ".", "'/index.md'", ";", "if", "(", "!", "$", "this", "->", "filesystem", "->", "exists", "(", "$", "indexPath", ")", ")", ...
Create index.md for the given version if it's not exists. @param $versionDirectory @return bool @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
[ "Create", "index", ".", "md", "for", "the", "given", "version", "if", "it", "s", "not", "exists", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/Commands/GenerateDocumentationCommand.php#L108-L120
train
saleem-hadad/larecipe
src/Commands/GenerateDocumentationCommand.php
GenerateDocumentationCommand.generateIndexContent
protected function generateIndexContent($stub) { $content = str_replace( '{{LANDING}}', ucwords(config('larecipe.docs.landing')), $stub ); $content = str_replace( '{{ROOT}}', config('larecipe.docs.route'), $content ...
php
protected function generateIndexContent($stub) { $content = str_replace( '{{LANDING}}', ucwords(config('larecipe.docs.landing')), $stub ); $content = str_replace( '{{ROOT}}', config('larecipe.docs.route'), $content ...
[ "protected", "function", "generateIndexContent", "(", "$", "stub", ")", "{", "$", "content", "=", "str_replace", "(", "'{{LANDING}}'", ",", "ucwords", "(", "config", "(", "'larecipe.docs.landing'", ")", ")", ",", "$", "stub", ")", ";", "$", "content", "=", ...
replace stub placeholders. @return string
[ "replace", "stub", "placeholders", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/Commands/GenerateDocumentationCommand.php#L148-L169
train
saleem-hadad/larecipe
src/Cache.php
Cache.checkTtlNeedsChanged
public function checkTtlNeedsChanged($ttl) { $app_version = explode('.', app()->version()); if (((int) $app_version[0] == 5 && (int) $app_version[1] >= 8) || $app_version[0] > 5) { return config('larecipe.cache.period') * 60; } return $ttl; }
php
public function checkTtlNeedsChanged($ttl) { $app_version = explode('.', app()->version()); if (((int) $app_version[0] == 5 && (int) $app_version[1] >= 8) || $app_version[0] > 5) { return config('larecipe.cache.period') * 60; } return $ttl; }
[ "public", "function", "checkTtlNeedsChanged", "(", "$", "ttl", ")", "{", "$", "app_version", "=", "explode", "(", "'.'", ",", "app", "(", ")", "->", "version", "(", ")", ")", ";", "if", "(", "(", "(", "int", ")", "$", "app_version", "[", "0", "]", ...
Checks if minutes need to be changed to seconds @param $ttl @return float|int
[ "Checks", "if", "minutes", "need", "to", "be", "changed", "to", "seconds" ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/Cache.php#L51-L60
train
saleem-hadad/larecipe
src/Traits/HasBladeParser.php
HasBladeParser.renderBlade
public function renderBlade($content, $data = []) { $content = $this->compileBlade($content); $obLevel = ob_get_level(); ob_start(); extract($data, EXTR_SKIP); try { eval('?'.'>'.$content); } catch (\Exception $e) { while (ob_get_level() > $ob...
php
public function renderBlade($content, $data = []) { $content = $this->compileBlade($content); $obLevel = ob_get_level(); ob_start(); extract($data, EXTR_SKIP); try { eval('?'.'>'.$content); } catch (\Exception $e) { while (ob_get_level() > $ob...
[ "public", "function", "renderBlade", "(", "$", "content", ",", "$", "data", "=", "[", "]", ")", "{", "$", "content", "=", "$", "this", "->", "compileBlade", "(", "$", "content", ")", ";", "$", "obLevel", "=", "ob_get_level", "(", ")", ";", "ob_start"...
Render markdown contain blade syntax. @param $content @param array $data @return false|string @throws \Exception
[ "Render", "markdown", "contain", "blade", "syntax", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/Traits/HasBladeParser.php#L17-L41
train
saleem-hadad/larecipe
src/Commands/ThemeCommand.php
ThemeCommand.addThemeRepositoryToRootComposer
protected function addThemeRepositoryToRootComposer() { $composer = json_decode(file_get_contents(base_path('composer.json')), true); $composer['repositories'][] = [ 'type' => 'path', 'url' => './'.$this->relativeThemePath(), ]; file_put_contents( ...
php
protected function addThemeRepositoryToRootComposer() { $composer = json_decode(file_get_contents(base_path('composer.json')), true); $composer['repositories'][] = [ 'type' => 'path', 'url' => './'.$this->relativeThemePath(), ]; file_put_contents( ...
[ "protected", "function", "addThemeRepositoryToRootComposer", "(", ")", "{", "$", "composer", "=", "json_decode", "(", "file_get_contents", "(", "base_path", "(", "'composer.json'", ")", ")", ",", "true", ")", ";", "$", "composer", "[", "'repositories'", "]", "["...
Add a path repository for the theme to the application's composer.json file. @return void
[ "Add", "a", "path", "repository", "for", "the", "theme", "to", "the", "application", "s", "composer", ".", "json", "file", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/Commands/ThemeCommand.php#L80-L93
train
saleem-hadad/larecipe
src/Commands/ThemeCommand.php
ThemeCommand.addThemePackageToRootComposer
protected function addThemePackageToRootComposer() { $composer = json_decode(file_get_contents(base_path('composer.json')), true); $composer['require'][$this->argument('name')] = '*'; file_put_contents( base_path('composer.json'), json_encode($composer, JSON_PRETTY_...
php
protected function addThemePackageToRootComposer() { $composer = json_decode(file_get_contents(base_path('composer.json')), true); $composer['require'][$this->argument('name')] = '*'; file_put_contents( base_path('composer.json'), json_encode($composer, JSON_PRETTY_...
[ "protected", "function", "addThemePackageToRootComposer", "(", ")", "{", "$", "composer", "=", "json_decode", "(", "file_get_contents", "(", "base_path", "(", "'composer.json'", ")", ")", ",", "true", ")", ";", "$", "composer", "[", "'require'", "]", "[", "$",...
Add a package entry for the theme to the application's composer.json file. @return void
[ "Add", "a", "package", "entry", "for", "the", "theme", "to", "the", "application", "s", "composer", ".", "json", "file", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/Commands/ThemeCommand.php#L100-L110
train
saleem-hadad/larecipe
src/Http/Controllers/DocumentationController.php
DocumentationController.show
public function show($version, $page = null) { $documentation = $this->documentationRepository->get($version, $page); if (Gate::has('viewLarecipe')) { $this->authorize('viewLarecipe', $documentation); } if ($this->documentationRepository->isNotPublishedVersion($version)...
php
public function show($version, $page = null) { $documentation = $this->documentationRepository->get($version, $page); if (Gate::has('viewLarecipe')) { $this->authorize('viewLarecipe', $documentation); } if ($this->documentationRepository->isNotPublishedVersion($version)...
[ "public", "function", "show", "(", "$", "version", ",", "$", "page", "=", "null", ")", "{", "$", "documentation", "=", "$", "this", "->", "documentationRepository", "->", "get", "(", "$", "version", ",", "$", "page", ")", ";", "if", "(", "Gate", "::"...
Show a documentation page. @param $version @param null $page @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response|\Illuminate\Routing\Redirector @throws \Illuminate\Auth\Access\AuthorizationException
[ "Show", "a", "documentation", "page", "." ]
d59a639c633cd51fbcc7f607db1513a04f93d213
https://github.com/saleem-hadad/larecipe/blob/d59a639c633cd51fbcc7f607db1513a04f93d213/src/Http/Controllers/DocumentationController.php#L52-L79
train
spatie/laravel-analytics
src/AnalyticsClient.php
AnalyticsClient.performQuery
public function performQuery(string $viewId, DateTime $startDate, DateTime $endDate, string $metrics, array $others = []) { $cacheName = $this->determineCacheName(func_get_args()); if ($this->cacheLifeTimeInMinutes == 0) { $this->cache->forget($cacheName); } return $thi...
php
public function performQuery(string $viewId, DateTime $startDate, DateTime $endDate, string $metrics, array $others = []) { $cacheName = $this->determineCacheName(func_get_args()); if ($this->cacheLifeTimeInMinutes == 0) { $this->cache->forget($cacheName); } return $thi...
[ "public", "function", "performQuery", "(", "string", "$", "viewId", ",", "DateTime", "$", "startDate", ",", "DateTime", "$", "endDate", ",", "string", "$", "metrics", ",", "array", "$", "others", "=", "[", "]", ")", "{", "$", "cacheName", "=", "$", "th...
Query the Google Analytics Service with given parameters. @param string $viewId @param \DateTime $startDate @param \DateTime $endDate @param string $metrics @param array $others @return array|null
[ "Query", "the", "Google", "Analytics", "Service", "with", "given", "parameters", "." ]
368ec15bd8b15f5c435e5d89d4898cf03e33b635
https://github.com/spatie/laravel-analytics/blob/368ec15bd8b15f5c435e5d89d4898cf03e33b635/src/AnalyticsClient.php#L52-L89
train
spatie/laravel-analytics
src/Analytics.php
Analytics.performQuery
public function performQuery(Period $period, string $metrics, array $others = []) { return $this->client->performQuery( $this->viewId, $period->startDate, $period->endDate, $metrics, $others ); }
php
public function performQuery(Period $period, string $metrics, array $others = []) { return $this->client->performQuery( $this->viewId, $period->startDate, $period->endDate, $metrics, $others ); }
[ "public", "function", "performQuery", "(", "Period", "$", "period", ",", "string", "$", "metrics", ",", "array", "$", "others", "=", "[", "]", ")", "{", "return", "$", "this", "->", "client", "->", "performQuery", "(", "$", "this", "->", "viewId", ",",...
Call the query method on the authenticated client. @param Period $period @param string $metrics @param array $others @return array|null
[ "Call", "the", "query", "method", "on", "the", "authenticated", "client", "." ]
368ec15bd8b15f5c435e5d89d4898cf03e33b635
https://github.com/spatie/laravel-analytics/blob/368ec15bd8b15f5c435e5d89d4898cf03e33b635/src/Analytics.php#L181-L190
train
smalot/pdfparser
src/Smalot/PdfParser/Header.php
Header.getElements
public function getElements() { foreach ($this->elements as $name => $element) { $this->resolveXRef($name); } return $this->elements; }
php
public function getElements() { foreach ($this->elements as $name => $element) { $this->resolveXRef($name); } return $this->elements; }
[ "public", "function", "getElements", "(", ")", "{", "foreach", "(", "$", "this", "->", "elements", "as", "$", "name", "=>", "$", "element", ")", "{", "$", "this", "->", "resolveXRef", "(", "$", "name", ")", ";", "}", "return", "$", "this", "->", "e...
Returns all elements. @return mixed
[ "Returns", "all", "elements", "." ]
0c85b15e6950a2c6be44db680cb136792a715d94
https://github.com/smalot/pdfparser/blob/0c85b15e6950a2c6be44db680cb136792a715d94/src/Smalot/PdfParser/Header.php#L70-L77
train
smalot/pdfparser
src/Smalot/PdfParser/Header.php
Header.getElementTypes
public function getElementTypes() { $types = array(); foreach ($this->elements as $key => $element) { $types[$key] = get_class($element); } return $types; }
php
public function getElementTypes() { $types = array(); foreach ($this->elements as $key => $element) { $types[$key] = get_class($element); } return $types; }
[ "public", "function", "getElementTypes", "(", ")", "{", "$", "types", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "elements", "as", "$", "key", "=>", "$", "element", ")", "{", "$", "types", "[", "$", "key", "]", "=", "get_class"...
Used only for debug. @return array
[ "Used", "only", "for", "debug", "." ]
0c85b15e6950a2c6be44db680cb136792a715d94
https://github.com/smalot/pdfparser/blob/0c85b15e6950a2c6be44db680cb136792a715d94/src/Smalot/PdfParser/Header.php#L84-L93
train
smalot/pdfparser
src/Smalot/PdfParser/Header.php
Header.resolveXRef
protected function resolveXRef($name) { if (($obj = $this->elements[$name]) instanceof ElementXRef && !is_null($this->document)) { /** @var ElementXRef $obj */ $object = $this->document->getObjectById($obj->getId()); if (is_null($object)) { return new Ele...
php
protected function resolveXRef($name) { if (($obj = $this->elements[$name]) instanceof ElementXRef && !is_null($this->document)) { /** @var ElementXRef $obj */ $object = $this->document->getObjectById($obj->getId()); if (is_null($object)) { return new Ele...
[ "protected", "function", "resolveXRef", "(", "$", "name", ")", "{", "if", "(", "(", "$", "obj", "=", "$", "this", "->", "elements", "[", "$", "name", "]", ")", "instanceof", "ElementXRef", "&&", "!", "is_null", "(", "$", "this", "->", "document", ")"...
Resolve XRef to object. @param string $name @return Element|PDFObject @throws \Exception
[ "Resolve", "XRef", "to", "object", "." ]
0c85b15e6950a2c6be44db680cb136792a715d94
https://github.com/smalot/pdfparser/blob/0c85b15e6950a2c6be44db680cb136792a715d94/src/Smalot/PdfParser/Header.php#L160-L175
train
smalot/pdfparser
src/Smalot/PdfParser/Page.php
Page.getXObjects
public function getXObjects() { if (!is_null($this->xobjects)) { return $this->xobjects; } $resources = $this->get('Resources'); if (method_exists($resources, 'has') && $resources->has('XObject')) { if ($resources->get('XObject') instanceof Header) { ...
php
public function getXObjects() { if (!is_null($this->xobjects)) { return $this->xobjects; } $resources = $this->get('Resources'); if (method_exists($resources, 'has') && $resources->has('XObject')) { if ($resources->get('XObject') instanceof Header) { ...
[ "public", "function", "getXObjects", "(", ")", "{", "if", "(", "!", "is_null", "(", "$", "this", "->", "xobjects", ")", ")", "{", "return", "$", "this", "->", "xobjects", ";", "}", "$", "resources", "=", "$", "this", "->", "get", "(", "'Resources'", ...
Support for XObject @return PDFObject[]
[ "Support", "for", "XObject" ]
0c85b15e6950a2c6be44db680cb136792a715d94
https://github.com/smalot/pdfparser/blob/0c85b15e6950a2c6be44db680cb136792a715d94/src/Smalot/PdfParser/Page.php#L121-L153
train
smalot/pdfparser
src/Smalot/PdfParser/Document.php
Document.buildDictionary
protected function buildDictionary() { // Build dictionary. $this->dictionary = array(); foreach ($this->objects as $id => $object) { $type = $object->getHeader()->get('Type')->getContent(); if (!empty($type)) { $this->dictionary[$type][$id] = $id; ...
php
protected function buildDictionary() { // Build dictionary. $this->dictionary = array(); foreach ($this->objects as $id => $object) { $type = $object->getHeader()->get('Type')->getContent(); if (!empty($type)) { $this->dictionary[$type][$id] = $id; ...
[ "protected", "function", "buildDictionary", "(", ")", "{", "// Build dictionary.", "$", "this", "->", "dictionary", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "objects", "as", "$", "id", "=>", "$", "object", ")", "{", "$", "type", ...
Build dictionary based on type header field.
[ "Build", "dictionary", "based", "on", "type", "header", "field", "." ]
0c85b15e6950a2c6be44db680cb136792a715d94
https://github.com/smalot/pdfparser/blob/0c85b15e6950a2c6be44db680cb136792a715d94/src/Smalot/PdfParser/Document.php#L97-L109
train
smalot/pdfparser
src/Smalot/PdfParser/Document.php
Document.buildDetails
protected function buildDetails() { // Build details array. $details = array(); // Extract document info if ($this->trailer->has('Info')) { /** @var PDFObject $info */ $info = $this->trailer->get('Info'); // This could be an ElementMissing object,...
php
protected function buildDetails() { // Build details array. $details = array(); // Extract document info if ($this->trailer->has('Info')) { /** @var PDFObject $info */ $info = $this->trailer->get('Info'); // This could be an ElementMissing object,...
[ "protected", "function", "buildDetails", "(", ")", "{", "// Build details array.", "$", "details", "=", "array", "(", ")", ";", "// Extract document info", "if", "(", "$", "this", "->", "trailer", "->", "has", "(", "'Info'", ")", ")", "{", "/** @var PDFObject ...
Build details array.
[ "Build", "details", "array", "." ]
0c85b15e6950a2c6be44db680cb136792a715d94
https://github.com/smalot/pdfparser/blob/0c85b15e6950a2c6be44db680cb136792a715d94/src/Smalot/PdfParser/Document.php#L114-L139
train
kiddyuchina/Beanbun
src/Lib/BloomFilter.php
BloomFilter.positions
protected function positions($value) { mt_srand(crc32($value)); $positions = new SplFixedArray($this->k); for ($i = 0; $i < $this->k; $i++) { $positions[$i] = mt_rand(1, $this->m); } return $positions; }
php
protected function positions($value) { mt_srand(crc32($value)); $positions = new SplFixedArray($this->k); for ($i = 0; $i < $this->k; $i++) { $positions[$i] = mt_rand(1, $this->m); } return $positions; }
[ "protected", "function", "positions", "(", "$", "value", ")", "{", "mt_srand", "(", "crc32", "(", "$", "value", ")", ")", ";", "$", "positions", "=", "new", "SplFixedArray", "(", "$", "this", "->", "k", ")", ";", "for", "(", "$", "i", "=", "0", "...
Calculates the positions a value hashes to in the bitfield. @param string $value The value to insert into the bitfield. @return SplFixedArray Array containing the numeric positions in the bitfield.
[ "Calculates", "the", "positions", "a", "value", "hashes", "to", "in", "the", "bitfield", "." ]
696a9681b7bc0425af7a783176dad43ab613fdc8
https://github.com/kiddyuchina/Beanbun/blob/696a9681b7bc0425af7a783176dad43ab613fdc8/src/Lib/BloomFilter.php#L120-L128
train
kiddyuchina/Beanbun
src/Lib/BloomFilter.php
BloomFilter.add
public function add($value) { foreach ($this->positions($value) as $position) { $this->setBitAtPosition($position); } }
php
public function add($value) { foreach ($this->positions($value) as $position) { $this->setBitAtPosition($position); } }
[ "public", "function", "add", "(", "$", "value", ")", "{", "foreach", "(", "$", "this", "->", "positions", "(", "$", "value", ")", "as", "$", "position", ")", "{", "$", "this", "->", "setBitAtPosition", "(", "$", "position", ")", ";", "}", "}" ]
Add a value into the set. @param string $value
[ "Add", "a", "value", "into", "the", "set", "." ]
696a9681b7bc0425af7a783176dad43ab613fdc8
https://github.com/kiddyuchina/Beanbun/blob/696a9681b7bc0425af7a783176dad43ab613fdc8/src/Lib/BloomFilter.php#L135-L140
train
kiddyuchina/Beanbun
src/Lib/BloomFilter.php
BloomFilter.maybeInSet
public function maybeInSet($value) { foreach ($this->positions($value) as $position) { if (!$this->getBitAtPosition($position)) { return false; } } return true; }
php
public function maybeInSet($value) { foreach ($this->positions($value) as $position) { if (!$this->getBitAtPosition($position)) { return false; } } return true; }
[ "public", "function", "maybeInSet", "(", "$", "value", ")", "{", "foreach", "(", "$", "this", "->", "positions", "(", "$", "value", ")", "as", "$", "position", ")", "{", "if", "(", "!", "$", "this", "->", "getBitAtPosition", "(", "$", "position", ")"...
Checks if the value may have been added to the set before. False positives are possible, false negatives are not. @param string $value @return boolean
[ "Checks", "if", "the", "value", "may", "have", "been", "added", "to", "the", "set", "before", ".", "False", "positives", "are", "possible", "false", "negatives", "are", "not", "." ]
696a9681b7bc0425af7a783176dad43ab613fdc8
https://github.com/kiddyuchina/Beanbun/blob/696a9681b7bc0425af7a783176dad43ab613fdc8/src/Lib/BloomFilter.php#L149-L157
train
kiddyuchina/Beanbun
src/Lib/BloomFilter.php
BloomFilter.showBitField
public function showBitField() { return join(array_map(function ($chr) {return str_pad(base_convert(bin2hex($chr), 16, 2), 8, '0', STR_PAD_LEFT);}, str_split($this->bitField))); }
php
public function showBitField() { return join(array_map(function ($chr) {return str_pad(base_convert(bin2hex($chr), 16, 2), 8, '0', STR_PAD_LEFT);}, str_split($this->bitField))); }
[ "public", "function", "showBitField", "(", ")", "{", "return", "join", "(", "array_map", "(", "function", "(", "$", "chr", ")", "{", "return", "str_pad", "(", "base_convert", "(", "bin2hex", "(", "$", "chr", ")", ",", "16", ",", "2", ")", ",", "8", ...
Returns an ASCII representation of the current bit field. @return string
[ "Returns", "an", "ASCII", "representation", "of", "the", "current", "bit", "field", "." ]
696a9681b7bc0425af7a783176dad43ab613fdc8
https://github.com/kiddyuchina/Beanbun/blob/696a9681b7bc0425af7a783176dad43ab613fdc8/src/Lib/BloomFilter.php#L164-L167
train
kiddyuchina/Beanbun
src/Lib/Client.php
Client.getConnection
protected function getConnection($key) { $offset = crc32($key) % count($this->_globalServers); if ($offset < 0) { $offset = -$offset; } if (!isset($this->_globalConnections[$offset]) || feof($this->_globalConnections[$offset])) { $connection = stream_socket_c...
php
protected function getConnection($key) { $offset = crc32($key) % count($this->_globalServers); if ($offset < 0) { $offset = -$offset; } if (!isset($this->_globalConnections[$offset]) || feof($this->_globalConnections[$offset])) { $connection = stream_socket_c...
[ "protected", "function", "getConnection", "(", "$", "key", ")", "{", "$", "offset", "=", "crc32", "(", "$", "key", ")", "%", "count", "(", "$", "this", "->", "_globalServers", ")", ";", "if", "(", "$", "offset", "<", "0", ")", "{", "$", "offset", ...
Connect to global server. @throws \Exception
[ "Connect", "to", "global", "server", "." ]
696a9681b7bc0425af7a783176dad43ab613fdc8
https://github.com/kiddyuchina/Beanbun/blob/696a9681b7bc0425af7a783176dad43ab613fdc8/src/Lib/Client.php#L56-L81
train
kiddyuchina/Beanbun
src/Lib/Client.php
Client.writeToRemote
protected function writeToRemote($data, $connection) { $buffer = serialize($data); $buffer = pack('N', 4 + strlen($buffer)) . $buffer; $len = fwrite($connection, $buffer); if ($len !== strlen($buffer)) { throw new \Exception('writeToRemote fail'); } }
php
protected function writeToRemote($data, $connection) { $buffer = serialize($data); $buffer = pack('N', 4 + strlen($buffer)) . $buffer; $len = fwrite($connection, $buffer); if ($len !== strlen($buffer)) { throw new \Exception('writeToRemote fail'); } }
[ "protected", "function", "writeToRemote", "(", "$", "data", ",", "$", "connection", ")", "{", "$", "buffer", "=", "serialize", "(", "$", "data", ")", ";", "$", "buffer", "=", "pack", "(", "'N'", ",", "4", "+", "strlen", "(", "$", "buffer", ")", ")"...
Write data to global server. @param string $buffer
[ "Write", "data", "to", "global", "server", "." ]
696a9681b7bc0425af7a783176dad43ab613fdc8
https://github.com/kiddyuchina/Beanbun/blob/696a9681b7bc0425af7a783176dad43ab613fdc8/src/Lib/Client.php#L406-L414
train
kiddyuchina/Beanbun
src/Lib/Client.php
Client.readFromRemote
protected function readFromRemote($connection) { $all_buffer = ''; $total_len = 4; $head_read = false; while (1) { $buffer = fread($connection, 8192); if ($buffer === '' || $buffer === false) { throw new \Exception('readFromRemote fail'); ...
php
protected function readFromRemote($connection) { $all_buffer = ''; $total_len = 4; $head_read = false; while (1) { $buffer = fread($connection, 8192); if ($buffer === '' || $buffer === false) { throw new \Exception('readFromRemote fail'); ...
[ "protected", "function", "readFromRemote", "(", "$", "connection", ")", "{", "$", "all_buffer", "=", "''", ";", "$", "total_len", "=", "4", ";", "$", "head_read", "=", "false", ";", "while", "(", "1", ")", "{", "$", "buffer", "=", "fread", "(", "$", ...
Read data from global server. @throws Exception
[ "Read", "data", "from", "global", "server", "." ]
696a9681b7bc0425af7a783176dad43ab613fdc8
https://github.com/kiddyuchina/Beanbun/blob/696a9681b7bc0425af7a783176dad43ab613fdc8/src/Lib/Client.php#L420-L445
train
acquia/blt
src/Robo/Commands/Composer/ComposerCommand.php
ComposerCommand.requirePackage
public function requirePackage($package_name, $package_version, $options = ['dev' => FALSE]) { /** @var \Robo\Task\Composer\RequireDependency $task */ $task = $this->taskComposerRequire() ->printOutput(TRUE) ->printMetadata(TRUE) ->dir($this->getConfigValue('repo.root')) ->interactive($...
php
public function requirePackage($package_name, $package_version, $options = ['dev' => FALSE]) { /** @var \Robo\Task\Composer\RequireDependency $task */ $task = $this->taskComposerRequire() ->printOutput(TRUE) ->printMetadata(TRUE) ->dir($this->getConfigValue('repo.root')) ->interactive($...
[ "public", "function", "requirePackage", "(", "$", "package_name", ",", "$", "package_version", ",", "$", "options", "=", "[", "'dev'", "=>", "FALSE", "]", ")", "{", "/** @var \\Robo\\Task\\Composer\\RequireDependency $task */", "$", "task", "=", "$", "this", "->",...
Requires a composer package. @command internal:composer:require @hidden @option dev Whether package should be added to require-dev.
[ "Requires", "a", "composer", "package", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Composer/ComposerCommand.php#L22-L71
train
acquia/blt
src/Robo/Hooks/InteractHook.php
InteractHook.interactGenerateSettingsFiles
public function interactGenerateSettingsFiles( InputInterface $input, OutputInterface $output, AnnotationData $annotationData ) { /** @var \Acquia\Blt\Robo\Wizards\SetupWizard $setup_wizard */ $setup_wizard = $this->getContainer()->get(SetupWizard::class); $setup_wizard->wizardGenerateSettings...
php
public function interactGenerateSettingsFiles( InputInterface $input, OutputInterface $output, AnnotationData $annotationData ) { /** @var \Acquia\Blt\Robo\Wizards\SetupWizard $setup_wizard */ $setup_wizard = $this->getContainer()->get(SetupWizard::class); $setup_wizard->wizardGenerateSettings...
[ "public", "function", "interactGenerateSettingsFiles", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ",", "AnnotationData", "$", "annotationData", ")", "{", "/** @var \\Acquia\\Blt\\Robo\\Wizards\\SetupWizard $setup_wizard */", "$", "setup_wizard",...
Runs wizard for generating settings files. @hook interact @interactGenerateSettingsFiles
[ "Runs", "wizard", "for", "generating", "settings", "files", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Hooks/InteractHook.php#L40-L48
train
acquia/blt
src/Robo/Hooks/InteractHook.php
InteractHook.interactInstallDrupal
public function interactInstallDrupal( InputInterface $input, OutputInterface $output, AnnotationData $annotationData ) { /** @var \Acquia\Blt\Robo\Wizards\SetupWizard $setup_wizard */ $setup_wizard = $this->getContainer()->get(SetupWizard::class); $setup_wizard->wizardInstallDrupal(); }
php
public function interactInstallDrupal( InputInterface $input, OutputInterface $output, AnnotationData $annotationData ) { /** @var \Acquia\Blt\Robo\Wizards\SetupWizard $setup_wizard */ $setup_wizard = $this->getContainer()->get(SetupWizard::class); $setup_wizard->wizardInstallDrupal(); }
[ "public", "function", "interactInstallDrupal", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ",", "AnnotationData", "$", "annotationData", ")", "{", "/** @var \\Acquia\\Blt\\Robo\\Wizards\\SetupWizard $setup_wizard */", "$", "setup_wizard", "=", ...
Runs wizard for installing Drupal. @hook interact @interactInstallDrupal
[ "Runs", "wizard", "for", "installing", "Drupal", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Hooks/InteractHook.php#L55-L63
train
acquia/blt
src/Robo/Hooks/InteractHook.php
InteractHook.interactConfigureBehat
public function interactConfigureBehat( InputInterface $input, OutputInterface $output, AnnotationData $annotationData ) { /** @var \Acquia\Blt\Robo\Wizards\TestsWizard $tests_wizard */ $tests_wizard = $this->getContainer()->get(TestsWizard::class); $tests_wizard->wizardConfigureBehat(); }
php
public function interactConfigureBehat( InputInterface $input, OutputInterface $output, AnnotationData $annotationData ) { /** @var \Acquia\Blt\Robo\Wizards\TestsWizard $tests_wizard */ $tests_wizard = $this->getContainer()->get(TestsWizard::class); $tests_wizard->wizardConfigureBehat(); }
[ "public", "function", "interactConfigureBehat", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ",", "AnnotationData", "$", "annotationData", ")", "{", "/** @var \\Acquia\\Blt\\Robo\\Wizards\\TestsWizard $tests_wizard */", "$", "tests_wizard", "=",...
Runs wizard for configuring Behat. @hook interact @interactConfigureBehat
[ "Runs", "wizard", "for", "configuring", "Behat", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Hooks/InteractHook.php#L70-L78
train
acquia/blt
src/Robo/Hooks/InteractHook.php
InteractHook.interactExecuteUpdates
public function interactExecuteUpdates( InputInterface $input, OutputInterface $output, AnnotationData $annotationData ) { if ($this->invokeDepth == 0 && $input->getFirstArgument() != 'blt:update' && $input->getFirstArgument() != 'update' && !$this->getInspector()->isSchemaVersionUpT...
php
public function interactExecuteUpdates( InputInterface $input, OutputInterface $output, AnnotationData $annotationData ) { if ($this->invokeDepth == 0 && $input->getFirstArgument() != 'blt:update' && $input->getFirstArgument() != 'update' && !$this->getInspector()->isSchemaVersionUpT...
[ "public", "function", "interactExecuteUpdates", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ",", "AnnotationData", "$", "annotationData", ")", "{", "if", "(", "$", "this", "->", "invokeDepth", "==", "0", "&&", "$", "input", "->"...
Executes outstanding updates. @hook interact *
[ "Executes", "outstanding", "updates", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Hooks/InteractHook.php#L85-L103
train
acquia/blt
src/Robo/Hooks/InteractHook.php
InteractHook.interactConfigIdentical
public function interactConfigIdentical( InputInterface $input, OutputInterface $output, AnnotationData $annotationData ) { $cm_strategies = [ 'config-split', 'core-only', ]; if (in_array($this->getConfigValue('cm.strategy'), $cm_strategies) && $this->getInspector()->isDrupalInstal...
php
public function interactConfigIdentical( InputInterface $input, OutputInterface $output, AnnotationData $annotationData ) { $cm_strategies = [ 'config-split', 'core-only', ]; if (in_array($this->getConfigValue('cm.strategy'), $cm_strategies) && $this->getInspector()->isDrupalInstal...
[ "public", "function", "interactConfigIdentical", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ",", "AnnotationData", "$", "annotationData", ")", "{", "$", "cm_strategies", "=", "[", "'config-split'", ",", "'core-only'", ",", "]", ";"...
Prompts user to confirm overwrite of active config on blt setup. @hook interact @interactConfigIdentical
[ "Prompts", "user", "to", "confirm", "overwrite", "of", "active", "config", "on", "blt", "setup", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Hooks/InteractHook.php#L110-L133
train
acquia/blt
src/Robo/Commands/Doctor/NodeCheck.php
NodeCheck.checkNodeVersionFileExists
protected function checkNodeVersionFileExists() { if (file_exists($this->getConfigValue('repo.root') . '/.nvmrc')) { $this->logProblem(__FUNCTION__, ".nvmrc file exists", 'info'); } elseif (file_exists($this->getConfigValue('repo.root') . '/.node-version')) { $this->logProblem(__FUNCTION__, ".no...
php
protected function checkNodeVersionFileExists() { if (file_exists($this->getConfigValue('repo.root') . '/.nvmrc')) { $this->logProblem(__FUNCTION__, ".nvmrc file exists", 'info'); } elseif (file_exists($this->getConfigValue('repo.root') . '/.node-version')) { $this->logProblem(__FUNCTION__, ".no...
[ "protected", "function", "checkNodeVersionFileExists", "(", ")", "{", "if", "(", "file_exists", "(", "$", "this", "->", "getConfigValue", "(", "'repo.root'", ")", ".", "'/.nvmrc'", ")", ")", "{", "$", "this", "->", "logProblem", "(", "__FUNCTION__", ",", "\"...
Checks that one of .nvmrc or .node-version exists in repo root.
[ "Checks", "that", "one", "of", ".", "nvmrc", "or", ".", "node", "-", "version", "exists", "in", "repo", "root", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Doctor/NodeCheck.php#L17-L27
train
acquia/blt
src/Robo/Commands/Setup/ImportCommand.php
ImportCommand.import
public function import() { $task = $this->taskDrush() ->drush('sql-drop') ->drush('sql-cli < ' . $this->getConfigValue('setup.dump-file')); $result = $task->run(); $exit_code = $result->getExitCode(); if ($exit_code) { throw new BltException("Unable to import setup.dump-file."); }...
php
public function import() { $task = $this->taskDrush() ->drush('sql-drop') ->drush('sql-cli < ' . $this->getConfigValue('setup.dump-file')); $result = $task->run(); $exit_code = $result->getExitCode(); if ($exit_code) { throw new BltException("Unable to import setup.dump-file."); }...
[ "public", "function", "import", "(", ")", "{", "$", "task", "=", "$", "this", "->", "taskDrush", "(", ")", "->", "drush", "(", "'sql-drop'", ")", "->", "drush", "(", "'sql-cli < '", ".", "$", "this", "->", "getConfigValue", "(", "'setup.dump-file'", ")",...
Imports a .sql file into the Drupal database. @command drupal:sql:import @aliases dsi @validateDrushConfig @executeInVm
[ "Imports", "a", ".", "sql", "file", "into", "the", "Drupal", "database", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Setup/ImportCommand.php#L23-L33
train
acquia/blt
src/Robo/Commands/Generate/MultisiteCommand.php
MultisiteCommand.generate
public function generate($options = [ 'site-dir' => InputOption::VALUE_REQUIRED, 'site-uri' => InputOption::VALUE_REQUIRED, 'remote-alias' => InputOption::VALUE_REQUIRED, ]) { $this->say("This will generate a new site in the docroot/sites directory."); $site_name = $this->getNewSiteName($options)...
php
public function generate($options = [ 'site-dir' => InputOption::VALUE_REQUIRED, 'site-uri' => InputOption::VALUE_REQUIRED, 'remote-alias' => InputOption::VALUE_REQUIRED, ]) { $this->say("This will generate a new site in the docroot/sites directory."); $site_name = $this->getNewSiteName($options)...
[ "public", "function", "generate", "(", "$", "options", "=", "[", "'site-dir'", "=>", "InputOption", "::", "VALUE_REQUIRED", ",", "'site-uri'", "=>", "InputOption", "::", "VALUE_REQUIRED", ",", "'remote-alias'", "=>", "InputOption", "::", "VALUE_REQUIRED", ",", "]"...
Generates a new multisite. @command recipes:multisite:init @aliases rmi multisite
[ "Generates", "a", "new", "multisite", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Generate/MultisiteCommand.php#L26-L68
train
acquia/blt
src/Robo/Commands/Generate/MultisiteCommand.php
MultisiteCommand.setLocalDbConfig
protected function setLocalDbConfig() { $config_local_db = $this->confirm("Would you like to configure the local database credentials?"); $db = []; if ($config_local_db) { $default_db = $this->getConfigValue('drupal.db'); $db['database'] = $this->askDefault("Local database name", $defau...
php
protected function setLocalDbConfig() { $config_local_db = $this->confirm("Would you like to configure the local database credentials?"); $db = []; if ($config_local_db) { $default_db = $this->getConfigValue('drupal.db'); $db['database'] = $this->askDefault("Local database name", $defau...
[ "protected", "function", "setLocalDbConfig", "(", ")", "{", "$", "config_local_db", "=", "$", "this", "->", "confirm", "(", "\"Would you like to configure the local database credentials?\"", ")", ";", "$", "db", "=", "[", "]", ";", "if", "(", "$", "config_local_db...
Prompts for and sets config for new database. @return array Empty array if user did not want to configure local db. Populated array otherwise.
[ "Prompts", "for", "and", "sets", "config", "for", "new", "database", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Generate/MultisiteCommand.php#L120-L140
train
acquia/blt
src/Update/Updater.php
Updater.setRepoRoot
public function setRepoRoot($repoRoot) { if (!$this->fs->exists($repoRoot)) { throw new FileNotFoundException(); } $this->repoRoot = $repoRoot; }
php
public function setRepoRoot($repoRoot) { if (!$this->fs->exists($repoRoot)) { throw new FileNotFoundException(); } $this->repoRoot = $repoRoot; }
[ "public", "function", "setRepoRoot", "(", "$", "repoRoot", ")", "{", "if", "(", "!", "$", "this", "->", "fs", "->", "exists", "(", "$", "repoRoot", ")", ")", "{", "throw", "new", "FileNotFoundException", "(", ")", ";", "}", "$", "this", "->", "repoRo...
The filepath of the repository root directory. This directory is expected to contain the composer.json that defines acquia/blt as a dependency. @param string $repoRoot The filepath of the repository root directory.
[ "The", "filepath", "of", "the", "repository", "root", "directory", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updater.php#L118-L124
train
acquia/blt
src/Update/Updater.php
Updater.executeUpdates
public function executeUpdates($updates) { /** @var Updates $updates_object */ $updates_object = new $this->updateClassName($this); $this->output->writeln("Executing updates..."); /** * @var string $method_name * @var Update $update */ foreach ($updates as $method_name => $update) { ...
php
public function executeUpdates($updates) { /** @var Updates $updates_object */ $updates_object = new $this->updateClassName($this); $this->output->writeln("Executing updates..."); /** * @var string $method_name * @var Update $update */ foreach ($updates as $method_name => $update) { ...
[ "public", "function", "executeUpdates", "(", "$", "updates", ")", "{", "/** @var Updates $updates_object */", "$", "updates_object", "=", "new", "$", "this", "->", "updateClassName", "(", "$", "this", ")", ";", "$", "this", "->", "output", "->", "writeln", "("...
Executes an array of updates. @param $updates \Acquia\Blt\Annotations\Update[]
[ "Executes", "an", "array", "of", "updates", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updater.php#L165-L178
train
acquia/blt
src/Update/Updater.php
Updater.printUpdates
public function printUpdates($updates) { /** * @var string $method_name * @var Update $update */ foreach ($updates as $method_name => $update) { $this->output->writeln(" - $method_name: {$update->description}"); } $this->output->writeln(''); }
php
public function printUpdates($updates) { /** * @var string $method_name * @var Update $update */ foreach ($updates as $method_name => $update) { $this->output->writeln(" - $method_name: {$update->description}"); } $this->output->writeln(''); }
[ "public", "function", "printUpdates", "(", "$", "updates", ")", "{", "/**\n * @var string $method_name\n * @var Update $update\n */", "foreach", "(", "$", "updates", "as", "$", "method_name", "=>", "$", "update", ")", "{", "$", "this", "->", "output", "-...
Prints a human-readable list of update methods to the screen. @param $updates \Acquia\Blt\Annotations\Update[]
[ "Prints", "a", "human", "-", "readable", "list", "of", "update", "methods", "to", "the", "screen", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updater.php#L185-L194
train
acquia/blt
src/Update/Updater.php
Updater.getUpdates
public function getUpdates($starting_version, $ending_version = NULL) { if (!$ending_version) { $ending_version = $this->getLatestUpdateMethodVersion(); } $updates = []; $update_methods = $this->getAllUpdateMethods(); /** * @var string $method_name * @var Update $metadata */ ...
php
public function getUpdates($starting_version, $ending_version = NULL) { if (!$ending_version) { $ending_version = $this->getLatestUpdateMethodVersion(); } $updates = []; $update_methods = $this->getAllUpdateMethods(); /** * @var string $method_name * @var Update $metadata */ ...
[ "public", "function", "getUpdates", "(", "$", "starting_version", ",", "$", "ending_version", "=", "NULL", ")", "{", "if", "(", "!", "$", "ending_version", ")", "{", "$", "ending_version", "=", "$", "this", "->", "getLatestUpdateMethodVersion", "(", ")", ";"...
Gets all applicable updates for a given version delta. @param string $starting_version The starting version, e.g., 8005000. @param string $ending_version The ending version, e.g., 8005001. @return array An array of applicable update methods, keyed by method name. Each row contains the metadata from the Update annota...
[ "Gets", "all", "applicable", "updates", "for", "a", "given", "version", "delta", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updater.php#L209-L230
train
acquia/blt
src/Update/Updater.php
Updater.getAllUpdateMethods
public function getAllUpdateMethods() { $update_methods = []; $methods = get_class_methods($this->updateClassName); foreach ($methods as $method_name) { $reflectionMethod = new \ReflectionMethod($this->updateClassName, $method_name); $annotations = $this->annotationsReader->getMethodAnnotation($...
php
public function getAllUpdateMethods() { $update_methods = []; $methods = get_class_methods($this->updateClassName); foreach ($methods as $method_name) { $reflectionMethod = new \ReflectionMethod($this->updateClassName, $method_name); $annotations = $this->annotationsReader->getMethodAnnotation($...
[ "public", "function", "getAllUpdateMethods", "(", ")", "{", "$", "update_methods", "=", "[", "]", ";", "$", "methods", "=", "get_class_methods", "(", "$", "this", "->", "updateClassName", ")", ";", "foreach", "(", "$", "methods", "as", "$", "method_name", ...
Gather an array of all available update methods. This will only return methods using the Update annotation. @see drupal_get_schema_versions()
[ "Gather", "an", "array", "of", "all", "available", "update", "methods", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updater.php#L239-L251
train
acquia/blt
src/Update/Updater.php
Updater.removeComposerPatch
public function removeComposerPatch($package, $url) { $composer_json = $this->getComposerJson(); if (!empty($composer_json['extra']['patches'][$package])) { foreach ($composer_json['extra']['patches'][$package] as $key => $patch_url) { if ($patch_url == $url) { unset($composer_json['extr...
php
public function removeComposerPatch($package, $url) { $composer_json = $this->getComposerJson(); if (!empty($composer_json['extra']['patches'][$package])) { foreach ($composer_json['extra']['patches'][$package] as $key => $patch_url) { if ($patch_url == $url) { unset($composer_json['extr...
[ "public", "function", "removeComposerPatch", "(", "$", "package", ",", "$", "url", ")", "{", "$", "composer_json", "=", "$", "this", "->", "getComposerJson", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "composer_json", "[", "'extra'", "]", "[", "...
Removes a patch from repo's root composer.json file. @param string $package The composer package name, e.g., 'drupal/features'. @param string $url The URL of the patch. @return bool TRUE if patch was removed, otherwise FALSE.
[ "Removes", "a", "patch", "from", "repo", "s", "root", "composer", ".", "json", "file", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updater.php#L315-L332
train
acquia/blt
src/Update/Updater.php
Updater.writeComposerJson
public function writeComposerJson($contents) { // Ensure that require and require-dev are objects and not arrays. if (array_key_exists('require', $contents) && is_array($contents['require'])) { ksort($contents['require']); $contents['require'] = (object) $contents['require']; } if (array_key...
php
public function writeComposerJson($contents) { // Ensure that require and require-dev are objects and not arrays. if (array_key_exists('require', $contents) && is_array($contents['require'])) { ksort($contents['require']); $contents['require'] = (object) $contents['require']; } if (array_key...
[ "public", "function", "writeComposerJson", "(", "$", "contents", ")", "{", "// Ensure that require and require-dev are objects and not arrays.", "if", "(", "array_key_exists", "(", "'require'", ",", "$", "contents", ")", "&&", "is_array", "(", "$", "contents", "[", "'...
Writes an array to composer.json. @param array $contents The new contents of composer.json.
[ "Writes", "an", "array", "to", "composer", ".", "json", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updater.php#L437-L448
train
acquia/blt
src/Update/Updater.php
Updater.moveFile
public function moveFile($source, $target, $overwrite = FALSE) { $source_path = $this->getRepoRoot() . '/' . $source; $target_path = $this->getRepoRoot() . '/' . $target; if ($this->getFileSystem()->exists($source)) { if ($overwrite) { $this->getFileSystem()->rename($source_path, $target_path...
php
public function moveFile($source, $target, $overwrite = FALSE) { $source_path = $this->getRepoRoot() . '/' . $source; $target_path = $this->getRepoRoot() . '/' . $target; if ($this->getFileSystem()->exists($source)) { if ($overwrite) { $this->getFileSystem()->rename($source_path, $target_path...
[ "public", "function", "moveFile", "(", "$", "source", ",", "$", "target", ",", "$", "overwrite", "=", "FALSE", ")", "{", "$", "source_path", "=", "$", "this", "->", "getRepoRoot", "(", ")", ".", "'/'", ".", "$", "source", ";", "$", "target_path", "="...
Moves a file from one location to another, relative to repo root. @param string $source The source filepath, relative to the repository root. @param string $target The target filepath, relative to the repository root. @return bool FALSE if nothing happened.
[ "Moves", "a", "file", "from", "one", "location", "to", "another", "relative", "to", "repo", "root", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updater.php#L489-L505
train
acquia/blt
src/Update/Updater.php
Updater.syncWithTemplate
public function syncWithTemplate($filePath, $overwrite = FALSE) { $sourcePath = $this->getBltRoot() . '/template/' . $filePath; $targetPath = $this->getRepoRoot() . '/' . $filePath; if ($this->getFileSystem()->exists($sourcePath)) { try { $this->getFileSystem()->copy($sourcePath, $targetPath,...
php
public function syncWithTemplate($filePath, $overwrite = FALSE) { $sourcePath = $this->getBltRoot() . '/template/' . $filePath; $targetPath = $this->getRepoRoot() . '/' . $filePath; if ($this->getFileSystem()->exists($sourcePath)) { try { $this->getFileSystem()->copy($sourcePath, $targetPath,...
[ "public", "function", "syncWithTemplate", "(", "$", "filePath", ",", "$", "overwrite", "=", "FALSE", ")", "{", "$", "sourcePath", "=", "$", "this", "->", "getBltRoot", "(", ")", ".", "'/template/'", ".", "$", "filePath", ";", "$", "targetPath", "=", "$",...
Copies a file from the BLT template to the repository. @param string $filePath The filepath, relative to the BLT template directory. @param bool $overwrite If true, target files newer than origin files are overwritten.
[ "Copies", "a", "file", "from", "the", "BLT", "template", "to", "the", "repository", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updater.php#L515-L528
train
acquia/blt
src/Update/Updater.php
Updater.replaceInFile
public function replaceInFile($source, $original, $replacement) { $source_path = $this->getRepoRoot() . '/' . $source; if ($this->getFileSystem()->exists($source)) { $contents = file_get_contents($source_path); $new_contents = str_replace($original, $replacement, $contents); file_put_contents(...
php
public function replaceInFile($source, $original, $replacement) { $source_path = $this->getRepoRoot() . '/' . $source; if ($this->getFileSystem()->exists($source)) { $contents = file_get_contents($source_path); $new_contents = str_replace($original, $replacement, $contents); file_put_contents(...
[ "public", "function", "replaceInFile", "(", "$", "source", ",", "$", "original", ",", "$", "replacement", ")", "{", "$", "source_path", "=", "$", "this", "->", "getRepoRoot", "(", ")", ".", "'/'", ".", "$", "source", ";", "if", "(", "$", "this", "->"...
Performs a find and replace in a text file. @param string $source The source filepath, relative to the repository root. @param string $original The original string to find. @param string $replacement The string with which to replace the original.
[ "Performs", "a", "find", "and", "replace", "in", "a", "text", "file", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updater.php#L540-L547
train
acquia/blt
src/Update/Updater.php
Updater.regenerateCloudHooks
public function regenerateCloudHooks() { if (file_exists($this->getRepoRoot() . '/hooks') && !$this->cloudHooksAlreadyUpdated) { self::executeCommand("./vendor/bin/blt recipes:cloud-hooks:init", NULL, FALSE); $this->cloudHooksAlreadyUpdated = TRUE; return TRUE; } return FALSE; }
php
public function regenerateCloudHooks() { if (file_exists($this->getRepoRoot() . '/hooks') && !$this->cloudHooksAlreadyUpdated) { self::executeCommand("./vendor/bin/blt recipes:cloud-hooks:init", NULL, FALSE); $this->cloudHooksAlreadyUpdated = TRUE; return TRUE; } return FALSE; }
[ "public", "function", "regenerateCloudHooks", "(", ")", "{", "if", "(", "file_exists", "(", "$", "this", "->", "getRepoRoot", "(", ")", ".", "'/hooks'", ")", "&&", "!", "$", "this", "->", "cloudHooksAlreadyUpdated", ")", "{", "self", "::", "executeCommand", ...
Regenerate Cloud Hooks, but only once.
[ "Regenerate", "Cloud", "Hooks", "but", "only", "once", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updater.php#L564-L571
train
acquia/blt
src/Robo/Application.php
Application.runCommand
public function runCommand(Command $command, InputInterface $input, OutputInterface $output) { return $this->doRunCommand($command, $input, $output); }
php
public function runCommand(Command $command, InputInterface $input, OutputInterface $output) { return $this->doRunCommand($command, $input, $output); }
[ "public", "function", "runCommand", "(", "Command", "$", "command", ",", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "return", "$", "this", "->", "doRunCommand", "(", "$", "command", ",", "$", "input", ",", "$", "output...
This command is identical to its parent, but public rather than protected.
[ "This", "command", "is", "identical", "to", "its", "parent", "but", "public", "rather", "than", "protected", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Application.php#L21-L23
train
acquia/blt
src/Robo/Filesets/Filesets.php
Filesets.getPhpFilesetFinder
protected function getPhpFilesetFinder() { $finder = new Finder(); $finder ->files() ->name("*.inc") ->name("*.install") ->name("*.module") ->name("*.php") ->name("*.profile") ->name("*.test") ->name("*.theme") // Behat php files are ignored because method n...
php
protected function getPhpFilesetFinder() { $finder = new Finder(); $finder ->files() ->name("*.inc") ->name("*.install") ->name("*.module") ->name("*.php") ->name("*.profile") ->name("*.test") ->name("*.theme") // Behat php files are ignored because method n...
[ "protected", "function", "getPhpFilesetFinder", "(", ")", "{", "$", "finder", "=", "new", "Finder", "(", ")", ";", "$", "finder", "->", "files", "(", ")", "->", "name", "(", "\"*.inc\"", ")", "->", "name", "(", "\"*.install\"", ")", "->", "name", "(", ...
Adds Drupalistic PHP patterns to a Symfony finder object. @return \Symfony\Component\Finder\Finder The finder object.
[ "Adds", "Drupalistic", "PHP", "patterns", "to", "a", "Symfony", "finder", "object", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Filesets/Filesets.php#L102-L119
train
acquia/blt
src/Robo/Filesets/Filesets.php
Filesets.getFrontendFilesetFinder
protected function getFrontendFilesetFinder() { $finder = new Finder(); $finder ->files() ->path("*/js/*") ->name("*.js") ->notName('*.min.js') ->notPath('bower_components') ->notPath('node_modules') ->notPath('vendor'); return $finder; }
php
protected function getFrontendFilesetFinder() { $finder = new Finder(); $finder ->files() ->path("*/js/*") ->name("*.js") ->notName('*.min.js') ->notPath('bower_components') ->notPath('node_modules') ->notPath('vendor'); return $finder; }
[ "protected", "function", "getFrontendFilesetFinder", "(", ")", "{", "$", "finder", "=", "new", "Finder", "(", ")", ";", "$", "finder", "->", "files", "(", ")", "->", "path", "(", "\"*/js/*\"", ")", "->", "name", "(", "\"*.js\"", ")", "->", "notName", "...
Adds Drupalistic JS patterns to a Symfony finder object. @return \Symfony\Component\Finder\Finder The finder object.
[ "Adds", "Drupalistic", "JS", "patterns", "to", "a", "Symfony", "finder", "object", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Filesets/Filesets.php#L127-L139
train
acquia/blt
src/Robo/Filesets/Filesets.php
Filesets.getYamlFilesetFinder
protected function getYamlFilesetFinder() { $finder = new Finder(); $finder ->files() ->name("*.yml") ->name("*.yaml") ->notPath('bower_components') ->notPath('node_modules') ->notPath('vendor'); return $finder; }
php
protected function getYamlFilesetFinder() { $finder = new Finder(); $finder ->files() ->name("*.yml") ->name("*.yaml") ->notPath('bower_components') ->notPath('node_modules') ->notPath('vendor'); return $finder; }
[ "protected", "function", "getYamlFilesetFinder", "(", ")", "{", "$", "finder", "=", "new", "Finder", "(", ")", ";", "$", "finder", "->", "files", "(", ")", "->", "name", "(", "\"*.yml\"", ")", "->", "name", "(", "\"*.yaml\"", ")", "->", "notPath", "(",...
Adds Drupalistic YAML patterns to a Symfony finder object. @return \Symfony\Component\Finder\Finder The finder object.
[ "Adds", "Drupalistic", "YAML", "patterns", "to", "a", "Symfony", "finder", "object", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Filesets/Filesets.php#L147-L158
train
acquia/blt
src/Robo/Filesets/Filesets.php
Filesets.getTwigFilesetFinder
protected function getTwigFilesetFinder() { $finder = new Finder(); $finder ->files() ->name("*.twig") ->notPath('bower_components') ->notPath('node_modules') ->notPath('vendor'); return $finder; }
php
protected function getTwigFilesetFinder() { $finder = new Finder(); $finder ->files() ->name("*.twig") ->notPath('bower_components') ->notPath('node_modules') ->notPath('vendor'); return $finder; }
[ "protected", "function", "getTwigFilesetFinder", "(", ")", "{", "$", "finder", "=", "new", "Finder", "(", ")", ";", "$", "finder", "->", "files", "(", ")", "->", "name", "(", "\"*.twig\"", ")", "->", "notPath", "(", "'bower_components'", ")", "->", "notP...
Adds Drupalistic Twig patterns to a Symfony finder object. @return \Symfony\Component\Finder\Finder The finder object.
[ "Adds", "Drupalistic", "Twig", "patterns", "to", "a", "Symfony", "finder", "object", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Filesets/Filesets.php#L166-L176
train
acquia/blt
src/Robo/Log/BltLogStyle.php
BltLogStyle.formatMessage
protected function formatMessage($label, $message, $context, $taskNameStyle, $messageStyle = '') { $message = parent::formatMessage($label, $message, $context, $taskNameStyle, $messageStyle); $message = trim($message); return $message; }
php
protected function formatMessage($label, $message, $context, $taskNameStyle, $messageStyle = '') { $message = parent::formatMessage($label, $message, $context, $taskNameStyle, $messageStyle); $message = trim($message); return $message; }
[ "protected", "function", "formatMessage", "(", "$", "label", ",", "$", "message", ",", "$", "context", ",", "$", "taskNameStyle", ",", "$", "messageStyle", "=", "''", ")", "{", "$", "message", "=", "parent", "::", "formatMessage", "(", "$", "label", ",",...
Log style customization for Robo. @param string $label The log event label. @param string $message The log message. @param array $context The context, e.g., $context['time'] for task duration. @param string $taskNameStyle The style wrapper for the label, e.g., 'comment' for '<comment></comment>'. @param string $messag...
[ "Log", "style", "customization", "for", "Robo", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Log/BltLogStyle.php#L31-L36
train
acquia/blt
src/Robo/Commands/Artifact/AcHooksCommand.php
AcHooksCommand.dbScrub
public function dbScrub($site, $target_env, $db_name, $source_env) { if (!EnvironmentDetector::isAcsfEnv($site, $target_env)) { $password = RandomString::string(10, FALSE, function ($string) { return !preg_match('/[^\x{80}-\x{F7} a-z0-9@+_.\'-]/i', $string); }, 'abcdefghijklm...
php
public function dbScrub($site, $target_env, $db_name, $source_env) { if (!EnvironmentDetector::isAcsfEnv($site, $target_env)) { $password = RandomString::string(10, FALSE, function ($string) { return !preg_match('/[^\x{80}-\x{F7} a-z0-9@+_.\'-]/i', $string); }, 'abcdefghijklm...
[ "public", "function", "dbScrub", "(", "$", "site", ",", "$", "target_env", ",", "$", "db_name", ",", "$", "source_env", ")", "{", "if", "(", "!", "EnvironmentDetector", "::", "isAcsfEnv", "(", "$", "site", ",", "$", "target_env", ")", ")", "{", "$", ...
Execute sql-sanitize against a database hosted in AC Cloud. This is intended to be called from db-scrub.sh cloud hook. @param string $site The site name, e.g., site1. @param string $target_env The cloud env, e.g., dev @param string $db_name The name of the database. @param string $source_env The source environment. @...
[ "Execute", "sql", "-", "sanitize", "against", "a", "database", "hosted", "in", "AC", "Cloud", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Artifact/AcHooksCommand.php#L136-L155
train
acquia/blt
src/Robo/Commands/Artifact/AcHooksCommand.php
AcHooksCommand.sendPostCodeUpdateNotifications
protected function sendPostCodeUpdateNotifications($site, $target_env, $source_branch, $deployed_tag, $success) { $is_tag = $source_branch != $deployed_tag; if ($success) { if ($is_tag) { $message = "An updated deployment has been made to *$site.$target_env* using tag *$deployed_tag*."; } ...
php
protected function sendPostCodeUpdateNotifications($site, $target_env, $source_branch, $deployed_tag, $success) { $is_tag = $source_branch != $deployed_tag; if ($success) { if ($is_tag) { $message = "An updated deployment has been made to *$site.$target_env* using tag *$deployed_tag*."; } ...
[ "protected", "function", "sendPostCodeUpdateNotifications", "(", "$", "site", ",", "$", "target_env", ",", "$", "source_branch", ",", "$", "deployed_tag", ",", "$", "success", ")", "{", "$", "is_tag", "=", "$", "source_branch", "!=", "$", "deployed_tag", ";", ...
Sends updates to notification endpoints. @param $site @param $target_env @param $source_branch @param $deployed_tag @param $success
[ "Sends", "updates", "to", "notification", "endpoints", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Artifact/AcHooksCommand.php#L186-L202
train
acquia/blt
src/Robo/Commands/Artifact/AcHooksCommand.php
AcHooksCommand.getSlackWebhookUrl
protected function getSlackWebhookUrl() { if ($this->getConfig()->has('slack.webhook-url')) { return $this->getConfigValue('slack.webhook-url'); } elseif (getenv('SLACK_WEBHOOK_URL')) { return getenv('SLACK_WEBHOOK_URL'); } $this->say("Slack webhook url not found. To enable Slack notifi...
php
protected function getSlackWebhookUrl() { if ($this->getConfig()->has('slack.webhook-url')) { return $this->getConfigValue('slack.webhook-url'); } elseif (getenv('SLACK_WEBHOOK_URL')) { return getenv('SLACK_WEBHOOK_URL'); } $this->say("Slack webhook url not found. To enable Slack notifi...
[ "protected", "function", "getSlackWebhookUrl", "(", ")", "{", "if", "(", "$", "this", "->", "getConfig", "(", ")", "->", "has", "(", "'slack.webhook-url'", ")", ")", "{", "return", "$", "this", "->", "getConfigValue", "(", "'slack.webhook-url'", ")", ";", ...
Gets slack web url. @return array|false|mixed|null|string
[ "Gets", "slack", "web", "url", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Artifact/AcHooksCommand.php#L225-L235
train
acquia/blt
src/Robo/Commands/Artifact/AcHooksCommand.php
AcHooksCommand.sendSlackNotification
protected function sendSlackNotification($url, $payload) { $this->say("Sending slack notification..."); $data = "payload=" . json_encode($payload); $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURN...
php
protected function sendSlackNotification($url, $payload) { $this->say("Sending slack notification..."); $data = "payload=" . json_encode($payload); $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURN...
[ "protected", "function", "sendSlackNotification", "(", "$", "url", ",", "$", "payload", ")", "{", "$", "this", "->", "say", "(", "\"Sending slack notification...\"", ")", ";", "$", "data", "=", "\"payload=\"", ".", "json_encode", "(", "$", "payload", ")", ";...
Sends a message to a slack channel. @param $url @param $payload
[ "Sends", "a", "message", "to", "a", "slack", "channel", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Artifact/AcHooksCommand.php#L243-L252
train
acquia/blt
src/Robo/Commands/Artifact/AcHooksCommand.php
AcHooksCommand.updateSites
protected function updateSites($site, $target_env) { if (EnvironmentDetector::isAhOdeEnv($target_env)) { $this->updateOdeSites(); } else { $this->updateAceSites($target_env); } }
php
protected function updateSites($site, $target_env) { if (EnvironmentDetector::isAhOdeEnv($target_env)) { $this->updateOdeSites(); } else { $this->updateAceSites($target_env); } }
[ "protected", "function", "updateSites", "(", "$", "site", ",", "$", "target_env", ")", "{", "if", "(", "EnvironmentDetector", "::", "isAhOdeEnv", "(", "$", "target_env", ")", ")", "{", "$", "this", "->", "updateOdeSites", "(", ")", ";", "}", "else", "{",...
Executes updates against all sites. @param $site @param $target_env @throws BltException
[ "Executes", "updates", "against", "all", "sites", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Artifact/AcHooksCommand.php#L261-L268
train
acquia/blt
src/Composer/Plugin.php
Plugin.onPostPackageEvent
public function onPostPackageEvent(PackageEvent $event) { $package = $this->getBltPackage($event->getOperation()); if ($package) { // By explicitly setting the blt package, the onPostCmdEvent() will // process the update automatically. $this->bltPackage = $package; } }
php
public function onPostPackageEvent(PackageEvent $event) { $package = $this->getBltPackage($event->getOperation()); if ($package) { // By explicitly setting the blt package, the onPostCmdEvent() will // process the update automatically. $this->bltPackage = $package; } }
[ "public", "function", "onPostPackageEvent", "(", "PackageEvent", "$", "event", ")", "{", "$", "package", "=", "$", "this", "->", "getBltPackage", "(", "$", "event", "->", "getOperation", "(", ")", ")", ";", "if", "(", "$", "package", ")", "{", "// By exp...
Marks blt to be processed after an install or update command. @param \Composer\Installer\PackageEvent $event
[ "Marks", "blt", "to", "be", "processed", "after", "an", "install", "or", "update", "command", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Composer/Plugin.php#L100-L107
train
acquia/blt
src/Composer/Plugin.php
Plugin.isNewProject
protected function isNewProject() { $composer_json = json_decode(file_get_contents($this->getRepoRoot() . '/composer.json'), TRUE); if (isset($composer_json['name']) && in_array($composer_json['name'], ['acquia/blt-project', 'acquia/blted8'])) { return TRUE; } return FALSE; }
php
protected function isNewProject() { $composer_json = json_decode(file_get_contents($this->getRepoRoot() . '/composer.json'), TRUE); if (isset($composer_json['name']) && in_array($composer_json['name'], ['acquia/blt-project', 'acquia/blted8'])) { return TRUE; } return FALSE; }
[ "protected", "function", "isNewProject", "(", ")", "{", "$", "composer_json", "=", "json_decode", "(", "file_get_contents", "(", "$", "this", "->", "getRepoRoot", "(", ")", ".", "'/composer.json'", ")", ",", "TRUE", ")", ";", "if", "(", "isset", "(", "$", ...
Determine if this is a project being newly created. This would execute in the context of `composer create-project acquia/blt-project`. @return bool TRUE if this is a newly create project.
[ "Determine", "if", "this", "is", "a", "project", "being", "newly", "created", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Composer/Plugin.php#L203-L209
train
acquia/blt
src/Composer/Plugin.php
Plugin.getVendorPath
public function getVendorPath() { $config = $this->composer->getConfig(); $filesystem = new Filesystem(); $filesystem->ensureDirectoryExists($config->get('vendor-dir')); $vendorPath = $filesystem->normalizePath(realpath($config->get('vendor-dir'))); return $vendorPath; }
php
public function getVendorPath() { $config = $this->composer->getConfig(); $filesystem = new Filesystem(); $filesystem->ensureDirectoryExists($config->get('vendor-dir')); $vendorPath = $filesystem->normalizePath(realpath($config->get('vendor-dir'))); return $vendorPath; }
[ "public", "function", "getVendorPath", "(", ")", "{", "$", "config", "=", "$", "this", "->", "composer", "->", "getConfig", "(", ")", ";", "$", "filesystem", "=", "new", "Filesystem", "(", ")", ";", "$", "filesystem", "->", "ensureDirectoryExists", "(", ...
Get the path to the 'vendor' directory. @return string
[ "Get", "the", "path", "to", "the", "vendor", "directory", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Composer/Plugin.php#L236-L243
train
acquia/blt
src/Composer/Plugin.php
Plugin.getOptions
protected function getOptions() { $defaults = [ 'update' => TRUE, ]; $extra = $this->composer->getPackage()->getExtra() + ['blt' => []]; $extra['blt'] = $extra['blt'] + $defaults; return $extra; }
php
protected function getOptions() { $defaults = [ 'update' => TRUE, ]; $extra = $this->composer->getPackage()->getExtra() + ['blt' => []]; $extra['blt'] = $extra['blt'] + $defaults; return $extra; }
[ "protected", "function", "getOptions", "(", ")", "{", "$", "defaults", "=", "[", "'update'", "=>", "TRUE", ",", "]", ";", "$", "extra", "=", "$", "this", "->", "composer", "->", "getPackage", "(", ")", "->", "getExtra", "(", ")", "+", "[", "'blt'", ...
Retrieve "extra" configuration. @return array
[ "Retrieve", "extra", "configuration", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Composer/Plugin.php#L250-L258
train
acquia/blt
src/Robo/Commands/Setup/DrupalCommand.php
DrupalCommand.install
public function install() { // Allows for installs to define custom user 0 name. if ($this->getConfigValue('drupal.account.name') !== NULL) { $username = $this->getConfigValue('drupal.account.name'); } else { // Generate a random, valid username. // @see \Drupal\user\Plugin\Validation...
php
public function install() { // Allows for installs to define custom user 0 name. if ($this->getConfigValue('drupal.account.name') !== NULL) { $username = $this->getConfigValue('drupal.account.name'); } else { // Generate a random, valid username. // @see \Drupal\user\Plugin\Validation...
[ "public", "function", "install", "(", ")", "{", "// Allows for installs to define custom user 0 name.", "if", "(", "$", "this", "->", "getConfigValue", "(", "'drupal.account.name'", ")", "!==", "NULL", ")", "{", "$", "username", "=", "$", "this", "->", "getConfigV...
Installs Drupal and imports configuration. @command internal:drupal:install @validateDrushConfig @hidden @return \Robo\Result The `drush site-install` command result. @throws BltException
[ "Installs", "Drupal", "and", "imports", "configuration", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Setup/DrupalCommand.php#L26-L73
train
acquia/blt
src/Robo/Commands/Doctor/BehatCheck.php
BehatCheck.checkBehat
protected function checkBehat() { $this->checkLocalConfig(); if ($this->behatLocalYmlExists()) { $behatDefaultLocalConfig = $this->getInspector()->getLocalBehatConfig()->export(); $this->checkDrupalVm($behatDefaultLocalConfig); $this->checkBaseUrl($behatDefaultLocalConfig); } }
php
protected function checkBehat() { $this->checkLocalConfig(); if ($this->behatLocalYmlExists()) { $behatDefaultLocalConfig = $this->getInspector()->getLocalBehatConfig()->export(); $this->checkDrupalVm($behatDefaultLocalConfig); $this->checkBaseUrl($behatDefaultLocalConfig); } }
[ "protected", "function", "checkBehat", "(", ")", "{", "$", "this", "->", "checkLocalConfig", "(", ")", ";", "if", "(", "$", "this", "->", "behatLocalYmlExists", "(", ")", ")", "{", "$", "behatDefaultLocalConfig", "=", "$", "this", "->", "getInspector", "("...
Checks Behat configuration in local.yml. @return bool
[ "Checks", "Behat", "configuration", "in", "local", ".", "yml", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Doctor/BehatCheck.php#L19-L26
train
acquia/blt
src/Robo/Common/Executor.php
Executor.drush
public function drush($command) { // @todo Set to silent if verbosity is less than very verbose. $bin = $this->getConfigValue('composer.bin'); /** @var \Robo\Common\ProcessExecutor $process_executor */ $drush_alias = $this->getConfigValue('drush.alias'); $command_string = "'$bin/drush' @$drush_alias...
php
public function drush($command) { // @todo Set to silent if verbosity is less than very verbose. $bin = $this->getConfigValue('composer.bin'); /** @var \Robo\Common\ProcessExecutor $process_executor */ $drush_alias = $this->getConfigValue('drush.alias'); $command_string = "'$bin/drush' @$drush_alias...
[ "public", "function", "drush", "(", "$", "command", ")", "{", "// @todo Set to silent if verbosity is less than very verbose.", "$", "bin", "=", "$", "this", "->", "getConfigValue", "(", "'composer.bin'", ")", ";", "/** @var \\Robo\\Common\\ProcessExecutor $process_executor *...
Executes a drush command. @param string $command The command to execute, without "drush" prefix. @return \Robo\Common\ProcessExecutor The unexecuted process.
[ "Executes", "a", "drush", "command", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Common/Executor.php#L77-L97
train
acquia/blt
src/Robo/Common/Executor.php
Executor.wait
public function wait(callable $callable, array $args, $message = '') { $maxWait = 60 * 1000; $checkEvery = 1 * 1000; $start = microtime(TRUE) * 1000; $end = $start + $maxWait; if (!$message) { $method_name = is_array($callable) ? $callable[1] : $callable; $message = "Waiting for $method...
php
public function wait(callable $callable, array $args, $message = '') { $maxWait = 60 * 1000; $checkEvery = 1 * 1000; $start = microtime(TRUE) * 1000; $end = $start + $maxWait; if (!$message) { $method_name = is_array($callable) ? $callable[1] : $callable; $message = "Waiting for $method...
[ "public", "function", "wait", "(", "callable", "$", "callable", ",", "array", "$", "args", ",", "$", "message", "=", "''", ")", "{", "$", "maxWait", "=", "60", "*", "1000", ";", "$", "checkEvery", "=", "1", "*", "1000", ";", "$", "start", "=", "m...
Waits until a given callable returns TRUE. This does have a maximum timeout. @param callable $callable The method/function to wait for a TRUE response from. @param array $args Arguments to pass to $callable. @param string $message The message to display when this function is called. @return bool TRUE if callable ret...
[ "Waits", "until", "a", "given", "callable", "returns", "TRUE", "." ]
8a903c1d930f82f4b9ee657d62d123782dd2ed59
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Common/Executor.php#L174-L200
train