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 |
---|---|---|---|---|---|---|---|---|---|---|---|
acquia/blt
|
src/Robo/Commands/Vm/VmCommand.php
|
VmCommand.boot
|
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 <comment>vagrant up</comment> to boot the VM.");
$result = $this->taskExec("vagrant up")
->dir($this->getConfigValue('repo.root'))
->printOutput(TRUE)
->run();
if (!$result->wasSuccessful()) {
$this->logger->error("Drupal VM failed to boot. Read Drupal VM's previous output for more information.");
$confirm = $this->confirm("Do you want to try to re-provision the VM? Sometimes this works.", TRUE);
if ($confirm) {
$result = $this->taskExec("vagrant provision")
->dir($this->getConfigValue('repo.root'))
->printOutput(TRUE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Unable to provision virtual machine. This is likely due to an issue with your Drupal VM configuration and not BLT itself.");
}
}
}
else {
$this->yell("Drupal VM booted successfully.");
$this->say(" * To run blt or drush commands against your VM, must SSH into the VM via <comment>vagrant ssh</comment>.");
$this->say(" * From now on, please use vagrant commands to manage your virtual machine on this computer.");
}
return $result;
}
}
|
php
|
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 <comment>vagrant up</comment> to boot the VM.");
$result = $this->taskExec("vagrant up")
->dir($this->getConfigValue('repo.root'))
->printOutput(TRUE)
->run();
if (!$result->wasSuccessful()) {
$this->logger->error("Drupal VM failed to boot. Read Drupal VM's previous output for more information.");
$confirm = $this->confirm("Do you want to try to re-provision the VM? Sometimes this works.", TRUE);
if ($confirm) {
$result = $this->taskExec("vagrant provision")
->dir($this->getConfigValue('repo.root'))
->printOutput(TRUE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Unable to provision virtual machine. This is likely due to an issue with your Drupal VM configuration and not BLT itself.");
}
}
}
else {
$this->yell("Drupal VM booted successfully.");
$this->say(" * To run blt or drush commands against your VM, must SSH into the VM via <comment>vagrant ssh</comment>.");
$this->say(" * From now on, please use vagrant commands to manage your virtual machine on this computer.");
}
return $result;
}
}
|
[
"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 <comment>vagrant up</comment> to boot the VM.\"",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"taskExec",
"(",
"\"vagrant up\"",
")",
"->",
"dir",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
")",
"->",
"printOutput",
"(",
"TRUE",
")",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"->",
"wasSuccessful",
"(",
")",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"error",
"(",
"\"Drupal VM failed to boot. Read Drupal VM's previous output for more information.\"",
")",
";",
"$",
"confirm",
"=",
"$",
"this",
"->",
"confirm",
"(",
"\"Do you want to try to re-provision the VM? Sometimes this works.\"",
",",
"TRUE",
")",
";",
"if",
"(",
"$",
"confirm",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"taskExec",
"(",
"\"vagrant provision\"",
")",
"->",
"dir",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
")",
"->",
"printOutput",
"(",
"TRUE",
")",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"->",
"wasSuccessful",
"(",
")",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Unable to provision virtual machine. This is likely due to an issue with your Drupal VM configuration and not BLT itself.\"",
")",
";",
"}",
"}",
"}",
"else",
"{",
"$",
"this",
"->",
"yell",
"(",
"\"Drupal VM booted successfully.\"",
")",
";",
"$",
"this",
"->",
"say",
"(",
"\" * To run blt or drush commands against your VM, must SSH into the VM via <comment>vagrant ssh</comment>.\"",
")",
";",
"$",
"this",
"->",
"say",
"(",
"\" * From now on, please use vagrant commands to manage your virtual machine on this computer.\"",
")",
";",
"}",
"return",
"$",
"result",
";",
"}",
"}"
] |
Boots a Drupal VM.
@throws \Acquia\Blt\Robo\Exceptions\BltException
|
[
"Boots",
"a",
"Drupal",
"VM",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Vm/VmCommand.php#L173-L203
|
train
|
acquia/blt
|
src/Robo/Commands/Vm/VmCommand.php
|
VmCommand.isDrupalVmRequired
|
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'])
&& $composer_json['require-dev']['geerlingguy/drupal-vm'] == $this->drupalVmVersionConstraint;
}
|
php
|
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'])
&& $composer_json['require-dev']['geerlingguy/drupal-vm'] == $this->drupalVmVersionConstraint;
}
|
[
"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'",
"]",
")",
"&&",
"$",
"composer_json",
"[",
"'require-dev'",
"]",
"[",
"'geerlingguy/drupal-vm'",
"]",
"==",
"$",
"this",
"->",
"drupalVmVersionConstraint",
";",
"}"
] |
Determines if Drupal VM is currently in composer.json's require-dev.
@return bool
TRUE if it is present already and matches version constraint.
|
[
"Determines",
"if",
"Drupal",
"VM",
"is",
"currently",
"in",
"composer",
".",
"json",
"s",
"require",
"-",
"dev",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Vm/VmCommand.php#L227-L231
|
train
|
acquia/blt
|
src/Robo/Commands/Vm/VmCommand.php
|
VmCommand.checkRequirements
|
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#quick-start-guide");
throw new BltException("Drupal VM requirements are missing.");
}
else {
$this->installVagrantPlugin('vagrant-hostsupdater');
}
}
|
php
|
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#quick-start-guide");
throw new BltException("Drupal VM requirements are missing.");
}
else {
$this->installVagrantPlugin('vagrant-hostsupdater');
}
}
|
[
"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#quick-start-guide\"",
")",
";",
"throw",
"new",
"BltException",
"(",
"\"Drupal VM requirements are missing.\"",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"installVagrantPlugin",
"(",
"'vagrant-hostsupdater'",
")",
";",
"}",
"}"
] |
Checks local system for Drupal VM requirements.
Verifies that vagrant and its required plugins are installed.
@throws \Acquia\Blt\Robo\Exceptions\BltException
|
[
"Checks",
"local",
"system",
"for",
"Drupal",
"VM",
"requirements",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Vm/VmCommand.php#L239-L249
|
train
|
acquia/blt
|
src/Robo/Commands/Vm/VmCommand.php
|
VmCommand.setBaseBox
|
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':
$config->set('workspace', '/root');
$config->set('extra_packages', [
'patchutils',
'sqlite',
]);
$config->set('installed_extras', [
'adminer',
'selenium',
'drush',
'mailhog',
'memcached',
'nodejs',
'solr',
'xdebug',
]);
break;
}
$config->set('base_box', $base_box);
}
|
php
|
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':
$config->set('workspace', '/root');
$config->set('extra_packages', [
'patchutils',
'sqlite',
]);
$config->set('installed_extras', [
'adminer',
'selenium',
'drush',
'mailhog',
'memcached',
'nodejs',
'solr',
'xdebug',
]);
break;
}
$config->set('base_box', $base_box);
}
|
[
"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'",
":",
"$",
"config",
"->",
"set",
"(",
"'workspace'",
",",
"'/root'",
")",
";",
"$",
"config",
"->",
"set",
"(",
"'extra_packages'",
",",
"[",
"'patchutils'",
",",
"'sqlite'",
",",
"]",
")",
";",
"$",
"config",
"->",
"set",
"(",
"'installed_extras'",
",",
"[",
"'adminer'",
",",
"'selenium'",
",",
"'drush'",
",",
"'mailhog'",
",",
"'memcached'",
",",
"'nodejs'",
",",
"'solr'",
",",
"'xdebug'",
",",
"]",
")",
";",
"break",
";",
"}",
"$",
"config",
"->",
"set",
"(",
"'base_box'",
",",
"$",
"base_box",
")",
";",
"}"
] |
Sets the Drupal VM base box.
@param \Acquia\Blt\Robo\Config\BltConfig $config
|
[
"Sets",
"the",
"Drupal",
"VM",
"base",
"box",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Vm/VmCommand.php#L268-L299
|
train
|
acquia/blt
|
src/Robo/Commands/Vm/VmCommand.php
|
VmCommand.customizeConfigFiles
|
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 new VM.
$random_local_ip = "192.168." . rand(3, 254) . '.' . rand(3, 254);
$config->set('random.ip', $random_local_ip);
$this->setBaseBox($config);
$config->expandFileProperties($this->projectDrupalVmConfigFile);
}
|
php
|
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 new VM.
$random_local_ip = "192.168." . rand(3, 254) . '.' . rand(3, 254);
$config->set('random.ip', $random_local_ip);
$this->setBaseBox($config);
$config->expandFileProperties($this->projectDrupalVmConfigFile);
}
|
[
"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 new VM.",
"$",
"random_local_ip",
"=",
"\"192.168.\"",
".",
"rand",
"(",
"3",
",",
"254",
")",
".",
"'.'",
".",
"rand",
"(",
"3",
",",
"254",
")",
";",
"$",
"config",
"->",
"set",
"(",
"'random.ip'",
",",
"$",
"random_local_ip",
")",
";",
"$",
"this",
"->",
"setBaseBox",
"(",
"$",
"config",
")",
";",
"$",
"config",
"->",
"expandFileProperties",
"(",
"$",
"this",
"->",
"projectDrupalVmConfigFile",
")",
";",
"}"
] |
Modifies the default configuration file.
|
[
"Modifies",
"the",
"default",
"configuration",
"file",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Vm/VmCommand.php#L304-L318
|
train
|
acquia/blt
|
src/Robo/Commands/Vm/VmCommand.php
|
VmCommand.createConfigFiles
|
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,
$this->projectDrupalVmVagrantfile, TRUE)
->stopOnFail()
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
}
|
php
|
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,
$this->projectDrupalVmVagrantfile, TRUE)
->stopOnFail()
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
}
|
[
"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",
",",
"$",
"this",
"->",
"projectDrupalVmVagrantfile",
",",
"TRUE",
")",
"->",
"stopOnFail",
"(",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"run",
"(",
")",
";",
"}"
] |
Creates the default configuration file.
|
[
"Creates",
"the",
"default",
"configuration",
"file",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Vm/VmCommand.php#L323-L335
|
train
|
acquia/blt
|
src/Robo/Commands/Vm/VmCommand.php
|
VmCommand.createDrushAlias
|
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 {
$project_drush_aliases = Expander::parse(file_get_contents($this->projectDrushAliasesFile), $this->getConfig()->export());
$default_drupal_vm_drush_aliases = Expander::parse(file_get_contents($this->defaultDrupalVmDrushAliasesFile), $this->getConfig()->export());
$new_aliases = ArrayManipulator::arrayMergeRecursiveDistinct($project_drush_aliases, $default_drupal_vm_drush_aliases);
}
file_put_contents($this->projectDrushAliasesFile, Yaml::dump($new_aliases));
}
|
php
|
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 {
$project_drush_aliases = Expander::parse(file_get_contents($this->projectDrushAliasesFile), $this->getConfig()->export());
$default_drupal_vm_drush_aliases = Expander::parse(file_get_contents($this->defaultDrupalVmDrushAliasesFile), $this->getConfig()->export());
$new_aliases = ArrayManipulator::arrayMergeRecursiveDistinct($project_drush_aliases, $default_drupal_vm_drush_aliases);
}
file_put_contents($this->projectDrushAliasesFile, Yaml::dump($new_aliases));
}
|
[
"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",
"{",
"$",
"project_drush_aliases",
"=",
"Expander",
"::",
"parse",
"(",
"file_get_contents",
"(",
"$",
"this",
"->",
"projectDrushAliasesFile",
")",
",",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"export",
"(",
")",
")",
";",
"$",
"default_drupal_vm_drush_aliases",
"=",
"Expander",
"::",
"parse",
"(",
"file_get_contents",
"(",
"$",
"this",
"->",
"defaultDrupalVmDrushAliasesFile",
")",
",",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"export",
"(",
")",
")",
";",
"$",
"new_aliases",
"=",
"ArrayManipulator",
"::",
"arrayMergeRecursiveDistinct",
"(",
"$",
"project_drush_aliases",
",",
"$",
"default_drupal_vm_drush_aliases",
")",
";",
"}",
"file_put_contents",
"(",
"$",
"this",
"->",
"projectDrushAliasesFile",
",",
"Yaml",
"::",
"dump",
"(",
"$",
"new_aliases",
")",
")",
";",
"}"
] |
Creates a new drush alias record.
|
[
"Creates",
"a",
"new",
"drush",
"alias",
"record",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Vm/VmCommand.php#L340-L352
|
train
|
acquia/blt
|
src/Robo/Commands/Blt/UpdateCommand.php
|
UpdateCommand.initializeBlt
|
protected function initializeBlt() {
$this->updateRootProjectFiles();
$this->taskExecStack()
->dir($this->getConfigValue("repo.root"))
->exec("composer drupal:scaffold")
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
// Reinitialize configuration now that project files exist.
$config_initializer = new ConfigInitializer($this->getConfigValue('repo.root'), $this->input());
$new_config = $config_initializer->initialize();
$this->getConfig()->import($new_config->export());
$this->invokeCommand('blt:init:settings');
$this->invokeCommand('recipes:blt:init:command');
$this->invokeCommand('blt:init:shell-alias');
if (DIRECTORY_SEPARATOR === '\\') {
// On Windows, during composer create-project,
// the wizard command fails when it reaches the interactive steps.
// Until this is fixed, go with the defaults.
// The user can run blt wizard any time later for changing defaults.
$this->input()->setInteractive(FALSE);
}
if ($this->input()->isInteractive()) {
$this->invokeCommand('wizard');
}
}
|
php
|
protected function initializeBlt() {
$this->updateRootProjectFiles();
$this->taskExecStack()
->dir($this->getConfigValue("repo.root"))
->exec("composer drupal:scaffold")
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
// Reinitialize configuration now that project files exist.
$config_initializer = new ConfigInitializer($this->getConfigValue('repo.root'), $this->input());
$new_config = $config_initializer->initialize();
$this->getConfig()->import($new_config->export());
$this->invokeCommand('blt:init:settings');
$this->invokeCommand('recipes:blt:init:command');
$this->invokeCommand('blt:init:shell-alias');
if (DIRECTORY_SEPARATOR === '\\') {
// On Windows, during composer create-project,
// the wizard command fails when it reaches the interactive steps.
// Until this is fixed, go with the defaults.
// The user can run blt wizard any time later for changing defaults.
$this->input()->setInteractive(FALSE);
}
if ($this->input()->isInteractive()) {
$this->invokeCommand('wizard');
}
}
|
[
"protected",
"function",
"initializeBlt",
"(",
")",
"{",
"$",
"this",
"->",
"updateRootProjectFiles",
"(",
")",
";",
"$",
"this",
"->",
"taskExecStack",
"(",
")",
"->",
"dir",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"\"repo.root\"",
")",
")",
"->",
"exec",
"(",
"\"composer drupal:scaffold\"",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"run",
"(",
")",
";",
"// Reinitialize configuration now that project files exist.",
"$",
"config_initializer",
"=",
"new",
"ConfigInitializer",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
",",
"$",
"this",
"->",
"input",
"(",
")",
")",
";",
"$",
"new_config",
"=",
"$",
"config_initializer",
"->",
"initialize",
"(",
")",
";",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"import",
"(",
"$",
"new_config",
"->",
"export",
"(",
")",
")",
";",
"$",
"this",
"->",
"invokeCommand",
"(",
"'blt:init:settings'",
")",
";",
"$",
"this",
"->",
"invokeCommand",
"(",
"'recipes:blt:init:command'",
")",
";",
"$",
"this",
"->",
"invokeCommand",
"(",
"'blt:init:shell-alias'",
")",
";",
"if",
"(",
"DIRECTORY_SEPARATOR",
"===",
"'\\\\'",
")",
"{",
"// On Windows, during composer create-project,",
"// the wizard command fails when it reaches the interactive steps.",
"// Until this is fixed, go with the defaults.",
"// The user can run blt wizard any time later for changing defaults.",
"$",
"this",
"->",
"input",
"(",
")",
"->",
"setInteractive",
"(",
"FALSE",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"input",
"(",
")",
"->",
"isInteractive",
"(",
")",
")",
"{",
"$",
"this",
"->",
"invokeCommand",
"(",
"'wizard'",
")",
";",
"}",
"}"
] |
Creates initial BLT files in their default state.
|
[
"Creates",
"initial",
"BLT",
"files",
"in",
"their",
"default",
"state",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Blt/UpdateCommand.php#L82-L108
|
train
|
acquia/blt
|
src/Robo/Commands/Blt/UpdateCommand.php
|
UpdateCommand.update
|
public function update($options = ['since' => InputOption::VALUE_REQUIRED]) {
$this->rsyncTemplate();
$starting_version = $options['since'] ?: $this->currentSchemaVersion;
if ($this->executeSchemaUpdates($starting_version)) {
$this->updateSchemaVersionFile();
}
$this->cleanup();
$this->invokeCommand('blt:init:shell-alias');
}
|
php
|
public function update($options = ['since' => InputOption::VALUE_REQUIRED]) {
$this->rsyncTemplate();
$starting_version = $options['since'] ?: $this->currentSchemaVersion;
if ($this->executeSchemaUpdates($starting_version)) {
$this->updateSchemaVersionFile();
}
$this->cleanup();
$this->invokeCommand('blt:init:shell-alias');
}
|
[
"public",
"function",
"update",
"(",
"$",
"options",
"=",
"[",
"'since'",
"=>",
"InputOption",
"::",
"VALUE_REQUIRED",
"]",
")",
"{",
"$",
"this",
"->",
"rsyncTemplate",
"(",
")",
";",
"$",
"starting_version",
"=",
"$",
"options",
"[",
"'since'",
"]",
"?",
":",
"$",
"this",
"->",
"currentSchemaVersion",
";",
"if",
"(",
"$",
"this",
"->",
"executeSchemaUpdates",
"(",
"$",
"starting_version",
")",
")",
"{",
"$",
"this",
"->",
"updateSchemaVersionFile",
"(",
")",
";",
"}",
"$",
"this",
"->",
"cleanup",
"(",
")",
";",
"$",
"this",
"->",
"invokeCommand",
"(",
"'blt:init:shell-alias'",
")",
";",
"}"
] |
Updates files from BLT's template and executes scripted updates.
@command blt:update
@aliases bu update
@param array $options
@throws BltException
|
[
"Updates",
"files",
"from",
"BLT",
"s",
"template",
"and",
"executes",
"scripted",
"updates",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Blt/UpdateCommand.php#L119-L128
|
train
|
acquia/blt
|
src/Robo/Commands/Blt/UpdateCommand.php
|
UpdateCommand.cleanup
|
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.settings.php",
"docroot/sites/default/settings/cache.settings.php",
"docroot/sites/default/settings/filesystem.settings.php",
"docroot/sites/default/settings/logging.settings.php",
"docroot/sites/default/settings/travis.settings.php",
"docroot/sites/default/settings/pipelines.settings.php",
"docroot/sites/default/settings/tugboat.settings.php",
"docroot/sites/settings/global.settings.default.php",
"tests/phpunit/blt",
"tests/phpunit/Bolt",
"scripts/blt",
"scripts/drupal",
"scripts/drupal-vm",
"scripts/git-hooks",
"scripts/release-notes",
"scripts/tugboat",
"blt.sh",
"project.yml",
"project.local.yml",
"example.project.local.yml",
"readme/acsf-setup.md",
"readme/architecture.md",
"readme/best-practices.md",
"readme/deploy.md",
"readme/dev-workflow.md",
"readme/features-workflow.md",
"readme/local-development.md",
"readme/onboarding.md",
"readme/project-tasks.md",
"readme/release-process.md",
"readme/repo-architecture.md",
"readme/views.md",
"drush/policy.drush.inc",
])
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
}
|
php
|
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.settings.php",
"docroot/sites/default/settings/cache.settings.php",
"docroot/sites/default/settings/filesystem.settings.php",
"docroot/sites/default/settings/logging.settings.php",
"docroot/sites/default/settings/travis.settings.php",
"docroot/sites/default/settings/pipelines.settings.php",
"docroot/sites/default/settings/tugboat.settings.php",
"docroot/sites/settings/global.settings.default.php",
"tests/phpunit/blt",
"tests/phpunit/Bolt",
"scripts/blt",
"scripts/drupal",
"scripts/drupal-vm",
"scripts/git-hooks",
"scripts/release-notes",
"scripts/tugboat",
"blt.sh",
"project.yml",
"project.local.yml",
"example.project.local.yml",
"readme/acsf-setup.md",
"readme/architecture.md",
"readme/best-practices.md",
"readme/deploy.md",
"readme/dev-workflow.md",
"readme/features-workflow.md",
"readme/local-development.md",
"readme/onboarding.md",
"readme/project-tasks.md",
"readme/release-process.md",
"readme/repo-architecture.md",
"readme/views.md",
"drush/policy.drush.inc",
])
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
}
|
[
"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.settings.php\"",
",",
"\"docroot/sites/default/settings/cache.settings.php\"",
",",
"\"docroot/sites/default/settings/filesystem.settings.php\"",
",",
"\"docroot/sites/default/settings/logging.settings.php\"",
",",
"\"docroot/sites/default/settings/travis.settings.php\"",
",",
"\"docroot/sites/default/settings/pipelines.settings.php\"",
",",
"\"docroot/sites/default/settings/tugboat.settings.php\"",
",",
"\"docroot/sites/settings/global.settings.default.php\"",
",",
"\"tests/phpunit/blt\"",
",",
"\"tests/phpunit/Bolt\"",
",",
"\"scripts/blt\"",
",",
"\"scripts/drupal\"",
",",
"\"scripts/drupal-vm\"",
",",
"\"scripts/git-hooks\"",
",",
"\"scripts/release-notes\"",
",",
"\"scripts/tugboat\"",
",",
"\"blt.sh\"",
",",
"\"project.yml\"",
",",
"\"project.local.yml\"",
",",
"\"example.project.local.yml\"",
",",
"\"readme/acsf-setup.md\"",
",",
"\"readme/architecture.md\"",
",",
"\"readme/best-practices.md\"",
",",
"\"readme/deploy.md\"",
",",
"\"readme/dev-workflow.md\"",
",",
"\"readme/features-workflow.md\"",
",",
"\"readme/local-development.md\"",
",",
"\"readme/onboarding.md\"",
",",
"\"readme/project-tasks.md\"",
",",
"\"readme/release-process.md\"",
",",
"\"readme/repo-architecture.md\"",
",",
"\"readme/views.md\"",
",",
"\"drush/policy.drush.inc\"",
",",
"]",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"run",
"(",
")",
";",
"}"
] |
Removes deprecated BLT files and directories.
@command blt:source:cleanup
@aliases bsc cleanup
|
[
"Removes",
"deprecated",
"BLT",
"files",
"and",
"directories",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Blt/UpdateCommand.php#L136-L179
|
train
|
acquia/blt
|
src/Robo/Commands/Blt/UpdateCommand.php
|
UpdateCommand.executeSchemaUpdates
|
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->say("<comment>The following BLT updates are outstanding:</comment>");
$updater->printUpdates($updates);
// @todo Do not prompt if this is being run from Plugin.php.
$confirm = $this->confirm('Would you like to perform the listed updates?', TRUE);
if ($confirm) {
try {
$updater->executeUpdates($updates);
return TRUE;
}
catch (\Exception $e) {
$this->logger->error($e->getMessage());
return FALSE;
}
}
}
}
|
php
|
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->say("<comment>The following BLT updates are outstanding:</comment>");
$updater->printUpdates($updates);
// @todo Do not prompt if this is being run from Plugin.php.
$confirm = $this->confirm('Would you like to perform the listed updates?', TRUE);
if ($confirm) {
try {
$updater->executeUpdates($updates);
return TRUE;
}
catch (\Exception $e) {
$this->logger->error($e->getMessage());
return FALSE;
}
}
}
}
|
[
"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",
"->",
"say",
"(",
"\"<comment>The following BLT updates are outstanding:</comment>\"",
")",
";",
"$",
"updater",
"->",
"printUpdates",
"(",
"$",
"updates",
")",
";",
"// @todo Do not prompt if this is being run from Plugin.php.",
"$",
"confirm",
"=",
"$",
"this",
"->",
"confirm",
"(",
"'Would you like to perform the listed updates?'",
",",
"TRUE",
")",
";",
"if",
"(",
"$",
"confirm",
")",
"{",
"try",
"{",
"$",
"updater",
"->",
"executeUpdates",
"(",
"$",
"updates",
")",
";",
"return",
"TRUE",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"error",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"return",
"FALSE",
";",
"}",
"}",
"}",
"}"
] |
Executes all update hooks for a given schema delta.
@param $starting_version
@return bool
TRUE if updates were successfully executed.
|
[
"Executes",
"all",
"update",
"hooks",
"for",
"a",
"given",
"schema",
"delta",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Blt/UpdateCommand.php#L271-L291
|
train
|
acquia/blt
|
src/Robo/Commands/Blt/UpdateCommand.php
|
UpdateCommand.convertLegacySchemaVersion
|
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, '.') !== FALSE) {
str_replace('-beta1', '', $version);
$semver_array = explode('.', $version);
$semver_array[1] = str_pad($semver_array[1], 3, "0", STR_PAD_LEFT);
$semver_array[2] = str_pad($semver_array[2], 3, "0", STR_PAD_LEFT);
$version = implode('', $semver_array);
}
if (strpos($version, 'dev') !== FALSE) {
$version = '0';
}
return $version;
}
|
php
|
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, '.') !== FALSE) {
str_replace('-beta1', '', $version);
$semver_array = explode('.', $version);
$semver_array[1] = str_pad($semver_array[1], 3, "0", STR_PAD_LEFT);
$semver_array[2] = str_pad($semver_array[2], 3, "0", STR_PAD_LEFT);
$version = implode('', $semver_array);
}
if (strpos($version, 'dev') !== FALSE) {
$version = '0';
}
return $version;
}
|
[
"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",
",",
"'.'",
")",
"!==",
"FALSE",
")",
"{",
"str_replace",
"(",
"'-beta1'",
",",
"''",
",",
"$",
"version",
")",
";",
"$",
"semver_array",
"=",
"explode",
"(",
"'.'",
",",
"$",
"version",
")",
";",
"$",
"semver_array",
"[",
"1",
"]",
"=",
"str_pad",
"(",
"$",
"semver_array",
"[",
"1",
"]",
",",
"3",
",",
"\"0\"",
",",
"STR_PAD_LEFT",
")",
";",
"$",
"semver_array",
"[",
"2",
"]",
"=",
"str_pad",
"(",
"$",
"semver_array",
"[",
"2",
"]",
",",
"3",
",",
"\"0\"",
",",
"STR_PAD_LEFT",
")",
";",
"$",
"version",
"=",
"implode",
"(",
"''",
",",
"$",
"semver_array",
")",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"version",
",",
"'dev'",
")",
"!==",
"FALSE",
")",
"{",
"$",
"version",
"=",
"'0'",
";",
"}",
"return",
"$",
"version",
";",
"}"
] |
Converts legacy BLT schema version to current version.
@param string $version
The legacy version.
@return string
The version in correct syntax.
|
[
"Converts",
"legacy",
"BLT",
"schema",
"version",
"to",
"current",
"version",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Blt/UpdateCommand.php#L302-L318
|
train
|
acquia/blt
|
src/Robo/Commands/Blt/UpdateCommand.php
|
UpdateCommand.rsyncTemplate
|
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 regular Windows paths.
if (DIRECTORY_SEPARATOR === '\\') {
$source = $this->convertWindowsPathToCygwinPath($source);
$destination = $this->convertWindowsPathToCygwinPath($destination);
}
$exclude_from = $this->getConfigValue('blt.update.ignore-existing-file');
$this->say("Copying files from BLT's template into your project...");
$result = $this->taskExecStack()
->exec("rsync -a --no-g '$source/' '$destination/' --exclude-from='$exclude_from'")
->exec("rsync -a --no-g '$source/' '$destination/' --include-from='$exclude_from' --ignore-existing")
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Could not rsync files from BLT into your repository.");
}
}
|
php
|
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 regular Windows paths.
if (DIRECTORY_SEPARATOR === '\\') {
$source = $this->convertWindowsPathToCygwinPath($source);
$destination = $this->convertWindowsPathToCygwinPath($destination);
}
$exclude_from = $this->getConfigValue('blt.update.ignore-existing-file');
$this->say("Copying files from BLT's template into your project...");
$result = $this->taskExecStack()
->exec("rsync -a --no-g '$source/' '$destination/' --exclude-from='$exclude_from'")
->exec("rsync -a --no-g '$source/' '$destination/' --include-from='$exclude_from' --ignore-existing")
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Could not rsync files from BLT into your repository.");
}
}
|
[
"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 regular Windows paths.",
"if",
"(",
"DIRECTORY_SEPARATOR",
"===",
"'\\\\'",
")",
"{",
"$",
"source",
"=",
"$",
"this",
"->",
"convertWindowsPathToCygwinPath",
"(",
"$",
"source",
")",
";",
"$",
"destination",
"=",
"$",
"this",
"->",
"convertWindowsPathToCygwinPath",
"(",
"$",
"destination",
")",
";",
"}",
"$",
"exclude_from",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'blt.update.ignore-existing-file'",
")",
";",
"$",
"this",
"->",
"say",
"(",
"\"Copying files from BLT's template into your project...\"",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"taskExecStack",
"(",
")",
"->",
"exec",
"(",
"\"rsync -a --no-g '$source/' '$destination/' --exclude-from='$exclude_from'\"",
")",
"->",
"exec",
"(",
"\"rsync -a --no-g '$source/' '$destination/' --include-from='$exclude_from' --ignore-existing\"",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"->",
"wasSuccessful",
"(",
")",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Could not rsync files from BLT into your repository.\"",
")",
";",
"}",
"}"
] |
Rsyncs files from BLT's template dir into project root dir.
@return void
@throws BltException
|
[
"Rsyncs",
"files",
"from",
"BLT",
"s",
"template",
"dir",
"into",
"project",
"root",
"dir",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Blt/UpdateCommand.php#L327-L348
|
train
|
acquia/blt
|
src/Robo/Commands/Blt/UpdateCommand.php
|
UpdateCommand.mungeProjectYml
|
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 = $this->getConfigValue('blt.config-files.project');
$template_project_yml = $this->getConfigValue('blt.root') . '/template/blt/blt.yml';
$munged_yml = YamlMunge::mungeFiles($template_project_yml, $repo_project_yml);
try {
YamlMunge::writeFile($repo_project_yml, $munged_yml);
}
catch (\Exception $e) {
throw new BltException("Could not update $repo_project_yml.");
}
}
|
php
|
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 = $this->getConfigValue('blt.config-files.project');
$template_project_yml = $this->getConfigValue('blt.root') . '/template/blt/blt.yml';
$munged_yml = YamlMunge::mungeFiles($template_project_yml, $repo_project_yml);
try {
YamlMunge::writeFile($repo_project_yml, $munged_yml);
}
catch (\Exception $e) {
throw new BltException("Could not update $repo_project_yml.");
}
}
|
[
"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",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'blt.config-files.project'",
")",
";",
"$",
"template_project_yml",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'blt.root'",
")",
".",
"'/template/blt/blt.yml'",
";",
"$",
"munged_yml",
"=",
"YamlMunge",
"::",
"mungeFiles",
"(",
"$",
"template_project_yml",
",",
"$",
"repo_project_yml",
")",
";",
"try",
"{",
"YamlMunge",
"::",
"writeFile",
"(",
"$",
"repo_project_yml",
",",
"$",
"munged_yml",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Could not update $repo_project_yml.\"",
")",
";",
"}",
"}"
] |
Updates project BLT .yml files with new key value pairs from upstream.
This WILL NOT overwrite existing values.
|
[
"Updates",
"project",
"BLT",
".",
"yml",
"files",
"with",
"new",
"key",
"value",
"pairs",
"from",
"upstream",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Blt/UpdateCommand.php#L359-L372
|
train
|
acquia/blt
|
src/Robo/Commands/Blt/UpdateCommand.php
|
UpdateCommand.setProjectName
|
protected function setProjectName() {
$project_name = basename($this->getConfigValue('repo.root'));
$project_yml = $this->getConfigValue('blt.config-files.project');
$project_config = YamlMunge::parseFile($project_yml);
$project_config['project']['machine_name'] = $project_name;
YamlMunge::writeFile($project_yml, $project_config);
}
|
php
|
protected function setProjectName() {
$project_name = basename($this->getConfigValue('repo.root'));
$project_yml = $this->getConfigValue('blt.config-files.project');
$project_config = YamlMunge::parseFile($project_yml);
$project_config['project']['machine_name'] = $project_name;
YamlMunge::writeFile($project_yml, $project_config);
}
|
[
"protected",
"function",
"setProjectName",
"(",
")",
"{",
"$",
"project_name",
"=",
"basename",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
")",
";",
"$",
"project_yml",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'blt.config-files.project'",
")",
";",
"$",
"project_config",
"=",
"YamlMunge",
"::",
"parseFile",
"(",
"$",
"project_yml",
")",
";",
"$",
"project_config",
"[",
"'project'",
"]",
"[",
"'machine_name'",
"]",
"=",
"$",
"project_name",
";",
"YamlMunge",
"::",
"writeFile",
"(",
"$",
"project_yml",
",",
"$",
"project_config",
")",
";",
"}"
] |
Sets project.name using the directory name of repot.root.
@return \Robo\Result
|
[
"Sets",
"project",
".",
"name",
"using",
"the",
"directory",
"name",
"of",
"repot",
".",
"root",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Blt/UpdateCommand.php#L379-L385
|
train
|
acquia/blt
|
src/Update/DoPackagistConverter.php
|
DoPackagistConverter.convertComposerJson
|
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/')) {
$composer_json['require'][$package_name] = self::convertVersionConstraint($version_constraint);
}
}
// Change drupal/lightning to acquia/lightning.
$composer_json['require']['acquia/lightning'] = '^2';
unset($composer_json['require']['drupal/lightning']);
// Update version constraints in require-dev.
foreach ($composer_json['require-dev'] as $package_name => $version_constraint) {
if (strstr($package_name, 'drupal/')) {
$composer_json['require-dev'][$package_name] = self::convertVersionConstraint($version_constraint);
}
}
// Remove https://packagist.drupal-composer.org.
foreach ($composer_json['repositories'] as $key => $repository) {
if ($repository['url'] == 'https://packagist.drupal-composer.org') {
unset($composer_json['repositories'][$key]);
}
}
// Add https://packages.drupal.org/8.
$composer_json['repositories']['drupal'] = [
'type' => 'composer',
'url' => 'https://packages.drupal.org/8',
];
return $composer_json;
}
|
php
|
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/')) {
$composer_json['require'][$package_name] = self::convertVersionConstraint($version_constraint);
}
}
// Change drupal/lightning to acquia/lightning.
$composer_json['require']['acquia/lightning'] = '^2';
unset($composer_json['require']['drupal/lightning']);
// Update version constraints in require-dev.
foreach ($composer_json['require-dev'] as $package_name => $version_constraint) {
if (strstr($package_name, 'drupal/')) {
$composer_json['require-dev'][$package_name] = self::convertVersionConstraint($version_constraint);
}
}
// Remove https://packagist.drupal-composer.org.
foreach ($composer_json['repositories'] as $key => $repository) {
if ($repository['url'] == 'https://packagist.drupal-composer.org') {
unset($composer_json['repositories'][$key]);
}
}
// Add https://packages.drupal.org/8.
$composer_json['repositories']['drupal'] = [
'type' => 'composer',
'url' => 'https://packages.drupal.org/8',
];
return $composer_json;
}
|
[
"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/'",
")",
")",
"{",
"$",
"composer_json",
"[",
"'require'",
"]",
"[",
"$",
"package_name",
"]",
"=",
"self",
"::",
"convertVersionConstraint",
"(",
"$",
"version_constraint",
")",
";",
"}",
"}",
"// Change drupal/lightning to acquia/lightning.",
"$",
"composer_json",
"[",
"'require'",
"]",
"[",
"'acquia/lightning'",
"]",
"=",
"'^2'",
";",
"unset",
"(",
"$",
"composer_json",
"[",
"'require'",
"]",
"[",
"'drupal/lightning'",
"]",
")",
";",
"// Update version constraints in require-dev.",
"foreach",
"(",
"$",
"composer_json",
"[",
"'require-dev'",
"]",
"as",
"$",
"package_name",
"=>",
"$",
"version_constraint",
")",
"{",
"if",
"(",
"strstr",
"(",
"$",
"package_name",
",",
"'drupal/'",
")",
")",
"{",
"$",
"composer_json",
"[",
"'require-dev'",
"]",
"[",
"$",
"package_name",
"]",
"=",
"self",
"::",
"convertVersionConstraint",
"(",
"$",
"version_constraint",
")",
";",
"}",
"}",
"// Remove https://packagist.drupal-composer.org.",
"foreach",
"(",
"$",
"composer_json",
"[",
"'repositories'",
"]",
"as",
"$",
"key",
"=>",
"$",
"repository",
")",
"{",
"if",
"(",
"$",
"repository",
"[",
"'url'",
"]",
"==",
"'https://packagist.drupal-composer.org'",
")",
"{",
"unset",
"(",
"$",
"composer_json",
"[",
"'repositories'",
"]",
"[",
"$",
"key",
"]",
")",
";",
"}",
"}",
"// Add https://packages.drupal.org/8.",
"$",
"composer_json",
"[",
"'repositories'",
"]",
"[",
"'drupal'",
"]",
"=",
"[",
"'type'",
"=>",
"'composer'",
",",
"'url'",
"=>",
"'https://packages.drupal.org/8'",
",",
"]",
";",
"return",
"$",
"composer_json",
";",
"}"
] |
Converts composer.json from packagist.drupal-composer.org to D.O format.
@param array $composer_json
The composer.json array.
@return array
The modified composer.json array.
|
[
"Converts",
"composer",
".",
"json",
"from",
"packagist",
".",
"drupal",
"-",
"composer",
".",
"org",
"to",
"D",
".",
"O",
"format",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/DoPackagistConverter.php#L19-L55
|
train
|
acquia/blt
|
src/Update/DoPackagistConverter.php
|
DoPackagistConverter.convertVersionConstraint
|
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_replace('/^8\.(x-)?/', NULL, $version_constraint);
}
/*
* dev-master => master-dev
* dev-8.x-1.x => 1.x-dev
* dev-8.x-1.x#abc123 => 1.x-dev#abc123
* dev-8.2.x => 2.x-dev
* dev-8.2.x#abc123 => 2.x-dev#abc123
* dev-something_else#123abc => something_else-dev#123abc
*/
if (strpos($version_constraint, 'dev-') === 0) {
return preg_replace('/^dev-(8\.(x-)?)?([^#]+)(#[a-f0-9]+)?$/', '$3-dev$4', $version_constraint);
}
/*
* 8.* => *
*/
if (preg_match('/^8\.\*$/', $version_constraint)) {
return "*";
}
/*
* ~8 => *@stable
* ^8 => *@stable
*/
if (preg_match('/^[\^~]8$/', $version_constraint)) {
return '*@stable';
}
/*
* ~8.1.0-alpha1 > ~1.0.0-alpha1
* ^8.1.0-alpha1 > ^1.0.0-alpha1
* ^8.1.0 > ^1.0
* 8.1.0-alpha1 > 1.0.0-alpha1
* 8.1.0-beta12 > 1.0.0-beta12
* 8.12.0-rc22 > 12.0.0-rc22
*/
if (preg_match('/^([\^~]|[><=!]{1,2})?8(\.)?(\d+)?(\.\d+)?(-(alpha|beta|rc)\d+)?(\.\*)?(@(dev|alpha|beta|rc))?/', $version_constraint, $matches)) {
/*
* Group 0. `~8.1.0-alpha1.*@alpha`
* Group 1. `~`
* Group 2. `.`
* Group 3. `1`
* Group 4. `.0`
* Group 5. `-alpha1`
* Group 6. `alpha`
* Group 7. `.*`
* Group 8. `@alpha`
* Group 9. `alpha`
*/
$new_version_constraint = $matches[3];
if (isset($matches[4])) {
$new_version_constraint .= $matches[4];
}
if (isset($matches[3])) {
$new_version_constraint .= '.0';
}
else {
$new_version_constraint .= '*';
}
if (isset($matches[5])) {
$new_version_constraint .= $matches[5];
}
elseif (isset($matches[7])) {
$new_version_constraint .= $matches[7];
}
if (isset($matches[8])) {
$new_version_constraint .= $matches[8];
}
if (isset($matches[1])) {
$new_version_constraint = $matches[1] . $new_version_constraint;
}
return $new_version_constraint;
}
return $version_constraint;
}
|
php
|
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_replace('/^8\.(x-)?/', NULL, $version_constraint);
}
/*
* dev-master => master-dev
* dev-8.x-1.x => 1.x-dev
* dev-8.x-1.x#abc123 => 1.x-dev#abc123
* dev-8.2.x => 2.x-dev
* dev-8.2.x#abc123 => 2.x-dev#abc123
* dev-something_else#123abc => something_else-dev#123abc
*/
if (strpos($version_constraint, 'dev-') === 0) {
return preg_replace('/^dev-(8\.(x-)?)?([^#]+)(#[a-f0-9]+)?$/', '$3-dev$4', $version_constraint);
}
/*
* 8.* => *
*/
if (preg_match('/^8\.\*$/', $version_constraint)) {
return "*";
}
/*
* ~8 => *@stable
* ^8 => *@stable
*/
if (preg_match('/^[\^~]8$/', $version_constraint)) {
return '*@stable';
}
/*
* ~8.1.0-alpha1 > ~1.0.0-alpha1
* ^8.1.0-alpha1 > ^1.0.0-alpha1
* ^8.1.0 > ^1.0
* 8.1.0-alpha1 > 1.0.0-alpha1
* 8.1.0-beta12 > 1.0.0-beta12
* 8.12.0-rc22 > 12.0.0-rc22
*/
if (preg_match('/^([\^~]|[><=!]{1,2})?8(\.)?(\d+)?(\.\d+)?(-(alpha|beta|rc)\d+)?(\.\*)?(@(dev|alpha|beta|rc))?/', $version_constraint, $matches)) {
/*
* Group 0. `~8.1.0-alpha1.*@alpha`
* Group 1. `~`
* Group 2. `.`
* Group 3. `1`
* Group 4. `.0`
* Group 5. `-alpha1`
* Group 6. `alpha`
* Group 7. `.*`
* Group 8. `@alpha`
* Group 9. `alpha`
*/
$new_version_constraint = $matches[3];
if (isset($matches[4])) {
$new_version_constraint .= $matches[4];
}
if (isset($matches[3])) {
$new_version_constraint .= '.0';
}
else {
$new_version_constraint .= '*';
}
if (isset($matches[5])) {
$new_version_constraint .= $matches[5];
}
elseif (isset($matches[7])) {
$new_version_constraint .= $matches[7];
}
if (isset($matches[8])) {
$new_version_constraint .= $matches[8];
}
if (isset($matches[1])) {
$new_version_constraint = $matches[1] . $new_version_constraint;
}
return $new_version_constraint;
}
return $version_constraint;
}
|
[
"protected",
"static",
"function",
"convertVersionConstraint",
"(",
"$",
"version_constraint",
")",
"{",
"/*\n * 8.2.x-dev => 2.x-dev\n * 8.x-2.x-dev => 2.x-dev\n * 8.2.x-dev#a1b2c3 => 2.x-dev#a1b2c3\n * 8.x-2.x-dev#a1b2c3 => 2.x-dev#a1b2c3\n */",
"if",
"(",
"preg_match",
"(",
"'/-dev(#[0-9a-f]+)?$/'",
",",
"$",
"version_constraint",
")",
")",
"{",
"return",
"preg_replace",
"(",
"'/^8\\.(x-)?/'",
",",
"NULL",
",",
"$",
"version_constraint",
")",
";",
"}",
"/*\n * dev-master => master-dev\n * dev-8.x-1.x => 1.x-dev\n * dev-8.x-1.x#abc123 => 1.x-dev#abc123\n * dev-8.2.x => 2.x-dev\n * dev-8.2.x#abc123 => 2.x-dev#abc123\n * dev-something_else#123abc => something_else-dev#123abc\n */",
"if",
"(",
"strpos",
"(",
"$",
"version_constraint",
",",
"'dev-'",
")",
"===",
"0",
")",
"{",
"return",
"preg_replace",
"(",
"'/^dev-(8\\.(x-)?)?([^#]+)(#[a-f0-9]+)?$/'",
",",
"'$3-dev$4'",
",",
"$",
"version_constraint",
")",
";",
"}",
"/*\n * 8.* => *\n */",
"if",
"(",
"preg_match",
"(",
"'/^8\\.\\*$/'",
",",
"$",
"version_constraint",
")",
")",
"{",
"return",
"\"*\"",
";",
"}",
"/*\n * ~8 => *@stable\n * ^8 => *@stable\n */",
"if",
"(",
"preg_match",
"(",
"'/^[\\^~]8$/'",
",",
"$",
"version_constraint",
")",
")",
"{",
"return",
"'*@stable'",
";",
"}",
"/*\n * ~8.1.0-alpha1 > ~1.0.0-alpha1\n * ^8.1.0-alpha1 > ^1.0.0-alpha1\n * ^8.1.0 > ^1.0\n * 8.1.0-alpha1 > 1.0.0-alpha1\n * 8.1.0-beta12 > 1.0.0-beta12\n * 8.12.0-rc22 > 12.0.0-rc22\n */",
"if",
"(",
"preg_match",
"(",
"'/^([\\^~]|[><=!]{1,2})?8(\\.)?(\\d+)?(\\.\\d+)?(-(alpha|beta|rc)\\d+)?(\\.\\*)?(@(dev|alpha|beta|rc))?/'",
",",
"$",
"version_constraint",
",",
"$",
"matches",
")",
")",
"{",
"/*\n * Group 0. `~8.1.0-alpha1.*@alpha`\n * Group 1. `~`\n * Group 2. `.`\n * Group 3. `1`\n * Group 4. `.0`\n * Group 5. `-alpha1`\n * Group 6. `alpha`\n * Group 7. `.*`\n * Group 8. `@alpha`\n * Group 9. `alpha`\n */",
"$",
"new_version_constraint",
"=",
"$",
"matches",
"[",
"3",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"matches",
"[",
"4",
"]",
")",
")",
"{",
"$",
"new_version_constraint",
".=",
"$",
"matches",
"[",
"4",
"]",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"matches",
"[",
"3",
"]",
")",
")",
"{",
"$",
"new_version_constraint",
".=",
"'.0'",
";",
"}",
"else",
"{",
"$",
"new_version_constraint",
".=",
"'*'",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"matches",
"[",
"5",
"]",
")",
")",
"{",
"$",
"new_version_constraint",
".=",
"$",
"matches",
"[",
"5",
"]",
";",
"}",
"elseif",
"(",
"isset",
"(",
"$",
"matches",
"[",
"7",
"]",
")",
")",
"{",
"$",
"new_version_constraint",
".=",
"$",
"matches",
"[",
"7",
"]",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"matches",
"[",
"8",
"]",
")",
")",
"{",
"$",
"new_version_constraint",
".=",
"$",
"matches",
"[",
"8",
"]",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"matches",
"[",
"1",
"]",
")",
")",
"{",
"$",
"new_version_constraint",
"=",
"$",
"matches",
"[",
"1",
"]",
".",
"$",
"new_version_constraint",
";",
"}",
"return",
"$",
"new_version_constraint",
";",
"}",
"return",
"$",
"version_constraint",
";",
"}"
] |
Converts from to to packagist.drupal-composer.org to D.O format.
@param string $version_constraint
The packagist.drupal-composer.org style version constraint.
@return string
The to packages.drupal.org/8 style constraint.
|
[
"Converts",
"from",
"to",
"to",
"packagist",
".",
"drupal",
"-",
"composer",
".",
"org",
"to",
"D",
".",
"O",
"format",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/DoPackagistConverter.php#L66-L147
|
train
|
acquia/blt
|
src/Robo/Commands/Artifact/FactoryHooksCommand.php
|
FactoryHooksCommand.updateAcsfSites
|
public function updateAcsfSites($site, $target_env) {
$this->say("Running updates for site <comment>$site</comment> in environment <comment>$target_env</comment>.");
$this->switchSiteContext($site);
$this->invokeCommand('artifact:update:drupal');
}
|
php
|
public function updateAcsfSites($site, $target_env) {
$this->say("Running updates for site <comment>$site</comment> in environment <comment>$target_env</comment>.");
$this->switchSiteContext($site);
$this->invokeCommand('artifact:update:drupal');
}
|
[
"public",
"function",
"updateAcsfSites",
"(",
"$",
"site",
",",
"$",
"target_env",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Running updates for site <comment>$site</comment> in environment <comment>$target_env</comment>.\"",
")",
";",
"$",
"this",
"->",
"switchSiteContext",
"(",
"$",
"site",
")",
";",
"$",
"this",
"->",
"invokeCommand",
"(",
"'artifact:update:drupal'",
")",
";",
"}"
] |
Executes updates against all ACSF sites in the target environment.
@param $site
@param $target_env
@throws \Acquia\Blt\Robo\Exceptions\BltException
|
[
"Executes",
"updates",
"against",
"all",
"ACSF",
"sites",
"in",
"the",
"target",
"environment",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Artifact/FactoryHooksCommand.php#L36-L40
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Timeline.php
|
Timeline.all
|
public function all($username, $repository, $issue)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/timeline');
}
|
php
|
public function all($username, $repository, $issue)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/timeline');
}
|
[
"public",
"function",
"all",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"issue",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/issues/'",
".",
"rawurlencode",
"(",
"$",
"issue",
")",
".",
"'/timeline'",
")",
";",
"}"
] |
Get all events for a specific issue.
@link https://developer.github.com/v3/issues/timeline/#list-events-for-an-issue
@param string $username
@param string $repository
@param int $issue
@return array
|
[
"Get",
"all",
"events",
"for",
"a",
"specific",
"issue",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Timeline.php#L30-L33
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Organization.php
|
Organization.repositories
|
public function repositories($organization, $type = 'all', $page = 1)
{
return $this->get('/orgs/'.rawurlencode($organization).'/repos', [
'type' => $type,
'page' => $page,
]);
}
|
php
|
public function repositories($organization, $type = 'all', $page = 1)
{
return $this->get('/orgs/'.rawurlencode($organization).'/repos', [
'type' => $type,
'page' => $page,
]);
}
|
[
"public",
"function",
"repositories",
"(",
"$",
"organization",
",",
"$",
"type",
"=",
"'all'",
",",
"$",
"page",
"=",
"1",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/orgs/'",
".",
"rawurlencode",
"(",
"$",
"organization",
")",
".",
"'/repos'",
",",
"[",
"'type'",
"=>",
"$",
"type",
",",
"'page'",
"=>",
"$",
"page",
",",
"]",
")",
";",
"}"
] |
List all repositories across all the organizations that you can access.
@link http://developer.github.com/v3/repos/#list-organization-repositories
@param string $organization the user name
@param string $type the type of repositories
@param int $page the page
@return array the repositories
|
[
"List",
"all",
"repositories",
"across",
"all",
"the",
"organizations",
"that",
"you",
"can",
"access",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Organization.php#L59-L65
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Apps.php
|
Apps.createInstallationToken
|
public function createInstallationToken($installationId, $userId = null)
{
$parameters = [];
if ($userId) {
$parameters['user_id'] = $userId;
}
return $this->post('/app/installations/'.rawurlencode($installationId).'/access_tokens', $parameters);
}
|
php
|
public function createInstallationToken($installationId, $userId = null)
{
$parameters = [];
if ($userId) {
$parameters['user_id'] = $userId;
}
return $this->post('/app/installations/'.rawurlencode($installationId).'/access_tokens', $parameters);
}
|
[
"public",
"function",
"createInstallationToken",
"(",
"$",
"installationId",
",",
"$",
"userId",
"=",
"null",
")",
"{",
"$",
"parameters",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"userId",
")",
"{",
"$",
"parameters",
"[",
"'user_id'",
"]",
"=",
"$",
"userId",
";",
"}",
"return",
"$",
"this",
"->",
"post",
"(",
"'/app/installations/'",
".",
"rawurlencode",
"(",
"$",
"installationId",
")",
".",
"'/access_tokens'",
",",
"$",
"parameters",
")",
";",
"}"
] |
Create an access token for an installation.
@param int $installationId An integration installation id
@param int $userId An optional user id on behalf of whom the
token will be requested
@link https://developer.github.com/v3/apps/#create-a-new-installation-token
@return array token and token metadata
|
[
"Create",
"an",
"access",
"token",
"for",
"an",
"installation",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Apps.php#L23-L31
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Apps.php
|
Apps.listRepositories
|
public function listRepositories($userId = null)
{
$parameters = [];
if ($userId) {
$parameters['user_id'] = $userId;
}
return $this->get('/installation/repositories', $parameters);
}
|
php
|
public function listRepositories($userId = null)
{
$parameters = [];
if ($userId) {
$parameters['user_id'] = $userId;
}
return $this->get('/installation/repositories', $parameters);
}
|
[
"public",
"function",
"listRepositories",
"(",
"$",
"userId",
"=",
"null",
")",
"{",
"$",
"parameters",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"userId",
")",
"{",
"$",
"parameters",
"[",
"'user_id'",
"]",
"=",
"$",
"userId",
";",
"}",
"return",
"$",
"this",
"->",
"get",
"(",
"'/installation/repositories'",
",",
"$",
"parameters",
")",
";",
"}"
] |
List repositories that are accessible to the authenticated installation.
@link https://developer.github.com/v3/apps/installations/#list-repositories
@param int $userId
@return array
|
[
"List",
"repositories",
"that",
"are",
"accessible",
"to",
"the",
"authenticated",
"installation",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Apps.php#L54-L62
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/GitData/References.php
|
References.show
|
public function show($username, $repository, $reference)
{
$reference = $this->encodeReference($reference);
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference);
}
|
php
|
public function show($username, $repository, $reference)
{
$reference = $this->encodeReference($reference);
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference);
}
|
[
"public",
"function",
"show",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"reference",
")",
"{",
"$",
"reference",
"=",
"$",
"this",
"->",
"encodeReference",
"(",
"$",
"reference",
")",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/git/refs/'",
".",
"$",
"reference",
")",
";",
"}"
] |
Show the reference of a repository.
@param string $username
@param string $repository
@param string $reference
@return array
|
[
"Show",
"the",
"reference",
"of",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/GitData/References.php#L63-L68
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/GitData/References.php
|
References.update
|
public function update($username, $repository, $reference, array $params)
{
if (!isset($params['sha'])) {
throw new MissingArgumentException('sha');
}
$reference = $this->encodeReference($reference);
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference, $params);
}
|
php
|
public function update($username, $repository, $reference, array $params)
{
if (!isset($params['sha'])) {
throw new MissingArgumentException('sha');
}
$reference = $this->encodeReference($reference);
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference, $params);
}
|
[
"public",
"function",
"update",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"reference",
",",
"array",
"$",
"params",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"params",
"[",
"'sha'",
"]",
")",
")",
"{",
"throw",
"new",
"MissingArgumentException",
"(",
"'sha'",
")",
";",
"}",
"$",
"reference",
"=",
"$",
"this",
"->",
"encodeReference",
"(",
"$",
"reference",
")",
";",
"return",
"$",
"this",
"->",
"patch",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/git/refs/'",
".",
"$",
"reference",
",",
"$",
"params",
")",
";",
"}"
] |
Update a reference for a repository.
@param string $username
@param string $repository
@param string $reference
@param array $params
@throws \Github\Exception\MissingArgumentException
@return array
|
[
"Update",
"a",
"reference",
"for",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/GitData/References.php#L102-L111
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/GitData/References.php
|
References.remove
|
public function remove($username, $repository, $reference)
{
$reference = $this->encodeReference($reference);
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference);
}
|
php
|
public function remove($username, $repository, $reference)
{
$reference = $this->encodeReference($reference);
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference);
}
|
[
"public",
"function",
"remove",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"reference",
")",
"{",
"$",
"reference",
"=",
"$",
"this",
"->",
"encodeReference",
"(",
"$",
"reference",
")",
";",
"return",
"$",
"this",
"->",
"delete",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/git/refs/'",
".",
"$",
"reference",
")",
";",
"}"
] |
Delete a reference of a repository.
@param string $username
@param string $repository
@param string $reference
@return array
|
[
"Delete",
"a",
"reference",
"of",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/GitData/References.php#L122-L127
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/GitData/Trees.php
|
Trees.show
|
public function show($username, $repository, $sha, $recursive = false)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/trees/'.rawurlencode($sha), $recursive ? ['recursive' => 1] : []);
}
|
php
|
public function show($username, $repository, $sha, $recursive = false)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/trees/'.rawurlencode($sha), $recursive ? ['recursive' => 1] : []);
}
|
[
"public",
"function",
"show",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"sha",
",",
"$",
"recursive",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/git/trees/'",
".",
"rawurlencode",
"(",
"$",
"sha",
")",
",",
"$",
"recursive",
"?",
"[",
"'recursive'",
"=>",
"1",
"]",
":",
"[",
"]",
")",
";",
"}"
] |
Get the tree for a repository.
@param string $username
@param string $repository
@param string $sha
@param bool $recursive
@return array
|
[
"Get",
"the",
"tree",
"for",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/GitData/Trees.php#L25-L28
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/GitData/Trees.php
|
Trees.create
|
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']];
}
foreach ($params['tree'] as $key => $tree) {
if (!isset($tree['path'], $tree['mode'], $tree['type'])) {
throw new MissingArgumentException(["tree.$key.path", "tree.$key.mode", "tree.$key.type"]);
}
// If `sha` is not set, `content` is required
if (!isset($tree['sha']) && !isset($tree['content'])) {
throw new MissingArgumentException("tree.$key.content");
}
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/trees', $params);
}
|
php
|
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']];
}
foreach ($params['tree'] as $key => $tree) {
if (!isset($tree['path'], $tree['mode'], $tree['type'])) {
throw new MissingArgumentException(["tree.$key.path", "tree.$key.mode", "tree.$key.type"]);
}
// If `sha` is not set, `content` is required
if (!isset($tree['sha']) && !isset($tree['content'])) {
throw new MissingArgumentException("tree.$key.content");
}
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/trees', $params);
}
|
[
"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'",
"]",
"]",
";",
"}",
"foreach",
"(",
"$",
"params",
"[",
"'tree'",
"]",
"as",
"$",
"key",
"=>",
"$",
"tree",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"tree",
"[",
"'path'",
"]",
",",
"$",
"tree",
"[",
"'mode'",
"]",
",",
"$",
"tree",
"[",
"'type'",
"]",
")",
")",
"{",
"throw",
"new",
"MissingArgumentException",
"(",
"[",
"\"tree.$key.path\"",
",",
"\"tree.$key.mode\"",
",",
"\"tree.$key.type\"",
"]",
")",
";",
"}",
"// If `sha` is not set, `content` is required",
"if",
"(",
"!",
"isset",
"(",
"$",
"tree",
"[",
"'sha'",
"]",
")",
"&&",
"!",
"isset",
"(",
"$",
"tree",
"[",
"'content'",
"]",
")",
")",
"{",
"throw",
"new",
"MissingArgumentException",
"(",
"\"tree.$key.content\"",
")",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"post",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/git/trees'",
",",
"$",
"params",
")",
";",
"}"
] |
Create tree for a repository.
@param string $username
@param string $repository
@param array $params
@throws \Github\Exception\MissingArgumentException
@return array
|
[
"Create",
"tree",
"for",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/GitData/Trees.php#L41-L63
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Gist/Comments.php
|
Comments.configure
|
public function configure($bodyType = null)
{
if (!in_array($bodyType, ['text', 'html', 'full'])) {
$bodyType = 'raw';
}
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s+json', $this->client->getApiVersion(), $bodyType);
return $this;
}
|
php
|
public function configure($bodyType = null)
{
if (!in_array($bodyType, ['text', 'html', 'full'])) {
$bodyType = 'raw';
}
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s+json', $this->client->getApiVersion(), $bodyType);
return $this;
}
|
[
"public",
"function",
"configure",
"(",
"$",
"bodyType",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"bodyType",
",",
"[",
"'text'",
",",
"'html'",
",",
"'full'",
"]",
")",
")",
"{",
"$",
"bodyType",
"=",
"'raw'",
";",
"}",
"$",
"this",
"->",
"acceptHeaderValue",
"=",
"sprintf",
"(",
"'application/vnd.github.%s.%s+json'",
",",
"$",
"this",
"->",
"client",
"->",
"getApiVersion",
"(",
")",
",",
"$",
"bodyType",
")",
";",
"return",
"$",
"this",
";",
"}"
] |
Configure the body type.
@link https://developer.github.com/v3/gists/comments/#custom-media-types
@param string|null $bodyType
@return self
|
[
"Configure",
"the",
"body",
"type",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Gist/Comments.php#L26-L35
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Gist/Comments.php
|
Comments.update
|
public function update($gist, $comment_id, $body)
{
return $this->patch('/gists/'.rawurlencode($gist).'/comments/'.rawurlencode($comment_id), ['body' => $body]);
}
|
php
|
public function update($gist, $comment_id, $body)
{
return $this->patch('/gists/'.rawurlencode($gist).'/comments/'.rawurlencode($comment_id), ['body' => $body]);
}
|
[
"public",
"function",
"update",
"(",
"$",
"gist",
",",
"$",
"comment_id",
",",
"$",
"body",
")",
"{",
"return",
"$",
"this",
"->",
"patch",
"(",
"'/gists/'",
".",
"rawurlencode",
"(",
"$",
"gist",
")",
".",
"'/comments/'",
".",
"rawurlencode",
"(",
"$",
"comment_id",
")",
",",
"[",
"'body'",
"=>",
"$",
"body",
"]",
")",
";",
"}"
] |
Create a comment for a gist.
@param string $gist
@param int $comment_id
@param string $body
@return array
|
[
"Create",
"a",
"comment",
"for",
"a",
"gist",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Gist/Comments.php#L84-L87
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/User.php
|
User.following
|
public function following($username, array $parameters = [], array $requestHeaders = [])
{
return $this->get('/users/'.rawurlencode($username).'/following', $parameters, $requestHeaders);
}
|
php
|
public function following($username, array $parameters = [], array $requestHeaders = [])
{
return $this->get('/users/'.rawurlencode($username).'/following', $parameters, $requestHeaders);
}
|
[
"public",
"function",
"following",
"(",
"$",
"username",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
",",
"array",
"$",
"requestHeaders",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/users/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/following'",
",",
"$",
"parameters",
",",
"$",
"requestHeaders",
")",
";",
"}"
] |
Request the users that a specific user is following.
@link http://developer.github.com/v3/users/followers/
@param string $username the username
@param array $parameters parameters for the query string
@param array $requestHeaders additional headers to set in the request
@return array list of followed users
|
[
"Request",
"the",
"users",
"that",
"a",
"specific",
"user",
"is",
"following",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/User.php#L99-L102
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/User.php
|
User.followers
|
public function followers($username, array $parameters = [], array $requestHeaders = [])
{
return $this->get('/users/'.rawurlencode($username).'/followers', $parameters, $requestHeaders);
}
|
php
|
public function followers($username, array $parameters = [], array $requestHeaders = [])
{
return $this->get('/users/'.rawurlencode($username).'/followers', $parameters, $requestHeaders);
}
|
[
"public",
"function",
"followers",
"(",
"$",
"username",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
",",
"array",
"$",
"requestHeaders",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/users/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/followers'",
",",
"$",
"parameters",
",",
"$",
"requestHeaders",
")",
";",
"}"
] |
Request the users following a specific user.
@link http://developer.github.com/v3/users/followers/
@param string $username the username
@param array $parameters parameters for the query string
@param array $requestHeaders additional headers to set in the request
@return array list of following users
|
[
"Request",
"the",
"users",
"following",
"a",
"specific",
"user",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/User.php#L115-L118
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/User.php
|
User.starred
|
public function starred($username, $page = 1, $perPage = 30, $sort = 'created', $direction = 'desc')
{
return $this->get('/users/'.rawurlencode($username).'/starred', [
'page' => $page,
'per_page' => $perPage,
'sort' => $sort,
'direction' => $direction,
]);
}
|
php
|
public function starred($username, $page = 1, $perPage = 30, $sort = 'created', $direction = 'desc')
{
return $this->get('/users/'.rawurlencode($username).'/starred', [
'page' => $page,
'per_page' => $perPage,
'sort' => $sort,
'direction' => $direction,
]);
}
|
[
"public",
"function",
"starred",
"(",
"$",
"username",
",",
"$",
"page",
"=",
"1",
",",
"$",
"perPage",
"=",
"30",
",",
"$",
"sort",
"=",
"'created'",
",",
"$",
"direction",
"=",
"'desc'",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/users/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/starred'",
",",
"[",
"'page'",
"=>",
"$",
"page",
",",
"'per_page'",
"=>",
"$",
"perPage",
",",
"'sort'",
"=>",
"$",
"sort",
",",
"'direction'",
"=>",
"$",
"direction",
",",
"]",
")",
";",
"}"
] |
Request starred repositories that a specific user has starred.
@link http://developer.github.com/v3/activity/starring/
@param string $username the username
@param int $page the page number of the paginated result set
@param int $perPage the number of results per page
@param string $sort sort by (possible values: created, updated)
@param string $direction direction of sort (possible values: asc, desc)
@return array list of starred repositories
|
[
"Request",
"starred",
"repositories",
"that",
"a",
"specific",
"user",
"has",
"starred",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/User.php#L147-L155
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/PullRequest.php
|
PullRequest.status
|
public function status($username, $repository, $id)
{
$link = $this->show($username, $repository, $id)['_links']['statuses']['href'];
return $this->get($link);
}
|
php
|
public function status($username, $repository, $id)
{
$link = $this->show($username, $repository, $id)['_links']['statuses']['href'];
return $this->get($link);
}
|
[
"public",
"function",
"status",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"id",
")",
"{",
"$",
"link",
"=",
"$",
"this",
"->",
"show",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"id",
")",
"[",
"'_links'",
"]",
"[",
"'statuses'",
"]",
"[",
"'href'",
"]",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"link",
")",
";",
"}"
] |
All statuses which are the statuses of its head branch.
@see http://developer.github.com/v3/pulls/
@param string $username the username
@param string $repository the repository
@param int $id the ID of the pull request for which statuses are retrieved
@return array array of statuses for the project
|
[
"All",
"statuses",
"which",
"are",
"the",
"statuses",
"of",
"its",
"head",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/PullRequest.php#L109-L114
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Contents.php
|
Contents.readme
|
public function readme($username, $repository, $reference = null)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme', [
'ref' => $reference,
]);
}
|
php
|
public function readme($username, $repository, $reference = null)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme', [
'ref' => $reference,
]);
}
|
[
"public",
"function",
"readme",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"reference",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/readme'",
",",
"[",
"'ref'",
"=>",
"$",
"reference",
",",
"]",
")",
";",
"}"
] |
Get content of README file in a repository.
@link http://developer.github.com/v3/repos/contents/
@param string $username the user who owns the repository
@param string $repository the name of the repository
@param null|string $reference reference to a branch or commit
@return array information for README file
|
[
"Get",
"content",
"of",
"README",
"file",
"in",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Contents.php#L52-L57
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Contents.php
|
Contents.show
|
public function show($username, $repository, $path = null, $reference = null)
{
$url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents';
if (null !== $path) {
$url .= '/'.rawurlencode($path);
}
return $this->get($url, [
'ref' => $reference,
]);
}
|
php
|
public function show($username, $repository, $path = null, $reference = null)
{
$url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents';
if (null !== $path) {
$url .= '/'.rawurlencode($path);
}
return $this->get($url, [
'ref' => $reference,
]);
}
|
[
"public",
"function",
"show",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"path",
"=",
"null",
",",
"$",
"reference",
"=",
"null",
")",
"{",
"$",
"url",
"=",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/contents'",
";",
"if",
"(",
"null",
"!==",
"$",
"path",
")",
"{",
"$",
"url",
".=",
"'/'",
".",
"rawurlencode",
"(",
"$",
"path",
")",
";",
"}",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"url",
",",
"[",
"'ref'",
"=>",
"$",
"reference",
",",
"]",
")",
";",
"}"
] |
Get contents of any file or directory in a repository.
@link http://developer.github.com/v3/repos/contents/
@param string $username the user who owns the repository
@param string $repository the name of the repository
@param null|string $path path to file or directory
@param null|string $reference reference to a branch or commit
@return array|string information for file | information for each item in directory
|
[
"Get",
"contents",
"of",
"any",
"file",
"or",
"directory",
"in",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Contents.php#L71-L81
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Contents.php
|
Contents.create
|
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),
'message' => $message,
];
if (null !== $branch) {
$parameters['branch'] = $branch;
}
if (null !== $committer) {
if (!isset($committer['name'], $committer['email'])) {
throw new MissingArgumentException(['name', 'email']);
}
$parameters['committer'] = $committer;
}
return $this->put($url, $parameters);
}
|
php
|
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),
'message' => $message,
];
if (null !== $branch) {
$parameters['branch'] = $branch;
}
if (null !== $committer) {
if (!isset($committer['name'], $committer['email'])) {
throw new MissingArgumentException(['name', 'email']);
}
$parameters['committer'] = $committer;
}
return $this->put($url, $parameters);
}
|
[
"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",
")",
",",
"'message'",
"=>",
"$",
"message",
",",
"]",
";",
"if",
"(",
"null",
"!==",
"$",
"branch",
")",
"{",
"$",
"parameters",
"[",
"'branch'",
"]",
"=",
"$",
"branch",
";",
"}",
"if",
"(",
"null",
"!==",
"$",
"committer",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"committer",
"[",
"'name'",
"]",
",",
"$",
"committer",
"[",
"'email'",
"]",
")",
")",
"{",
"throw",
"new",
"MissingArgumentException",
"(",
"[",
"'name'",
",",
"'email'",
"]",
")",
";",
"}",
"$",
"parameters",
"[",
"'committer'",
"]",
"=",
"$",
"committer",
";",
"}",
"return",
"$",
"this",
"->",
"put",
"(",
"$",
"url",
",",
"$",
"parameters",
")",
";",
"}"
] |
Creates a new file in a repository.
@link http://developer.github.com/v3/repos/contents/#create-a-file
@param string $username the user who owns the repository
@param string $repository the name of the repository
@param string $path path to file
@param string $content contents of the new file
@param string $message the commit message
@param null|string $branch name of a branch
@param null|array $committer information about the committer
@throws MissingArgumentException
@return array information about the new file
|
[
"Creates",
"a",
"new",
"file",
"in",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Contents.php#L100-L121
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Contents.php
|
Contents.exists
|
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, [
'ref' => $reference,
]);
if ($response->getStatusCode() !== 200) {
return false;
}
} catch (TwoFactorAuthenticationRequiredException $ex) {
throw $ex;
} catch (\Exception $ex) {
return false;
}
return true;
}
|
php
|
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, [
'ref' => $reference,
]);
if ($response->getStatusCode() !== 200) {
return false;
}
} catch (TwoFactorAuthenticationRequiredException $ex) {
throw $ex;
} catch (\Exception $ex) {
return false;
}
return true;
}
|
[
"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",
",",
"[",
"'ref'",
"=>",
"$",
"reference",
",",
"]",
")",
";",
"if",
"(",
"$",
"response",
"->",
"getStatusCode",
"(",
")",
"!==",
"200",
")",
"{",
"return",
"false",
";",
"}",
"}",
"catch",
"(",
"TwoFactorAuthenticationRequiredException",
"$",
"ex",
")",
"{",
"throw",
"$",
"ex",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"ex",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] |
Checks that a given path exists in a repository.
@param string $username the user who owns the repository
@param string $repository the name of the repository
@param string $path path of file to check
@param null|string $reference reference to a branch or commit
@return bool
|
[
"Checks",
"that",
"a",
"given",
"path",
"exists",
"in",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Contents.php#L133-L156
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Contents.php
|
Contents.rm
|
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,
];
if (null !== $branch) {
$parameters['branch'] = $branch;
}
if (null !== $committer) {
if (!isset($committer['name'], $committer['email'])) {
throw new MissingArgumentException(['name', 'email']);
}
$parameters['committer'] = $committer;
}
return $this->delete($url, $parameters);
}
|
php
|
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,
];
if (null !== $branch) {
$parameters['branch'] = $branch;
}
if (null !== $committer) {
if (!isset($committer['name'], $committer['email'])) {
throw new MissingArgumentException(['name', 'email']);
}
$parameters['committer'] = $committer;
}
return $this->delete($url, $parameters);
}
|
[
"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",
",",
"]",
";",
"if",
"(",
"null",
"!==",
"$",
"branch",
")",
"{",
"$",
"parameters",
"[",
"'branch'",
"]",
"=",
"$",
"branch",
";",
"}",
"if",
"(",
"null",
"!==",
"$",
"committer",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"committer",
"[",
"'name'",
"]",
",",
"$",
"committer",
"[",
"'email'",
"]",
")",
")",
"{",
"throw",
"new",
"MissingArgumentException",
"(",
"[",
"'name'",
",",
"'email'",
"]",
")",
";",
"}",
"$",
"parameters",
"[",
"'committer'",
"]",
"=",
"$",
"committer",
";",
"}",
"return",
"$",
"this",
"->",
"delete",
"(",
"$",
"url",
",",
"$",
"parameters",
")",
";",
"}"
] |
Deletes a file from a repository.
@link http://developer.github.com/v3/repos/contents/#delete-a-file
@param string $username the user who owns the repository
@param string $repository the name of the repository
@param string $path path to file
@param string $message the commit message
@param string $sha blob SHA of the file being deleted
@param null|string $branch name of a branch
@param null|array $committer information about the committer
@throws MissingArgumentException
@return array information about the updated file
|
[
"Deletes",
"a",
"file",
"from",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Contents.php#L217-L238
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Contents.php
|
Contents.archive
|
public function archive($username, $repository, $format, $reference = null)
{
if (!in_array($format, ['tarball', 'zipball'])) {
$format = 'tarball';
}
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/'.rawurlencode($format).
((null !== $reference) ? ('/'.rawurlencode($reference)) : ''));
}
|
php
|
public function archive($username, $repository, $format, $reference = null)
{
if (!in_array($format, ['tarball', 'zipball'])) {
$format = 'tarball';
}
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/'.rawurlencode($format).
((null !== $reference) ? ('/'.rawurlencode($reference)) : ''));
}
|
[
"public",
"function",
"archive",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"format",
",",
"$",
"reference",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"format",
",",
"[",
"'tarball'",
",",
"'zipball'",
"]",
")",
")",
"{",
"$",
"format",
"=",
"'tarball'",
";",
"}",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"format",
")",
".",
"(",
"(",
"null",
"!==",
"$",
"reference",
")",
"?",
"(",
"'/'",
".",
"rawurlencode",
"(",
"$",
"reference",
")",
")",
":",
"''",
")",
")",
";",
"}"
] |
Get content of archives in a repository.
@link http://developer.github.com/v3/repos/contents/
@param string $username the user who owns the repository
@param string $repository the name of the repository
@param string $format format of archive: tarball or zipball
@param null|string $reference reference to a branch or commit
@return string repository archive binary data
|
[
"Get",
"content",
"of",
"archives",
"in",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Contents.php#L252-L260
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Contents.php
|
Contents.download
|
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 file or a symlink to a file.', $path));
}
if (!isset($file['content'])) {
throw new ErrorException(sprintf('Unable to access "content" for file "%s" (possible keys: "%s").', $path, implode(', ', array_keys($file))));
}
if (!isset($file['encoding'])) {
throw new InvalidArgumentException(sprintf('Can\'t decode content of file "%s", as no encoding is defined.', $path));
}
if ('base64' !== $file['encoding']) {
throw new InvalidArgumentException(sprintf('Encoding "%s" of file "%s" is not supported.', $file['encoding'], $path));
}
return base64_decode($file['content']) ?: null;
}
|
php
|
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 file or a symlink to a file.', $path));
}
if (!isset($file['content'])) {
throw new ErrorException(sprintf('Unable to access "content" for file "%s" (possible keys: "%s").', $path, implode(', ', array_keys($file))));
}
if (!isset($file['encoding'])) {
throw new InvalidArgumentException(sprintf('Can\'t decode content of file "%s", as no encoding is defined.', $path));
}
if ('base64' !== $file['encoding']) {
throw new InvalidArgumentException(sprintf('Encoding "%s" of file "%s" is not supported.', $file['encoding'], $path));
}
return base64_decode($file['content']) ?: null;
}
|
[
"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 file or a symlink to a file.'",
",",
"$",
"path",
")",
")",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"file",
"[",
"'content'",
"]",
")",
")",
"{",
"throw",
"new",
"ErrorException",
"(",
"sprintf",
"(",
"'Unable to access \"content\" for file \"%s\" (possible keys: \"%s\").'",
",",
"$",
"path",
",",
"implode",
"(",
"', '",
",",
"array_keys",
"(",
"$",
"file",
")",
")",
")",
")",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"file",
"[",
"'encoding'",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Can\\'t decode content of file \"%s\", as no encoding is defined.'",
",",
"$",
"path",
")",
")",
";",
"}",
"if",
"(",
"'base64'",
"!==",
"$",
"file",
"[",
"'encoding'",
"]",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Encoding \"%s\" of file \"%s\" is not supported.'",
",",
"$",
"file",
"[",
"'encoding'",
"]",
",",
"$",
"path",
")",
")",
";",
"}",
"return",
"base64_decode",
"(",
"$",
"file",
"[",
"'content'",
"]",
")",
"?",
":",
"null",
";",
"}"
] |
Get the contents of a file in a repository.
@param string $username the user who owns the repository
@param string $repository the name of the repository
@param string $path path to file
@param null|string $reference reference to a branch or commit
@throws InvalidArgumentException If $path is not a file or if its encoding is different from base64
@throws ErrorException If $path doesn't include a 'content' index
@return null|string content of file, or null in case of base64_decode failure
|
[
"Get",
"the",
"contents",
"of",
"a",
"file",
"in",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Contents.php#L275-L296
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue.php
|
Issue.find
|
public function find($username, $repository, $state, $keyword)
{
if (!in_array($state, ['open', 'closed'])) {
$state = 'open';
}
return $this->get('/legacy/issues/search/'.rawurlencode($username).'/'.rawurlencode($repository).'/'.rawurlencode($state).'/'.rawurlencode($keyword));
}
|
php
|
public function find($username, $repository, $state, $keyword)
{
if (!in_array($state, ['open', 'closed'])) {
$state = 'open';
}
return $this->get('/legacy/issues/search/'.rawurlencode($username).'/'.rawurlencode($repository).'/'.rawurlencode($state).'/'.rawurlencode($keyword));
}
|
[
"public",
"function",
"find",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"state",
",",
"$",
"keyword",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"state",
",",
"[",
"'open'",
",",
"'closed'",
"]",
")",
")",
"{",
"$",
"state",
"=",
"'open'",
";",
"}",
"return",
"$",
"this",
"->",
"get",
"(",
"'/legacy/issues/search/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"state",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"keyword",
")",
")",
";",
"}"
] |
Search issues by username, repo, state and keyword.
@deprecated This method is deprecated use the Search api instead. See https://developer.github.com/v3/search/legacy/#legacy-search-api-is-deprecated
@link http://developer.github.com/v3/search/#search-issues
@param string $username the username
@param string $repository the repository
@param string $state the issue state, can be open or closed
@param string $keyword the keyword to filter issues by
@return array list of issues found
|
[
"Search",
"issues",
"by",
"username",
"repo",
"state",
"and",
"keyword",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue.php#L74-L81
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue.php
|
Issue.org
|
public function org($organization, $state, array $params = [])
{
if (!in_array($state, ['open', 'closed'])) {
$state = 'open';
}
return $this->get('/orgs/'.rawurlencode($organization).'/issues', array_merge(['page' => 1, 'state' => $state], $params));
}
|
php
|
public function org($organization, $state, array $params = [])
{
if (!in_array($state, ['open', 'closed'])) {
$state = 'open';
}
return $this->get('/orgs/'.rawurlencode($organization).'/issues', array_merge(['page' => 1, 'state' => $state], $params));
}
|
[
"public",
"function",
"org",
"(",
"$",
"organization",
",",
"$",
"state",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"state",
",",
"[",
"'open'",
",",
"'closed'",
"]",
")",
")",
"{",
"$",
"state",
"=",
"'open'",
";",
"}",
"return",
"$",
"this",
"->",
"get",
"(",
"'/orgs/'",
".",
"rawurlencode",
"(",
"$",
"organization",
")",
".",
"'/issues'",
",",
"array_merge",
"(",
"[",
"'page'",
"=>",
"1",
",",
"'state'",
"=>",
"$",
"state",
"]",
",",
"$",
"params",
")",
")",
";",
"}"
] |
List issues by organization.
@link http://developer.github.com/v3/issues/
@param string $organization the organization
@param string $state the issue state, can be open or closed
@param array $params the additional parameters like milestone, assignees, labels, sort, direction
@return array list of issues found
|
[
"List",
"issues",
"by",
"organization",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue.php#L94-L101
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue.php
|
Issue.lock
|
public function lock($username, $repository, $id)
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id).'/lock');
}
|
php
|
public function lock($username, $repository, $id)
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id).'/lock');
}
|
[
"public",
"function",
"lock",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"put",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/issues/'",
".",
"rawurlencode",
"(",
"$",
"id",
")",
".",
"'/lock'",
")",
";",
"}"
] |
Lock an issue. Users with push access can lock an issue's conversation.
@link https://developer.github.com/v3/issues/#lock-an-issue
@param string $username
@param string $repository
@param int $id
@return string
|
[
"Lock",
"an",
"issue",
".",
"Users",
"with",
"push",
"access",
"can",
"lock",
"an",
"issue",
"s",
"conversation",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue.php#L171-L174
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue.php
|
Issue.unlock
|
public function unlock($username, $repository, $id)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id).'/lock');
}
|
php
|
public function unlock($username, $repository, $id)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id).'/lock');
}
|
[
"public",
"function",
"unlock",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"delete",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/issues/'",
".",
"rawurlencode",
"(",
"$",
"id",
")",
".",
"'/lock'",
")",
";",
"}"
] |
Unlock an issue. Users with push access can unlock an issue's conversation.
@link https://developer.github.com/v3/issues/#lock-an-issue
@param string $username
@param string $repository
@param int $id
@return string
|
[
"Unlock",
"an",
"issue",
".",
"Users",
"with",
"push",
"access",
"can",
"unlock",
"an",
"issue",
"s",
"conversation",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue.php#L187-L190
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/RateLimit.php
|
RateLimit.getResource
|
public function getResource($name)
{
// Fetch once per instance
if (empty($this->resources)) {
$this->fetchLimits();
}
if (!isset($this->resources[$name])) {
return false;
}
return $this->resources[$name];
}
|
php
|
public function getResource($name)
{
// Fetch once per instance
if (empty($this->resources)) {
$this->fetchLimits();
}
if (!isset($this->resources[$name])) {
return false;
}
return $this->resources[$name];
}
|
[
"public",
"function",
"getResource",
"(",
"$",
"name",
")",
"{",
"// Fetch once per instance",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"resources",
")",
")",
"{",
"$",
"this",
"->",
"fetchLimits",
"(",
")",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"resources",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"resources",
"[",
"$",
"name",
"]",
";",
"}"
] |
Returns a rate limit resource object by the given name.
@param string $name
@return RateLimitResource|false
|
[
"Returns",
"a",
"rate",
"limit",
"resource",
"object",
"by",
"the",
"given",
"name",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/RateLimit.php#L52-L64
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/RateLimit.php
|
RateLimit.fetchLimits
|
protected function fetchLimits()
{
$result = $this->get('/rate_limit') ?: [];
// Assemble Limit instances
foreach ($result['resources'] as $resourceName => $resource) {
$this->resources[$resourceName] = new RateLimitResource($resourceName, $resource);
}
return $result;
}
|
php
|
protected function fetchLimits()
{
$result = $this->get('/rate_limit') ?: [];
// Assemble Limit instances
foreach ($result['resources'] as $resourceName => $resource) {
$this->resources[$resourceName] = new RateLimitResource($resourceName, $resource);
}
return $result;
}
|
[
"protected",
"function",
"fetchLimits",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"get",
"(",
"'/rate_limit'",
")",
"?",
":",
"[",
"]",
";",
"// Assemble Limit instances",
"foreach",
"(",
"$",
"result",
"[",
"'resources'",
"]",
"as",
"$",
"resourceName",
"=>",
"$",
"resource",
")",
"{",
"$",
"this",
"->",
"resources",
"[",
"$",
"resourceName",
"]",
"=",
"new",
"RateLimitResource",
"(",
"$",
"resourceName",
",",
"$",
"resource",
")",
";",
"}",
"return",
"$",
"result",
";",
"}"
] |
Returns the data directly from the GitHub API endpoint.
@return array
|
[
"Returns",
"the",
"data",
"directly",
"from",
"the",
"GitHub",
"API",
"endpoint",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/RateLimit.php#L71-L81
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Deployment.php
|
Deployment.updateStatus
|
public function updateStatus($username, $repository, $id, array $params)
{
if (!isset($params['state'])) {
throw new MissingArgumentException(['state']);
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id).'/statuses', $params);
}
|
php
|
public function updateStatus($username, $repository, $id, array $params)
{
if (!isset($params['state'])) {
throw new MissingArgumentException(['state']);
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id).'/statuses', $params);
}
|
[
"public",
"function",
"updateStatus",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"id",
",",
"array",
"$",
"params",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"params",
"[",
"'state'",
"]",
")",
")",
"{",
"throw",
"new",
"MissingArgumentException",
"(",
"[",
"'state'",
"]",
")",
";",
"}",
"return",
"$",
"this",
"->",
"post",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/deployments/'",
".",
"rawurlencode",
"(",
"$",
"id",
")",
".",
"'/statuses'",
",",
"$",
"params",
")",
";",
"}"
] |
Updates a deployment by creating a new status update.
@link https://developer.github.com/v3/repos/deployments/#create-a-deployment-status
@param string $username the username
@param string $repository the repository
@param int $id the deployment number
@param array $params The information about the deployment update.
Must include a "state" field of pending, success, error, or failure.
May also be given a target_url and description, ßee link for more details.
@throws MissingArgumentException
@return array information about the deployment
|
[
"Updates",
"a",
"deployment",
"by",
"creating",
"a",
"new",
"status",
"update",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Deployment.php#L85-L92
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Deployment.php
|
Deployment.getStatuses
|
public function getStatuses($username, $repository, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id).'/statuses');
}
|
php
|
public function getStatuses($username, $repository, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id).'/statuses');
}
|
[
"public",
"function",
"getStatuses",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/deployments/'",
".",
"rawurlencode",
"(",
"$",
"id",
")",
".",
"'/statuses'",
")",
";",
"}"
] |
Gets all of the status updates tied to a given deployment.
@param string $username the username
@param string $repository the repository
@param int $id the deployment identifier
@return array the deployment statuses
|
[
"Gets",
"all",
"of",
"the",
"status",
"updates",
"tied",
"to",
"a",
"given",
"deployment",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Deployment.php#L103-L106
|
train
|
KnpLabs/php-github-api
|
lib/Github/HttpClient/Message/ResponseMediator.php
|
ResponseMediator.getHeader
|
public static function getHeader(ResponseInterface $response, $name)
{
$headers = $response->getHeader($name);
return array_shift($headers);
}
|
php
|
public static function getHeader(ResponseInterface $response, $name)
{
$headers = $response->getHeader($name);
return array_shift($headers);
}
|
[
"public",
"static",
"function",
"getHeader",
"(",
"ResponseInterface",
"$",
"response",
",",
"$",
"name",
")",
"{",
"$",
"headers",
"=",
"$",
"response",
"->",
"getHeader",
"(",
"$",
"name",
")",
";",
"return",
"array_shift",
"(",
"$",
"headers",
")",
";",
"}"
] |
Get the value for a single header.
@param ResponseInterface $response
@param string $name
@return string|null
|
[
"Get",
"the",
"value",
"for",
"a",
"single",
"header",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/HttpClient/Message/ResponseMediator.php#L76-L81
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Notification.php
|
Notification.all
|
public function all($includingRead = false, $participating = false, DateTime $since = null, DateTime $before = null)
{
$parameters = [
'all' => $includingRead,
'participating' => $participating,
];
if ($since !== null) {
$parameters['since'] = $since->format(DateTime::ISO8601);
}
if ($before !== null) {
$parameters['before'] = $before->format(DateTime::ISO8601);
}
return $this->get('/notifications', $parameters);
}
|
php
|
public function all($includingRead = false, $participating = false, DateTime $since = null, DateTime $before = null)
{
$parameters = [
'all' => $includingRead,
'participating' => $participating,
];
if ($since !== null) {
$parameters['since'] = $since->format(DateTime::ISO8601);
}
if ($before !== null) {
$parameters['before'] = $before->format(DateTime::ISO8601);
}
return $this->get('/notifications', $parameters);
}
|
[
"public",
"function",
"all",
"(",
"$",
"includingRead",
"=",
"false",
",",
"$",
"participating",
"=",
"false",
",",
"DateTime",
"$",
"since",
"=",
"null",
",",
"DateTime",
"$",
"before",
"=",
"null",
")",
"{",
"$",
"parameters",
"=",
"[",
"'all'",
"=>",
"$",
"includingRead",
",",
"'participating'",
"=>",
"$",
"participating",
",",
"]",
";",
"if",
"(",
"$",
"since",
"!==",
"null",
")",
"{",
"$",
"parameters",
"[",
"'since'",
"]",
"=",
"$",
"since",
"->",
"format",
"(",
"DateTime",
"::",
"ISO8601",
")",
";",
"}",
"if",
"(",
"$",
"before",
"!==",
"null",
")",
"{",
"$",
"parameters",
"[",
"'before'",
"]",
"=",
"$",
"before",
"->",
"format",
"(",
"DateTime",
"::",
"ISO8601",
")",
";",
"}",
"return",
"$",
"this",
"->",
"get",
"(",
"'/notifications'",
",",
"$",
"parameters",
")",
";",
"}"
] |
Get a listing of notifications.
@link https://developer.github.com/v3/activity/notifications/
@param bool $includingRead
@param bool $participating
@param DateTime|null $since
@return array array of notifications
|
[
"Get",
"a",
"listing",
"of",
"notifications",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Notification.php#L29-L45
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Notification.php
|
Notification.markRead
|
public function markRead(DateTime $since = null)
{
$parameters = [];
if ($since !== null) {
$parameters['last_read_at'] = $since->format(DateTime::ISO8601);
}
$this->put('/notifications', $parameters);
}
|
php
|
public function markRead(DateTime $since = null)
{
$parameters = [];
if ($since !== null) {
$parameters['last_read_at'] = $since->format(DateTime::ISO8601);
}
$this->put('/notifications', $parameters);
}
|
[
"public",
"function",
"markRead",
"(",
"DateTime",
"$",
"since",
"=",
"null",
")",
"{",
"$",
"parameters",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"since",
"!==",
"null",
")",
"{",
"$",
"parameters",
"[",
"'last_read_at'",
"]",
"=",
"$",
"since",
"->",
"format",
"(",
"DateTime",
"::",
"ISO8601",
")",
";",
"}",
"$",
"this",
"->",
"put",
"(",
"'/notifications'",
",",
"$",
"parameters",
")",
";",
"}"
] |
Marks all notifications as read from the current date.
Optionally give DateTime to mark as read before that date.
@link https://developer.github.com/v3/activity/notifications/#mark-as-read
@param DateTime|null $since
|
[
"Marks",
"all",
"notifications",
"as",
"read",
"from",
"the",
"current",
"date",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Notification.php#L56-L65
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Assignees.php
|
Assignees.listAvailable
|
public function listAvailable($username, $repository, array $parameters = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/assignees', $parameters);
}
|
php
|
public function listAvailable($username, $repository, array $parameters = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/assignees', $parameters);
}
|
[
"public",
"function",
"listAvailable",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/assignees'",
",",
"$",
"parameters",
")",
";",
"}"
] |
List all the available assignees to which issues may be assigned.
@param string $username
@param string $repository
@param array $parameters
@return array
|
[
"List",
"all",
"the",
"available",
"assignees",
"to",
"which",
"issues",
"may",
"be",
"assigned",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Assignees.php#L19-L22
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Assignees.php
|
Assignees.check
|
public function check($username, $repository, $assignee)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/assignees/'.rawurlencode($assignee));
}
|
php
|
public function check($username, $repository, $assignee)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/assignees/'.rawurlencode($assignee));
}
|
[
"public",
"function",
"check",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"assignee",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/assignees/'",
".",
"rawurlencode",
"(",
"$",
"assignee",
")",
")",
";",
"}"
] |
Check to see if a particular user is an assignee for a repository.
@link https://developer.github.com/v3/issues/assignees/#check-assignee
@param string $username
@param string $repository
@param string $assignee
@return array
|
[
"Check",
"to",
"see",
"if",
"a",
"particular",
"user",
"is",
"an",
"assignee",
"for",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Assignees.php#L35-L38
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Assignees.php
|
Assignees.add
|
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 a string in "%s" is deprecated and will throw an exception in php-github-api version 3.0. Pass an array of strings instead', __METHOD__), E_USER_DEPRECATED);
$parameters['assignees'] = [$parameters['assignees']];
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/assignees', $parameters);
}
|
php
|
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 a string in "%s" is deprecated and will throw an exception in php-github-api version 3.0. Pass an array of strings instead', __METHOD__), E_USER_DEPRECATED);
$parameters['assignees'] = [$parameters['assignees']];
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/assignees', $parameters);
}
|
[
"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 a string in \"%s\" is deprecated and will throw an exception in php-github-api version 3.0. Pass an array of strings instead'",
",",
"__METHOD__",
")",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"parameters",
"[",
"'assignees'",
"]",
"=",
"[",
"$",
"parameters",
"[",
"'assignees'",
"]",
"]",
";",
"}",
"return",
"$",
"this",
"->",
"post",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/issues/'",
".",
"rawurlencode",
"(",
"$",
"issue",
")",
".",
"'/assignees'",
",",
"$",
"parameters",
")",
";",
"}"
] |
Add assignees to an Issue.
@link https://developer.github.com/v3/issues/assignees/#add-assignees-to-an-issue
@param string $username
@param string $repository
@param string $issue
@param array $parameters
@throws MissingArgumentException
@return string
|
[
"Add",
"assignees",
"to",
"an",
"Issue",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Assignees.php#L54-L67
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Assignees.php
|
Assignees.remove
|
public function remove($username, $repository, $issue, array $parameters)
{
if (!isset($parameters['assignees'])) {
throw new MissingArgumentException('assignees');
}
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/assignees', $parameters);
}
|
php
|
public function remove($username, $repository, $issue, array $parameters)
{
if (!isset($parameters['assignees'])) {
throw new MissingArgumentException('assignees');
}
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/assignees', $parameters);
}
|
[
"public",
"function",
"remove",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"issue",
",",
"array",
"$",
"parameters",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"parameters",
"[",
"'assignees'",
"]",
")",
")",
"{",
"throw",
"new",
"MissingArgumentException",
"(",
"'assignees'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"delete",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/issues/'",
".",
"rawurlencode",
"(",
"$",
"issue",
")",
".",
"'/assignees'",
",",
"$",
"parameters",
")",
";",
"}"
] |
Remove assignees from an Issue.
@link https://developer.github.com/v3/issues/assignees/#remove-assignees-from-an-issue
@param string $username
@param string $repository
@param string $issue
@param array $parameters
@throws MissingArgumentException
@return string
|
[
"Remove",
"assignees",
"from",
"an",
"Issue",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Assignees.php#L83-L90
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Events.php
|
Events.show
|
public function show($username, $repository, $event)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/events/'.rawurlencode($event));
}
|
php
|
public function show($username, $repository, $event)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/events/'.rawurlencode($event));
}
|
[
"public",
"function",
"show",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"event",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/issues/events/'",
".",
"rawurlencode",
"(",
"$",
"event",
")",
")",
";",
"}"
] |
Display an event for an issue.
@link https://developer.github.com/v3/issues/events/#get-a-single-event
@param string $username
@param string $repository
@param string $event
@return array
|
[
"Display",
"an",
"event",
"for",
"an",
"issue",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Events.php#L50-L53
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/GitData/Blobs.php
|
Blobs.show
|
public function show($username, $repository, $sha)
{
$response = $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/blobs/'.rawurlencode($sha));
return $response;
}
|
php
|
public function show($username, $repository, $sha)
{
$response = $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/blobs/'.rawurlencode($sha));
return $response;
}
|
[
"public",
"function",
"show",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"sha",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/git/blobs/'",
".",
"rawurlencode",
"(",
"$",
"sha",
")",
")",
";",
"return",
"$",
"response",
";",
"}"
] |
Show a blob of a sha for a repository.
@param string $username
@param string $repository
@param string $sha
@return array
|
[
"Show",
"a",
"blob",
"of",
"a",
"sha",
"for",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/GitData/Blobs.php#L44-L49
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/PullRequest/Comments.php
|
Comments.all
|
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([
'page' => 1,
'per_page' => 30,
], $params);
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments', $parameters);
}
|
php
|
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([
'page' => 1,
'per_page' => 30,
], $params);
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments', $parameters);
}
|
[
"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",
"(",
"[",
"'page'",
"=>",
"1",
",",
"'per_page'",
"=>",
"30",
",",
"]",
",",
"$",
"params",
")",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/pulls/comments'",
",",
"$",
"parameters",
")",
";",
"}"
] |
Get a listing of a pull request's comments by the username, repository and pull request number
or all repository comments by the username and repository.
@link https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request
@link https://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository
@param string $username the username
@param string $repository the repository
@param int|null $pullRequest the pull request number
@param array $params a list of extra parameters.
@return array
|
[
"Get",
"a",
"listing",
"of",
"a",
"pull",
"request",
"s",
"comments",
"by",
"the",
"username",
"repository",
"and",
"pull",
"request",
"number",
"or",
"all",
"repository",
"comments",
"by",
"the",
"username",
"and",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/PullRequest/Comments.php#L57-L69
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/PullRequest/Comments.php
|
Comments.remove
|
public function remove($username, $repository, $comment)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.rawurlencode($comment));
}
|
php
|
public function remove($username, $repository, $comment)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.rawurlencode($comment));
}
|
[
"public",
"function",
"remove",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"comment",
")",
"{",
"return",
"$",
"this",
"->",
"delete",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/pulls/comments/'",
".",
"rawurlencode",
"(",
"$",
"comment",
")",
")",
";",
"}"
] |
Delete a pull request comment by the username, repository and comment id.
@link https://developer.github.com/v3/pulls/comments/#delete-a-comment
@param string $username the username
@param string $repository the repository
@param int $comment the comment id
@return string
|
[
"Delete",
"a",
"pull",
"request",
"comment",
"by",
"the",
"username",
"repository",
"and",
"comment",
"id",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/PullRequest/Comments.php#L149-L152
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repo.php
|
Repo.update
|
public function update($username, $repository, array $values)
{
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository), $values);
}
|
php
|
public function update($username, $repository, array $values)
{
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository), $values);
}
|
[
"public",
"function",
"update",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"array",
"$",
"values",
")",
"{",
"return",
"$",
"this",
"->",
"patch",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
",",
"$",
"values",
")",
";",
"}"
] |
Set information of a repository.
@link http://developer.github.com/v3/repos/
@param string $username the user who owns the repository
@param string $repository the name of the repository
@param array $values the key => value pairs to post
@return array information about the repository
|
[
"Set",
"information",
"of",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repo.php#L239-L242
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repo.php
|
Repo.readme
|
public function readme($username, $repository, $format = 'raw')
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme', [], [
'Accept' => "application/vnd.github.$format",
]);
}
|
php
|
public function readme($username, $repository, $format = 'raw')
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme', [], [
'Accept' => "application/vnd.github.$format",
]);
}
|
[
"public",
"function",
"readme",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"format",
"=",
"'raw'",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/readme'",
",",
"[",
"]",
",",
"[",
"'Accept'",
"=>",
"\"application/vnd.github.$format\"",
",",
"]",
")",
";",
"}"
] |
Get the readme content for a repository by its username and repository name.
@link http://developer.github.com/v3/repos/contents/#get-the-readme
@param string $username the user who owns the repository
@param string $repository the name of the repository
@param string $format one of formats: "raw", "html", or "v3+json"
@return string|array the readme content
|
[
"Get",
"the",
"readme",
"content",
"for",
"a",
"repository",
"by",
"its",
"username",
"and",
"repository",
"name",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repo.php#L270-L275
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repo.php
|
Repo.contributors
|
public function contributors($username, $repository, $includingAnonymous = false)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contributors', [
'anon' => $includingAnonymous ?: null,
]);
}
|
php
|
public function contributors($username, $repository, $includingAnonymous = false)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contributors', [
'anon' => $includingAnonymous ?: null,
]);
}
|
[
"public",
"function",
"contributors",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"includingAnonymous",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/contributors'",
",",
"[",
"'anon'",
"=>",
"$",
"includingAnonymous",
"?",
":",
"null",
",",
"]",
")",
";",
"}"
] |
Get the contributors of a repository.
@link http://developer.github.com/v3/repos/
@param string $username the user who owns the repository
@param string $repository the name of the repository
@param bool $includingAnonymous by default, the list only shows GitHub users.
You can include non-users too by setting this to true
@return array list of the repo contributors
|
[
"Get",
"the",
"contributors",
"of",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repo.php#L466-L471
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repo.php
|
Repo.tags
|
public function tags($username, $repository, array $params = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/tags', $params);
}
|
php
|
public function tags($username, $repository, array $params = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/tags', $params);
}
|
[
"public",
"function",
"tags",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/tags'",
",",
"$",
"params",
")",
";",
"}"
] |
Get the tags of a repository.
@link http://developer.github.com/v3/repos/
@param string $username the user who owns the repository
@param string $repository the name of the repository
@param array $params the additional parameters like milestone, assignees, labels, sort, direction
@return array list of the repository tags
|
[
"Get",
"the",
"tags",
"of",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repo.php#L499-L502
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repo.php
|
Repo.codeOfConduct
|
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';
return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/community/code_of_conduct');
}
|
php
|
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';
return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/community/code_of_conduct');
}
|
[
"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'",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurldecode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurldecode",
"(",
"$",
"repository",
")",
".",
"'/community/code_of_conduct'",
")",
";",
"}"
] |
Get the contents of a repository's code of conduct.
@link https://developer.github.com/v3/codes_of_conduct/#get-the-contents-of-a-repositorys-code-of-conduct
@param string $username
@param string $repository
@return array
|
[
"Get",
"the",
"contents",
"of",
"a",
"repository",
"s",
"code",
"of",
"conduct",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repo.php#L621-L627
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repo.php
|
Repo.topics
|
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';
return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/topics');
}
|
php
|
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';
return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/topics');
}
|
[
"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'",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurldecode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurldecode",
"(",
"$",
"repository",
")",
".",
"'/topics'",
")",
";",
"}"
] |
List all topics for a repository.
@link https://developer.github.com/v3/repos/#list-all-topics-for-a-repository
@param string $username
@param string $repository
@return array
|
[
"List",
"all",
"topics",
"for",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repo.php#L639-L645
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repo.php
|
Repo.replaceTopics
|
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';
return $this->put('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/topics', ['names' => $topics]);
}
|
php
|
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';
return $this->put('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/topics', ['names' => $topics]);
}
|
[
"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'",
";",
"return",
"$",
"this",
"->",
"put",
"(",
"'/repos/'",
".",
"rawurldecode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurldecode",
"(",
"$",
"repository",
")",
".",
"'/topics'",
",",
"[",
"'names'",
"=>",
"$",
"topics",
"]",
")",
";",
"}"
] |
Replace all topics for a repository.
@link https://developer.github.com/v3/repos/#replace-all-topics-for-a-repository
@param string $username
@param string $repository
@param array $topics
@return array
|
[
"Replace",
"all",
"topics",
"for",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repo.php#L658-L664
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repo.php
|
Repo.transfer
|
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';
return $this->post('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/transfer', ['new_owner' => $newOwner, 'team_id' => $teamId]);
}
|
php
|
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';
return $this->post('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/transfer', ['new_owner' => $newOwner, 'team_id' => $teamId]);
}
|
[
"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'",
";",
"return",
"$",
"this",
"->",
"post",
"(",
"'/repos/'",
".",
"rawurldecode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurldecode",
"(",
"$",
"repository",
")",
".",
"'/transfer'",
",",
"[",
"'new_owner'",
"=>",
"$",
"newOwner",
",",
"'team_id'",
"=>",
"$",
"teamId",
"]",
")",
";",
"}"
] |
Transfer a repository.
@link https://developer.github.com/v3/repos/#transfer-a-repository
@param string $username
@param string $repository
@param string $newOwner
@param array $teamId
@return array
|
[
"Transfer",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repo.php#L678-L684
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Milestones.php
|
Milestones.all
|
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'])) {
$params['sort'] = 'due_date';
}
if (isset($params['direction']) && !in_array($params['direction'], ['asc', 'desc'])) {
$params['direction'] = 'asc';
}
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones', array_merge([
'page' => 1,
'state' => 'open',
'sort' => 'due_date',
'direction' => 'asc',
], $params));
}
|
php
|
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'])) {
$params['sort'] = 'due_date';
}
if (isset($params['direction']) && !in_array($params['direction'], ['asc', 'desc'])) {
$params['direction'] = 'asc';
}
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones', array_merge([
'page' => 1,
'state' => 'open',
'sort' => 'due_date',
'direction' => 'asc',
], $params));
}
|
[
"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'",
"]",
")",
")",
"{",
"$",
"params",
"[",
"'sort'",
"]",
"=",
"'due_date'",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'direction'",
"]",
")",
"&&",
"!",
"in_array",
"(",
"$",
"params",
"[",
"'direction'",
"]",
",",
"[",
"'asc'",
",",
"'desc'",
"]",
")",
")",
"{",
"$",
"params",
"[",
"'direction'",
"]",
"=",
"'asc'",
";",
"}",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/milestones'",
",",
"array_merge",
"(",
"[",
"'page'",
"=>",
"1",
",",
"'state'",
"=>",
"'open'",
",",
"'sort'",
"=>",
"'due_date'",
",",
"'direction'",
"=>",
"'asc'",
",",
"]",
",",
"$",
"params",
")",
")",
";",
"}"
] |
Get all milestones for a repository.
@link https://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
@param string $username
@param string $repository
@param array $params
@return array
|
[
"Get",
"all",
"milestones",
"for",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Milestones.php#L26-L44
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Milestones.php
|
Milestones.create
|
public function create($username, $repository, array $params)
{
if (!isset($params['title'])) {
throw new MissingArgumentException('title');
}
if (isset($params['state']) && !in_array($params['state'], ['open', 'closed'])) {
$params['state'] = 'open';
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones', $params);
}
|
php
|
public function create($username, $repository, array $params)
{
if (!isset($params['title'])) {
throw new MissingArgumentException('title');
}
if (isset($params['state']) && !in_array($params['state'], ['open', 'closed'])) {
$params['state'] = 'open';
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones', $params);
}
|
[
"public",
"function",
"create",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"array",
"$",
"params",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"params",
"[",
"'title'",
"]",
")",
")",
"{",
"throw",
"new",
"MissingArgumentException",
"(",
"'title'",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'state'",
"]",
")",
"&&",
"!",
"in_array",
"(",
"$",
"params",
"[",
"'state'",
"]",
",",
"[",
"'open'",
",",
"'closed'",
"]",
")",
")",
"{",
"$",
"params",
"[",
"'state'",
"]",
"=",
"'open'",
";",
"}",
"return",
"$",
"this",
"->",
"post",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/milestones'",
",",
"$",
"params",
")",
";",
"}"
] |
Create a milestone for a repository.
@link https://developer.github.com/v3/issues/milestones/#create-a-milestone
@param string $username
@param string $repository
@param array $params
@throws \Github\Exception\MissingArgumentException
@return array
|
[
"Create",
"a",
"milestone",
"for",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Milestones.php#L75-L85
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Milestones.php
|
Milestones.update
|
public function update($username, $repository, $id, array $params)
{
if (isset($params['state']) && !in_array($params['state'], ['open', 'closed'])) {
$params['state'] = 'open';
}
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id), $params);
}
|
php
|
public function update($username, $repository, $id, array $params)
{
if (isset($params['state']) && !in_array($params['state'], ['open', 'closed'])) {
$params['state'] = 'open';
}
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id), $params);
}
|
[
"public",
"function",
"update",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"id",
",",
"array",
"$",
"params",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'state'",
"]",
")",
"&&",
"!",
"in_array",
"(",
"$",
"params",
"[",
"'state'",
"]",
",",
"[",
"'open'",
",",
"'closed'",
"]",
")",
")",
"{",
"$",
"params",
"[",
"'state'",
"]",
"=",
"'open'",
";",
"}",
"return",
"$",
"this",
"->",
"patch",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/milestones/'",
".",
"rawurlencode",
"(",
"$",
"id",
")",
",",
"$",
"params",
")",
";",
"}"
] |
Update a milestone for a repository.
@link https://developer.github.com/v3/issues/milestones/#update-a-milestone
@param string $username
@param string $repository
@param int $id
@param array $params
@return array
|
[
"Update",
"a",
"milestone",
"for",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Milestones.php#L99-L106
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Milestones.php
|
Milestones.remove
|
public function remove($username, $repository, $id)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id));
}
|
php
|
public function remove($username, $repository, $id)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id));
}
|
[
"public",
"function",
"remove",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"delete",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/milestones/'",
".",
"rawurlencode",
"(",
"$",
"id",
")",
")",
";",
"}"
] |
Delete a milestone for a repository.
@link https://developer.github.com/v3/issues/milestones/#delete-a-milestone
@param string $username
@param string $repository
@param int $id
@return array|string
|
[
"Delete",
"a",
"milestone",
"for",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Milestones.php#L119-L122
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Milestones.php
|
Milestones.labels
|
public function labels($username, $repository, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id).'/labels');
}
|
php
|
public function labels($username, $repository, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id).'/labels');
}
|
[
"public",
"function",
"labels",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/milestones/'",
".",
"rawurlencode",
"(",
"$",
"id",
")",
".",
"'/labels'",
")",
";",
"}"
] |
Get the labels of a milestone.
@link https://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone
@param string $username
@param string $repository
@param int $id
@return array
|
[
"Get",
"the",
"labels",
"of",
"a",
"milestone",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Milestones.php#L135-L138
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/PullRequest/Review.php
|
Review.show
|
public function show($username, $repository, $pullRequest, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id);
}
|
php
|
public function show($username, $repository, $pullRequest, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id);
}
|
[
"public",
"function",
"show",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"pullRequest",
",",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/pulls/'",
".",
"$",
"pullRequest",
".",
"'/reviews/'",
".",
"$",
"id",
")",
";",
"}"
] |
Get a single pull request review by the username, repository, pull request number and the review id.
@link https://developer.github.com/v3/pulls/reviews/#get-a-single-review
@param string $username the username
@param string $repository the repository
@param int $pullRequest the pull request number
@param int $id the review id
@return array the pull request review
|
[
"Get",
"a",
"single",
"pull",
"request",
"review",
"by",
"the",
"username",
"repository",
"pull",
"request",
"number",
"and",
"the",
"review",
"id",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/PullRequest/Review.php#L60-L63
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/PullRequest/Review.php
|
Review.comments
|
public function comments($username, $repository, $pullRequest, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($pullRequest).'/reviews/'.rawurlencode($id).'/comments');
}
|
php
|
public function comments($username, $repository, $pullRequest, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($pullRequest).'/reviews/'.rawurlencode($id).'/comments');
}
|
[
"public",
"function",
"comments",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"pullRequest",
",",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/pulls/'",
".",
"rawurlencode",
"(",
"$",
"pullRequest",
")",
".",
"'/reviews/'",
".",
"rawurlencode",
"(",
"$",
"id",
")",
".",
"'/comments'",
")",
";",
"}"
] |
Get comments for a single pull request review.
@link https://developer.github.com/v3/pulls/reviews/#get-comments-for-a-single-review
@param string $username the username
@param string $repository the repository
@param int $pullRequest the pull request number
@param int $id the review id
@return array|string
|
[
"Get",
"comments",
"for",
"a",
"single",
"pull",
"request",
"review",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/PullRequest/Review.php#L94-L97
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/PullRequest/Review.php
|
Review.create
|
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 one of ["APPROVE", "REQUEST_CHANGES", "COMMENT"] ("%s" given).', $params['event']));
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews', $params);
}
|
php
|
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 one of ["APPROVE", "REQUEST_CHANGES", "COMMENT"] ("%s" given).', $params['event']));
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews', $params);
}
|
[
"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 one of [\"APPROVE\", \"REQUEST_CHANGES\", \"COMMENT\"] (\"%s\" given).'",
",",
"$",
"params",
"[",
"'event'",
"]",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"post",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/pulls/'",
".",
"$",
"pullRequest",
".",
"'/reviews'",
",",
"$",
"params",
")",
";",
"}"
] |
Create a pull request review by the username, repository and pull request number.
@link https://developer.github.com/v3/pulls/reviews/#create-a-pull-request-review
@param string $username the username
@param string $repository the repository
@param int $pullRequest the pull request number
@param array $params a list of extra parameters.
@throws MissingArgumentException
@return array the pull request review
|
[
"Create",
"a",
"pull",
"request",
"review",
"by",
"the",
"username",
"repository",
"and",
"pull",
"request",
"number",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/PullRequest/Review.php#L113-L120
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/PullRequest/Review.php
|
Review.submit
|
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 InvalidArgumentException(sprintf('"event" must be one of ["APPROVE", "REQUEST_CHANGES", "COMMENT"] ("%s" given).', $params['event']));
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id.'/events', $params);
}
|
php
|
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 InvalidArgumentException(sprintf('"event" must be one of ["APPROVE", "REQUEST_CHANGES", "COMMENT"] ("%s" given).', $params['event']));
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id.'/events', $params);
}
|
[
"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",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'\"event\" must be one of [\"APPROVE\", \"REQUEST_CHANGES\", \"COMMENT\"] (\"%s\" given).'",
",",
"$",
"params",
"[",
"'event'",
"]",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"post",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/pulls/'",
".",
"$",
"pullRequest",
".",
"'/reviews/'",
".",
"$",
"id",
".",
"'/events'",
",",
"$",
"params",
")",
";",
"}"
] |
Submit a pull request review by the username, repository, pull request number and the review id.
@link https://developer.github.com/v3/pulls/reviews/#submit-a-pull-request-review
@param string $username the username
@param string $repository the repository
@param int $pullRequest the pull request number
@param int $id the review id
@param array $params a list of extra parameters.
@throws MissingArgumentException
@return array the pull request review
|
[
"Submit",
"a",
"pull",
"request",
"review",
"by",
"the",
"username",
"repository",
"pull",
"request",
"number",
"and",
"the",
"review",
"id",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/PullRequest/Review.php#L137-L148
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/PullRequest/Review.php
|
Review.dismiss
|
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 InvalidArgumentException('"message" is mandatory and cannot be empty');
}
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id.'/dismissals', [
'message' => $message,
]);
}
|
php
|
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 InvalidArgumentException('"message" is mandatory and cannot be empty');
}
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id.'/dismissals', [
'message' => $message,
]);
}
|
[
"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",
"InvalidArgumentException",
"(",
"'\"message\" is mandatory and cannot be empty'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"put",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/pulls/'",
".",
"$",
"pullRequest",
".",
"'/reviews/'",
".",
"$",
"id",
".",
"'/dismissals'",
",",
"[",
"'message'",
"=>",
"$",
"message",
",",
"]",
")",
";",
"}"
] |
Dismiss a pull request review by the username, repository, pull request number and the review id.
@link https://developer.github.com/v3/pulls/reviews/#dismiss-a-pull-request-review
@param string $username the username
@param string $repository the repository
@param int $pullRequest the pull request number
@param int $id the review id
@param string $message a mandatory dismissal message
@return array|string
|
[
"Dismiss",
"a",
"pull",
"request",
"review",
"by",
"the",
"username",
"repository",
"pull",
"request",
"number",
"and",
"the",
"review",
"id",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/PullRequest/Review.php#L163-L176
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/PullRequest/Review.php
|
Review.update
|
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('"body" is mandatory and cannot be empty');
}
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id, [
'body' => $body,
]);
}
|
php
|
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('"body" is mandatory and cannot be empty');
}
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id, [
'body' => $body,
]);
}
|
[
"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",
"(",
"'\"body\" is mandatory and cannot be empty'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"put",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/pulls/'",
".",
"$",
"pullRequest",
".",
"'/reviews/'",
".",
"$",
"id",
",",
"[",
"'body'",
"=>",
"$",
"body",
",",
"]",
")",
";",
"}"
] |
Update a pull request review by the username, repository, pull request number and the review id.
@link https://developer.github.com/v3/pulls/reviews/#update-a-pull-request-review
@param string $username the username
@param string $repository the repository
@param int $pullRequest the pull request number
@param int $id the review id
@param string $body a mandatory dismissal message
@return array|string
|
[
"Update",
"a",
"pull",
"request",
"review",
"by",
"the",
"username",
"repository",
"pull",
"request",
"number",
"and",
"the",
"review",
"id",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/PullRequest/Review.php#L191-L204
|
train
|
KnpLabs/php-github-api
|
lib/Github/Client.php
|
Client.setEnterpriseUrl
|
private function setEnterpriseUrl($enterpriseUrl)
{
$builder = $this->getHttpClientBuilder();
$builder->removePlugin(Plugin\AddHostPlugin::class);
$builder->removePlugin(PathPrepend::class);
$builder->addPlugin(new Plugin\AddHostPlugin(UriFactoryDiscovery::find()->createUri($enterpriseUrl)));
$builder->addPlugin(new PathPrepend(sprintf('/api/%s', $this->getApiVersion())));
}
|
php
|
private function setEnterpriseUrl($enterpriseUrl)
{
$builder = $this->getHttpClientBuilder();
$builder->removePlugin(Plugin\AddHostPlugin::class);
$builder->removePlugin(PathPrepend::class);
$builder->addPlugin(new Plugin\AddHostPlugin(UriFactoryDiscovery::find()->createUri($enterpriseUrl)));
$builder->addPlugin(new PathPrepend(sprintf('/api/%s', $this->getApiVersion())));
}
|
[
"private",
"function",
"setEnterpriseUrl",
"(",
"$",
"enterpriseUrl",
")",
"{",
"$",
"builder",
"=",
"$",
"this",
"->",
"getHttpClientBuilder",
"(",
")",
";",
"$",
"builder",
"->",
"removePlugin",
"(",
"Plugin",
"\\",
"AddHostPlugin",
"::",
"class",
")",
";",
"$",
"builder",
"->",
"removePlugin",
"(",
"PathPrepend",
"::",
"class",
")",
";",
"$",
"builder",
"->",
"addPlugin",
"(",
"new",
"Plugin",
"\\",
"AddHostPlugin",
"(",
"UriFactoryDiscovery",
"::",
"find",
"(",
")",
"->",
"createUri",
"(",
"$",
"enterpriseUrl",
")",
")",
")",
";",
"$",
"builder",
"->",
"addPlugin",
"(",
"new",
"PathPrepend",
"(",
"sprintf",
"(",
"'/api/%s'",
",",
"$",
"this",
"->",
"getApiVersion",
"(",
")",
")",
")",
")",
";",
"}"
] |
Sets the URL of your GitHub Enterprise instance.
@param string $enterpriseUrl URL of the API in the form of http(s)://hostname
|
[
"Sets",
"the",
"URL",
"of",
"your",
"GitHub",
"Enterprise",
"instance",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Client.php#L343-L351
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.show
|
public function show($username, $repository, $branch)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection');
}
|
php
|
public function show($username, $repository, $branch)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection');
}
|
[
"public",
"function",
"show",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection'",
")",
";",
"}"
] |
Retrieves configured protection for the provided branch.
@link https://developer.github.com/v3/repos/branches/#get-branch-protection
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@return array The branch protection information
|
[
"Retrieves",
"configured",
"protection",
"for",
"the",
"provided",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L35-L38
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.update
|
public function update($username, $repository, $branch, array $params = [])
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection', $params);
}
|
php
|
public function update($username, $repository, $branch, array $params = [])
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection', $params);
}
|
[
"public",
"function",
"update",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"put",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection'",
",",
"$",
"params",
")",
";",
"}"
] |
Updates the repo's branch protection.
@link https://developer.github.com/v3/repos/branches/#update-branch-protection
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@param array $params The branch protection information
@return array The updated branch protection information
|
[
"Updates",
"the",
"repo",
"s",
"branch",
"protection",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L52-L55
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.remove
|
public function remove($username, $repository, $branch)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection');
}
|
php
|
public function remove($username, $repository, $branch)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection');
}
|
[
"public",
"function",
"remove",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
")",
"{",
"return",
"$",
"this",
"->",
"delete",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection'",
")",
";",
"}"
] |
Remove the repo's branch protection.
@link https://developer.github.com/v3/repos/branches/#remove-branch-protection
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
|
[
"Remove",
"the",
"repo",
"s",
"branch",
"protection",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L66-L69
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.showStatusChecks
|
public function showStatusChecks($username, $repository, $branch)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks');
}
|
php
|
public function showStatusChecks($username, $repository, $branch)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks');
}
|
[
"public",
"function",
"showStatusChecks",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/required_status_checks'",
")",
";",
"}"
] |
Get required status checks of protected branch.
@link https://developer.github.com/v3/repos/branches/#get-required-status-checks-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@return array The required status checks information
|
[
"Get",
"required",
"status",
"checks",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L82-L85
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.updateStatusChecks
|
public function updateStatusChecks($username, $repository, $branch, array $params = [])
{
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks', $params);
}
|
php
|
public function updateStatusChecks($username, $repository, $branch, array $params = [])
{
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks', $params);
}
|
[
"public",
"function",
"updateStatusChecks",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"patch",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/required_status_checks'",
",",
"$",
"params",
")",
";",
"}"
] |
Update required status checks of protected branch.
@link https://developer.github.com/v3/repos/branches/#update-required-status-checks-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@param array $params The branch status checks information
@return array The updated branch status checks information
|
[
"Update",
"required",
"status",
"checks",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L99-L102
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.removeStatusChecks
|
public function removeStatusChecks($username, $repository, $branch)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks');
}
|
php
|
public function removeStatusChecks($username, $repository, $branch)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks');
}
|
[
"public",
"function",
"removeStatusChecks",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
")",
"{",
"return",
"$",
"this",
"->",
"delete",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/required_status_checks'",
")",
";",
"}"
] |
Remove required status checks of protected branch.
@link https://developer.github.com/v3/repos/branches/#remove-required-status-checks-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
|
[
"Remove",
"required",
"status",
"checks",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L113-L116
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.showStatusChecksContexts
|
public function showStatusChecksContexts($username, $repository, $branch)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks/contexts');
}
|
php
|
public function showStatusChecksContexts($username, $repository, $branch)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks/contexts');
}
|
[
"public",
"function",
"showStatusChecksContexts",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/required_status_checks/contexts'",
")",
";",
"}"
] |
List required status checks contexts of protected branch.
@link https://developer.github.com/v3/repos/branches/#list-required-status-checks-contexts-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@return array The required status checks contexts information
|
[
"List",
"required",
"status",
"checks",
"contexts",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L129-L132
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.replaceStatusChecksContexts
|
public function replaceStatusChecksContexts($username, $repository, $branch, array $params = [])
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks/contexts', $params);
}
|
php
|
public function replaceStatusChecksContexts($username, $repository, $branch, array $params = [])
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks/contexts', $params);
}
|
[
"public",
"function",
"replaceStatusChecksContexts",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"put",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/required_status_checks/contexts'",
",",
"$",
"params",
")",
";",
"}"
] |
Replace required status checks contexts of protected branch.
@link https://developer.github.com/v3/repos/branches/#replace-required-status-checks-contexts-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@param array $params The branch status checks contexts information
@return array The new branch status checks contexts information
|
[
"Replace",
"required",
"status",
"checks",
"contexts",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L146-L149
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.addStatusChecksContexts
|
public function addStatusChecksContexts($username, $repository, $branch, array $params = [])
{
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks/contexts', $params);
}
|
php
|
public function addStatusChecksContexts($username, $repository, $branch, array $params = [])
{
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks/contexts', $params);
}
|
[
"public",
"function",
"addStatusChecksContexts",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"post",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/required_status_checks/contexts'",
",",
"$",
"params",
")",
";",
"}"
] |
Add required status checks contexts of protected branch.
@link https://developer.github.com/v3/repos/branches/#add-required-status-checks-contexts-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@param array $params The branch status checks contexts information
@return array The updated branch status checks contexts information
|
[
"Add",
"required",
"status",
"checks",
"contexts",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L163-L166
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.removeStatusChecksContexts
|
public function removeStatusChecksContexts($username, $repository, $branch, array $params = [])
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks/contexts', $params);
}
|
php
|
public function removeStatusChecksContexts($username, $repository, $branch, array $params = [])
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks/contexts', $params);
}
|
[
"public",
"function",
"removeStatusChecksContexts",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"delete",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/required_status_checks/contexts'",
",",
"$",
"params",
")",
";",
"}"
] |
Remove required status checks contexts of protected branch.
@link https://developer.github.com/v3/repos/branches/#remove-required-status-checks-contexts-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@param array $params The branch status checks contexts information
@return array The updated branch status checks contexts information
|
[
"Remove",
"required",
"status",
"checks",
"contexts",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L180-L183
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.showPullRequestReviewEnforcement
|
public function showPullRequestReviewEnforcement($username, $repository, $branch)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_pull_request_reviews');
}
|
php
|
public function showPullRequestReviewEnforcement($username, $repository, $branch)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_pull_request_reviews');
}
|
[
"public",
"function",
"showPullRequestReviewEnforcement",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/required_pull_request_reviews'",
")",
";",
"}"
] |
Get pull request review enforcement of protected branch.
@link https://developer.github.com/v3/repos/branches/#get-pull-request-review-enforcement-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@return array The pull request review enforcement information
|
[
"Get",
"pull",
"request",
"review",
"enforcement",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L196-L199
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.updatePullRequestReviewEnforcement
|
public function updatePullRequestReviewEnforcement($username, $repository, $branch, array $params = [])
{
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_pull_request_reviews', $params);
}
|
php
|
public function updatePullRequestReviewEnforcement($username, $repository, $branch, array $params = [])
{
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_pull_request_reviews', $params);
}
|
[
"public",
"function",
"updatePullRequestReviewEnforcement",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"patch",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/required_pull_request_reviews'",
",",
"$",
"params",
")",
";",
"}"
] |
Update pull request review enforcement of protected branch.
@link https://developer.github.com/v3/repos/branches/#update-pull-request-review-enforcement-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@param array $params The branch status checks information
@return array The updated branch status checks information
|
[
"Update",
"pull",
"request",
"review",
"enforcement",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L213-L216
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.removePullRequestReviewEnforcement
|
public function removePullRequestReviewEnforcement($username, $repository, $branch)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_pull_request_reviews');
}
|
php
|
public function removePullRequestReviewEnforcement($username, $repository, $branch)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_pull_request_reviews');
}
|
[
"public",
"function",
"removePullRequestReviewEnforcement",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
")",
"{",
"return",
"$",
"this",
"->",
"delete",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/required_pull_request_reviews'",
")",
";",
"}"
] |
Remove pull request review enforcement of protected branch.
@link https://developer.github.com/v3/repos/branches/#remove-pull-request-review-enforcement-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
|
[
"Remove",
"pull",
"request",
"review",
"enforcement",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L227-L230
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.showAdminEnforcement
|
public function showAdminEnforcement($username, $repository, $branch)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/enforce_admins');
}
|
php
|
public function showAdminEnforcement($username, $repository, $branch)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/enforce_admins');
}
|
[
"public",
"function",
"showAdminEnforcement",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/enforce_admins'",
")",
";",
"}"
] |
Get admin enforcement of protected branch.
@link https://developer.github.com/v3/repos/branches/#get-admin-enforcement-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@return array The admin enforcement information
|
[
"Get",
"admin",
"enforcement",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L243-L246
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.addAdminEnforcement
|
public function addAdminEnforcement($username, $repository, $branch)
{
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/enforce_admins');
}
|
php
|
public function addAdminEnforcement($username, $repository, $branch)
{
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/enforce_admins');
}
|
[
"public",
"function",
"addAdminEnforcement",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
")",
"{",
"return",
"$",
"this",
"->",
"post",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/enforce_admins'",
")",
";",
"}"
] |
Add admin enforcement of protected branch.
@link https://developer.github.com/v3/repos/branches/#add-admin-enforcement-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@return array The updated admin enforcement information
|
[
"Add",
"admin",
"enforcement",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L259-L262
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.removeAdminEnforcement
|
public function removeAdminEnforcement($username, $repository, $branch)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/enforce_admins');
}
|
php
|
public function removeAdminEnforcement($username, $repository, $branch)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/enforce_admins');
}
|
[
"public",
"function",
"removeAdminEnforcement",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
")",
"{",
"return",
"$",
"this",
"->",
"delete",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/enforce_admins'",
")",
";",
"}"
] |
Remove admin enforcement of protected branch.
@link https://developer.github.com/v3/repos/branches/#remove-admin-enforcement-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
|
[
"Remove",
"admin",
"enforcement",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L273-L276
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.showRestrictions
|
public function showRestrictions($username, $repository, $branch)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions');
}
|
php
|
public function showRestrictions($username, $repository, $branch)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions');
}
|
[
"public",
"function",
"showRestrictions",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/restrictions'",
")",
";",
"}"
] |
Get restrictions of protected branch.
@link https://developer.github.com/v3/repos/branches/#get-restrictions-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@return array The branch restrictions information
|
[
"Get",
"restrictions",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L289-L292
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.removeRestrictions
|
public function removeRestrictions($username, $repository, $branch)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions');
}
|
php
|
public function removeRestrictions($username, $repository, $branch)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions');
}
|
[
"public",
"function",
"removeRestrictions",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
")",
"{",
"return",
"$",
"this",
"->",
"delete",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/restrictions'",
")",
";",
"}"
] |
Remove restrictions of protected branch.
@link https://developer.github.com/v3/repos/branches/#remove-restrictions-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
|
[
"Remove",
"restrictions",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L303-L306
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.showTeamRestrictions
|
public function showTeamRestrictions($username, $repository, $branch)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/teams');
}
|
php
|
public function showTeamRestrictions($username, $repository, $branch)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/teams');
}
|
[
"public",
"function",
"showTeamRestrictions",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/restrictions/teams'",
")",
";",
"}"
] |
List team restrictions of protected branch.
@link https://developer.github.com/v3/repos/branches/#list-team-restrictions-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@return array The branch team restrictions information
|
[
"List",
"team",
"restrictions",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L319-L322
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.replaceTeamRestrictions
|
public function replaceTeamRestrictions($username, $repository, $branch, array $params = [])
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/teams', $params);
}
|
php
|
public function replaceTeamRestrictions($username, $repository, $branch, array $params = [])
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/teams', $params);
}
|
[
"public",
"function",
"replaceTeamRestrictions",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"put",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/restrictions/teams'",
",",
"$",
"params",
")",
";",
"}"
] |
Replace team restrictions of protected branch.
@link https://developer.github.com/v3/repos/branches/#replace-team-restrictions-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@param array $params The list of team slugs with push access
@return array The new branch team restrictions information
|
[
"Replace",
"team",
"restrictions",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L336-L339
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.addTeamRestrictions
|
public function addTeamRestrictions($username, $repository, $branch, array $params = [])
{
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/teams', $params);
}
|
php
|
public function addTeamRestrictions($username, $repository, $branch, array $params = [])
{
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/teams', $params);
}
|
[
"public",
"function",
"addTeamRestrictions",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"post",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/restrictions/teams'",
",",
"$",
"params",
")",
";",
"}"
] |
Add team restrictions of protected branch.
@link https://developer.github.com/v3/repos/branches/#add-team-restrictions-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@param array $params The list of team slugs with push access
@return array The branch team restrictions information
|
[
"Add",
"team",
"restrictions",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L353-L356
|
train
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.