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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
fvsch/kirby-staticbuilder | src/Builder.php | Builder.htmlReport | public function htmlReport($data=[])
{
// Forcefully remove headers that might have been set by some
// templates, controllers or plugins when rendering pages.
header_remove();
$root = dirname(__DIR__);
$data['styles'] = file_get_contents($root . '/assets/report.css');
$data['script'] = file_get_contents($root . '/assets/report.js');
$body = Tpl::load(__DIR__ . '/report.php', $data);
return new Response($body, 'html', $data['error'] ? 500 : 200);
} | php | public function htmlReport($data=[])
{
// Forcefully remove headers that might have been set by some
// templates, controllers or plugins when rendering pages.
header_remove();
$root = dirname(__DIR__);
$data['styles'] = file_get_contents($root . '/assets/report.css');
$data['script'] = file_get_contents($root . '/assets/report.js');
$body = Tpl::load(__DIR__ . '/report.php', $data);
return new Response($body, 'html', $data['error'] ? 500 : 200);
} | [
"public",
"function",
"htmlReport",
"(",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"// Forcefully remove headers that might have been set by some",
"// templates, controllers or plugins when rendering pages.",
"header_remove",
"(",
")",
";",
"$",
"root",
"=",
"dirname",
"(",
... | Render the HTML report page
@param array $data
@return Response | [
"Render",
"the",
"HTML",
"report",
"page"
] | b2802f48ee978086661df97992ec27a9e08d0f28 | https://github.com/fvsch/kirby-staticbuilder/blob/b2802f48ee978086661df97992ec27a9e08d0f28/src/Builder.php#L610-L620 | train |
fvsch/kirby-staticbuilder | src/Builder.php | Builder.defaultFilter | public static function defaultFilter($page)
{
// Exclude folders containing Kirby Modules
// https://github.com/getkirby-plugins/modules-plugin
$mod = C::get('modules.template.prefix', 'module.');
if (Str::startsWith($page->intendedTemplate(), $mod)) {
return [false, "Ignoring module pages (template prefix: \"$mod\")"];
}
// Exclude pages missing a content file
// Note: $page->content()->exists() returns the wrong information,
// so we use the inventory instead. For an empty directory, it can
// be [] (single-language site) or ['code' => null] (multilang).
if (array_shift($page->inventory()['content']) === null) {
return [false, 'Page has no content file.'];
}
return true;
} | php | public static function defaultFilter($page)
{
// Exclude folders containing Kirby Modules
// https://github.com/getkirby-plugins/modules-plugin
$mod = C::get('modules.template.prefix', 'module.');
if (Str::startsWith($page->intendedTemplate(), $mod)) {
return [false, "Ignoring module pages (template prefix: \"$mod\")"];
}
// Exclude pages missing a content file
// Note: $page->content()->exists() returns the wrong information,
// so we use the inventory instead. For an empty directory, it can
// be [] (single-language site) or ['code' => null] (multilang).
if (array_shift($page->inventory()['content']) === null) {
return [false, 'Page has no content file.'];
}
return true;
} | [
"public",
"static",
"function",
"defaultFilter",
"(",
"$",
"page",
")",
"{",
"// Exclude folders containing Kirby Modules",
"// https://github.com/getkirby-plugins/modules-plugin",
"$",
"mod",
"=",
"C",
"::",
"get",
"(",
"'modules.template.prefix'",
",",
"'module.'",
")",
... | Standard filter used to exclude empty "page" directories
@param Page $page
@return bool|array | [
"Standard",
"filter",
"used",
"to",
"exclude",
"empty",
"page",
"directories"
] | b2802f48ee978086661df97992ec27a9e08d0f28 | https://github.com/fvsch/kirby-staticbuilder/blob/b2802f48ee978086661df97992ec27a9e08d0f28/src/Builder.php#L627-L643 | train |
fvsch/kirby-staticbuilder | src/Controller.php | Controller.register | static function register()
{
if (static::$registered) {
return 'StaticBuilder is already enabled';
}
if (!C::get('staticbuilder', false)) {
return 'StaticBuilder does not seem to be enabled in your config. See https://github.com/fvsch/kirby-staticbuilder/blob/master/doc/install.md for instructions.';
}
$kirby = kirby();
if (!class_exists('Kirby\\Registry')) {
throw new Exception('Twig plugin requires Kirby 2.3 or higher. Current version: ' . $kirby->version());
}
$kirby->set('route', [
'pattern' => 'staticbuilder',
'action' => 'Kirby\\StaticBuilder\\Controller::siteAction',
'method' => 'GET|POST'
]);
$kirby->set('route', [
'pattern' => 'staticbuilder/(:all)',
'action' => 'Kirby\\StaticBuilder\\Controller::pageAction',
'method' => 'GET|POST'
]);
static::$registered = true;
return 'Enabled StaticBuilder routes.';
} | php | static function register()
{
if (static::$registered) {
return 'StaticBuilder is already enabled';
}
if (!C::get('staticbuilder', false)) {
return 'StaticBuilder does not seem to be enabled in your config. See https://github.com/fvsch/kirby-staticbuilder/blob/master/doc/install.md for instructions.';
}
$kirby = kirby();
if (!class_exists('Kirby\\Registry')) {
throw new Exception('Twig plugin requires Kirby 2.3 or higher. Current version: ' . $kirby->version());
}
$kirby->set('route', [
'pattern' => 'staticbuilder',
'action' => 'Kirby\\StaticBuilder\\Controller::siteAction',
'method' => 'GET|POST'
]);
$kirby->set('route', [
'pattern' => 'staticbuilder/(:all)',
'action' => 'Kirby\\StaticBuilder\\Controller::pageAction',
'method' => 'GET|POST'
]);
static::$registered = true;
return 'Enabled StaticBuilder routes.';
} | [
"static",
"function",
"register",
"(",
")",
"{",
"if",
"(",
"static",
"::",
"$",
"registered",
")",
"{",
"return",
"'StaticBuilder is already enabled'",
";",
"}",
"if",
"(",
"!",
"C",
"::",
"get",
"(",
"'staticbuilder'",
",",
"false",
")",
")",
"{",
"ret... | Register StaticBuilder's routes
Returns a string with the current status
@return string | [
"Register",
"StaticBuilder",
"s",
"routes",
"Returns",
"a",
"string",
"with",
"the",
"current",
"status"
] | b2802f48ee978086661df97992ec27a9e08d0f28 | https://github.com/fvsch/kirby-staticbuilder/blob/b2802f48ee978086661df97992ec27a9e08d0f28/src/Controller.php#L19-L43 | train |
fvsch/kirby-staticbuilder | src/Controller.php | Controller.pageAction | static function pageAction($uri)
{
$write = R::is('POST') and R::get('confirm');
$page = page($uri);
$builder = new Builder();
$data = [
'mode' => 'page',
'error' => false,
'confirm' => $write,
'summary' => []
];
if (!$page) {
$data['error'] = "Error: Cannot find page for \"$uri\"";
}
else {
$builder->run($page, $write);
$data['summary'] = $builder->summary;
}
return $builder->htmlReport($data);
} | php | static function pageAction($uri)
{
$write = R::is('POST') and R::get('confirm');
$page = page($uri);
$builder = new Builder();
$data = [
'mode' => 'page',
'error' => false,
'confirm' => $write,
'summary' => []
];
if (!$page) {
$data['error'] = "Error: Cannot find page for \"$uri\"";
}
else {
$builder->run($page, $write);
$data['summary'] = $builder->summary;
}
return $builder->htmlReport($data);
} | [
"static",
"function",
"pageAction",
"(",
"$",
"uri",
")",
"{",
"$",
"write",
"=",
"R",
"::",
"is",
"(",
"'POST'",
")",
"and",
"R",
"::",
"get",
"(",
"'confirm'",
")",
";",
"$",
"page",
"=",
"page",
"(",
"$",
"uri",
")",
";",
"$",
"builder",
"="... | Similar to siteAction but for a single page.
@param $uri
@return Response | [
"Similar",
"to",
"siteAction",
"but",
"for",
"a",
"single",
"page",
"."
] | b2802f48ee978086661df97992ec27a9e08d0f28 | https://github.com/fvsch/kirby-staticbuilder/blob/b2802f48ee978086661df97992ec27a9e08d0f28/src/Controller.php#L89-L108 | train |
timegridio/concierge | src/Models/Business.php | Business.boot | public static function boot()
{
parent::boot();
static::creating(function ($business) {
$business->slug = $business->makeSlug($business->name);
});
} | php | public static function boot()
{
parent::boot();
static::creating(function ($business) {
$business->slug = $business->makeSlug($business->name);
});
} | [
"public",
"static",
"function",
"boot",
"(",
")",
"{",
"parent",
"::",
"boot",
"(",
")",
";",
"static",
"::",
"creating",
"(",
"function",
"(",
"$",
"business",
")",
"{",
"$",
"business",
"->",
"slug",
"=",
"$",
"business",
"->",
"makeSlug",
"(",
"$"... | Define model events.
@return void | [
"Define",
"model",
"events",
"."
] | f5495dab5907ba9df3210af843fceaa8c8d009d6 | https://github.com/timegridio/concierge/blob/f5495dab5907ba9df3210af843fceaa8c8d009d6/src/Models/Business.php#L78-L87 | train |
timegridio/concierge | src/Timetable/Strategies/TimetableTimeslotStrategy.php | TimetableTimeslotStrategy.buildTimetable | public function buildTimetable($vacancies, $starting = 'today', $days = 1)
{
$this->initTimetable($starting, $days);
foreach ($vacancies as $vacancy) {
$this->updateTimeslots($vacancy, $this->interval);
}
return $this->timetable->get();
} | php | public function buildTimetable($vacancies, $starting = 'today', $days = 1)
{
$this->initTimetable($starting, $days);
foreach ($vacancies as $vacancy) {
$this->updateTimeslots($vacancy, $this->interval);
}
return $this->timetable->get();
} | [
"public",
"function",
"buildTimetable",
"(",
"$",
"vacancies",
",",
"$",
"starting",
"=",
"'today'",
",",
"$",
"days",
"=",
"1",
")",
"{",
"$",
"this",
"->",
"initTimetable",
"(",
"$",
"starting",
",",
"$",
"days",
")",
";",
"foreach",
"(",
"$",
"vac... | Build timetable.
@param \Illuminate\Database\Eloquent\Collection $vacancies
@param string $starting
@param int $days
@return array | [
"Build",
"timetable",
"."
] | f5495dab5907ba9df3210af843fceaa8c8d009d6 | https://github.com/timegridio/concierge/blob/f5495dab5907ba9df3210af843fceaa8c8d009d6/src/Timetable/Strategies/TimetableTimeslotStrategy.php#L38-L47 | train |
timegridio/concierge | src/Timetable/Timetable.php | Timetable.init | public function init()
{
$this->timetable = [];
$dimensions['service'] = $this->inflateServices();
$dimensions['date'] = $this->inflateDates();
$dimensions['time'] = $this->inflateTimes();
foreach ($dimensions['service'] as $service) {
foreach ($dimensions['date'] as $date) {
foreach ($dimensions['time'] as $time) {
$this->capacity($date, $time, $service, 0);
}
}
}
return $this;
} | php | public function init()
{
$this->timetable = [];
$dimensions['service'] = $this->inflateServices();
$dimensions['date'] = $this->inflateDates();
$dimensions['time'] = $this->inflateTimes();
foreach ($dimensions['service'] as $service) {
foreach ($dimensions['date'] as $date) {
foreach ($dimensions['time'] as $time) {
$this->capacity($date, $time, $service, 0);
}
}
}
return $this;
} | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"timetable",
"=",
"[",
"]",
";",
"$",
"dimensions",
"[",
"'service'",
"]",
"=",
"$",
"this",
"->",
"inflateServices",
"(",
")",
";",
"$",
"dimensions",
"[",
"'date'",
"]",
"=",
"$",
"t... | Initialize Timetable.
@return $this | [
"Initialize",
"Timetable",
"."
] | f5495dab5907ba9df3210af843fceaa8c8d009d6 | https://github.com/timegridio/concierge/blob/f5495dab5907ba9df3210af843fceaa8c8d009d6/src/Timetable/Timetable.php#L154-L171 | train |
timegridio/concierge | src/Timetable/Timetable.php | Timetable.capacity | public function capacity($date, $time, $service, $capacity = null)
{
$path = $this->dimensions(compact('date', 'service', 'time'));
return $capacity === null
? $this->array_get($this->timetable, $path)
: $this->array_set($this->timetable, $path, $capacity);
} | php | public function capacity($date, $time, $service, $capacity = null)
{
$path = $this->dimensions(compact('date', 'service', 'time'));
return $capacity === null
? $this->array_get($this->timetable, $path)
: $this->array_set($this->timetable, $path, $capacity);
} | [
"public",
"function",
"capacity",
"(",
"$",
"date",
",",
"$",
"time",
",",
"$",
"service",
",",
"$",
"capacity",
"=",
"null",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"dimensions",
"(",
"compact",
"(",
"'date'",
",",
"'service'",
",",
"'time'",... | Set the capacity for a slot.
@param string $date
@param string $time
@param string $service
@param int $capacity
@return int | [
"Set",
"the",
"capacity",
"for",
"a",
"slot",
"."
] | f5495dab5907ba9df3210af843fceaa8c8d009d6 | https://github.com/timegridio/concierge/blob/f5495dab5907ba9df3210af843fceaa8c8d009d6/src/Timetable/Timetable.php#L230-L237 | train |
timegridio/concierge | src/Timetable/Timetable.php | Timetable.dimensions | private function dimensions(array $segments)
{
$translatedDimensions = $this->dimensions;
$this->array_substitute($translatedDimensions, $segments);
return implode('.', $translatedDimensions);
} | php | private function dimensions(array $segments)
{
$translatedDimensions = $this->dimensions;
$this->array_substitute($translatedDimensions, $segments);
return implode('.', $translatedDimensions);
} | [
"private",
"function",
"dimensions",
"(",
"array",
"$",
"segments",
")",
"{",
"$",
"translatedDimensions",
"=",
"$",
"this",
"->",
"dimensions",
";",
"$",
"this",
"->",
"array_substitute",
"(",
"$",
"translatedDimensions",
",",
"$",
"segments",
")",
";",
"re... | Get a concrete Timetable path.
@param array $segments
@return string | [
"Get",
"a",
"concrete",
"Timetable",
"path",
"."
] | f5495dab5907ba9df3210af843fceaa8c8d009d6 | https://github.com/timegridio/concierge/blob/f5495dab5907ba9df3210af843fceaa8c8d009d6/src/Timetable/Timetable.php#L246-L253 | train |
timegridio/concierge | src/Timetable/Timetable.php | Timetable.format | public function format($dimensions)
{
if (is_array($dimensions)) {
$this->dimensions = $dimensions;
}
if (is_string($dimensions)) {
$this->dimensions = explode('.', $dimensions);
}
return $this;
} | php | public function format($dimensions)
{
if (is_array($dimensions)) {
$this->dimensions = $dimensions;
}
if (is_string($dimensions)) {
$this->dimensions = explode('.', $dimensions);
}
return $this;
} | [
"public",
"function",
"format",
"(",
"$",
"dimensions",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"dimensions",
")",
")",
"{",
"$",
"this",
"->",
"dimensions",
"=",
"$",
"dimensions",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"dimensions",
")",
")... | Setter for the dimensions format.
@param string $dimensions
@return $this | [
"Setter",
"for",
"the",
"dimensions",
"format",
"."
] | f5495dab5907ba9df3210af843fceaa8c8d009d6 | https://github.com/timegridio/concierge/blob/f5495dab5907ba9df3210af843fceaa8c8d009d6/src/Timetable/Timetable.php#L262-L273 | train |
hpolthof/laravel-translations-db | src/DatabaseLoader.php | DatabaseLoader.addTranslation | public function addTranslation($locale, $group, $key)
{
if(!\Config::get('app.debug') || \Config::get('translation-db.minimal')) return;
// Extract the real key from the translation.
if (preg_match("/^{$group}\.(.*?)$/sm", $key, $match)) {
$name = $match[1];
} else {
throw new TranslationException('Could not extract key from translation.');
}
$item = \DB::table('translations')
->where('locale', $locale)
->where('group', $group)
->where('name', $name)->first();
$data = compact('locale', 'group', 'name');
$data = array_merge($data, [
'viewed_at' => date_create(),
'updated_at' => date_create(),
]);
if($item === null) {
$data = array_merge($data, [
'created_at' => date_create(),
]);
\DB::table('translations')->insert($data);
} else {
if($this->_app['config']->get('translation-db.update_viewed_at')) {
\DB::table('translations')->where('id', $item->id)->update($data);
}
}
} | php | public function addTranslation($locale, $group, $key)
{
if(!\Config::get('app.debug') || \Config::get('translation-db.minimal')) return;
// Extract the real key from the translation.
if (preg_match("/^{$group}\.(.*?)$/sm", $key, $match)) {
$name = $match[1];
} else {
throw new TranslationException('Could not extract key from translation.');
}
$item = \DB::table('translations')
->where('locale', $locale)
->where('group', $group)
->where('name', $name)->first();
$data = compact('locale', 'group', 'name');
$data = array_merge($data, [
'viewed_at' => date_create(),
'updated_at' => date_create(),
]);
if($item === null) {
$data = array_merge($data, [
'created_at' => date_create(),
]);
\DB::table('translations')->insert($data);
} else {
if($this->_app['config']->get('translation-db.update_viewed_at')) {
\DB::table('translations')->where('id', $item->id)->update($data);
}
}
} | [
"public",
"function",
"addTranslation",
"(",
"$",
"locale",
",",
"$",
"group",
",",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"\\",
"Config",
"::",
"get",
"(",
"'app.debug'",
")",
"||",
"\\",
"Config",
"::",
"get",
"(",
"'translation-db.minimal'",
")",
")"... | Adds a new translation to the database or
updates an existing record if the viewed_at
updates are allowed.
@param string $locale
@param string $group
@param string $name
@return void | [
"Adds",
"a",
"new",
"translation",
"to",
"the",
"database",
"or",
"updates",
"an",
"existing",
"record",
"if",
"the",
"viewed_at",
"updates",
"are",
"allowed",
"."
] | 4f7a7136687f64321a392b1d610a2b8f7a18383e | https://github.com/hpolthof/laravel-translations-db/blob/4f7a7136687f64321a392b1d610a2b8f7a18383e/src/DatabaseLoader.php#L54-L86 | train |
hpolthof/laravel-translations-db | src/ServiceProvider.php | ServiceProvider.pluckOrLists | public static function pluckOrLists(Builder $query, $column, $key = null)
{
if(\Illuminate\Foundation\Application::VERSION < '5.2') {
$result = $query->lists($column, $key);
} else {
$result = $query->pluck($column, $key);
}
return $result;
} | php | public static function pluckOrLists(Builder $query, $column, $key = null)
{
if(\Illuminate\Foundation\Application::VERSION < '5.2') {
$result = $query->lists($column, $key);
} else {
$result = $query->pluck($column, $key);
}
return $result;
} | [
"public",
"static",
"function",
"pluckOrLists",
"(",
"Builder",
"$",
"query",
",",
"$",
"column",
",",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"\\",
"Illuminate",
"\\",
"Foundation",
"\\",
"Application",
"::",
"VERSION",
"<",
"'5.2'",
")",
"{",
"... | Alternative pluck to stay backwards compatible with Laravel 5.1 LTS.
@param Builder $query
@param $column
@param null $key
@return array|mixed | [
"Alternative",
"pluck",
"to",
"stay",
"backwards",
"compatible",
"with",
"Laravel",
"5",
".",
"1",
"LTS",
"."
] | 4f7a7136687f64321a392b1d610a2b8f7a18383e | https://github.com/hpolthof/laravel-translations-db/blob/4f7a7136687f64321a392b1d610a2b8f7a18383e/src/ServiceProvider.php#L147-L156 | train |
vajiralasantha/PHP-Image-Compare | src/ImageCompare.php | ImageCompare.compare | public function compare($pathOne, $pathTwo) {
$i1 = $this->createImage($pathOne);
$i2 = $this->createImage($pathTwo);
if (!$i1 || !$i2) {
return false;
}
$i1 = $this->resizeImage($pathOne);
$i2 = $this->resizeImage($pathTwo);
imagefilter($i1, IMG_FILTER_GRAYSCALE);
imagefilter($i2, IMG_FILTER_GRAYSCALE);
$colorMeanOne = $this->colorMeanValue($i1);
$colorMeanTwo = $this->colorMeanValue($i2);
$bits1 = $this->bits($colorMeanOne);
$bits2 = $this->bits($colorMeanTwo);
$hammeringDistance = 0;
for ($x = 0; $x < 64; $x++) {
if ($bits1[$x] != $bits2[$x]) {
$hammeringDistance++;
}
}
return $hammeringDistance;
} | php | public function compare($pathOne, $pathTwo) {
$i1 = $this->createImage($pathOne);
$i2 = $this->createImage($pathTwo);
if (!$i1 || !$i2) {
return false;
}
$i1 = $this->resizeImage($pathOne);
$i2 = $this->resizeImage($pathTwo);
imagefilter($i1, IMG_FILTER_GRAYSCALE);
imagefilter($i2, IMG_FILTER_GRAYSCALE);
$colorMeanOne = $this->colorMeanValue($i1);
$colorMeanTwo = $this->colorMeanValue($i2);
$bits1 = $this->bits($colorMeanOne);
$bits2 = $this->bits($colorMeanTwo);
$hammeringDistance = 0;
for ($x = 0; $x < 64; $x++) {
if ($bits1[$x] != $bits2[$x]) {
$hammeringDistance++;
}
}
return $hammeringDistance;
} | [
"public",
"function",
"compare",
"(",
"$",
"pathOne",
",",
"$",
"pathTwo",
")",
"{",
"$",
"i1",
"=",
"$",
"this",
"->",
"createImage",
"(",
"$",
"pathOne",
")",
";",
"$",
"i2",
"=",
"$",
"this",
"->",
"createImage",
"(",
"$",
"pathTwo",
")",
";",
... | Main function. Returns the hammering distance of two images' bit value.
@param string $pathOne Path to image 1
@param string $pathTwo Path to image 2
@return bool|int Hammering value on success. False on error. | [
"Main",
"function",
".",
"Returns",
"the",
"hammering",
"distance",
"of",
"two",
"images",
"bit",
"value",
"."
] | 9ea466236c91b8bfa169b3459e3089d2f4b31f7e | https://github.com/vajiralasantha/PHP-Image-Compare/blob/9ea466236c91b8bfa169b3459e3089d2f4b31f7e/src/ImageCompare.php#L14-L43 | train |
vajiralasantha/PHP-Image-Compare | src/ImageCompare.php | ImageCompare.createImage | private function createImage($path) {
$mime = $this->mimeType($path);
if ($mime[2] == 'jpg') {
return imagecreatefromjpeg ($path);
} else if ($mime[2] == 'png') {
return imagecreatefrompng ($path);
} else {
return false;
}
} | php | private function createImage($path) {
$mime = $this->mimeType($path);
if ($mime[2] == 'jpg') {
return imagecreatefromjpeg ($path);
} else if ($mime[2] == 'png') {
return imagecreatefrompng ($path);
} else {
return false;
}
} | [
"private",
"function",
"createImage",
"(",
"$",
"path",
")",
"{",
"$",
"mime",
"=",
"$",
"this",
"->",
"mimeType",
"(",
"$",
"path",
")",
";",
"if",
"(",
"$",
"mime",
"[",
"2",
"]",
"==",
"'jpg'",
")",
"{",
"return",
"imagecreatefromjpeg",
"(",
"$"... | Returns image resource or false if it's not jpg or png
@param string $path Path to image
@return bool|resource | [
"Returns",
"image",
"resource",
"or",
"false",
"if",
"it",
"s",
"not",
"jpg",
"or",
"png"
] | 9ea466236c91b8bfa169b3459e3089d2f4b31f7e | https://github.com/vajiralasantha/PHP-Image-Compare/blob/9ea466236c91b8bfa169b3459e3089d2f4b31f7e/src/ImageCompare.php#L75-L85 | train |
vajiralasantha/PHP-Image-Compare | src/ImageCompare.php | ImageCompare.resizeImage | private function resizeImage($path) {
$mime = $this->mimeType($path);
$t = imagecreatetruecolor(8, 8);
$source = $this->createImage($path);
imagecopyresized($t, $source, 0, 0, 0, 0, 8, 8, $mime[0], $mime[1]);
return $t;
} | php | private function resizeImage($path) {
$mime = $this->mimeType($path);
$t = imagecreatetruecolor(8, 8);
$source = $this->createImage($path);
imagecopyresized($t, $source, 0, 0, 0, 0, 8, 8, $mime[0], $mime[1]);
return $t;
} | [
"private",
"function",
"resizeImage",
"(",
"$",
"path",
")",
"{",
"$",
"mime",
"=",
"$",
"this",
"->",
"mimeType",
"(",
"$",
"path",
")",
";",
"$",
"t",
"=",
"imagecreatetruecolor",
"(",
"8",
",",
"8",
")",
";",
"$",
"source",
"=",
"$",
"this",
"... | Resize the image to a 8x8 square and returns as image resource.
@param string $path Path to image
@return resource Image resource identifier | [
"Resize",
"the",
"image",
"to",
"a",
"8x8",
"square",
"and",
"returns",
"as",
"image",
"resource",
"."
] | 9ea466236c91b8bfa169b3459e3089d2f4b31f7e | https://github.com/vajiralasantha/PHP-Image-Compare/blob/9ea466236c91b8bfa169b3459e3089d2f4b31f7e/src/ImageCompare.php#L94-L104 | train |
vajiralasantha/PHP-Image-Compare | src/ImageCompare.php | ImageCompare.colorMeanValue | private function colorMeanValue($resource) {
$colorList = array();
$colorSum = 0;
for ($a = 0; $a<8; $a++) {
for ($b = 0; $b<8; $b++) {
$rgb = imagecolorat($resource, $a, $b);
$colorList[] = $rgb & 0xFF;
$colorSum += $rgb & 0xFF;
}
}
return array($colorSum/64,$colorList);
} | php | private function colorMeanValue($resource) {
$colorList = array();
$colorSum = 0;
for ($a = 0; $a<8; $a++) {
for ($b = 0; $b<8; $b++) {
$rgb = imagecolorat($resource, $a, $b);
$colorList[] = $rgb & 0xFF;
$colorSum += $rgb & 0xFF;
}
}
return array($colorSum/64,$colorList);
} | [
"private",
"function",
"colorMeanValue",
"(",
"$",
"resource",
")",
"{",
"$",
"colorList",
"=",
"array",
"(",
")",
";",
"$",
"colorSum",
"=",
"0",
";",
"for",
"(",
"$",
"a",
"=",
"0",
";",
"$",
"a",
"<",
"8",
";",
"$",
"a",
"++",
")",
"{",
"f... | Returns the mean value of the colors and the list of all pixel's colors.
@param resource $resource Image resource identifier
@return array | [
"Returns",
"the",
"mean",
"value",
"of",
"the",
"colors",
"and",
"the",
"list",
"of",
"all",
"pixel",
"s",
"colors",
"."
] | 9ea466236c91b8bfa169b3459e3089d2f4b31f7e | https://github.com/vajiralasantha/PHP-Image-Compare/blob/9ea466236c91b8bfa169b3459e3089d2f4b31f7e/src/ImageCompare.php#L113-L125 | train |
vajiralasantha/PHP-Image-Compare | src/ImageCompare.php | ImageCompare.bits | private function bits($colorMean) {
$bits = array();
foreach ($colorMean[1] as $color) {
$bits[] = ($color >= $colorMean[0]) ? 1 : 0;
}
return $bits;
} | php | private function bits($colorMean) {
$bits = array();
foreach ($colorMean[1] as $color) {
$bits[] = ($color >= $colorMean[0]) ? 1 : 0;
}
return $bits;
} | [
"private",
"function",
"bits",
"(",
"$",
"colorMean",
")",
"{",
"$",
"bits",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"colorMean",
"[",
"1",
"]",
"as",
"$",
"color",
")",
"{",
"$",
"bits",
"[",
"]",
"=",
"(",
"$",
"color",
">=",
"$",
... | Returns an array with 1 and zeros. If a color is bigger than the mean value of colors it is 1
@param array $colorMean Color Mean details.
@return array | [
"Returns",
"an",
"array",
"with",
"1",
"and",
"zeros",
".",
"If",
"a",
"color",
"is",
"bigger",
"than",
"the",
"mean",
"value",
"of",
"colors",
"it",
"is",
"1"
] | 9ea466236c91b8bfa169b3459e3089d2f4b31f7e | https://github.com/vajiralasantha/PHP-Image-Compare/blob/9ea466236c91b8bfa169b3459e3089d2f4b31f7e/src/ImageCompare.php#L134-L142 | train |
mormat/php-formula-interpreter | src/FormulaInterpreter/Compiler.php | Compiler.compile | function compile($expression) {
$options = $this->parser->parse($expression);
$command = $this->commandFactory->create($options);
return new Executable($command, $this->variables);
} | php | function compile($expression) {
$options = $this->parser->parse($expression);
$command = $this->commandFactory->create($options);
return new Executable($command, $this->variables);
} | [
"function",
"compile",
"(",
"$",
"expression",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"parser",
"->",
"parse",
"(",
"$",
"expression",
")",
";",
"$",
"command",
"=",
"$",
"this",
"->",
"commandFactory",
"->",
"create",
"(",
"$",
"options",
... | Compile an expression and return the corresponding executable
@param string $expression
@return \FormulaInterpreter\Executable | [
"Compile",
"an",
"expression",
"and",
"return",
"the",
"corresponding",
"executable"
] | d6a25ed5cbb051b87f16372d7ee248c573a59c35 | https://github.com/mormat/php-formula-interpreter/blob/d6a25ed5cbb051b87f16372d7ee248c573a59c35/src/FormulaInterpreter/Compiler.php#L67-L71 | train |
wapmorgan/PhpCodeAnalyzer | src/PhpCodeAnalyzer.php | PhpCodeAnalyzer.catchAsStringUntilSemicolon | protected function catchAsStringUntilSemicolon(array $tokens, $pos) {
$t = count($tokens);
$catched = null;
for ($i = $pos; $i < $t; $i++) {
if ($tokens[$i] == ';')
return $catched;
else if ($tokens[$i] == '\\')
$catched .= '\\';
else if (is_array($tokens[$i])) {
$catched .= $tokens[$i][1];
}
}
return $catched;
} | php | protected function catchAsStringUntilSemicolon(array $tokens, $pos) {
$t = count($tokens);
$catched = null;
for ($i = $pos; $i < $t; $i++) {
if ($tokens[$i] == ';')
return $catched;
else if ($tokens[$i] == '\\')
$catched .= '\\';
else if (is_array($tokens[$i])) {
$catched .= $tokens[$i][1];
}
}
return $catched;
} | [
"protected",
"function",
"catchAsStringUntilSemicolon",
"(",
"array",
"$",
"tokens",
",",
"$",
"pos",
")",
"{",
"$",
"t",
"=",
"count",
"(",
"$",
"tokens",
")",
";",
"$",
"catched",
"=",
"null",
";",
"for",
"(",
"$",
"i",
"=",
"$",
"pos",
";",
"$",... | Catches class name after use statement; | [
"Catches",
"class",
"name",
"after",
"use",
"statement",
";"
] | 89d06eaa3de85d2fe468ffff4dd2ab12d996dca1 | https://github.com/wapmorgan/PhpCodeAnalyzer/blob/89d06eaa3de85d2fe468ffff4dd2ab12d996dca1/src/PhpCodeAnalyzer.php#L241-L254 | train |
mercari/dietcube | src/Dispatcher.php | Dispatcher.dispatchRouter | protected function dispatchRouter($method, $path)
{
$router = $this->container['router'];
$logger = $this->container['logger'];
$logger->debug('Router dispatch.', ['method' => $method, 'path' => $path]);
$router->init();
$route_info = $router->dispatch($method, $path);
$handler = null;
$vars = [];
switch ($route_info[0]) {
case RouteDispatcher::NOT_FOUND:
$logger->debug('Routing failed. Not Found.');
throw new HttpNotFoundException('404 Not Found');
break;
case RouteDispatcher::METHOD_NOT_ALLOWED:
$logger->debug('Routing failed. Method Not Allowd.');
throw new HttpMethodNotAllowedException('405 Method Not Allowed');
break;
case RouteDispatcher::FOUND:
$handler = $route_info[1];
$vars = $route_info[2];
$logger->debug('Route found.', ['handler' => $handler]);
break;
}
return [$handler, $vars];
} | php | protected function dispatchRouter($method, $path)
{
$router = $this->container['router'];
$logger = $this->container['logger'];
$logger->debug('Router dispatch.', ['method' => $method, 'path' => $path]);
$router->init();
$route_info = $router->dispatch($method, $path);
$handler = null;
$vars = [];
switch ($route_info[0]) {
case RouteDispatcher::NOT_FOUND:
$logger->debug('Routing failed. Not Found.');
throw new HttpNotFoundException('404 Not Found');
break;
case RouteDispatcher::METHOD_NOT_ALLOWED:
$logger->debug('Routing failed. Method Not Allowd.');
throw new HttpMethodNotAllowedException('405 Method Not Allowed');
break;
case RouteDispatcher::FOUND:
$handler = $route_info[1];
$vars = $route_info[2];
$logger->debug('Route found.', ['handler' => $handler]);
break;
}
return [$handler, $vars];
} | [
"protected",
"function",
"dispatchRouter",
"(",
"$",
"method",
",",
"$",
"path",
")",
"{",
"$",
"router",
"=",
"$",
"this",
"->",
"container",
"[",
"'router'",
"]",
";",
"$",
"logger",
"=",
"$",
"this",
"->",
"container",
"[",
"'logger'",
"]",
";",
"... | Dispatch router with HTTP request information.
@param $method
@param $path
@return array | [
"Dispatch",
"router",
"with",
"HTTP",
"request",
"information",
"."
] | fceda3bd3a51c0bcdd51bcc928e8de80765a2590 | https://github.com/mercari/dietcube/blob/fceda3bd3a51c0bcdd51bcc928e8de80765a2590/src/Dispatcher.php#L264-L294 | train |
mercari/dietcube | src/Dispatcher.php | Dispatcher.filterResponse | protected function filterResponse(Response $response)
{
$event = new FilterResponseEvent($this->app, $response);
$this->event_dispatcher->dispatch(DietcubeEvents::FILTER_RESPONSE, $event);
return $this->finishRequest($event->getResponse());
} | php | protected function filterResponse(Response $response)
{
$event = new FilterResponseEvent($this->app, $response);
$this->event_dispatcher->dispatch(DietcubeEvents::FILTER_RESPONSE, $event);
return $this->finishRequest($event->getResponse());
} | [
"protected",
"function",
"filterResponse",
"(",
"Response",
"$",
"response",
")",
"{",
"$",
"event",
"=",
"new",
"FilterResponseEvent",
"(",
"$",
"this",
"->",
"app",
",",
"$",
"response",
")",
";",
"$",
"this",
"->",
"event_dispatcher",
"->",
"dispatch",
... | Dispatch FILTER_RESPONSE event to filter response.
@param Response $response
@return Response | [
"Dispatch",
"FILTER_RESPONSE",
"event",
"to",
"filter",
"response",
"."
] | fceda3bd3a51c0bcdd51bcc928e8de80765a2590 | https://github.com/mercari/dietcube/blob/fceda3bd3a51c0bcdd51bcc928e8de80765a2590/src/Dispatcher.php#L315-L321 | train |
mercari/dietcube | src/Dispatcher.php | Dispatcher.finishRequest | protected function finishRequest(Response $response)
{
$event = new FinishRequestEvent($this->app, $response);
$this->event_dispatcher->dispatch(DietcubeEvents::FINISH_REQUEST, $event);
$response = $event->getResponse();
$response->sendHeaders();
$response->sendBody();
return $response;
} | php | protected function finishRequest(Response $response)
{
$event = new FinishRequestEvent($this->app, $response);
$this->event_dispatcher->dispatch(DietcubeEvents::FINISH_REQUEST, $event);
$response = $event->getResponse();
$response->sendHeaders();
$response->sendBody();
return $response;
} | [
"protected",
"function",
"finishRequest",
"(",
"Response",
"$",
"response",
")",
"{",
"$",
"event",
"=",
"new",
"FinishRequestEvent",
"(",
"$",
"this",
"->",
"app",
",",
"$",
"response",
")",
";",
"$",
"this",
"->",
"event_dispatcher",
"->",
"dispatch",
"(... | Finish request and send response.
@param Response $response
@return Response | [
"Finish",
"request",
"and",
"send",
"response",
"."
] | fceda3bd3a51c0bcdd51bcc928e8de80765a2590 | https://github.com/mercari/dietcube/blob/fceda3bd3a51c0bcdd51bcc928e8de80765a2590/src/Dispatcher.php#L329-L340 | train |
wbrowar/craft-3-adminbar | src/AdminBar.php | AdminBar.settingsHtml | protected function settingsHtml(): string
{
//AdminBar::$plugin->bar->clearAdminBarCache();
$settings = $this->getSettings();
// Create one empty table row if non are present
if (empty($settings->customLinks)) {
$settings['customLinks'] = [['','',0]];
}
$adminBarWidgets = AdminBar::$plugin->bar->getAdminBarWidgetsFromPlugins();
return Craft::$app->view->renderTemplate(
'admin-bar/settings',
[
'widgets' => $adminBarWidgets,
'settings' => $settings
]
);
} | php | protected function settingsHtml(): string
{
//AdminBar::$plugin->bar->clearAdminBarCache();
$settings = $this->getSettings();
// Create one empty table row if non are present
if (empty($settings->customLinks)) {
$settings['customLinks'] = [['','',0]];
}
$adminBarWidgets = AdminBar::$plugin->bar->getAdminBarWidgetsFromPlugins();
return Craft::$app->view->renderTemplate(
'admin-bar/settings',
[
'widgets' => $adminBarWidgets,
'settings' => $settings
]
);
} | [
"protected",
"function",
"settingsHtml",
"(",
")",
":",
"string",
"{",
"//AdminBar::$plugin->bar->clearAdminBarCache();",
"$",
"settings",
"=",
"$",
"this",
"->",
"getSettings",
"(",
")",
";",
"// Create one empty table row if non are present",
"if",
"(",
"empty",
"(",
... | Returns the rendered settings HTML, which will be inserted into the content
block on the settings page.
@return string The rendered settings HTML | [
"Returns",
"the",
"rendered",
"settings",
"HTML",
"which",
"will",
"be",
"inserted",
"into",
"the",
"content",
"block",
"on",
"the",
"settings",
"page",
"."
] | 173f6d7049a11852d1f6453eb35af0e5ea644ef2 | https://github.com/wbrowar/craft-3-adminbar/blob/173f6d7049a11852d1f6453eb35af0e5ea644ef2/src/AdminBar.php#L147-L167 | train |
fortrabbit/slimcontroller | src/SlimController/Slim.php | Slim.addRoutes | public function addRoutes(array $routes, $globalMiddlewares = array())
{
if (!is_array($globalMiddlewares)) {
if (func_num_args() > 2) {
$args = func_get_args();
$globalMiddlewares = array_slice($args, 1);
} else {
$globalMiddlewares = array($globalMiddlewares);
}
}
foreach ($routes as $path => $routeArgs) {
// create array for simple request
$routeArgs = (is_array($routeArgs)) ? $routeArgs : array('any' => $routeArgs);
if (array_keys($routeArgs) === range(0, count($routeArgs) - 1)) {
// route args is a sequential array not associative
$routeArgs = array('any' => array($routeArgs[0],
isset($routeArgs[1]) && is_array($routeArgs[1]) ? $routeArgs[1] : array_slice($routeArgs, 1))
);
}
foreach ($routeArgs as $httpMethod => $classArgs) {
// assign vars if middleware callback exists
if (is_array($classArgs)) {
$classRoute = $classArgs[0];
$localMiddlewares = is_array($classArgs[1]) ? $classArgs[1] : array_slice($classArgs, 1);
} else {
$classRoute = $classArgs;
$localMiddlewares = array();
}
// specific HTTP method
$httpMethod = strtoupper($httpMethod);
if (!in_array($httpMethod, static::$ALLOWED_HTTP_METHODS)) {
throw new \InvalidArgumentException("Http method '$httpMethod' is not supported.");
}
$routeMiddlewares = array_merge($localMiddlewares, $globalMiddlewares);
$route = $this->addControllerRoute($path, $classRoute, $routeMiddlewares);
if (!isset($this->routeNames[$classRoute])) {
$route->name($classRoute);
$this->routeNames[$classRoute] = 1;
}
if ('any' === $httpMethod) {
call_user_func_array(array($route, 'via'), static::$ALLOWED_HTTP_METHODS);
} else {
$route->via($httpMethod);
}
}
}
return $this;
} | php | public function addRoutes(array $routes, $globalMiddlewares = array())
{
if (!is_array($globalMiddlewares)) {
if (func_num_args() > 2) {
$args = func_get_args();
$globalMiddlewares = array_slice($args, 1);
} else {
$globalMiddlewares = array($globalMiddlewares);
}
}
foreach ($routes as $path => $routeArgs) {
// create array for simple request
$routeArgs = (is_array($routeArgs)) ? $routeArgs : array('any' => $routeArgs);
if (array_keys($routeArgs) === range(0, count($routeArgs) - 1)) {
// route args is a sequential array not associative
$routeArgs = array('any' => array($routeArgs[0],
isset($routeArgs[1]) && is_array($routeArgs[1]) ? $routeArgs[1] : array_slice($routeArgs, 1))
);
}
foreach ($routeArgs as $httpMethod => $classArgs) {
// assign vars if middleware callback exists
if (is_array($classArgs)) {
$classRoute = $classArgs[0];
$localMiddlewares = is_array($classArgs[1]) ? $classArgs[1] : array_slice($classArgs, 1);
} else {
$classRoute = $classArgs;
$localMiddlewares = array();
}
// specific HTTP method
$httpMethod = strtoupper($httpMethod);
if (!in_array($httpMethod, static::$ALLOWED_HTTP_METHODS)) {
throw new \InvalidArgumentException("Http method '$httpMethod' is not supported.");
}
$routeMiddlewares = array_merge($localMiddlewares, $globalMiddlewares);
$route = $this->addControllerRoute($path, $classRoute, $routeMiddlewares);
if (!isset($this->routeNames[$classRoute])) {
$route->name($classRoute);
$this->routeNames[$classRoute] = 1;
}
if ('any' === $httpMethod) {
call_user_func_array(array($route, 'via'), static::$ALLOWED_HTTP_METHODS);
} else {
$route->via($httpMethod);
}
}
}
return $this;
} | [
"public",
"function",
"addRoutes",
"(",
"array",
"$",
"routes",
",",
"$",
"globalMiddlewares",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"globalMiddlewares",
")",
")",
"{",
"if",
"(",
"func_num_args",
"(",
")",
">",
"2",
... | Add multiple controller based routes
Simple Format
<code>
$app->addRoutes(array(
'/some/path' => 'className:methodName'
));
</code>
With explicit HTTP method
<code>
$app->addRoutes(array(
'/some/path' => array('get' => 'className:methodName')
));
</code>
With local middleware
<code>
$app->addRoutes(array(
'/some/path' => array('get' => 'className:methodName', function() {})
'/other/path' => array('className:methodName', function() {})
));
</code>
With global middleware
<code>
$app->addRoutes(array(
'/some/path' => 'className:methodName',
), function() {});
</code>
@param array $routes The route definitions
@param array $globalMiddlewares
@throws \InvalidArgumentException
@internal param $callable ,... $middlewares Optional callable used for all routes as middleware
@return $this | [
"Add",
"multiple",
"controller",
"based",
"routes"
] | d85f097ef2f75c653dcd7f8ee518fdeb64825c38 | https://github.com/fortrabbit/slimcontroller/blob/d85f097ef2f75c653dcd7f8ee518fdeb64825c38/src/SlimController/Slim.php#L71-L126 | train |
fortrabbit/slimcontroller | src/SlimController/Slim.php | Slim.addControllerRoute | public function addControllerRoute($path, $route, array $middleware = array())
{
$callback = $this->buildCallbackFromControllerRoute($route);
array_unshift($middleware, $path);
array_push($middleware, $callback);
$route = call_user_func_array(array($this, 'map'), $middleware);
return $route;
} | php | public function addControllerRoute($path, $route, array $middleware = array())
{
$callback = $this->buildCallbackFromControllerRoute($route);
array_unshift($middleware, $path);
array_push($middleware, $callback);
$route = call_user_func_array(array($this, 'map'), $middleware);
return $route;
} | [
"public",
"function",
"addControllerRoute",
"(",
"$",
"path",
",",
"$",
"route",
",",
"array",
"$",
"middleware",
"=",
"array",
"(",
")",
")",
"{",
"$",
"callback",
"=",
"$",
"this",
"->",
"buildCallbackFromControllerRoute",
"(",
"$",
"route",
")",
";",
... | Add a new controller route
<code>
$app->addControllerRoute("/the/path", "className:methodName", array(function () { doSome(); }))
->via('GET')->condition(..);
$app->addControllerRoute("/the/path", "className:methodName")
->via('GET')->condition(..);
</code>
@param string $path
@param string $route
@param callable[] $middleware,...
@return \Slim\Route | [
"Add",
"a",
"new",
"controller",
"route"
] | d85f097ef2f75c653dcd7f8ee518fdeb64825c38 | https://github.com/fortrabbit/slimcontroller/blob/d85f097ef2f75c653dcd7f8ee518fdeb64825c38/src/SlimController/Slim.php#L145-L155 | train |
fortrabbit/slimcontroller | src/SlimController/Slim.php | Slim.buildCallbackFromControllerRoute | protected function buildCallbackFromControllerRoute($route)
{
list($controller, $methodName) = $this->determineClassAndMethod($route);
$app = & $this;
$callable = function () use ($app, $controller, $methodName) {
// Get action arguments
$args = func_get_args();
// Try to fetch the instance from Slim's container, otherwise lazy-instantiate it
$instance = $app->container->has($controller) ? $app->container->get($controller) : new $controller($app);
return call_user_func_array(array($instance, $methodName), $args);
};
return $callable;
} | php | protected function buildCallbackFromControllerRoute($route)
{
list($controller, $methodName) = $this->determineClassAndMethod($route);
$app = & $this;
$callable = function () use ($app, $controller, $methodName) {
// Get action arguments
$args = func_get_args();
// Try to fetch the instance from Slim's container, otherwise lazy-instantiate it
$instance = $app->container->has($controller) ? $app->container->get($controller) : new $controller($app);
return call_user_func_array(array($instance, $methodName), $args);
};
return $callable;
} | [
"protected",
"function",
"buildCallbackFromControllerRoute",
"(",
"$",
"route",
")",
"{",
"list",
"(",
"$",
"controller",
",",
"$",
"methodName",
")",
"=",
"$",
"this",
"->",
"determineClassAndMethod",
"(",
"$",
"route",
")",
";",
"$",
"app",
"=",
"&",
"$"... | Builds closure callback from controller route
@param $route
@return \Closure | [
"Builds",
"closure",
"callback",
"from",
"controller",
"route"
] | d85f097ef2f75c653dcd7f8ee518fdeb64825c38 | https://github.com/fortrabbit/slimcontroller/blob/d85f097ef2f75c653dcd7f8ee518fdeb64825c38/src/SlimController/Slim.php#L164-L178 | train |
fortrabbit/slimcontroller | src/SlimController/SlimController.php | SlimController.render | protected function render($template, $args = array())
{
if (!is_null($this->renderTemplateSuffix)
&& !preg_match('/\.' . $this->renderTemplateSuffix . '$/', $template)
) {
$template .= '.' . $this->renderTemplateSuffix;
}
$this->app->render($template, $args);
} | php | protected function render($template, $args = array())
{
if (!is_null($this->renderTemplateSuffix)
&& !preg_match('/\.' . $this->renderTemplateSuffix . '$/', $template)
) {
$template .= '.' . $this->renderTemplateSuffix;
}
$this->app->render($template, $args);
} | [
"protected",
"function",
"render",
"(",
"$",
"template",
",",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"renderTemplateSuffix",
")",
"&&",
"!",
"preg_match",
"(",
"'/\\.'",
".",
"$",
"this",
"->... | Renders output with given template
@param string $template Name of the template to be rendererd
@param array $args Args for view | [
"Renders",
"output",
"with",
"given",
"template"
] | d85f097ef2f75c653dcd7f8ee518fdeb64825c38 | https://github.com/fortrabbit/slimcontroller/blob/d85f097ef2f75c653dcd7f8ee518fdeb64825c38/src/SlimController/SlimController.php#L94-L102 | train |
fortrabbit/slimcontroller | src/SlimController/SlimController.php | SlimController.params | protected function params($names = array(), $reqMode = null, $defaults = null)
{
// no names given -> get them all
if (!$names) {
$names = $this->getAllParamNames($reqMode);
}
$res = array();
foreach ($names as $obj) {
$name = is_array($obj) ? $obj[0] : $obj;
$param = $this->param($name, $reqMode);
if (!is_null($param) && (!is_array($param) || !empty($param))) {
$res[$name] = $param;
} // if in "need all" mode
elseif ($defaults === true) {
return null;
} // if in default mode
elseif (is_array($defaults) && isset($defaults[$name])) {
$res[$name] = $defaults[$name];
}
}
return $res;
} | php | protected function params($names = array(), $reqMode = null, $defaults = null)
{
// no names given -> get them all
if (!$names) {
$names = $this->getAllParamNames($reqMode);
}
$res = array();
foreach ($names as $obj) {
$name = is_array($obj) ? $obj[0] : $obj;
$param = $this->param($name, $reqMode);
if (!is_null($param) && (!is_array($param) || !empty($param))) {
$res[$name] = $param;
} // if in "need all" mode
elseif ($defaults === true) {
return null;
} // if in default mode
elseif (is_array($defaults) && isset($defaults[$name])) {
$res[$name] = $defaults[$name];
}
}
return $res;
} | [
"protected",
"function",
"params",
"(",
"$",
"names",
"=",
"array",
"(",
")",
",",
"$",
"reqMode",
"=",
"null",
",",
"$",
"defaults",
"=",
"null",
")",
"{",
"// no names given -> get them all",
"if",
"(",
"!",
"$",
"names",
")",
"{",
"$",
"names",
"=",... | Reads multiple params at once
<code>
$params = $this->params(['prefix.name', 'other.name']); // -> ["prefix.name" => "value", ..]
$params = $this->params(['prefix.name', 'other.name'], true); // -> null if not all found
$params = $this->params(['prefix.name', 'other.name'], ['other.name' => "Default Value"]);
</code>
@param mixed $names Name or names of parameters (GET or POST)
@param mixed $reqMode Optional mode. Either null (all params), true | "post"
(only POST params), false | "get" (only GET params)
@param mixed $defaults Either true (require ALL given or return null), array (defaults)
@return mixed Either array or single string or null | [
"Reads",
"multiple",
"params",
"at",
"once"
] | d85f097ef2f75c653dcd7f8ee518fdeb64825c38 | https://github.com/fortrabbit/slimcontroller/blob/d85f097ef2f75c653dcd7f8ee518fdeb64825c38/src/SlimController/SlimController.php#L192-L214 | train |
fortrabbit/slimcontroller | src/SlimController/SlimController.php | SlimController.cleanupParam | protected function cleanupParam($value)
{
if (is_array($value)) {
foreach ($value as $k => $v) {
$clean = $this->cleanupParam($v);
if (!is_null($clean)) {
$value[$k] = $clean;
}
}
return $value;
} else {
return preg_replace('/>/', '', preg_replace('/</', '', $value));
}
} | php | protected function cleanupParam($value)
{
if (is_array($value)) {
foreach ($value as $k => $v) {
$clean = $this->cleanupParam($v);
if (!is_null($clean)) {
$value[$k] = $clean;
}
}
return $value;
} else {
return preg_replace('/>/', '', preg_replace('/</', '', $value));
}
} | [
"protected",
"function",
"cleanupParam",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"foreach",
"(",
"$",
"value",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"clean",
"=",
"$",
"this",
"->",
"cleanupP... | Cleans up a single or a list of params by stripping HTML encodings
@param string $value
@return string | [
"Cleans",
"up",
"a",
"single",
"or",
"a",
"list",
"of",
"params",
"by",
"stripping",
"HTML",
"encodings"
] | d85f097ef2f75c653dcd7f8ee518fdeb64825c38 | https://github.com/fortrabbit/slimcontroller/blob/d85f097ef2f75c653dcd7f8ee518fdeb64825c38/src/SlimController/SlimController.php#L223-L237 | train |
daixianceng/yii2-echarts | src/ECharts.php | ECharts.registerClientScript | protected function registerClientScript()
{
$id = $this->options['id'];
$view = $this->getView();
$option = !empty($this->pluginOptions['option']) ? Json::encode($this->pluginOptions['option']) : '{}';
if ($this->theme) {
$js = "var {$this->clientId} = echarts.init(document.getElementById('{$id}'), " . $this->quote($this->theme) . ");";
} else {
$js = "var {$this->clientId} = echarts.init(document.getElementById('{$id}'));";
}
$js .= "{$this->clientId}.setOption({$option});";
if (isset($this->pluginOptions['group'])) {
$js .= "{$this->clientId}.group = " . $this->quote($this->pluginOptions['group']) . ";";
}
if ($this->responsive) {
$js .= "$(window).resize(function () {{$this->clientId}.resize()});";
}
foreach ($this->pluginEvents as $name => $handlers) {
$handlers = (array) $handlers;
foreach ($handlers as $handler) {
$js .= "{$this->clientId}.on(" . $this->quote($name) . ", $handler);";
}
}
EChartsAsset::register($view);
$view->registerJs($js);
} | php | protected function registerClientScript()
{
$id = $this->options['id'];
$view = $this->getView();
$option = !empty($this->pluginOptions['option']) ? Json::encode($this->pluginOptions['option']) : '{}';
if ($this->theme) {
$js = "var {$this->clientId} = echarts.init(document.getElementById('{$id}'), " . $this->quote($this->theme) . ");";
} else {
$js = "var {$this->clientId} = echarts.init(document.getElementById('{$id}'));";
}
$js .= "{$this->clientId}.setOption({$option});";
if (isset($this->pluginOptions['group'])) {
$js .= "{$this->clientId}.group = " . $this->quote($this->pluginOptions['group']) . ";";
}
if ($this->responsive) {
$js .= "$(window).resize(function () {{$this->clientId}.resize()});";
}
foreach ($this->pluginEvents as $name => $handlers) {
$handlers = (array) $handlers;
foreach ($handlers as $handler) {
$js .= "{$this->clientId}.on(" . $this->quote($name) . ", $handler);";
}
}
EChartsAsset::register($view);
$view->registerJs($js);
} | [
"protected",
"function",
"registerClientScript",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"options",
"[",
"'id'",
"]",
";",
"$",
"view",
"=",
"$",
"this",
"->",
"getView",
"(",
")",
";",
"$",
"option",
"=",
"!",
"empty",
"(",
"$",
"this",
... | Registers the required js files and script to initialize echarts plugin. | [
"Registers",
"the",
"required",
"js",
"files",
"and",
"script",
"to",
"initialize",
"echarts",
"plugin",
"."
] | 511995efe02025b4b2d7f5723a5be668a06d1f2c | https://github.com/daixianceng/yii2-echarts/blob/511995efe02025b4b2d7f5723a5be668a06d1f2c/src/ECharts.php#L107-L134 | train |
daixianceng/yii2-echarts | src/ECharts.php | ECharts.getClientId | public function getClientId()
{
if ($this->_clientId === null) {
$id = $this->options['id'];
$this->_clientId = "echarts_{$id}";
}
return $this->_clientId;
} | php | public function getClientId()
{
if ($this->_clientId === null) {
$id = $this->options['id'];
$this->_clientId = "echarts_{$id}";
}
return $this->_clientId;
} | [
"public",
"function",
"getClientId",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_clientId",
"===",
"null",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"options",
"[",
"'id'",
"]",
";",
"$",
"this",
"->",
"_clientId",
"=",
"\"echarts_{$id}\"",
";"... | Returns the client ID of the echarts.
@return string | [
"Returns",
"the",
"client",
"ID",
"of",
"the",
"echarts",
"."
] | 511995efe02025b4b2d7f5723a5be668a06d1f2c | https://github.com/daixianceng/yii2-echarts/blob/511995efe02025b4b2d7f5723a5be668a06d1f2c/src/ECharts.php#L152-L160 | train |
daixianceng/yii2-echarts | src/ECharts.php | ECharts.registerTheme | public static function registerTheme($theme)
{
$themes = (array) $theme;
array_walk($themes, function (&$name) {
$name .= '.js';
});
static::$_themeJsFiles = array_unique(array_merge(static::$_themeJsFiles, $themes));
if (static::$_themeJsFiles) {
ThemeAsset::register(Yii::$app->getView())->js = static::$_themeJsFiles;
}
} | php | public static function registerTheme($theme)
{
$themes = (array) $theme;
array_walk($themes, function (&$name) {
$name .= '.js';
});
static::$_themeJsFiles = array_unique(array_merge(static::$_themeJsFiles, $themes));
if (static::$_themeJsFiles) {
ThemeAsset::register(Yii::$app->getView())->js = static::$_themeJsFiles;
}
} | [
"public",
"static",
"function",
"registerTheme",
"(",
"$",
"theme",
")",
"{",
"$",
"themes",
"=",
"(",
"array",
")",
"$",
"theme",
";",
"array_walk",
"(",
"$",
"themes",
",",
"function",
"(",
"&",
"$",
"name",
")",
"{",
"$",
"name",
".=",
"'.js'",
... | Registers the JS files of the given themes.
@param string|array $theme | [
"Registers",
"the",
"JS",
"files",
"of",
"the",
"given",
"themes",
"."
] | 511995efe02025b4b2d7f5723a5be668a06d1f2c | https://github.com/daixianceng/yii2-echarts/blob/511995efe02025b4b2d7f5723a5be668a06d1f2c/src/ECharts.php#L167-L177 | train |
daixianceng/yii2-echarts | src/ECharts.php | ECharts.registerMap | public static function registerMap($map)
{
$maps = (array) $map;
array_walk($maps, function (&$name) {
$name = 'js/' . $name . '.js';
});
static::$_mapJsFiles = array_unique(array_merge(static::$_mapJsFiles, $maps));
if (static::$_mapJsFiles) {
MapAsset::register(Yii::$app->getView())->js = static::$_mapJsFiles;
}
} | php | public static function registerMap($map)
{
$maps = (array) $map;
array_walk($maps, function (&$name) {
$name = 'js/' . $name . '.js';
});
static::$_mapJsFiles = array_unique(array_merge(static::$_mapJsFiles, $maps));
if (static::$_mapJsFiles) {
MapAsset::register(Yii::$app->getView())->js = static::$_mapJsFiles;
}
} | [
"public",
"static",
"function",
"registerMap",
"(",
"$",
"map",
")",
"{",
"$",
"maps",
"=",
"(",
"array",
")",
"$",
"map",
";",
"array_walk",
"(",
"$",
"maps",
",",
"function",
"(",
"&",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"'js/'",
".",
"$",... | Registers the JS files of the given maps.
@param string|array $map | [
"Registers",
"the",
"JS",
"files",
"of",
"the",
"given",
"maps",
"."
] | 511995efe02025b4b2d7f5723a5be668a06d1f2c | https://github.com/daixianceng/yii2-echarts/blob/511995efe02025b4b2d7f5723a5be668a06d1f2c/src/ECharts.php#L184-L194 | train |
minchao/mitake-php | src/Message/Message.php | Message.toINI | public function toINI()
{
$smBody = str_replace("\n", chr(6), $this->smbody);
$ini = '';
$ini .= "dstaddr={$this->dstaddr}\n";
$ini .= "smbody={$smBody}\n";
if (!empty($this->dlvtime)) {
$ini .= "dlvtime={$this->dlvtime}\n";
}
if (!empty($this->vldtime)) {
$ini .= "vldtime={$this->vldtime}\n";
}
if (!empty($this->response)) {
$ini .= "response={$this->response}\n";
}
return $ini;
} | php | public function toINI()
{
$smBody = str_replace("\n", chr(6), $this->smbody);
$ini = '';
$ini .= "dstaddr={$this->dstaddr}\n";
$ini .= "smbody={$smBody}\n";
if (!empty($this->dlvtime)) {
$ini .= "dlvtime={$this->dlvtime}\n";
}
if (!empty($this->vldtime)) {
$ini .= "vldtime={$this->vldtime}\n";
}
if (!empty($this->response)) {
$ini .= "response={$this->response}\n";
}
return $ini;
} | [
"public",
"function",
"toINI",
"(",
")",
"{",
"$",
"smBody",
"=",
"str_replace",
"(",
"\"\\n\"",
",",
"chr",
"(",
"6",
")",
",",
"$",
"this",
"->",
"smbody",
")",
";",
"$",
"ini",
"=",
"''",
";",
"$",
"ini",
".=",
"\"dstaddr={$this->dstaddr}\\n\"",
"... | toINI returns the INI format string from the message fields
@return string | [
"toINI",
"returns",
"the",
"INI",
"format",
"string",
"from",
"the",
"message",
"fields"
] | 23d2a17660ea58fb63ee08bd6cd495fe6da526f5 | https://github.com/minchao/mitake-php/blob/23d2a17660ea58fb63ee08bd6cd495fe6da526f5/src/Message/Message.php#L136-L154 | train |
minchao/mitake-php | src/Client.php | Client.sendRequest | public function sendRequest(Request $request)
{
$response = $this->httpClient->send($request);
$this->checkErrorResponse($response);
return $response;
} | php | public function sendRequest(Request $request)
{
$response = $this->httpClient->send($request);
$this->checkErrorResponse($response);
return $response;
} | [
"public",
"function",
"sendRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"httpClient",
"->",
"send",
"(",
"$",
"request",
")",
";",
"$",
"this",
"->",
"checkErrorResponse",
"(",
"$",
"response",
")",
";",
... | Send an API request
@param Request $request
@return ResponseInterface
@throws BadResponseException
@throws \GuzzleHttp\Exception\GuzzleException | [
"Send",
"an",
"API",
"request"
] | 23d2a17660ea58fb63ee08bd6cd495fe6da526f5 | https://github.com/minchao/mitake-php/blob/23d2a17660ea58fb63ee08bd6cd495fe6da526f5/src/Client.php#L206-L213 | train |
minchao/mitake-php | src/Client.php | Client.newRequest | public function newRequest($method, $uri, $contentType = null, $body = null)
{
// TODO $uri whitelist (trusted domain)
$headers = [
'User-Agent' => $this->userAgent,
];
if (!is_null($contentType)) {
$headers['Content-Type'] = $contentType;
}
return new Request(
$method,
$uri,
$headers,
$body
);
} | php | public function newRequest($method, $uri, $contentType = null, $body = null)
{
// TODO $uri whitelist (trusted domain)
$headers = [
'User-Agent' => $this->userAgent,
];
if (!is_null($contentType)) {
$headers['Content-Type'] = $contentType;
}
return new Request(
$method,
$uri,
$headers,
$body
);
} | [
"public",
"function",
"newRequest",
"(",
"$",
"method",
",",
"$",
"uri",
",",
"$",
"contentType",
"=",
"null",
",",
"$",
"body",
"=",
"null",
")",
"{",
"// TODO $uri whitelist (trusted domain)",
"$",
"headers",
"=",
"[",
"'User-Agent'",
"=>",
"$",
"this",
... | Create an API request
@param string $method
@param string|UriInterface $uri
@param string|null $contentType
@param string|null $body
@return Request | [
"Create",
"an",
"API",
"request"
] | 23d2a17660ea58fb63ee08bd6cd495fe6da526f5 | https://github.com/minchao/mitake-php/blob/23d2a17660ea58fb63ee08bd6cd495fe6da526f5/src/Client.php#L224-L241 | train |
minchao/mitake-php | src/Client.php | Client.buildUriWithQuery | public function buildUriWithQuery($uri, array $params = [])
{
$uri = uri_for($uri);
if (!Uri::isAbsolute($uri)) {
$uri = $uri->withScheme($this->baseURL->getScheme())
->withUserInfo($this->baseURL->getUserInfo())
->withHost($this->baseURL->getHost())
->withPort($this->baseURL->getPort());
}
$default = [
'username' => $this->username,
'password' => $this->password,
];
return $uri->withQuery(build_query(array_merge($default, $params)));
} | php | public function buildUriWithQuery($uri, array $params = [])
{
$uri = uri_for($uri);
if (!Uri::isAbsolute($uri)) {
$uri = $uri->withScheme($this->baseURL->getScheme())
->withUserInfo($this->baseURL->getUserInfo())
->withHost($this->baseURL->getHost())
->withPort($this->baseURL->getPort());
}
$default = [
'username' => $this->username,
'password' => $this->password,
];
return $uri->withQuery(build_query(array_merge($default, $params)));
} | [
"public",
"function",
"buildUriWithQuery",
"(",
"$",
"uri",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"uri",
"=",
"uri_for",
"(",
"$",
"uri",
")",
";",
"if",
"(",
"!",
"Uri",
"::",
"isAbsolute",
"(",
"$",
"uri",
")",
")",
"{",
... | Return the uri with authentication parameters and query string
@param string|UriInterface $uri
@param array $params Query string parameters
@return UriInterface | [
"Return",
"the",
"uri",
"with",
"authentication",
"parameters",
"and",
"query",
"string"
] | 23d2a17660ea58fb63ee08bd6cd495fe6da526f5 | https://github.com/minchao/mitake-php/blob/23d2a17660ea58fb63ee08bd6cd495fe6da526f5/src/Client.php#L251-L268 | train |
minchao/mitake-php | src/Client.php | Client.checkErrorResponse | protected function checkErrorResponse(ResponseInterface $response)
{
$statusCode = $response->getStatusCode();
if (200 <= $statusCode && $statusCode < 299) {
if (!$response->getBody()->getSize()) {
throw new BadResponseException('unexpected empty body');
}
return;
}
// Mitake API always return status code 200
throw new BadResponseException(sprintf('unexpected status code: %d', $statusCode));
} | php | protected function checkErrorResponse(ResponseInterface $response)
{
$statusCode = $response->getStatusCode();
if (200 <= $statusCode && $statusCode < 299) {
if (!$response->getBody()->getSize()) {
throw new BadResponseException('unexpected empty body');
}
return;
}
// Mitake API always return status code 200
throw new BadResponseException(sprintf('unexpected status code: %d', $statusCode));
} | [
"protected",
"function",
"checkErrorResponse",
"(",
"ResponseInterface",
"$",
"response",
")",
"{",
"$",
"statusCode",
"=",
"$",
"response",
"->",
"getStatusCode",
"(",
")",
";",
"if",
"(",
"200",
"<=",
"$",
"statusCode",
"&&",
"$",
"statusCode",
"<",
"299",... | Check the API response for errors
@param ResponseInterface $response
@throws BadResponseException | [
"Check",
"the",
"API",
"response",
"for",
"errors"
] | 23d2a17660ea58fb63ee08bd6cd495fe6da526f5 | https://github.com/minchao/mitake-php/blob/23d2a17660ea58fb63ee08bd6cd495fe6da526f5/src/Client.php#L276-L289 | train |
minchao/mitake-php | src/API.php | API.sendBatch | public function sendBatch(array $messages)
{
$body = '';
/** @var Message\Message $message */
foreach ($messages as $i => $message) {
if (!$message instanceof Message\Message) {
throw new InvalidArgumentException();
}
$body .= "[{$i}]\n";
$body .= $message->toINI();
}
$body = trim($body);
$request = $this->client->newRequest(
'POST',
$this->client->buildUriWithQuery('/SmSendPost.asp', ['encoding' => 'UTF8']),
'text/plain',
$body
);
$response = $this->client->sendRequest($request);
return $this->parseMessageResponse($response);
} | php | public function sendBatch(array $messages)
{
$body = '';
/** @var Message\Message $message */
foreach ($messages as $i => $message) {
if (!$message instanceof Message\Message) {
throw new InvalidArgumentException();
}
$body .= "[{$i}]\n";
$body .= $message->toINI();
}
$body = trim($body);
$request = $this->client->newRequest(
'POST',
$this->client->buildUriWithQuery('/SmSendPost.asp', ['encoding' => 'UTF8']),
'text/plain',
$body
);
$response = $this->client->sendRequest($request);
return $this->parseMessageResponse($response);
} | [
"public",
"function",
"sendBatch",
"(",
"array",
"$",
"messages",
")",
"{",
"$",
"body",
"=",
"''",
";",
"/** @var Message\\Message $message */",
"foreach",
"(",
"$",
"messages",
"as",
"$",
"i",
"=>",
"$",
"message",
")",
"{",
"if",
"(",
"!",
"$",
"messa... | Send multiple SMS
@param Message\Message[] $messages
@return Message\Response
@throws Exception\BadResponseException
@throws InvalidArgumentException
@throws \GuzzleHttp\Exception\GuzzleException | [
"Send",
"multiple",
"SMS"
] | 23d2a17660ea58fb63ee08bd6cd495fe6da526f5 | https://github.com/minchao/mitake-php/blob/23d2a17660ea58fb63ee08bd6cd495fe6da526f5/src/API.php#L38-L62 | train |
minchao/mitake-php | src/API.php | API.queryAccountPoint | public function queryAccountPoint()
{
$request = $this->client->newRequest(
'GET',
$this->client->buildUriWithQuery('/SmQueryGet.asp')
);
$response = $this->client->sendRequest($request);
$contents = $response->getBody()->getContents();
$data = explode("=", $contents);
return $data[1];
} | php | public function queryAccountPoint()
{
$request = $this->client->newRequest(
'GET',
$this->client->buildUriWithQuery('/SmQueryGet.asp')
);
$response = $this->client->sendRequest($request);
$contents = $response->getBody()->getContents();
$data = explode("=", $contents);
return $data[1];
} | [
"public",
"function",
"queryAccountPoint",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"client",
"->",
"newRequest",
"(",
"'GET'",
",",
"$",
"this",
"->",
"client",
"->",
"buildUriWithQuery",
"(",
"'/SmQueryGet.asp'",
")",
")",
";",
"$",
"respon... | Retrieve your account balance
@return integer
@throws Exception\BadResponseException
@throws \GuzzleHttp\Exception\GuzzleException | [
"Retrieve",
"your",
"account",
"balance"
] | 23d2a17660ea58fb63ee08bd6cd495fe6da526f5 | https://github.com/minchao/mitake-php/blob/23d2a17660ea58fb63ee08bd6cd495fe6da526f5/src/API.php#L131-L143 | train |
minchao/mitake-php | src/API.php | API.queryMessageStatus | public function queryMessageStatus(array $ids)
{
$request = $this->client->newRequest(
'GET',
$this->client->buildUriWithQuery('/SmQueryGet.asp', ['msgid' => implode(',', $ids)])
);
$response = $this->client->sendRequest($request);
return $this->parseMessageStatusResponse($response);
} | php | public function queryMessageStatus(array $ids)
{
$request = $this->client->newRequest(
'GET',
$this->client->buildUriWithQuery('/SmQueryGet.asp', ['msgid' => implode(',', $ids)])
);
$response = $this->client->sendRequest($request);
return $this->parseMessageStatusResponse($response);
} | [
"public",
"function",
"queryMessageStatus",
"(",
"array",
"$",
"ids",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"client",
"->",
"newRequest",
"(",
"'GET'",
",",
"$",
"this",
"->",
"client",
"->",
"buildUriWithQuery",
"(",
"'/SmQueryGet.asp'",
",",
... | Fetch the status of specific messages
@param string[] $ids
@return Message\StatusResponse
@throws Exception\BadResponseException
@throws InvalidArgumentException
@throws \GuzzleHttp\Exception\GuzzleException | [
"Fetch",
"the",
"status",
"of",
"specific",
"messages"
] | 23d2a17660ea58fb63ee08bd6cd495fe6da526f5 | https://github.com/minchao/mitake-php/blob/23d2a17660ea58fb63ee08bd6cd495fe6da526f5/src/API.php#L154-L164 | train |
estahn/phpunit-json-assertions | src/Extension/Symfony.php | Symfony.assertJsonResponse | public static function assertJsonResponse(Response $response, $statusCode = 200)
{
\PHPUnit\Framework\Assert::assertEquals(
$statusCode,
$response->getStatusCode(),
$response->getContent()
);
\PHPUnit\Framework\Assert::assertTrue(
$response->headers->contains('Content-Type', 'application/json'),
$response->headers
);
} | php | public static function assertJsonResponse(Response $response, $statusCode = 200)
{
\PHPUnit\Framework\Assert::assertEquals(
$statusCode,
$response->getStatusCode(),
$response->getContent()
);
\PHPUnit\Framework\Assert::assertTrue(
$response->headers->contains('Content-Type', 'application/json'),
$response->headers
);
} | [
"public",
"static",
"function",
"assertJsonResponse",
"(",
"Response",
"$",
"response",
",",
"$",
"statusCode",
"=",
"200",
")",
"{",
"\\",
"PHPUnit",
"\\",
"Framework",
"\\",
"Assert",
"::",
"assertEquals",
"(",
"$",
"statusCode",
",",
"$",
"response",
"->"... | Asserts that a response is successful and of type json.
@param Response $response Response object
@param int $statusCode Expected status code (default 200)
@see \Bazinga\Bundle\RestExtraBundle\Test\WebTestCase::assertJsonResponse() | [
"Asserts",
"that",
"a",
"response",
"is",
"successful",
"and",
"of",
"type",
"json",
"."
] | e75e20ddec1072656e99db48e489455609912319 | https://github.com/estahn/phpunit-json-assertions/blob/e75e20ddec1072656e99db48e489455609912319/src/Extension/Symfony.php#L70-L81 | train |
whitemerry/phpkin | src/Span.php | Span.toArray | public function toArray()
{
$span = [
'id' => (string) $this->id,
'traceId' => (string) $this->traceId,
'name' => $this->name,
'timestamp' => $this->annotationBlock->getStartTimestamp(),
'duration' => $this->annotationBlock->getDuration(),
'annotations' => $this->annotationBlock->toArray()
];
if ($this->parentId !== null) {
$span['parentId'] = (string) $this->parentId;
}
if ($this->metadata !== null) {
$span['binaryAnnotations'] = $this->metadata->toArray();
}
return $span;
} | php | public function toArray()
{
$span = [
'id' => (string) $this->id,
'traceId' => (string) $this->traceId,
'name' => $this->name,
'timestamp' => $this->annotationBlock->getStartTimestamp(),
'duration' => $this->annotationBlock->getDuration(),
'annotations' => $this->annotationBlock->toArray()
];
if ($this->parentId !== null) {
$span['parentId'] = (string) $this->parentId;
}
if ($this->metadata !== null) {
$span['binaryAnnotations'] = $this->metadata->toArray();
}
return $span;
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"span",
"=",
"[",
"'id'",
"=>",
"(",
"string",
")",
"$",
"this",
"->",
"id",
",",
"'traceId'",
"=>",
"(",
"string",
")",
"$",
"this",
"->",
"traceId",
",",
"'name'",
"=>",
"$",
"this",
"->",
"n... | Converts Span to array
@return array | [
"Converts",
"Span",
"to",
"array"
] | 5dcd9e4e8b7c7244539830669aefdea924902d8f | https://github.com/whitemerry/phpkin/blob/5dcd9e4e8b7c7244539830669aefdea924902d8f/src/Span.php#L76-L96 | train |
whitemerry/phpkin | src/Span.php | Span.setMetadata | protected function setMetadata($metadata)
{
if ($metadata !== null && !($metadata instanceof Metadata)) {
throw new \InvalidArgumentException('$metadata must be instance of Metadata');
}
$this->metadata = $metadata;
} | php | protected function setMetadata($metadata)
{
if ($metadata !== null && !($metadata instanceof Metadata)) {
throw new \InvalidArgumentException('$metadata must be instance of Metadata');
}
$this->metadata = $metadata;
} | [
"protected",
"function",
"setMetadata",
"(",
"$",
"metadata",
")",
"{",
"if",
"(",
"$",
"metadata",
"!==",
"null",
"&&",
"!",
"(",
"$",
"metadata",
"instanceof",
"Metadata",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'$metadata mu... | Valid and set metadata
@param $metadata Metadata
@throws \InvalidArgumentException | [
"Valid",
"and",
"set",
"metadata"
] | 5dcd9e4e8b7c7244539830669aefdea924902d8f | https://github.com/whitemerry/phpkin/blob/5dcd9e4e8b7c7244539830669aefdea924902d8f/src/Span.php#L145-L152 | train |
whitemerry/phpkin | src/Tracer.php | Tracer.addTraceSpan | protected function addTraceSpan($unsetParentId = true)
{
$span = new Span(
TracerInfo::getTraceSpanId(),
$this->name,
new AnnotationBlock(
$this->endpoint,
$this->startTimestamp,
zipkin_timestamp(),
AnnotationBlock::SERVER
)
);
if ($unsetParentId) {
$span->unsetParentId();
}
$this->addSpan($span);
} | php | protected function addTraceSpan($unsetParentId = true)
{
$span = new Span(
TracerInfo::getTraceSpanId(),
$this->name,
new AnnotationBlock(
$this->endpoint,
$this->startTimestamp,
zipkin_timestamp(),
AnnotationBlock::SERVER
)
);
if ($unsetParentId) {
$span->unsetParentId();
}
$this->addSpan($span);
} | [
"protected",
"function",
"addTraceSpan",
"(",
"$",
"unsetParentId",
"=",
"true",
")",
"{",
"$",
"span",
"=",
"new",
"Span",
"(",
"TracerInfo",
"::",
"getTraceSpanId",
"(",
")",
",",
"$",
"this",
"->",
"name",
",",
"new",
"AnnotationBlock",
"(",
"$",
"thi... | Adds main span to Spans
@param $unsetParentId bool are you frontend? | [
"Adds",
"main",
"span",
"to",
"Spans"
] | 5dcd9e4e8b7c7244539830669aefdea924902d8f | https://github.com/whitemerry/phpkin/blob/5dcd9e4e8b7c7244539830669aefdea924902d8f/src/Tracer.php#L124-L140 | train |
whitemerry/phpkin | src/AnnotationBlock.php | AnnotationBlock.toArray | public function toArray()
{
return [
[
'endpoint' => $this->endpoint->toArray(),
'timestamp' => $this->startTimestamp,
'value' => $this->values[0]
],
[
'endpoint' => $this->endpoint->toArray(),
'timestamp' => $this->endTimestamp,
'value' => $this->values[1]
]
];
} | php | public function toArray()
{
return [
[
'endpoint' => $this->endpoint->toArray(),
'timestamp' => $this->startTimestamp,
'value' => $this->values[0]
],
[
'endpoint' => $this->endpoint->toArray(),
'timestamp' => $this->endTimestamp,
'value' => $this->values[1]
]
];
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"return",
"[",
"[",
"'endpoint'",
"=>",
"$",
"this",
"->",
"endpoint",
"->",
"toArray",
"(",
")",
",",
"'timestamp'",
"=>",
"$",
"this",
"->",
"startTimestamp",
",",
"'value'",
"=>",
"$",
"this",
"->",
"v... | AnnotationBlock to array
@return array | [
"AnnotationBlock",
"to",
"array"
] | 5dcd9e4e8b7c7244539830669aefdea924902d8f | https://github.com/whitemerry/phpkin/blob/5dcd9e4e8b7c7244539830669aefdea924902d8f/src/AnnotationBlock.php#L77-L91 | train |
whitemerry/phpkin | src/AnnotationBlock.php | AnnotationBlock.setValues | protected function setValues($type)
{
switch ($type) {
case static::CLIENT:
$this->values = ['cs', 'cr'];
break;
case static::SERVER:
$this->values = ['sr', 'ss'];
break;
default:
throw new \InvalidArgumentException('$type must be TYPE_CLIENT or TYPE_SERVER');
}
} | php | protected function setValues($type)
{
switch ($type) {
case static::CLIENT:
$this->values = ['cs', 'cr'];
break;
case static::SERVER:
$this->values = ['sr', 'ss'];
break;
default:
throw new \InvalidArgumentException('$type must be TYPE_CLIENT or TYPE_SERVER');
}
} | [
"protected",
"function",
"setValues",
"(",
"$",
"type",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"static",
"::",
"CLIENT",
":",
"$",
"this",
"->",
"values",
"=",
"[",
"'cs'",
",",
"'cr'",
"]",
";",
"break",
";",
"case",
"static",
"::... | Valid type and set annotation types
@param $type string
@throws \InvalidArgumentException | [
"Valid",
"type",
"and",
"set",
"annotation",
"types"
] | 5dcd9e4e8b7c7244539830669aefdea924902d8f | https://github.com/whitemerry/phpkin/blob/5dcd9e4e8b7c7244539830669aefdea924902d8f/src/AnnotationBlock.php#L100-L112 | train |
whitemerry/phpkin | src/AnnotationBlock.php | AnnotationBlock.setTimestamp | protected function setTimestamp($field, $timestamp, $now = false)
{
if ($timestamp === null && $now) {
$this->{$field} = zipkin_timestamp();
return null;
}
if (!is_zipkin_timestamp($timestamp)) {
throw new \InvalidArgumentException($field . ' must be generated by zipkin_timestamp()');
}
$this->{$field} = $timestamp;
return null;
} | php | protected function setTimestamp($field, $timestamp, $now = false)
{
if ($timestamp === null && $now) {
$this->{$field} = zipkin_timestamp();
return null;
}
if (!is_zipkin_timestamp($timestamp)) {
throw new \InvalidArgumentException($field . ' must be generated by zipkin_timestamp()');
}
$this->{$field} = $timestamp;
return null;
} | [
"protected",
"function",
"setTimestamp",
"(",
"$",
"field",
",",
"$",
"timestamp",
",",
"$",
"now",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"timestamp",
"===",
"null",
"&&",
"$",
"now",
")",
"{",
"$",
"this",
"->",
"{",
"$",
"field",
"}",
"=",
"z... | Valid and set timestamp
@param $field string
@param $timestamp int
@param $now bool
@throws \InvalidArgumentException
@return null | [
"Valid",
"and",
"set",
"timestamp"
] | 5dcd9e4e8b7c7244539830669aefdea924902d8f | https://github.com/whitemerry/phpkin/blob/5dcd9e4e8b7c7244539830669aefdea924902d8f/src/AnnotationBlock.php#L141-L154 | train |
unicodeveloper/laravel-mentions | src/MentionServiceProvider.php | MentionServiceProvider.boot | public function boot()
{
$config = realpath(__DIR__.'/../resources/config/mentions.php');
$views = realpath(__DIR__.'/../resources/views');
$script = realpath(__DIR__.'/../resources/assets');
$this->publishes([
$config => config_path('mentions.php'),
$views => base_path('resources/views/vendor/mentions'),
$script => public_path('js'),
]);
$this->loadViewsFrom(__DIR__.'/../resources/views', 'mentions');
if (! $this->app->routesAreCached()) {
require __DIR__.'/Http/routes.php';
}
} | php | public function boot()
{
$config = realpath(__DIR__.'/../resources/config/mentions.php');
$views = realpath(__DIR__.'/../resources/views');
$script = realpath(__DIR__.'/../resources/assets');
$this->publishes([
$config => config_path('mentions.php'),
$views => base_path('resources/views/vendor/mentions'),
$script => public_path('js'),
]);
$this->loadViewsFrom(__DIR__.'/../resources/views', 'mentions');
if (! $this->app->routesAreCached()) {
require __DIR__.'/Http/routes.php';
}
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"config",
"=",
"realpath",
"(",
"__DIR__",
".",
"'/../resources/config/mentions.php'",
")",
";",
"$",
"views",
"=",
"realpath",
"(",
"__DIR__",
".",
"'/../resources/views'",
")",
";",
"$",
"script",
"=",
"rea... | Publishes all the assets this package needs to function and load all routes
@return [type] [description] | [
"Publishes",
"all",
"the",
"assets",
"this",
"package",
"needs",
"to",
"function",
"and",
"load",
"all",
"routes"
] | e58e38b6b08f0d165cf9e7f5a510efc2eb0e635d | https://github.com/unicodeveloper/laravel-mentions/blob/e58e38b6b08f0d165cf9e7f5a510efc2eb0e635d/src/MentionServiceProvider.php#L22-L39 | train |
whitemerry/phpkin | src/Metadata.php | Metadata.set | public function set($key, $value)
{
if (!is_string($key)) {
throw new \InvalidArgumentException('$key must be string');
}
if (!is_string($value) && !is_numeric($value) && !is_bool($value)) {
throw new \InvalidArgumentException('$value must be string, int or bool');
}
$this->annotations[] = [
'key' => $key,
'value' => (string) $value
];
} | php | public function set($key, $value)
{
if (!is_string($key)) {
throw new \InvalidArgumentException('$key must be string');
}
if (!is_string($value) && !is_numeric($value) && !is_bool($value)) {
throw new \InvalidArgumentException('$value must be string, int or bool');
}
$this->annotations[] = [
'key' => $key,
'value' => (string) $value
];
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'$key must be string'",
")",
";",
"}",
"if",
"(",
"!",
"is... | Set meta annotation
@param $key string
@param $value string|int|float|bool
@throws \InvalidArgumentException | [
"Set",
"meta",
"annotation"
] | 5dcd9e4e8b7c7244539830669aefdea924902d8f | https://github.com/whitemerry/phpkin/blob/5dcd9e4e8b7c7244539830669aefdea924902d8f/src/Metadata.php#L81-L95 | train |
whitemerry/phpkin | src/Endpoint.php | Endpoint.setIp | protected function setIp($ip)
{
if (filter_var($ip, FILTER_VALIDATE_IP) === false) {
throw new \InvalidArgumentException('$ip must be correct');
}
$this->ip = $ip;
} | php | protected function setIp($ip)
{
if (filter_var($ip, FILTER_VALIDATE_IP) === false) {
throw new \InvalidArgumentException('$ip must be correct');
}
$this->ip = $ip;
} | [
"protected",
"function",
"setIp",
"(",
"$",
"ip",
")",
"{",
"if",
"(",
"filter_var",
"(",
"$",
"ip",
",",
"FILTER_VALIDATE_IP",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'$ip must be correct'",
")",
";",
"}",
"$... | Valid and set ip
@param $ip string
@throws \InvalidArgumentException | [
"Valid",
"and",
"set",
"ip"
] | 5dcd9e4e8b7c7244539830669aefdea924902d8f | https://github.com/whitemerry/phpkin/blob/5dcd9e4e8b7c7244539830669aefdea924902d8f/src/Endpoint.php#L78-L85 | train |
whitemerry/phpkin | src/TracerInfo.php | TracerInfo.setSampled | protected static function setSampled($sampler)
{
if ($sampler === null) {
static::$sampled = true;
return null;
}
if (is_bool($sampler)) {
static::$sampled = $sampler;
return null;
}
if (!is_bool($sampler) && !($sampler instanceof Sampler)) {
throw new \InvalidArgumentException('$sampler must be instance of Sampler or boolean');
}
static::$sampled = $sampler->isSampled();
return null;
} | php | protected static function setSampled($sampler)
{
if ($sampler === null) {
static::$sampled = true;
return null;
}
if (is_bool($sampler)) {
static::$sampled = $sampler;
return null;
}
if (!is_bool($sampler) && !($sampler instanceof Sampler)) {
throw new \InvalidArgumentException('$sampler must be instance of Sampler or boolean');
}
static::$sampled = $sampler->isSampled();
return null;
} | [
"protected",
"static",
"function",
"setSampled",
"(",
"$",
"sampler",
")",
"{",
"if",
"(",
"$",
"sampler",
"===",
"null",
")",
"{",
"static",
"::",
"$",
"sampled",
"=",
"true",
";",
"return",
"null",
";",
"}",
"if",
"(",
"is_bool",
"(",
"$",
"sampler... | Valid and set sampled
@param $sampler Sampler|bool
@throws \InvalidArgumentException
@return null | [
"Valid",
"and",
"set",
"sampled"
] | 5dcd9e4e8b7c7244539830669aefdea924902d8f | https://github.com/whitemerry/phpkin/blob/5dcd9e4e8b7c7244539830669aefdea924902d8f/src/TracerInfo.php#L91-L109 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Activity/Starring.php | Starring.listRepositories | public function listRepositories(string $sort = AbstractApi::SORT_CREATED,
string $direction = AbstractApi::DIRECTION_DESC, string $username = null): array
{
if (null !== $username) {
return $this->getApi()->request($this->getApi()->sprintf('/users/:username/starred?:args', $username,
http_build_query(['sort' => $sort, 'direction' => $direction])));
}
return $this->getApi()->request($this->getApi()->sprintf('/user/starred?:args',
http_build_query(['sort' => $sort, 'direction' => $direction])));
} | php | public function listRepositories(string $sort = AbstractApi::SORT_CREATED,
string $direction = AbstractApi::DIRECTION_DESC, string $username = null): array
{
if (null !== $username) {
return $this->getApi()->request($this->getApi()->sprintf('/users/:username/starred?:args', $username,
http_build_query(['sort' => $sort, 'direction' => $direction])));
}
return $this->getApi()->request($this->getApi()->sprintf('/user/starred?:args',
http_build_query(['sort' => $sort, 'direction' => $direction])));
} | [
"public",
"function",
"listRepositories",
"(",
"string",
"$",
"sort",
"=",
"AbstractApi",
"::",
"SORT_CREATED",
",",
"string",
"$",
"direction",
"=",
"AbstractApi",
"::",
"DIRECTION_DESC",
",",
"string",
"$",
"username",
"=",
"null",
")",
":",
"array",
"{",
... | List repositories being starred
@link https://developer.github.com/v3/activity/starring/#list-repositories-being-starred
@param string $sort
@param string $direction
@param string $username
@return array | [
"List",
"repositories",
"being",
"starred"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Activity/Starring.php#L39-L49 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Activity/Starring.php | Starring.checkYouAreStarringRepository | public function checkYouAreStarringRepository(): bool
{
$this->getApi()->request($this->getApi()
->sprintf('/user/starred/:owner/:repo', $this->getActivity()->getOwner(),
$this->getActivity()->getRepo()));
if ($this->getApi()->getHeaders()['Status'] == '204 No Content') {
return true;
}
return false;
} | php | public function checkYouAreStarringRepository(): bool
{
$this->getApi()->request($this->getApi()
->sprintf('/user/starred/:owner/:repo', $this->getActivity()->getOwner(),
$this->getActivity()->getRepo()));
if ($this->getApi()->getHeaders()['Status'] == '204 No Content') {
return true;
}
return false;
} | [
"public",
"function",
"checkYouAreStarringRepository",
"(",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/user/starred/:owner/:repo'",
",",
"$",
"this",
"... | Check if you are starring a repository
@link https://developer.github.com/v3/activity/starring/#check-if-you-are-starring-a-repository
@return bool | [
"Check",
"if",
"you",
"are",
"starring",
"a",
"repository"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Activity/Starring.php#L57-L68 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Users/PublicKeys.php | PublicKeys.listUserPublicKeys | public function listUserPublicKeys(string $username): array
{
return $this->getApi()->request($this->getApi()->sprintf('/users/:username/keys', $username));
} | php | public function listUserPublicKeys(string $username): array
{
return $this->getApi()->request($this->getApi()->sprintf('/users/:username/keys', $username));
} | [
"public",
"function",
"listUserPublicKeys",
"(",
"string",
"$",
"username",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/users/:username/keys'... | List public keys for a user
@link https://developer.github.com/v3/users/keys/#list-public-keys-for-a-user
@param string $username
@return array
@throws \Exception | [
"List",
"public",
"keys",
"for",
"a",
"user"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Users/PublicKeys.php#L25-L28 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Users/PublicKeys.php | PublicKeys.getSinglePublicKey | public function getSinglePublicKey(int $id): array
{
return $this->getApi()->request($this->getApi()->sprintf('/user/keys/:id', (string)$id));
} | php | public function getSinglePublicKey(int $id): array
{
return $this->getApi()->request($this->getApi()->sprintf('/user/keys/:id', (string)$id));
} | [
"public",
"function",
"getSinglePublicKey",
"(",
"int",
"$",
"id",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/user/keys/:id'",
",",
"(",... | Get a single public key
@link https://developer.github.com/v3/users/keys/#get-a-single-public-key
@param int $id
@return array
@throws \Exception | [
"Get",
"a",
"single",
"public",
"key"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Users/PublicKeys.php#L52-L55 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Users/PublicKeys.php | PublicKeys.deletePublicKey | public function deletePublicKey(int $id): array
{
return $this->getApi()->request($this->getApi()->sprintf('/user/keys/:id', (string)$id),
Request::METHOD_DELETE);
} | php | public function deletePublicKey(int $id): array
{
return $this->getApi()->request($this->getApi()->sprintf('/user/keys/:id', (string)$id),
Request::METHOD_DELETE);
} | [
"public",
"function",
"deletePublicKey",
"(",
"int",
"$",
"id",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/user/keys/:id'",
",",
"(",
... | Delete a public key
@link https://developer.github.com/v3/users/keys/#delete-a-public-key
@param int $id
@return array
@throws \Exception | [
"Delete",
"a",
"public",
"key"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Users/PublicKeys.php#L79-L83 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Organizations.php | Organizations.listUserOrganizations | public function listUserOrganizations(string $username): array
{
return $this->getApi()->request($this->getApi()->sprintf('/users/:username/orgs', $username));
} | php | public function listUserOrganizations(string $username): array
{
return $this->getApi()->request($this->getApi()->sprintf('/users/:username/orgs', $username));
} | [
"public",
"function",
"listUserOrganizations",
"(",
"string",
"$",
"username",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/users/:username/or... | List user organizations
@link https://developer.github.com/v3/orgs/#list-user-organizations
@param string $username
@return array
@throws \Exception | [
"List",
"user",
"organizations"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Organizations.php#L42-L45 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Organizations.php | Organizations.get | public function get(string $org): array
{
return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org', $org));
} | php | public function get(string $org): array
{
return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org', $org));
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"org",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/orgs/:org'",
",",
"$",
"org",
")"... | Get an organization
@link https://developer.github.com/v3/orgs/#get-an-organization
@param string $org
@return array
@throws \Exception | [
"Get",
"an",
"organization"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Organizations.php#L57-L60 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Organizations.php | Organizations.edit | public function edit(string $org, string $billingEmail = null, string $company = null, string $email = null,
string $location = null, string $name = null, string $description = null): array
{
return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org', $org), Request::METHOD_PATCH, [
'billing_email' => $billingEmail,
'company' => $company,
'email' => $email,
'location' => $location,
'name' => $name,
'description' => $description
]);
} | php | public function edit(string $org, string $billingEmail = null, string $company = null, string $email = null,
string $location = null, string $name = null, string $description = null): array
{
return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org', $org), Request::METHOD_PATCH, [
'billing_email' => $billingEmail,
'company' => $company,
'email' => $email,
'location' => $location,
'name' => $name,
'description' => $description
]);
} | [
"public",
"function",
"edit",
"(",
"string",
"$",
"org",
",",
"string",
"$",
"billingEmail",
"=",
"null",
",",
"string",
"$",
"company",
"=",
"null",
",",
"string",
"$",
"email",
"=",
"null",
",",
"string",
"$",
"location",
"=",
"null",
",",
"string",
... | Edit an organization
@link https://developer.github.com/v3/orgs/#edit-an-organization
@param string $org
@param string $billingEmail
@param string $company
@param string $email
@param string $location
@param string $name
@param string $description
@return array
@throws \Exception | [
"Edit",
"an",
"organization"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Organizations.php#L78-L89 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Activity/Events.php | Events.listRepositoryEvents | public function listRepositoryEvents(): array
{
return $this->getApi()->request($this->getApi()
->sprintf('/repos/:owner/:repo/events', $this->getActivity()->getOwner(),
$this->getActivity()->getRepo()));
} | php | public function listRepositoryEvents(): array
{
return $this->getApi()->request($this->getApi()
->sprintf('/repos/:owner/:repo/events', $this->getActivity()->getOwner(),
$this->getActivity()->getRepo()));
} | [
"public",
"function",
"listRepositoryEvents",
"(",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/repos/:owner/:repo/events'",
",",
"$",
"this",... | List repository events
@link https://developer.github.com/v3/activity/events/#list-repository-events
@return array | [
"List",
"repository",
"events"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Activity/Events.php#L31-L36 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Activity/Events.php | Events.listIssueEvents | public function listIssueEvents(): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events',
$this->getActivity()->getOwner(), $this->getActivity()->getRepo()));
} | php | public function listIssueEvents(): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events',
$this->getActivity()->getOwner(), $this->getActivity()->getRepo()));
} | [
"public",
"function",
"listIssueEvents",
"(",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/repos/:owner/:repo/issues/events'",
",",
"$",
"this... | List issue events for a repository
@link https://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
@return array | [
"List",
"issue",
"events",
"for",
"a",
"repository"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Activity/Events.php#L44-L48 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Activity/Events.php | Events.listPublicNetworkEvents | public function listPublicNetworkEvents(): array
{
return $this->getApi()->request($this->getApi()->sprintf('/networks/:owner/:repo/events',
$this->getActivity()->getOwner(), $this->getActivity()->getRepo()));
} | php | public function listPublicNetworkEvents(): array
{
return $this->getApi()->request($this->getApi()->sprintf('/networks/:owner/:repo/events',
$this->getActivity()->getOwner(), $this->getActivity()->getRepo()));
} | [
"public",
"function",
"listPublicNetworkEvents",
"(",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/networks/:owner/:repo/events'",
",",
"$",
"... | List public events for a network of repositories
@link https://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories
@return array | [
"List",
"public",
"events",
"for",
"a",
"network",
"of",
"repositories"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Activity/Events.php#L56-L60 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Activity/Events.php | Events.listPublicOrganizationEvents | public function listPublicOrganizationEvents(string $organization): array
{
return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/events', $organization));
} | php | public function listPublicOrganizationEvents(string $organization): array
{
return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/events', $organization));
} | [
"public",
"function",
"listPublicOrganizationEvents",
"(",
"string",
"$",
"organization",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/orgs/:o... | List public events for an organization
@link https://developer.github.com/v3/activity/events/#list-public-events-for-an-organization
@param string $organization
@return array | [
"List",
"public",
"events",
"for",
"an",
"organization"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Activity/Events.php#L71-L74 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Activity/Events.php | Events.listUserReceiveEvents | public function listUserReceiveEvents(string $username): array
{
return $this->getApi()->request($this->getApi()->sprintf('/users/:username/received_events', $username));
} | php | public function listUserReceiveEvents(string $username): array
{
return $this->getApi()->request($this->getApi()->sprintf('/users/:username/received_events', $username));
} | [
"public",
"function",
"listUserReceiveEvents",
"(",
"string",
"$",
"username",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/users/:username/re... | List events that a user has received
@link https://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
@param string $username
@return array | [
"List",
"events",
"that",
"a",
"user",
"has",
"received"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Activity/Events.php#L85-L88 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Activity/Events.php | Events.listPublicUserReceiveEvents | public function listPublicUserReceiveEvents(string $username): array
{
return $this->getApi()->request($this->getApi()->sprintf('/users/:username/received_events/public', $username));
} | php | public function listPublicUserReceiveEvents(string $username): array
{
return $this->getApi()->request($this->getApi()->sprintf('/users/:username/received_events/public', $username));
} | [
"public",
"function",
"listPublicUserReceiveEvents",
"(",
"string",
"$",
"username",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/users/:usern... | List public events that a user has received
@link https://developer.github.com/v3/activity/events/#list-public-events-that-a-user-has-received
@param string $username
@return array | [
"List",
"public",
"events",
"that",
"a",
"user",
"has",
"received"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Activity/Events.php#L99-L102 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Activity/Events.php | Events.listUserPerformedEvents | public function listUserPerformedEvents(string $username): array
{
return $this->getApi()->request($this->getApi()->sprintf('/users/:username/events', $username));
} | php | public function listUserPerformedEvents(string $username): array
{
return $this->getApi()->request($this->getApi()->sprintf('/users/:username/events', $username));
} | [
"public",
"function",
"listUserPerformedEvents",
"(",
"string",
"$",
"username",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/users/:username/... | List events performed by a user
@link https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
@param string $username
@return array | [
"List",
"events",
"performed",
"by",
"a",
"user"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Activity/Events.php#L113-L116 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Activity/Events.php | Events.listPublicUserPerformedEvents | public function listPublicUserPerformedEvents(string $username): array
{
return $this->getApi()->request($this->getApi()->sprintf('/users/:username/events/public', $username));
} | php | public function listPublicUserPerformedEvents(string $username): array
{
return $this->getApi()->request($this->getApi()->sprintf('/users/:username/events/public', $username));
} | [
"public",
"function",
"listPublicUserPerformedEvents",
"(",
"string",
"$",
"username",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/users/:use... | List public events performed by a user
@link https://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user
@param string $username
@return array | [
"List",
"public",
"events",
"performed",
"by",
"a",
"user"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Activity/Events.php#L127-L130 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Activity/Events.php | Events.listOrganizationEvents | public function listOrganizationEvents(string $username, string $organization): array
{
return $this->getApi()->request($this->getApi()
->sprintf('/users/:username/events/orgs/:org', $username, $organization));
} | php | public function listOrganizationEvents(string $username, string $organization): array
{
return $this->getApi()->request($this->getApi()
->sprintf('/users/:username/events/orgs/:org', $username, $organization));
} | [
"public",
"function",
"listOrganizationEvents",
"(",
"string",
"$",
"username",
",",
"string",
"$",
"organization",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->"... | List events for an organization
@link https://developer.github.com/v3/activity/events/#list-events-for-an-organization
@param string $username
@param string $organization
@return array | [
"List",
"events",
"for",
"an",
"organization"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Activity/Events.php#L142-L146 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Repositories/Releases.php | Releases.listReleases | public function listReleases(): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()));
} | php | public function listReleases(): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()));
} | [
"public",
"function",
"listReleases",
"(",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/repos/:owner/:repo/releases'",
",",
"$",
"this",
"->... | List releases for a repository
@link https://developer.github.com/v3/repos/releases/#list-releases-for-a-repository
@return array | [
"List",
"releases",
"for",
"a",
"repository"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Releases.php#L23-L27 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Repositories/Releases.php | Releases.getReleaseByTagName | public function getReleaseByTagName(string $tag): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/tags/:tag',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $tag));
} | php | public function getReleaseByTagName(string $tag): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/tags/:tag',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $tag));
} | [
"public",
"function",
"getReleaseByTagName",
"(",
"string",
"$",
"tag",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/repos/:owner/:repo/releas... | Get a release by tag name
@link https://developer.github.com/v3/repos/releases/#get-a-release-by-tag-name
@param string $tag
@return array
@throws \Exception | [
"Get",
"a",
"release",
"by",
"tag",
"name"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Releases.php#L67-L71 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Repositories/Releases.php | Releases.createRelease | public function createRelease(string $tagName, string $targetCommitish = AbstractApi::BRANCH_MASTER,
string $name = null, string $body = null, bool $draft = false,
bool $preRelease = false): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, [
'tag_name' => $tagName,
'target_commitish' => $targetCommitish,
'name' => $name,
'body' => $body,
'draft' => $draft,
'prerelease' => $preRelease
]);
} | php | public function createRelease(string $tagName, string $targetCommitish = AbstractApi::BRANCH_MASTER,
string $name = null, string $body = null, bool $draft = false,
bool $preRelease = false): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, [
'tag_name' => $tagName,
'target_commitish' => $targetCommitish,
'name' => $name,
'body' => $body,
'draft' => $draft,
'prerelease' => $preRelease
]);
} | [
"public",
"function",
"createRelease",
"(",
"string",
"$",
"tagName",
",",
"string",
"$",
"targetCommitish",
"=",
"AbstractApi",
"::",
"BRANCH_MASTER",
",",
"string",
"$",
"name",
"=",
"null",
",",
"string",
"$",
"body",
"=",
"null",
",",
"bool",
"$",
"dra... | Create a release
@link https://developer.github.com/v3/repos/releases/#create-a-release
@param string $tagName
@param string $targetCommitish
@param string $name
@param string $body
@param bool $draft
@param bool $preRelease
@return array | [
"Create",
"a",
"release"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Releases.php#L87-L100 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Repositories/Releases.php | Releases.editRelease | public function editRelease(string $id, string $tagName, string $targetCommitish = AbstractApi::BRANCH_MASTER,
string $name, string $body, bool $draft = false, bool $preRelease = false): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/:id',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_PATCH, [
'tag_name' => $tagName,
'target_commitish' => $targetCommitish,
'name' => $name,
'body' => $body,
'draft' => $draft,
'prerelease' => $preRelease
]);
} | php | public function editRelease(string $id, string $tagName, string $targetCommitish = AbstractApi::BRANCH_MASTER,
string $name, string $body, bool $draft = false, bool $preRelease = false): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/:id',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_PATCH, [
'tag_name' => $tagName,
'target_commitish' => $targetCommitish,
'name' => $name,
'body' => $body,
'draft' => $draft,
'prerelease' => $preRelease
]);
} | [
"public",
"function",
"editRelease",
"(",
"string",
"$",
"id",
",",
"string",
"$",
"tagName",
",",
"string",
"$",
"targetCommitish",
"=",
"AbstractApi",
"::",
"BRANCH_MASTER",
",",
"string",
"$",
"name",
",",
"string",
"$",
"body",
",",
"bool",
"$",
"draft... | Edit a release
@link https://developer.github.com/v3/repos/releases/#edit-a-release
@param string $id
@param string $tagName
@param string $targetCommitish
@param string $name
@param string $body
@param bool $draft
@param bool $preRelease
@return array | [
"Edit",
"a",
"release"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Releases.php#L117-L129 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Repositories/Releases.php | Releases.deleteRelease | public function deleteRelease(string $id): bool
{
$this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/:id',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_DELETE);
if ($this->getApi()->getHeaders()['Status'] == '204 No Content') {
return true;
}
return false;
} | php | public function deleteRelease(string $id): bool
{
$this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/:id',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_DELETE);
if ($this->getApi()->getHeaders()['Status'] == '204 No Content') {
return true;
}
return false;
} | [
"public",
"function",
"deleteRelease",
"(",
"string",
"$",
"id",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/repos/:owner/:repo/releases/:id'",
",",
"... | Delete a release
@link https://developer.github.com/v3/repos/releases/#delete-a-release
@param string $id
@return bool | [
"Delete",
"a",
"release"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Releases.php#L140-L150 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Repositories/Releases.php | Releases.getReleaseAssets | public function getReleaseAssets(string $id): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/:id/assets',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id));
} | php | public function getReleaseAssets(string $id): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/:id/assets',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id));
} | [
"public",
"function",
"getReleaseAssets",
"(",
"string",
"$",
"id",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/repos/:owner/:repo/releases/:... | List assets for a release
@link https://developer.github.com/v3/repos/releases/#list-assets-for-a-release
@param string $id
@return array | [
"List",
"assets",
"for",
"a",
"release"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Releases.php#L161-L165 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Repositories/Releases.php | Releases.uploadReleaseAsset | public function uploadReleaseAsset(string $id, string $contentType, string $name): array
{
return $this->getApi()->setApiUrl(AbstractApi::API_UPLOADS)->request($this->getApi()
->sprintf('/repos/:owner/:repo/releases/:id/assets?:arg',
$this->getRepositories()
->getOwner(),
$this->getRepositories()
->getRepo(), $id,
http_build_query(['name' => $name])),
Request::METHOD_POST, [
'Content-Type' => $contentType
]);
} | php | public function uploadReleaseAsset(string $id, string $contentType, string $name): array
{
return $this->getApi()->setApiUrl(AbstractApi::API_UPLOADS)->request($this->getApi()
->sprintf('/repos/:owner/:repo/releases/:id/assets?:arg',
$this->getRepositories()
->getOwner(),
$this->getRepositories()
->getRepo(), $id,
http_build_query(['name' => $name])),
Request::METHOD_POST, [
'Content-Type' => $contentType
]);
} | [
"public",
"function",
"uploadReleaseAsset",
"(",
"string",
"$",
"id",
",",
"string",
"$",
"contentType",
",",
"string",
"$",
"name",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"setApiUrl",
"(",
"AbstractApi",
"::",
"AP... | Upload a release asset
@link https://developer.github.com/v3/repos/releases/#upload-a-release-asset
@param string $id
@param string $contentType
@param string $name
@return array | [
"Upload",
"a",
"release",
"asset"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Releases.php#L178-L191 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Repositories/Releases.php | Releases.editReleaseAsset | public function editReleaseAsset(string $id, string $name, string $label = ''): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/assets/:id',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_PATCH, [
'name' => $name,
'label' => $label
]);
} | php | public function editReleaseAsset(string $id, string $name, string $label = ''): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/assets/:id',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_PATCH, [
'name' => $name,
'label' => $label
]);
} | [
"public",
"function",
"editReleaseAsset",
"(",
"string",
"$",
"id",
",",
"string",
"$",
"name",
",",
"string",
"$",
"label",
"=",
"''",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
... | Edit a release asset
@link https://developer.github.com/v3/repos/releases/#edit-a-release-asset
@param string $id
@param string $name
@param string $label
@return array | [
"Edit",
"a",
"release",
"asset"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Releases.php#L219-L226 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/GitData/References.php | References.getAll | public function getAll(): array
{
return $this->getApi()->request($this->getApi()
->sprintf('/repos/:owner/:repo/git/refs', $this->getGitData()->getOwner(),
$this->getGitData()->getRepo()));
} | php | public function getAll(): array
{
return $this->getApi()->request($this->getApi()
->sprintf('/repos/:owner/:repo/git/refs', $this->getGitData()->getOwner(),
$this->getGitData()->getRepo()));
} | [
"public",
"function",
"getAll",
"(",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/repos/:owner/:repo/git/refs'",
",",
"$",
"this",
"->",
"... | Get all References
@link https://developer.github.com/v3/git/refs/#get-all-references
@return array
@throws \Exception | [
"Get",
"all",
"References"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/GitData/References.php#L38-L43 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/GitData/References.php | References.create | public function create(string $ref, string $sha): array
{
return $this->getApi()->request($this->getApi()
->sprintf('/repos/:owner/:repo/git/refs', $this->getGitData()->getOwner(),
$this->getGitData()->getRepo()), Request::METHOD_POST, [
'ref' => $ref,
'sha' => $sha
]);
} | php | public function create(string $ref, string $sha): array
{
return $this->getApi()->request($this->getApi()
->sprintf('/repos/:owner/:repo/git/refs', $this->getGitData()->getOwner(),
$this->getGitData()->getRepo()), Request::METHOD_POST, [
'ref' => $ref,
'sha' => $sha
]);
} | [
"public",
"function",
"create",
"(",
"string",
"$",
"ref",
",",
"string",
"$",
"sha",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/rep... | Create a Reference
@link https://developer.github.com/v3/git/refs/#create-a-reference
@param string $ref
@param string $sha
@return array
@throws \Exception | [
"Create",
"a",
"Reference"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/GitData/References.php#L56-L64 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/GitData/References.php | References.update | public function update(string $ref, string $sha, bool $force = false): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/refs/:ref',
$this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $ref), Request::METHOD_POST, [
'sha' => $sha,
'force' => $force
]);
} | php | public function update(string $ref, string $sha, bool $force = false): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/refs/:ref',
$this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $ref), Request::METHOD_POST, [
'sha' => $sha,
'force' => $force
]);
} | [
"public",
"function",
"update",
"(",
"string",
"$",
"ref",
",",
"string",
"$",
"sha",
",",
"bool",
"$",
"force",
"=",
"false",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi... | Update a Reference
@link https://developer.github.com/v3/git/refs/#update-a-reference
@param string $ref
@param string $sha
@param bool $force
@return array
@throws \Exception | [
"Update",
"a",
"Reference"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/GitData/References.php#L78-L85 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/GitData/References.php | References.delete | public function delete(string $ref): bool
{
$this->getApi()->request($this->getApi()
->sprintf('/repos/:owner/:repo/git/refs/:ref', $this->getGitData()->getOwner(),
$this->getGitData()->getRepo(), $ref), Request::METHOD_DELETE);
if ($this->getApi()->getHeaders()['Status'] == '204 No Content') {
return true;
}
return false;
} | php | public function delete(string $ref): bool
{
$this->getApi()->request($this->getApi()
->sprintf('/repos/:owner/:repo/git/refs/:ref', $this->getGitData()->getOwner(),
$this->getGitData()->getRepo(), $ref), Request::METHOD_DELETE);
if ($this->getApi()->getHeaders()['Status'] == '204 No Content') {
return true;
}
return false;
} | [
"public",
"function",
"delete",
"(",
"string",
"$",
"ref",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/repos/:owner/:repo/git/refs/:ref'",
",",
"$",
... | Delete a Reference
@link https://developer.github.com/v3/git/refs/#delete-a-reference
@param string $ref
@return bool
@throws \Exception | [
"Delete",
"a",
"Reference"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/GitData/References.php#L97-L108 | train |
FlexyProject/GitHubAPI | lib/GitHub/WebHook.php | WebHook.getEvent | public function getEvent(string $event)
{
$class = (string)$this->sprintf(':namespace\Event\:event', __NAMESPACE__, $event);
if (class_exists($class)) {
return new $class($this);
}
return null;
} | php | public function getEvent(string $event)
{
$class = (string)$this->sprintf(':namespace\Event\:event', __NAMESPACE__, $event);
if (class_exists($class)) {
return new $class($this);
}
return null;
} | [
"public",
"function",
"getEvent",
"(",
"string",
"$",
"event",
")",
"{",
"$",
"class",
"=",
"(",
"string",
")",
"$",
"this",
"->",
"sprintf",
"(",
"':namespace\\Event\\:event'",
",",
"__NAMESPACE__",
",",
"$",
"event",
")",
";",
"if",
"(",
"class_exists",
... | Returns Event object
@param string $event
@return null|EventInterface | [
"Returns",
"Event",
"object"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/WebHook.php#L25-L34 | train |
FlexyProject/GitHubAPI | lib/GitHub/Client.php | Client.getReceiver | public function getReceiver(string $receiver)
{
$class = (string)$this->sprintf(':namespace\Receiver\:receiver', __NAMESPACE__, $receiver);
if (class_exists($class)) {
return new $class($this);
}
return null;
} | php | public function getReceiver(string $receiver)
{
$class = (string)$this->sprintf(':namespace\Receiver\:receiver', __NAMESPACE__, $receiver);
if (class_exists($class)) {
return new $class($this);
}
return null;
} | [
"public",
"function",
"getReceiver",
"(",
"string",
"$",
"receiver",
")",
"{",
"$",
"class",
"=",
"(",
"string",
")",
"$",
"this",
"->",
"sprintf",
"(",
"':namespace\\Receiver\\:receiver'",
",",
"__NAMESPACE__",
",",
"$",
"receiver",
")",
";",
"if",
"(",
"... | Returns receiver object
@param string $receiver
@return null|AbstractReceiver | [
"Returns",
"receiver",
"object"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Client.php#L35-L44 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Repositories/Commits.php | Commits.listCommits | public function listCommits(string $sha = AbstractApi::BRANCH_MASTER, string $path = null, string $author = null,
string $since = null, string $until = null): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits?:args',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), http_build_query([
"sha" => $sha,
"path" => $path,
"author" => $author,
"since" => $since,
"until" => $until
])));
} | php | public function listCommits(string $sha = AbstractApi::BRANCH_MASTER, string $path = null, string $author = null,
string $since = null, string $until = null): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits?:args',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), http_build_query([
"sha" => $sha,
"path" => $path,
"author" => $author,
"since" => $since,
"until" => $until
])));
} | [
"public",
"function",
"listCommits",
"(",
"string",
"$",
"sha",
"=",
"AbstractApi",
"::",
"BRANCH_MASTER",
",",
"string",
"$",
"path",
"=",
"null",
",",
"string",
"$",
"author",
"=",
"null",
",",
"string",
"$",
"since",
"=",
"null",
",",
"string",
"$",
... | List commits on a repository
@link https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository
@param string $sha
@param string|null $path
@param string|null $author
@param string|null $since
@param string|null $until
@return array | [
"List",
"commits",
"on",
"a",
"repository"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Commits.php#L28-L39 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Enterprise/ManagementConsole.php | ManagementConsole.upload | public function upload(string $license, string $package, string $settings = ''): array
{
$this->getApi()->setApiUrl(sprintf('http://license:%s@%s', md5($license), $this->getHostname()));
return $this->getApi()->request(sprintf('/setup/api/start -F package=@%s -F license=@%s -F settings=<%s',
$package, $license, $settings), Request::METHOD_POST);
} | php | public function upload(string $license, string $package, string $settings = ''): array
{
$this->getApi()->setApiUrl(sprintf('http://license:%s@%s', md5($license), $this->getHostname()));
return $this->getApi()->request(sprintf('/setup/api/start -F package=@%s -F license=@%s -F settings=<%s',
$package, $license, $settings), Request::METHOD_POST);
} | [
"public",
"function",
"upload",
"(",
"string",
"$",
"license",
",",
"string",
"$",
"package",
",",
"string",
"$",
"settings",
"=",
"''",
")",
":",
"array",
"{",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"setApiUrl",
"(",
"sprintf",
"(",
"'http://lic... | Upload a license and software package for the first time
@link https://developer.github.com/v3/enterprise/management_console/#upload-a-license-and-software-package-for-the-first-time
@param string $license
@param string $package
@param string $settings
@return array | [
"Upload",
"a",
"license",
"and",
"software",
"package",
"for",
"the",
"first",
"time"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Enterprise/ManagementConsole.php#L78-L84 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Enterprise/ManagementConsole.php | ManagementConsole.updateMaintenanceStatus | public function updateMaintenanceStatus(string $maintenance): array
{
return $this->getApi()->request(sprintf('/setup/api/maintenance -d maintenance=%s', $maintenance),
Request::METHOD_POST);
} | php | public function updateMaintenanceStatus(string $maintenance): array
{
return $this->getApi()->request(sprintf('/setup/api/maintenance -d maintenance=%s', $maintenance),
Request::METHOD_POST);
} | [
"public",
"function",
"updateMaintenanceStatus",
"(",
"string",
"$",
"maintenance",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"sprintf",
"(",
"'/setup/api/maintenance -d maintenance=%s'",
",",
"$",
"maintenance"... | Enable or disable maintenance mode
@link https://developer.github.com/v3/enterprise/management_console/#enable-or-disable-maintenance-mode
@param string $maintenance
@return array | [
"Enable",
"or",
"disable",
"maintenance",
"mode"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Enterprise/ManagementConsole.php#L171-L175 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Enterprise/ManagementConsole.php | ManagementConsole.addNewAuthorizedSshKeys | public function addNewAuthorizedSshKeys(string $authorizedKey): array
{
return $this->getApi()->request(sprintf('/setup/api/settings/authorized-keys -F authorized_key=@%s',
$authorizedKey), Request::METHOD_POST);
} | php | public function addNewAuthorizedSshKeys(string $authorizedKey): array
{
return $this->getApi()->request(sprintf('/setup/api/settings/authorized-keys -F authorized_key=@%s',
$authorizedKey), Request::METHOD_POST);
} | [
"public",
"function",
"addNewAuthorizedSshKeys",
"(",
"string",
"$",
"authorizedKey",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"sprintf",
"(",
"'/setup/api/settings/authorized-keys -F authorized_key=@%s'",
",",
"... | Add a new authorized SSH key
@link https://developer.github.com/v3/enterprise/management_console/#add-a-new-authorized-ssh-key
@param string $authorizedKey
@return array | [
"Add",
"a",
"new",
"authorized",
"SSH",
"key"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Enterprise/ManagementConsole.php#L197-L201 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Enterprise/ManagementConsole.php | ManagementConsole.removeAuthorizedSshKeys | public function removeAuthorizedSshKeys(string $authorizedKey): array
{
return $this->getApi()->request(sprintf('/setup/api/settings/authorized-keys -F authorized_key=@%s',
$authorizedKey), Request::METHOD_DELETE);
} | php | public function removeAuthorizedSshKeys(string $authorizedKey): array
{
return $this->getApi()->request(sprintf('/setup/api/settings/authorized-keys -F authorized_key=@%s',
$authorizedKey), Request::METHOD_DELETE);
} | [
"public",
"function",
"removeAuthorizedSshKeys",
"(",
"string",
"$",
"authorizedKey",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"sprintf",
"(",
"'/setup/api/settings/authorized-keys -F authorized_key=@%s'",
",",
"... | Remove an authorized SSH key
@link https://developer.github.com/v3/enterprise/management_console/#remove-an-authorized-ssh-key
@param string $authorizedKey
@return array | [
"Remove",
"an",
"authorized",
"SSH",
"key"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Enterprise/ManagementConsole.php#L212-L216 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/AbstractReceiver.php | AbstractReceiver.getReceiver | public function getReceiver(string $name)
{
$classPath = explode('\\', get_called_class());
$class = (string)$this->getApi()
->sprintf(':namespace\:class\:method', __NAMESPACE__, end($classPath), $name);
if (class_exists($class)) {
return new $class($this);
}
return null;
} | php | public function getReceiver(string $name)
{
$classPath = explode('\\', get_called_class());
$class = (string)$this->getApi()
->sprintf(':namespace\:class\:method', __NAMESPACE__, end($classPath), $name);
if (class_exists($class)) {
return new $class($this);
}
return null;
} | [
"public",
"function",
"getReceiver",
"(",
"string",
"$",
"name",
")",
"{",
"$",
"classPath",
"=",
"explode",
"(",
"'\\\\'",
",",
"get_called_class",
"(",
")",
")",
";",
"$",
"class",
"=",
"(",
"string",
")",
"$",
"this",
"->",
"getApi",
"(",
")",
"->... | Get a sub-receiver
@param string $name
@return null|object | [
"Get",
"a",
"sub",
"-",
"receiver"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/AbstractReceiver.php#L85-L96 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Issues/Milestones.php | Milestones.listMilestones | public function listMilestones(string $state = AbstractApi::STATE_OPEN, string $sort = AbstractApi::SORT_DUE_DATE,
string $direction = AbstractApi::DIRECTION_ASC): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/milestones?:args',
$this->getIssues()->getOwner(), $this->getIssues()->getRepo(), http_build_query([
'state' => $state,
'sort' => $sort,
'direction' => $direction
])));
} | php | public function listMilestones(string $state = AbstractApi::STATE_OPEN, string $sort = AbstractApi::SORT_DUE_DATE,
string $direction = AbstractApi::DIRECTION_ASC): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/milestones?:args',
$this->getIssues()->getOwner(), $this->getIssues()->getRepo(), http_build_query([
'state' => $state,
'sort' => $sort,
'direction' => $direction
])));
} | [
"public",
"function",
"listMilestones",
"(",
"string",
"$",
"state",
"=",
"AbstractApi",
"::",
"STATE_OPEN",
",",
"string",
"$",
"sort",
"=",
"AbstractApi",
"::",
"SORT_DUE_DATE",
",",
"string",
"$",
"direction",
"=",
"AbstractApi",
"::",
"DIRECTION_ASC",
")",
... | List milestones for a repository
@link https://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
@param string $state
@param string $sort
@param string $direction
@return array | [
"List",
"milestones",
"for",
"a",
"repository"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Issues/Milestones.php#L28-L37 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Issues/Milestones.php | Milestones.getMilestone | public function getMilestone(int $number): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/milestones/:number',
$this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number));
} | php | public function getMilestone(int $number): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/milestones/:number',
$this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number));
} | [
"public",
"function",
"getMilestone",
"(",
"int",
"$",
"number",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/repos/:owner/:repo/milestones/:n... | Get a single milestone
@link https://developer.github.com/v3/issues/milestones/#get-a-single-milestone
@param int $number
@return array | [
"Get",
"a",
"single",
"milestone"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Issues/Milestones.php#L48-L52 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Issues/Milestones.php | Milestones.createMilestone | public function createMilestone(string $title, string $state = AbstractApi::STATE_OPEN, string $description = '',
string $dueOn = ''): array
{
return $this->getApi()->request($this->getApi()
->sprintf('/repos/:owner/:repo/milestones', $this->getIssues()->getOwner(),
$this->getIssues()->getRepo()), Request::METHOD_POST, [
'title' => $title,
'state' => $state,
'description' => $description,
'due_on' => (new DateTime($dueOn))->format(DateTime::ATOM)
]);
} | php | public function createMilestone(string $title, string $state = AbstractApi::STATE_OPEN, string $description = '',
string $dueOn = ''): array
{
return $this->getApi()->request($this->getApi()
->sprintf('/repos/:owner/:repo/milestones', $this->getIssues()->getOwner(),
$this->getIssues()->getRepo()), Request::METHOD_POST, [
'title' => $title,
'state' => $state,
'description' => $description,
'due_on' => (new DateTime($dueOn))->format(DateTime::ATOM)
]);
} | [
"public",
"function",
"createMilestone",
"(",
"string",
"$",
"title",
",",
"string",
"$",
"state",
"=",
"AbstractApi",
"::",
"STATE_OPEN",
",",
"string",
"$",
"description",
"=",
"''",
",",
"string",
"$",
"dueOn",
"=",
"''",
")",
":",
"array",
"{",
"retu... | Create a milestone
@link https://developer.github.com/v3/issues/milestones/#create-a-milestone
@param string $title
@param string $state
@param string $description
@param string $dueOn
@return array | [
"Create",
"a",
"milestone"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Issues/Milestones.php#L66-L77 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Repositories/Contents.php | Contents.getContents | public function getContents(string $path = '', string $ref = AbstractApi::BRANCH_MASTER): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/contents/:path?:args',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $path,
http_build_query(['ref' => $ref])));
} | php | public function getContents(string $path = '', string $ref = AbstractApi::BRANCH_MASTER): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/contents/:path?:args',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $path,
http_build_query(['ref' => $ref])));
} | [
"public",
"function",
"getContents",
"(",
"string",
"$",
"path",
"=",
"''",
",",
"string",
"$",
"ref",
"=",
"AbstractApi",
"::",
"BRANCH_MASTER",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this"... | This method returns the contents of a file or directory in a repository.
@link https://developer.github.com/v3/repos/contents/#get-contents
@param string $path
@param string $ref
@return array | [
"This",
"method",
"returns",
"the",
"contents",
"of",
"a",
"file",
"or",
"directory",
"in",
"a",
"repository",
"."
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Contents.php#L38-L43 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Repositories/Contents.php | Contents.getArchiveLink | public function getArchiveLink(string $archiveFormat = AbstractApi::ARCHIVE_TARBALL,
string $ref = AbstractApi::BRANCH_MASTER): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/:archive_format/:ref',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $archiveFormat, $ref));
} | php | public function getArchiveLink(string $archiveFormat = AbstractApi::ARCHIVE_TARBALL,
string $ref = AbstractApi::BRANCH_MASTER): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/:archive_format/:ref',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $archiveFormat, $ref));
} | [
"public",
"function",
"getArchiveLink",
"(",
"string",
"$",
"archiveFormat",
"=",
"AbstractApi",
"::",
"ARCHIVE_TARBALL",
",",
"string",
"$",
"ref",
"=",
"AbstractApi",
"::",
"BRANCH_MASTER",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
... | Get archive link
@link https://developer.github.com/v3/repos/contents/#get-archive-link
@param string $archiveFormat
@param string $ref
@return array | [
"Get",
"archive",
"link"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Contents.php#L121-L126 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/GitData/Blobs.php | Blobs.createBlob | public function createBlob(string $content, string $encoding = 'utf-8'): array
{
return $this->getApi()->request($this->getApi()
->sprintf('/repos/:owner/:repo/git/blobs', $this->getGitData()->getOwner(),
$this->getGitData()->getRepo()), Request::METHOD_POST, [
'content' => $content,
'encoding' => $encoding
]);
} | php | public function createBlob(string $content, string $encoding = 'utf-8'): array
{
return $this->getApi()->request($this->getApi()
->sprintf('/repos/:owner/:repo/git/blobs', $this->getGitData()->getOwner(),
$this->getGitData()->getRepo()), Request::METHOD_POST, [
'content' => $content,
'encoding' => $encoding
]);
} | [
"public",
"function",
"createBlob",
"(",
"string",
"$",
"content",
",",
"string",
"$",
"encoding",
"=",
"'utf-8'",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"... | Create a Blob
@link https://developer.github.com/v3/git/blobs/#create-a-blob
@param string $content
@param string $encoding
@return array | [
"Create",
"a",
"Blob"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/GitData/Blobs.php#L40-L48 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Repositories/Merging.php | Merging.performMerge | public function performMerge(string $base, string $head, string $commitMessage = null): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/merges',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, [
'base' => $base,
'head' => $head,
'commit_message' => $commitMessage
]);
} | php | public function performMerge(string $base, string $head, string $commitMessage = null): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/merges',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, [
'base' => $base,
'head' => $head,
'commit_message' => $commitMessage
]);
} | [
"public",
"function",
"performMerge",
"(",
"string",
"$",
"base",
",",
"string",
"$",
"head",
",",
"string",
"$",
"commitMessage",
"=",
"null",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
... | Perform a merge
@link https://developer.github.com/v3/repos/merging/#perform-a-merge
@param string $base
@param string $head
@param string|null $commitMessage
@return array | [
"Perform",
"a",
"merge"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Merging.php#L26-L34 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Repositories/Forks.php | Forks.createFork | public function createFork(string $organization = ''): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/forks',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST,
['organization' => $organization]);
} | php | public function createFork(string $organization = ''): array
{
return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/forks',
$this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST,
['organization' => $organization]);
} | [
"public",
"function",
"createFork",
"(",
"string",
"$",
"organization",
"=",
"''",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/repos/:own... | Create a fork
@link https://developer.github.com/v3/repos/forks/#create-a-fork
@param string $organization
@return array | [
"Create",
"a",
"fork"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Forks.php#L41-L46 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Organizations/Teams.php | Teams.listTeamMembers | public function listTeamMembers(int $id): array
{
return $this->getApi()->request($this->getApi()->sprintf('/teams/:id/members', (string)$id));
} | php | public function listTeamMembers(int $id): array
{
return $this->getApi()->request($this->getApi()->sprintf('/teams/:id/members', (string)$id));
} | [
"public",
"function",
"listTeamMembers",
"(",
"int",
"$",
"id",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/teams/:id/members'",
",",
"("... | List team members
@link https://developer.github.com/v3/orgs/teams/#list-team-members
@param int $id
@return array
@throws \Exception | [
"List",
"team",
"members"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Organizations/Teams.php#L124-L127 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Organizations/Teams.php | Teams.listTeamRepos | public function listTeamRepos(int $id): array
{
return $this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos', (string)$id));
} | php | public function listTeamRepos(int $id): array
{
return $this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos', (string)$id));
} | [
"public",
"function",
"listTeamRepos",
"(",
"int",
"$",
"id",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/teams/:id/repos'",
",",
"(",
... | List team repos
@link https://developer.github.com/v3/orgs/teams/#list-team-repos
@param int $id
@return array
@throws \Exception | [
"List",
"team",
"repos"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Organizations/Teams.php#L197-L200 | train |
FlexyProject/GitHubAPI | lib/GitHub/Receiver/Organizations/Teams.php | Teams.checkTeamManagesRepository | public function checkTeamManagesRepository(int $id): bool
{
$this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos/:owner/:repo', (string)$id,
$this->getOrganizations()->getOwner(), $this->getOrganizations()->getRepo()));
if ($this->getApi()->getHeaders()['Status'] == '204 No Content') {
return true;
}
return false;
} | php | public function checkTeamManagesRepository(int $id): bool
{
$this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos/:owner/:repo', (string)$id,
$this->getOrganizations()->getOwner(), $this->getOrganizations()->getRepo()));
if ($this->getApi()->getHeaders()['Status'] == '204 No Content') {
return true;
}
return false;
} | [
"public",
"function",
"checkTeamManagesRepository",
"(",
"int",
"$",
"id",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"request",
"(",
"$",
"this",
"->",
"getApi",
"(",
")",
"->",
"sprintf",
"(",
"'/teams/:id/repos/:owner/:repo'",
"... | Check if a team manages a repository
@link https://developer.github.com/v3/orgs/teams/#get-team-repo
@param int $id
@return bool
@throws \Exception | [
"Check",
"if",
"a",
"team",
"manages",
"a",
"repository"
] | cb5044443daf138787a7feb9aa9bf50220a44fd6 | https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Organizations/Teams.php#L212-L222 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.