_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q18800
AllCommand.all
train
public function all() { $commands = [ 'tests:composer:validate', 'tests:php:lint', 'tests:phpcs:sniff:all', 'tests:yaml:lint:all', 'tests:twig:lint:all', ]; // To enable this command, set validate.acsf to TRUE
php
{ "resource": "" }
q18801
ComposerCheck.performAllChecks
train
public function performAllChecks() { $this->checkRequire(); $this->checkBltRequireDev(); if (!$this->getInspector()->isVmCli()) {
php
{ "resource": "" }
q18802
ComposerCheck.checkComposerConfig
train
protected function checkComposerConfig() { // @todo specify third key Acquia\\Blt\\Custom\\. $this->compareComposerConfig('autoload', 'psr-4'); // @todo specify third key Drupal\\Tests\\PHPUnit\\\. $this->compareComposerConfig('autoload-dev', 'psr-4'); $this->compareComposerConfig('extra', 'installe...
php
{ "resource": "" }
q18803
WebUriCheck.checkUriResponse
train
protected function checkUriResponse() { $site_available = $this->getExecutor()->execute("curl -I --insecure " . $this->drushStatus['uri'])->run()->wasSuccessful(); if (!$site_available) { $this->logProblem(__FUNCTION__, [ "Did not get a response from {$this->drushStatus['uri']}", "Is your ...
php
{ "resource": "" }
q18804
WebUriCheck.checkHttps
train
protected function checkHttps() { if (strstr($this->drushStatus['uri'], 'https')) { if (!$this->getExecutor()->execute('curl -cacert ' . $this->drushStatus['uri'])->run()->wasSuccessful()) { $this->logProblem(__FUNCTION__, [
php
{ "resource": "" }
q18805
WizardCommand.wizard
train
public function wizard($options = [ 'recipe' => InputOption::VALUE_REQUIRED, ]) { $recipe_filename = $options['recipe']; if ($recipe_filename) { $answers = $this->loadRecipeFile($recipe_filename); } else { $answers = $this->askForAnswers(); } $this->say("<comment>You have ente...
php
{ "resource": "" }
q18806
WizardCommand.loadRecipeFile
train
protected function loadRecipeFile($filename) { if (!file_exists($filename)) { throw new FileNotFoundException($filename); } $recipe = Yaml::parse( file_get_contents($filename)
php
{ "resource": "" }
q18807
WizardCommand.askForAnswers
train
protected function askForAnswers() { $this->say("<info>Let's start by entering some information about your project.</info>"); $answers['human_name'] = $this->askDefault("Project name (human readable):", $this->getConfigValue('project.human_name')); $default_machine_name = StringManipulator::convertStringToM...
php
{ "resource": "" }
q18808
ComposerCommand.validate
train
public function validate() { $this->say("Validating composer.json and composer.lock..."); $result = $this->taskExecStack() ->dir($this->getConfigValue('repo.root')) ->exec('composer validate --no-check-all --ansi') ->run(); if (!$result->wasSuccessful()) { $this->say($result->getMess...
php
{ "resource": "" }
q18809
ConfigCheck.checkDeprecatedKeys
train
protected function checkDeprecatedKeys() { $deprecated_keys = [ 'project.hash_salt', 'project.profile.contrib', 'project.vendor', 'project.description', 'project.themes', 'hosting', ]; $deprecated_keys_exist = FALSE; $outcome = []; foreach ($deprecated_keys as $de...
php
{ "resource": "" }
q18810
VmCommand.vm
train
public function vm($options = ['no-boot' => FALSE]) { if (!$this->getInspector()->isDrupalVmConfigPresent()) { $confirm = $this->confirm("Drupal VM is not currently installed. Install it now? ", TRUE); if ($confirm) { $this->install(); } else { return FALSE; } } ...
php
{ "resource": "" }
q18811
VmCommand.nuke
train
public function nuke() { $confirm = $this->confirm("This will destroy your VM, and delete all associated configuration. Continue?"); if ($confirm) { $this->taskExecStack() ->exec("vagrant destroy") ->dir($this->getConfigValue('repo.root')) ->printOutput(TRUE) ->stopOnFail()...
php
{ "resource": "" }
q18812
VmCommand.config
train
protected function config() { $this->say("Generating default configuration for Drupal VM..."); $this->createDrushAlias(); $this->createConfigFiles(); $this->customizeConfigFiles(); $vm_config = Yaml::parse(file_get_contents($this->projectDrupalVmConfigFile)); $this->validateConfig($vm_config);...
php
{ "resource": "" }
q18813
VmCommand.localInitialize
train
protected function localInitialize() { if (!$this->getInspector()->isBltLocalConfigFilePresent()) { $this->invokeCommands(['blt:init:settings']); } $filename = $this->getConfigValue('blt.config-files.local'); $this->logger->info("Updating $filename"); $contents = Yaml::parse(file_get_content...
php
{ "resource": "" }
q18814
VmCommand.boot
train
protected function boot() { $this->checkRequirements(); $this->yell(" * We have configured your new Drupal VM to use PHP 7.2. If you would like to change this, edit box/config.yml."); $confirm = $this->confirm("Do you want to boot Drupal VM?", TRUE); if ($confirm) { $this->say("In the future, run ...
php
{ "resource": "" }
q18815
VmCommand.isDrupalVmRequired
train
protected function isDrupalVmRequired() { $composer_json = json_decode(file_get_contents($this->getConfigValue('repo.root') . '/composer.json'), TRUE); return !empty($composer_json['require-dev']['geerlingguy/drupal-vm'])
php
{ "resource": "" }
q18816
VmCommand.checkRequirements
train
protected function checkRequirements() { if (!$this->getInspector()->commandExists("vagrant")) { $this->logger->error("Vagrant is not installed."); $this->say("Please install all dependencies for Drupal VM by following the Quickstart Guide:"); $this->say("https://github.com/geerlingguy/drupal-vm#q...
php
{ "resource": "" }
q18817
VmCommand.setBaseBox
train
protected function setBaseBox($config) { $base_box = $this->askChoice( "Which base box would you like to use?", [ 'geerlingguy/drupal-vm', 'geerlingguy/ubuntu1604', ], 0); switch ($base_box) { case 'geerlingguy/ubuntu1604': case 'geerlingguy/drupal-vm':
php
{ "resource": "" }
q18818
VmCommand.customizeConfigFiles
train
protected function customizeConfigFiles() { /** @var \Acquia\Blt\Robo\Config\BltConfig $config */ $config = clone $this->getConfig(); $config->set('drupalvm.config.dir', $this->vmConfigDir); $config->expandFileProperties($this->projectDrupalVmVagrantfile); // Generate a Random IP address for the n...
php
{ "resource": "" }
q18819
VmCommand.createConfigFiles
train
protected function createConfigFiles() { $this->logger->info("Creating configuration files for Drupal VM..."); $this->taskFilesystemStack() ->mkdir($this->vmDir) ->copy($this->defaultDrupalVmConfigFile, $this->projectDrupalVmConfigFile, TRUE) ->copy($this->defaultDrupalVmVagrantfile,
php
{ "resource": "" }
q18820
VmCommand.createDrushAlias
train
protected function createDrushAlias() { $this->logger->info("Adding a drush alias for the new VM..."); if (!file_exists($this->projectDrushAliasesFile)) { $new_aliases = Expander::parse(file_get_contents($this->defaultDrupalVmDrushAliasesFile), $this->getConfig()->export()); } else { $projec...
php
{ "resource": "" }
q18821
UpdateCommand.initializeBlt
train
protected function initializeBlt() { $this->updateRootProjectFiles(); $this->taskExecStack() ->dir($this->getConfigValue("repo.root")) ->exec("composer drupal:scaffold") ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE) ->run(); // Reinitialize configuration no...
php
{ "resource": "" }
q18822
UpdateCommand.update
train
public function update($options = ['since' => InputOption::VALUE_REQUIRED]) { $this->rsyncTemplate(); $starting_version = $options['since'] ?:
php
{ "resource": "" }
q18823
UpdateCommand.cleanup
train
public function cleanup() { $this->say("Removing deprecated files and directories..."); $this->taskFilesystemStack() ->remove([ "build", "docroot/sites/default/settings/apcu_fix.yml", "docroot/sites/default/settings/base.settings.php", "docroot/sites/default/settings/blt.se...
php
{ "resource": "" }
q18824
UpdateCommand.executeSchemaUpdates
train
protected function executeSchemaUpdates($starting_version) { $starting_version = $this->convertLegacySchemaVersion($starting_version); $updater = new Updater('Acquia\Blt\Update\Updates', $this->getConfigValue('repo.root')); $updates = $updater->getUpdates($starting_version); if ($updates) { $this-...
php
{ "resource": "" }
q18825
UpdateCommand.convertLegacySchemaVersion
train
protected function convertLegacySchemaVersion($version) { // Check to see if version is Semver (legacy format). Convert to expected // syntax. Luckily, there are a finite number of known legacy versions. // We check specifically for those. // E.g., 8.6.6 => 8006006. if (strpos($version, '.') !== FAL...
php
{ "resource": "" }
q18826
UpdateCommand.rsyncTemplate
train
protected function rsyncTemplate() { $source = $this->getConfigValue('blt.root') . '/template'; $destination = $this->getConfigValue('repo.root'); // There is no native rsync on Windows. // The most used one on Windows is https://itefix.net/cwrsync, // which runs with cygwin, so doesn't cope with re...
php
{ "resource": "" }
q18827
UpdateCommand.mungeProjectYml
train
protected function mungeProjectYml() { $this->say("Merging BLT's <comment>blt.yml</comment> template with your project's <comment>blt/blt.yml</comment>..."); // Values in the project's existing blt.yml file will be preserved and // not overridden. $repo_project_yml =
php
{ "resource": "" }
q18828
UpdateCommand.setProjectName
train
protected function setProjectName() { $project_name = basename($this->getConfigValue('repo.root')); $project_yml = $this->getConfigValue('blt.config-files.project'); $project_config = YamlMunge::parseFile($project_yml);
php
{ "resource": "" }
q18829
DoPackagistConverter.convertComposerJson
train
public static function convertComposerJson($composer_json) { // Update version constraints in require. foreach ($composer_json['require'] as $package_name => $version_constraint) { if ($package_name == 'drupal/core') { continue; } if (strstr($package_name, 'drupal/')) { $compos...
php
{ "resource": "" }
q18830
DoPackagistConverter.convertVersionConstraint
train
protected static function convertVersionConstraint($version_constraint) { /* * 8.2.x-dev => 2.x-dev * 8.x-2.x-dev => 2.x-dev * 8.2.x-dev#a1b2c3 => 2.x-dev#a1b2c3 * 8.x-2.x-dev#a1b2c3 => 2.x-dev#a1b2c3 */ if (preg_match('/-dev(#[0-9a-f]+)?$/', $version_constraint)) { return preg_r...
php
{ "resource": "" }
q18831
FactoryHooksCommand.updateAcsfSites
train
public function updateAcsfSites($site, $target_env) { $this->say("Running updates for site <comment>$site</comment>
php
{ "resource": "" }
q18832
Timeline.all
train
public function all($username, $repository, $issue) { return $this->get('/repos/'.rawurlencode($usernam
php
{ "resource": "" }
q18833
Organization.repositories
train
public function repositories($organization, $type = 'all', $page = 1) { return $this->get('/orgs/'.rawurlencode($organization).'/repos', [
php
{ "resource": "" }
q18834
Apps.createInstallationToken
train
public function createInstallationToken($installationId, $userId = null) { $parameters = []; if ($userId) {
php
{ "resource": "" }
q18835
Apps.listRepositories
train
public function listRepositories($userId = null) { $parameters = []; if ($userId) {
php
{ "resource": "" }
q18836
References.show
train
public function show($username, $repository, $reference) { $reference = $this->encodeReference($reference);
php
{ "resource": "" }
q18837
References.update
train
public function update($username, $repository, $reference, array $params) { if (!isset($params['sha'])) { throw new MissingArgumentException('sha');
php
{ "resource": "" }
q18838
References.remove
train
public function remove($username, $repository, $reference) { $reference = $this->encodeReference($reference);
php
{ "resource": "" }
q18839
Trees.show
train
public function show($username, $repository, $sha, $recursive = false) { return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/gi
php
{ "resource": "" }
q18840
Trees.create
train
public function create($username, $repository, array $params) { if (!isset($params['tree']) || !is_array($params['tree'])) { throw new MissingArgumentException('tree'); } if (!isset($params['tree'][0])) { $params['tree'] = [$params['tree']]; } foreac...
php
{ "resource": "" }
q18841
Comments.configure
train
public function configure($bodyType = null) { if (!in_array($bodyType, ['text', 'html', 'full'])) { $bodyType = 'raw'; }
php
{ "resource": "" }
q18842
Comments.update
train
public function update($gist, $comment_id, $body) { return $this->patch('/gists/'.rawurlencode(
php
{ "resource": "" }
q18843
User.following
train
public function following($username, array $parameters = [], array $requestHeaders =
php
{ "resource": "" }
q18844
User.followers
train
public function followers($username, array $parameters = [], array $requestHeaders =
php
{ "resource": "" }
q18845
User.starred
train
public function starred($username, $page = 1, $perPage = 30, $sort = 'created', $direction = 'desc') { return $this->get('/users/'.rawurlencode($username).'/starred', [ 'page' => $page,
php
{ "resource": "" }
q18846
PullRequest.status
train
public function status($username, $repository, $id) { $link = $this->show($username,
php
{ "resource": "" }
q18847
Contents.readme
train
public function readme($username, $repository, $reference = null) { return $this->
php
{ "resource": "" }
q18848
Contents.show
train
public function show($username, $repository, $path = null, $reference = null) { $url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents'; if (null !== $path) {
php
{ "resource": "" }
q18849
Contents.create
train
public function create($username, $repository, $path, $content, $message, $branch = null, array $committer = null) { $url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents/'.rawurlencode($path); $parameters = [ 'content' => base64_encode($content), 'me...
php
{ "resource": "" }
q18850
Contents.exists
train
public function exists($username, $repository, $path, $reference = null) { $url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents'; if (null !== $path) { $url .= '/'.rawurlencode($path); } try { $response = $this->head($url, [ ...
php
{ "resource": "" }
q18851
Contents.rm
train
public function rm($username, $repository, $path, $message, $sha, $branch = null, array $committer = null) { $url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents/'.rawurlencode($path); $parameters = [ 'message' => $message, 'sha' => $sha, ...
php
{ "resource": "" }
q18852
Contents.archive
train
public function archive($username, $repository, $format, $reference = null) { if (!in_array($format, ['tarball', 'zipball'])) { $format = 'tarball'; }
php
{ "resource": "" }
q18853
Contents.download
train
public function download($username, $repository, $path, $reference = null) { $file = $this->show($username, $repository, $path, $reference); if (!isset($file['type']) || !in_array($file['type'], ['file', 'symlink'], true)) { throw new InvalidArgumentException(sprintf('Path "%s" is not a...
php
{ "resource": "" }
q18854
Issue.find
train
public function find($username, $repository, $state, $keyword) { if (!in_array($state, ['open', 'closed'])) { $state = 'open'; }
php
{ "resource": "" }
q18855
Issue.org
train
public function org($organization, $state, array $params = []) { if (!in_array($state, ['open', 'closed'])) {
php
{ "resource": "" }
q18856
Issue.lock
train
public function lock($username, $repository, $id) { return $this->put('/repos/'.rawurlencode($userna
php
{ "resource": "" }
q18857
Issue.unlock
train
public function unlock($username, $repository, $id) { return $this->delete('/repos/'.rawurlencode($use
php
{ "resource": "" }
q18858
RateLimit.getResource
train
public function getResource($name) { // Fetch once per instance if (empty($this->resources)) {
php
{ "resource": "" }
q18859
RateLimit.fetchLimits
train
protected function fetchLimits() { $result = $this->get('/rate_limit') ?: []; // Assemble Limit instances foreach ($result['resources'] as $resourceName => $resource) {
php
{ "resource": "" }
q18860
Deployment.updateStatus
train
public function updateStatus($username, $repository, $id, array $params) { if (!isset($params['state'])) { throw new MissingArgumentException(['state']); }
php
{ "resource": "" }
q18861
Deployment.getStatuses
train
public function getStatuses($username, $repository, $id) { return $this->get('/repos/'.rawurlencode($usern
php
{ "resource": "" }
q18862
ResponseMediator.getHeader
train
public static function getHeader(ResponseInterface $response, $name)
php
{ "resource": "" }
q18863
Notification.all
train
public function all($includingRead = false, $participating = false, DateTime $since = null, DateTime $before = null) { $parameters = [ 'all' => $includingRead, 'participating' => $participating, ]; if ($since !== null) {
php
{ "resource": "" }
q18864
Notification.markRead
train
public function markRead(DateTime $since = null) { $parameters = []; if ($since !== null)
php
{ "resource": "" }
q18865
Assignees.listAvailable
train
public function listAvailable($username, $repository, array $parameters = []) { return
php
{ "resource": "" }
q18866
Assignees.check
train
public function check($username, $repository, $assignee) { return $this->get('/repos/'.rawurlencode($us
php
{ "resource": "" }
q18867
Assignees.add
train
public function add($username, $repository, $issue, array $parameters) { if (!isset($parameters['assignees'])) { throw new MissingArgumentException('assignees'); } if (!is_array($parameters['assignees'])) { @trigger_error(sprintf('Passing the "assignees" parameter as...
php
{ "resource": "" }
q18868
Assignees.remove
train
public function remove($username, $repository, $issue, array $parameters) { if (!isset($parameters['assignees'])) { throw new MissingArgumentException('assignees'); }
php
{ "resource": "" }
q18869
Events.show
train
public function show($username, $repository, $event) { return $this->get('/repos/'.rawurlencode($usern
php
{ "resource": "" }
q18870
Blobs.show
train
public function show($username, $repository, $sha) { $response = $this->get('/r
php
{ "resource": "" }
q18871
Comments.all
train
public function all($username, $repository, $pullRequest = null, array $params = []) { if (null !== $pullRequest) { return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($pullRequest).'/comments'); } $parameters = array_merge([ ...
php
{ "resource": "" }
q18872
Comments.remove
train
public function remove($username, $repository, $comment) { return $this->delete('/repos/'.rawurlencode($us
php
{ "resource": "" }
q18873
Repo.update
train
public function update($username, $repository, array $values) {
php
{ "resource": "" }
q18874
Repo.readme
train
public function readme($username, $repository, $format = 'raw') { return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme', [], [
php
{ "resource": "" }
q18875
Repo.contributors
train
public function contributors($username, $repository, $includingAnonymous = false) { return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'
php
{ "resource": "" }
q18876
Repo.tags
train
public function tags($username, $repository, array $params = []) {
php
{ "resource": "" }
q18877
Repo.codeOfConduct
train
public function codeOfConduct($username, $repository) { //This api is in preview mode, so set the correct accept-header $this->acceptHeaderValue = 'application/vnd.github.scarlet-witch-preview+json';
php
{ "resource": "" }
q18878
Repo.topics
train
public function topics($username, $repository) { //This api is in preview mode, so set the correct accept-header $this->acceptHeaderValue = 'application/vnd.github.mercy-preview+json';
php
{ "resource": "" }
q18879
Repo.replaceTopics
train
public function replaceTopics($username, $repository, array $topics) { //This api is in preview mode, so set the correct accept-header $this->acceptHeaderValue = 'application/vnd.github.mercy-preview+json';
php
{ "resource": "" }
q18880
Repo.transfer
train
public function transfer($username, $repository, $newOwner, $teamId = []) { //This api is in preview mode, so set the correct accept-header $this->acceptHeaderValue = 'application/vnd.github.nightshade-preview+json';
php
{ "resource": "" }
q18881
Milestones.all
train
public function all($username, $repository, array $params = []) { if (isset($params['state']) && !in_array($params['state'], ['open', 'closed', 'all'])) { $params['state'] = 'open'; } if (isset($params['sort']) && !in_array($params['sort'], ['due_date', 'completeness'])) { ...
php
{ "resource": "" }
q18882
Milestones.create
train
public function create($username, $repository, array $params) { if (!isset($params['title'])) { throw new MissingArgumentException('title'); }
php
{ "resource": "" }
q18883
Milestones.update
train
public function update($username, $repository, $id, array $params) { if (isset($params['state']) && !in_array($params['state'], ['open', 'closed'])) { $params['state'] = 'open'; } return
php
{ "resource": "" }
q18884
Milestones.remove
train
public function remove($username, $repository, $id) { return $this->delete('/repos/'.rawurlencode($u
php
{ "resource": "" }
q18885
Milestones.labels
train
public function labels($username, $repository, $id) { return $this->get('/repos/'.rawurlencode($usernam
php
{ "resource": "" }
q18886
Review.show
train
public function show($username, $repository, $pullRequest, $id) { return
php
{ "resource": "" }
q18887
Review.comments
train
public function comments($username, $repository, $pullRequest, $id) { return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'
php
{ "resource": "" }
q18888
Review.create
train
public function create($username, $repository, $pullRequest, array $params = []) { if (array_key_exists('event', $params) && !in_array($params['event'], ['APPROVE', 'REQUEST_CHANGES', 'COMMENT'], true)) { throw new InvalidArgumentException(sprintf('"event" must be
php
{ "resource": "" }
q18889
Review.submit
train
public function submit($username, $repository, $pullRequest, $id, array $params = []) { if (!isset($params['event'])) { throw new MissingArgumentException('event'); } if (!in_array($params['event'], ['APPROVE', 'REQUEST_CHANGES', 'COMMENT'], true)) { throw new
php
{ "resource": "" }
q18890
Review.dismiss
train
public function dismiss($username, $repository, $pullRequest, $id, $message) { if (!is_string($message)) { throw new InvalidArgumentException(sprintf('"message" must be a valid string ("%s" given).', gettype($message))); } if (empty($message)) { throw new InvalidArgu...
php
{ "resource": "" }
q18891
Review.update
train
public function update($username, $repository, $pullRequest, $id, $body) { if (!is_string($body)) { throw new InvalidArgumentException(sprintf('"body" must be a valid string ("%s" given).', gettype($body))); } if (empty($body)) { throw new InvalidArgumentException('"...
php
{ "resource": "" }
q18892
Client.setEnterpriseUrl
train
private function setEnterpriseUrl($enterpriseUrl) { $builder = $this->getHttpClientBuilder(); $builder->removePlugin(Plugin\AddHostPlugin::class);
php
{ "resource": "" }
q18893
Protection.show
train
public function show($username, $repository, $branch) { return $this->get('/repos/'.rawurlencode($username
php
{ "resource": "" }
q18894
Protection.update
train
public function update($username, $repository, $branch, array $params = []) { return
php
{ "resource": "" }
q18895
Protection.remove
train
public function remove($username, $repository, $branch) { return $this->dele
php
{ "resource": "" }
q18896
Protection.showStatusChecks
train
public function showStatusChecks($username, $repository, $branch) { return $this->get('/
php
{ "resource": "" }
q18897
Protection.updateStatusChecks
train
public function updateStatusChecks($username, $repository, $branch, array $params = []) { return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($reposito
php
{ "resource": "" }
q18898
Protection.removeStatusChecks
train
public function removeStatusChecks($username, $repository, $branch) { return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/br
php
{ "resource": "" }
q18899
Protection.showStatusChecksContexts
train
public function showStatusChecksContexts($username, $repository, $branch) { return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/bran
php
{ "resource": "" }