_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q18500 | ConfirmedPasswordField.setName | train | public function setName($name)
{
$this->getPasswordField()->setName($name . '[_Password]');
$this->getConfirmPasswordField()->setName($name . '[_ConfirmPassword]');
if ($this->hiddenField) {
| php | {
"resource": ""
} |
q18501 | ConfirmedPasswordField.isSaveable | train | public function isSaveable()
{
return !$this->showOnClick
| php | {
"resource": ""
} |
q18502 | ConfirmedPasswordField.saveInto | train | public function saveInto(DataObjectInterface $record)
{
if (!$this->isSaveable()) {
| php | {
"resource": ""
} |
q18503 | ConfirmedPasswordField.performReadonlyTransformation | train | public function performReadonlyTransformation()
{
/** @var ReadonlyField $field */
$field = $this->castedCopy(ReadonlyField::class)
| php | {
"resource": ""
} |
q18504 | ConfirmedPasswordField.setRequireExistingPassword | train | public function setRequireExistingPassword($show)
{
// Don't modify if already added / removed
if ((bool)$show === $this->requireExistingPassword) {
return $this;
}
$this->requireExistingPassword = $show;
$name = $this->getName();
$currentName = "{$name}[_... | php | {
"resource": ""
} |
q18505 | ConfirmationTokenChain.filteredTokens | train | protected function filteredTokens()
{
foreach ($this->tokens as $token) {
if | php | {
"resource": ""
} |
q18506 | ConfirmationTokenChain.getRedirectUrlParams | train | public function getRedirectUrlParams()
{
$params = $_GET;
unset($params['url']); // CLIRequestBuilder may add this
foreach ($this->filteredTokens() as $token) {
| php | {
"resource": ""
} |
q18507 | ArrayLib.invert | train | public static function invert($arr)
{
if (!$arr) {
return [];
}
$result = array();
foreach ($arr as | php | {
"resource": ""
} |
q18508 | ArrayLib.array_map_recursive | train | public static function array_map_recursive($f, $array)
{
$applyOrRecurse = function ($v) use ($f) {
return is_array($v) ? ArrayLib::array_map_recursive($f, $v) : | php | {
"resource": ""
} |
q18509 | ArrayLib.array_merge_recursive | train | public static function array_merge_recursive($array)
{
$arrays = func_get_args();
$merged = array();
if (count($arrays) == 1) {
return $array;
}
while ($arrays) {
$array = array_shift($arrays);
if (!is_array($array)) {
tr... | php | {
"resource": ""
} |
q18510 | ArrayLib.flatten | train | public static function flatten($array, $preserveKeys = true, &$out = array())
{
array_walk_recursive(
$array,
function ($value, $key) use (&$out, $preserveKeys) {
if (!is_scalar($value)) {
// Do nothing
} elseif ($preserveKeys) {
... | php | {
"resource": ""
} |
q18511 | RSSFeed_Entry.Description | train | public function Description()
{
$description = $this->rssField($this->descriptionField);
// HTML fields need links re-written
if ($description instanceof DBHTMLText) {
| php | {
"resource": ""
} |
q18512 | RSSFeed_Entry.AbsoluteLink | train | public function AbsoluteLink()
{
if ($this->failover->hasMethod('AbsoluteLink')) {
return $this->failover->AbsoluteLink();
} else {
if ($this->failover->hasMethod('Link')) {
| php | {
"resource": ""
} |
q18513 | Setting.set | train | public function set($key, $value)
{
$setting = SettingModel::create(
[
'key' => $key,
'value' | php | {
"resource": ""
} |
q18514 | Setting.get | train | public function get($key)
{
$setting = SettingModel::where('key', $key)->first();
| php | {
"resource": ""
} |
q18515 | CouchbaseDB.deleteObjectByType | train | protected function deleteObjectByType($name,$id)
{
| php | {
"resource": ""
} |
q18516 | Server.handleAuthorizeRequest | train | public function handleAuthorizeRequest(RequestInterface $request, ResponseInterface $response, $is_authorized, $user_id = null)
{
$this->response = $response;
| php | {
"resource": ""
} |
q18517 | Server.addStorage | train | 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 | {
"resource": ""
} |
q18518 | Server.createDefaultJwtAccessTokenStorage | train | 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 | {
"resource": ""
} |
q18519 | Server.createDefaultJwtAccessTokenResponseType | train | 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 | {
"resource": ""
} |
q18520 | DynamoDB.dynamo2array | train | private function dynamo2array($dynamodbResult)
{
$result = array();
foreach ($dynamodbResult["Item"] as $key => $val) {
$result[$key] | php | {
"resource": ""
} |
q18521 | HttpBasic.getClientCredentials | train | 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 | {
"resource": ""
} |
q18522 | AccessToken.getAuthorizeResponse | train | 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 | {
"resource": ""
} |
q18523 | JwtAccessToken.convertJwtToOAuth2 | train | protected function convertJwtToOAuth2($tokenData)
{
$keyMapping = array(
'aud' => 'client_id',
'exp' => 'expires',
'sub' => 'user_id'
);
foreach ($keyMapping as $jwtKey => $oauth2Key) {
if (isset($tokenData[$jwtKey])) | php | {
"resource": ""
} |
q18524 | AuthorizeController.getValidResponseTypes | train | protected function getValidResponseTypes()
{
return array(
self::RESPONSE_TYPE_ACCESS_TOKEN,
self::RESPONSE_TYPE_AUTHORIZATION_CODE,
self::RESPONSE_TYPE_ID_TOKEN,
| php | {
"resource": ""
} |
q18525 | JwtAccessToken.createPayload | train | 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 | {
"resource": ""
} |
q18526 | UserInfoController.handleUserInfoRequest | train | 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 | {
"resource": ""
} |
q18527 | AuthorizeController.handleAuthorizeRequest | train | 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 | {
"resource": ""
} |
q18528 | ResourceController.verifyResourceRequest | train | 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 | {
"resource": ""
} |
q18529 | ResourceController.getAccessTokenData | train | 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 | {
"resource": ""
} |
q18530 | TokenController.addGrantType | train | public function addGrantType(GrantTypeInterface $grantType, $identifier = null)
{
if (is_null($identifier) || | php | {
"resource": ""
} |
q18531 | TokenController.revokeToken | train | 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 | {
"resource": ""
} |
q18532 | Response.getHttpHeadersAsString | train | 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) {
| php | {
"resource": ""
} |
q18533 | Scope.checkScope | train | public function checkScope($required_scope, $available_scope)
{
$required_scope = explode(' ', trim($required_scope));
$available_scope | php | {
"resource": ""
} |
q18534 | Scope.scopeExists | train | 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 | {
"resource": ""
} |
q18535 | AuthorizationCode.createAuthorizationCode | train | public function createAuthorizationCode($client_id, $user_id, $redirect_uri, $scope = null)
{
$code = $this->generateAuthorizationCode();
$this->storage->setAuthorizationCode($code, | php | {
"resource": ""
} |
q18536 | AuthorizationCode.generateAuthorizationCode | train | 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 | {
"resource": ""
} |
q18537 | IdToken.createIdToken | train | 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 | {
"resource": ""
} |
q18538 | Bearer.requestHasToken | train | public function requestHasToken(RequestInterface $request)
{
$headers = $request->headers('AUTHORIZATION');
// check the header, then the querystring, then the request body
return !empty($headers) || | php | {
"resource": ""
} |
q18539 | Documentation.getIndex | train | 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 | {
"resource": ""
} |
q18540 | Documentation.get | train | 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 | {
"resource": ""
} |
q18541 | Documentation.replaceLinks | train | public static function replaceLinks($version, $content)
{
$content = str_replace('{{version}}', $version, $content);
| php | {
"resource": ""
} |
q18542 | Documentation.sectionExists | train | public function sectionExists($version, $page)
{
return $this->files->exists(
| php | {
"resource": ""
} |
q18543 | AssetCommand.runCommand | train | 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); | php | {
"resource": ""
} |
q18544 | AssetCommand.hasValidNameArgument | train | public function hasValidNameArgument()
{
$name = $this->argument('name');
if (! Str::contains($name, '/')) {
$this->error("The name argument expects a vendor | php | {
"resource": ""
} |
q18545 | AssetCommand.renameStubs | train | protected function renameStubs()
{
foreach ($this->stubsToRename() as | php | {
"resource": ""
} |
q18546 | LaRecipeServiceProvider.registerConsoleCommands | train | protected function registerConsoleCommands()
{
$this->commands(AssetCommand::class);
$this->commands(ThemeCommand::class);
| php | {
"resource": ""
} |
q18547 | DocumentationRepository.prepareNotFound | train | protected function prepareNotFound()
{
$this->title = 'Page not found';
$this->content = view('larecipe::partials.404');
$this->currentSection = '';
| php | {
"resource": ""
} |
q18548 | DocumentationRepository.prepareTitle | train | protected function prepareTitle()
{
$this->title = (new Crawler($this->content))->filterXPath('//h1');
$this->title | php | {
"resource": ""
} |
q18549 | DocumentationRepository.prepareSection | train | protected function prepareSection($version, $page)
{
if ($this->documentation->sectionExists($version, $page)) {
| php | {
"resource": ""
} |
q18550 | DocumentationRepository.prepareCanonical | train | protected function prepareCanonical()
{
if ($this->documentation->sectionExists($this->defaultVersion, $this->sectionPage)) | php | {
"resource": ""
} |
q18551 | GenerateDocumentationCommand.createVersionDirectory | train | protected function createVersionDirectory($versionDirectory)
{
if (! $this->filesystem->isDirectory($versionDirectory)) {
| php | {
"resource": ""
} |
q18552 | GenerateDocumentationCommand.createVersionIndex | train | protected function createVersionIndex($versionDirectory)
{
$indexPath = $versionDirectory.'/index.md';
if (! $this->filesystem->exists($indexPath)) {
$content = $this->generateIndexContent($this->getStub('index'));
| php | {
"resource": ""
} |
q18553 | GenerateDocumentationCommand.generateIndexContent | train | protected function generateIndexContent($stub)
{
$content = str_replace(
'{{LANDING}}',
ucwords(config('larecipe.docs.landing')),
$stub
);
$content = str_replace(
'{{ROOT}}',
config('larecipe.docs.route'),
| php | {
"resource": ""
} |
q18554 | Cache.checkTtlNeedsChanged | train | public function checkTtlNeedsChanged($ttl)
{
$app_version = explode('.', app()->version());
if (((int) $app_version[0] == 5 && (int) $app_version[1] >= 8) || $app_version[0] > 5) {
| php | {
"resource": ""
} |
q18555 | HasBladeParser.renderBlade | train | 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 | {
"resource": ""
} |
q18556 | ThemeCommand.addThemeRepositoryToRootComposer | train | protected function addThemeRepositoryToRootComposer()
{
$composer = json_decode(file_get_contents(base_path('composer.json')), true);
$composer['repositories'][] = [
'type' => 'path',
'url' => './'.$this->relativeThemePath(),
| php | {
"resource": ""
} |
q18557 | ThemeCommand.addThemePackageToRootComposer | train | protected function addThemePackageToRootComposer()
{
$composer = json_decode(file_get_contents(base_path('composer.json')), true);
$composer['require'][$this->argument('name')] = '*';
file_put_contents(
| php | {
"resource": ""
} |
q18558 | DocumentationController.show | train | 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 | {
"resource": ""
} |
q18559 | AnalyticsClient.performQuery | train | 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 | {
"resource": ""
} |
q18560 | Analytics.performQuery | train | public function performQuery(Period $period, string $metrics, array $others = [])
{
return $this->client->performQuery(
| php | {
"resource": ""
} |
q18561 | Header.getElements | train | public function getElements()
{
foreach ($this->elements as $name => | php | {
"resource": ""
} |
q18562 | Header.getElementTypes | train | public function getElementTypes()
{
$types = array();
foreach ($this->elements as $key => $element) {
$types[$key] | php | {
"resource": ""
} |
q18563 | Header.resolveXRef | train | 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 | {
"resource": ""
} |
q18564 | Page.getXObjects | train | 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 | {
"resource": ""
} |
q18565 | Document.buildDictionary | train | protected function buildDictionary()
{
// Build dictionary.
$this->dictionary = array();
foreach ($this->objects as $id | php | {
"resource": ""
} |
q18566 | Document.buildDetails | train | 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 | {
"resource": ""
} |
q18567 | BloomFilter.positions | train | protected function positions($value)
{
mt_srand(crc32($value));
$positions = new SplFixedArray($this->k);
for ($i = 0; $i < $this->k; $i++) {
| php | {
"resource": ""
} |
q18568 | BloomFilter.add | train | public function add($value)
{
foreach ($this->positions($value) as | php | {
"resource": ""
} |
q18569 | BloomFilter.maybeInSet | train | public function maybeInSet($value)
{
foreach ($this->positions($value) as $position) {
if (!$this->getBitAtPosition($position)) {
| php | {
"resource": ""
} |
q18570 | BloomFilter.showBitField | train | public function showBitField()
{
return join(array_map(function ($chr) {return str_pad(base_convert(bin2hex($chr), 16, 2), | php | {
"resource": ""
} |
q18571 | Client.getConnection | train | 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 | {
"resource": ""
} |
q18572 | Client.writeToRemote | train | protected function writeToRemote($data, $connection)
{
$buffer = serialize($data);
$buffer = pack('N', 4 + strlen($buffer)) . $buffer;
$len = fwrite($connection, $buffer);
| php | {
"resource": ""
} |
q18573 | Client.readFromRemote | train | 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 | {
"resource": ""
} |
q18574 | ComposerCommand.requirePackage | train | 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 | {
"resource": ""
} |
q18575 | InteractHook.interactGenerateSettingsFiles | train | public function interactGenerateSettingsFiles(
InputInterface $input,
OutputInterface $output,
AnnotationData $annotationData
) {
/** @var \Acquia\Blt\Robo\Wizards\SetupWizard $setup_wizard */
$setup_wizard | php | {
"resource": ""
} |
q18576 | InteractHook.interactInstallDrupal | train | public function interactInstallDrupal(
InputInterface $input,
OutputInterface $output,
AnnotationData $annotationData
) {
/** @var \Acquia\Blt\Robo\Wizards\SetupWizard $setup_wizard */
$setup_wizard | php | {
"resource": ""
} |
q18577 | InteractHook.interactConfigureBehat | train | public function interactConfigureBehat(
InputInterface $input,
OutputInterface $output,
AnnotationData $annotationData
) {
/** @var \Acquia\Blt\Robo\Wizards\TestsWizard $tests_wizard */
$tests_wizard | php | {
"resource": ""
} |
q18578 | InteractHook.interactExecuteUpdates | train | public function interactExecuteUpdates(
InputInterface $input,
OutputInterface $output,
AnnotationData $annotationData
) {
if ($this->invokeDepth == 0
&& $input->getFirstArgument() != 'blt:update'
&& $input->getFirstArgument() != 'update'
&& !$this->getInspector()->isSchemaVersionUpT... | php | {
"resource": ""
} |
q18579 | InteractHook.interactConfigIdentical | train | 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 | {
"resource": ""
} |
q18580 | NodeCheck.checkNodeVersionFileExists | train | protected function checkNodeVersionFileExists() {
if (file_exists($this->getConfigValue('repo.root') . '/.nvmrc')) {
$this->logProblem(__FUNCTION__, ".nvmrc file exists", 'info');
}
| php | {
"resource": ""
} |
q18581 | ImportCommand.import | train | public function import() {
$task = $this->taskDrush()
->drush('sql-drop')
->drush('sql-cli < ' . $this->getConfigValue('setup.dump-file'));
| php | {
"resource": ""
} |
q18582 | MultisiteCommand.generate | train | 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 | {
"resource": ""
} |
q18583 | MultisiteCommand.setLocalDbConfig | train | 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 | {
"resource": ""
} |
q18584 | Updater.setRepoRoot | train | public function setRepoRoot($repoRoot) {
if (!$this->fs->exists($repoRoot)) {
throw new | php | {
"resource": ""
} |
q18585 | Updater.executeUpdates | train | 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 | php | {
"resource": ""
} |
q18586 | Updater.printUpdates | train | public function printUpdates($updates) {
/**
* @var string $method_name
* @var Update $update
*/
foreach ($updates as $method_name => $update) {
| php | {
"resource": ""
} |
q18587 | Updater.getUpdates | train | 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 | {
"resource": ""
} |
q18588 | Updater.getAllUpdateMethods | train | public function getAllUpdateMethods() {
$update_methods = [];
$methods = get_class_methods($this->updateClassName);
foreach ($methods as $method_name) {
$reflectionMethod = new \ReflectionMethod($this->updateClassName, $method_name);
$annotations = | php | {
"resource": ""
} |
q18589 | Updater.removeComposerPatch | train | 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 | {
"resource": ""
} |
q18590 | Updater.writeComposerJson | train | 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 | {
"resource": ""
} |
q18591 | Updater.moveFile | train | 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 | {
"resource": ""
} |
q18592 | Updater.syncWithTemplate | train | public function syncWithTemplate($filePath, $overwrite = FALSE) {
$sourcePath = $this->getBltRoot() . '/template/' . $filePath;
$targetPath = $this->getRepoRoot() . '/' . $filePath;
if ($this->getFileSystem()->exists($sourcePath)) {
| php | {
"resource": ""
} |
q18593 | Updater.replaceInFile | train | public function replaceInFile($source, $original, $replacement) {
$source_path = $this->getRepoRoot() . '/' . $source;
if ($this->getFileSystem()->exists($source)) {
$contents = file_get_contents($source_path);
$new_contents = | php | {
"resource": ""
} |
q18594 | Updater.regenerateCloudHooks | train | public function regenerateCloudHooks() {
if (file_exists($this->getRepoRoot() . '/hooks') && !$this->cloudHooksAlreadyUpdated) {
self::executeCommand("./vendor/bin/blt recipes:cloud-hooks:init", | php | {
"resource": ""
} |
q18595 | Application.runCommand | train | public function runCommand(Command $command, InputInterface $input, | php | {
"resource": ""
} |
q18596 | Filesets.getPhpFilesetFinder | train | 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 | {
"resource": ""
} |
q18597 | Filesets.getFrontendFilesetFinder | train | protected function getFrontendFilesetFinder() {
$finder = new Finder();
$finder
->files()
->path("*/js/*")
->name("*.js")
->notName('*.min.js')
| php | {
"resource": ""
} |
q18598 | Filesets.getYamlFilesetFinder | train | protected function getYamlFilesetFinder() {
$finder = new Finder();
$finder
->files()
->name("*.yml")
->name("*.yaml")
->notPath('bower_components')
| php | {
"resource": ""
} |
q18599 | Filesets.getTwigFilesetFinder | train | protected function getTwigFilesetFinder() {
$finder = new Finder();
$finder
->files()
->name("*.twig")
->notPath('bower_components')
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.