Improve updater

This commit is contained in:
grandeljay 2022-03-27 10:15:50 +02:00
parent 56e4f7e7ff
commit 567639dff5
357 changed files with 817 additions and 29901 deletions

View file

@ -6,7 +6,6 @@
"embed/embed": "^4.3",
"laminas/laminas-diactoros": "^2.8",
"grandel/include-directory": "^0.2.2",
"knplabs/github-api": "^3.0",
"guzzlehttp/guzzle": "^7.0.1",
"http-interop/http-factory-guzzle": "^1.0",
"qferr/mjml-php": "^1.1",

785
composer.lock generated
View file

@ -4,74 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "a9023528de34be7d5f1d8155ae3a2d47",
"content-hash": "9d59ba37ed1c4a9cd5bce3b355023840",
"packages": [
{
"name": "clue/stream-filter",
"version": "v1.6.0",
"source": {
"type": "git",
"url": "https://github.com/clue/stream-filter.git",
"reference": "d6169430c7731d8509da7aecd0af756a5747b78e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/clue/stream-filter/zipball/d6169430c7731d8509da7aecd0af756a5747b78e",
"reference": "d6169430c7731d8509da7aecd0af756a5747b78e",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36"
},
"type": "library",
"autoload": {
"files": [
"src/functions_include.php"
],
"psr-4": {
"Clue\\StreamFilter\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@clue.engineering"
}
],
"description": "A simple and modern approach to stream filtering in PHP",
"homepage": "https://github.com/clue/php-stream-filter",
"keywords": [
"bucket brigade",
"callback",
"filter",
"php_user_filter",
"stream",
"stream_filter_append",
"stream_filter_register"
],
"support": {
"issues": "https://github.com/clue/stream-filter/issues",
"source": "https://github.com/clue/stream-filter/tree/v1.6.0"
},
"funding": [
{
"url": "https://clue.engineering/support",
"type": "custom"
},
{
"url": "https://github.com/clue",
"type": "github"
}
],
"time": "2022-02-21T13:15:14+00:00"
},
{
"name": "composer/ca-bundle",
"version": "1.3.1",
@ -806,94 +740,6 @@
},
"time": "2021-07-21T13:50:14+00:00"
},
{
"name": "knplabs/github-api",
"version": "v3.5.1",
"source": {
"type": "git",
"url": "https://github.com/KnpLabs/php-github-api.git",
"reference": "37b167998e8e1f318b3d99633675cfa007540565"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/KnpLabs/php-github-api/zipball/37b167998e8e1f318b3d99633675cfa007540565",
"reference": "37b167998e8e1f318b3d99633675cfa007540565",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": "^7.2.5 || ^8.0",
"php-http/cache-plugin": "^1.7.1",
"php-http/client-common": "^2.3",
"php-http/discovery": "^1.12",
"php-http/httplug": "^2.2",
"php-http/multipart-stream-builder": "^1.1.2",
"psr/cache": "^1.0|^2.0|^3.0",
"psr/http-client-implementation": "^1.0",
"psr/http-factory-implementation": "^1.0",
"psr/http-message": "^1.0",
"symfony/deprecation-contracts": "^2.2|^3.0",
"symfony/polyfill-php80": "^1.17"
},
"require-dev": {
"guzzlehttp/guzzle": "^7.2",
"guzzlehttp/psr7": "^1.7",
"http-interop/http-factory-guzzle": "^1.0",
"php-http/mock-client": "^1.4.1",
"phpstan/extension-installer": "^1.0.5",
"phpstan/phpstan": "^0.12.57",
"phpstan/phpstan-deprecation-rules": "^0.12.5",
"phpunit/phpunit": "^8.5 || ^9.4",
"symfony/cache": "^5.1.8",
"symfony/phpunit-bridge": "^5.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-2.x": "2.20.x-dev",
"dev-master": "3.4.x-dev"
}
},
"autoload": {
"psr-4": {
"Github\\": "lib/Github/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "KnpLabs Team",
"homepage": "http://knplabs.com"
},
{
"name": "Thibault Duplessis",
"email": "thibault.duplessis@gmail.com",
"homepage": "http://ornicar.github.com"
}
],
"description": "GitHub API v3 client",
"homepage": "https://github.com/KnpLabs/php-github-api",
"keywords": [
"api",
"gh",
"gist",
"github"
],
"support": {
"issues": "https://github.com/KnpLabs/php-github-api/issues",
"source": "https://github.com/KnpLabs/php-github-api/tree/v3.5.1"
},
"funding": [
{
"url": "https://github.com/acrobat",
"type": "github"
}
],
"time": "2022-02-19T11:15:46+00:00"
},
{
"name": "laminas/laminas-diactoros",
"version": "2.8.0",
@ -1150,566 +996,6 @@
},
"time": "2020-11-19T17:43:46+00:00"
},
{
"name": "php-http/cache-plugin",
"version": "1.7.5",
"source": {
"type": "git",
"url": "https://github.com/php-http/cache-plugin.git",
"reference": "63bc3f7242825c9a817db8f78e4c9703b0c471e2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/cache-plugin/zipball/63bc3f7242825c9a817db8f78e4c9703b0c471e2",
"reference": "63bc3f7242825c9a817db8f78e4c9703b0c471e2",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"php-http/client-common": "^1.9 || ^2.0",
"php-http/message-factory": "^1.0",
"psr/cache": "^1.0 || ^2.0 || ^3.0",
"symfony/options-resolver": "^2.6 || ^3.0 || ^4.0 || ^5.0 || ^6.0"
},
"require-dev": {
"phpspec/phpspec": "^5.1 || ^6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.6-dev"
}
},
"autoload": {
"psr-4": {
"Http\\Client\\Common\\Plugin\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "PSR-6 Cache plugin for HTTPlug",
"homepage": "http://httplug.io",
"keywords": [
"cache",
"http",
"httplug",
"plugin"
],
"support": {
"issues": "https://github.com/php-http/cache-plugin/issues",
"source": "https://github.com/php-http/cache-plugin/tree/1.7.5"
},
"time": "2022-01-18T12:24:56+00:00"
},
{
"name": "php-http/client-common",
"version": "2.5.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/client-common.git",
"reference": "d135751167d57e27c74de674d6a30cef2dc8e054"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/client-common/zipball/d135751167d57e27c74de674d6a30cef2dc8e054",
"reference": "d135751167d57e27c74de674d6a30cef2dc8e054",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"php-http/httplug": "^2.0",
"php-http/message": "^1.6",
"php-http/message-factory": "^1.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0",
"symfony/options-resolver": "~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0 || ^6.0",
"symfony/polyfill-php80": "^1.17"
},
"require-dev": {
"doctrine/instantiator": "^1.1",
"guzzlehttp/psr7": "^1.4",
"nyholm/psr7": "^1.2",
"phpspec/phpspec": "^5.1 || ^6.3 || ^7.1",
"phpspec/prophecy": "^1.10.2",
"phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3"
},
"suggest": {
"ext-json": "To detect JSON responses with the ContentTypePlugin",
"ext-libxml": "To detect XML responses with the ContentTypePlugin",
"php-http/cache-plugin": "PSR-6 Cache plugin",
"php-http/logger-plugin": "PSR-3 Logger plugin",
"php-http/stopwatch-plugin": "Symfony Stopwatch plugin"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3.x-dev"
}
},
"autoload": {
"psr-4": {
"Http\\Client\\Common\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "Common HTTP Client implementations and tools for HTTPlug",
"homepage": "http://httplug.io",
"keywords": [
"client",
"common",
"http",
"httplug"
],
"support": {
"issues": "https://github.com/php-http/client-common/issues",
"source": "https://github.com/php-http/client-common/tree/2.5.0"
},
"time": "2021-11-26T15:01:24+00:00"
},
{
"name": "php-http/discovery",
"version": "1.14.1",
"source": {
"type": "git",
"url": "https://github.com/php-http/discovery.git",
"reference": "de90ab2b41d7d61609f504e031339776bc8c7223"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/discovery/zipball/de90ab2b41d7d61609f504e031339776bc8c7223",
"reference": "de90ab2b41d7d61609f504e031339776bc8c7223",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"conflict": {
"nyholm/psr7": "<1.0"
},
"require-dev": {
"graham-campbell/phpspec-skip-example-extension": "^5.0",
"php-http/httplug": "^1.0 || ^2.0",
"php-http/message-factory": "^1.0",
"phpspec/phpspec": "^5.1 || ^6.1",
"puli/composer-plugin": "1.0.0-beta10"
},
"suggest": {
"php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9-dev"
}
},
"autoload": {
"psr-4": {
"Http\\Discovery\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "Finds installed HTTPlug implementations and PSR-7 message factories",
"homepage": "http://php-http.org",
"keywords": [
"adapter",
"client",
"discovery",
"factory",
"http",
"message",
"psr7"
],
"support": {
"issues": "https://github.com/php-http/discovery/issues",
"source": "https://github.com/php-http/discovery/tree/1.14.1"
},
"time": "2021-09-18T07:57:46+00:00"
},
{
"name": "php-http/httplug",
"version": "2.3.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/httplug.git",
"reference": "f640739f80dfa1152533976e3c112477f69274eb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/httplug/zipball/f640739f80dfa1152533976e3c112477f69274eb",
"reference": "f640739f80dfa1152533976e3c112477f69274eb",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"php-http/promise": "^1.1",
"psr/http-client": "^1.0",
"psr/http-message": "^1.0"
},
"require-dev": {
"friends-of-phpspec/phpspec-code-coverage": "^4.1",
"phpspec/phpspec": "^5.1 || ^6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
}
},
"autoload": {
"psr-4": {
"Http\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Eric GELOEN",
"email": "geloen.eric@gmail.com"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://sagikazarmark.hu"
}
],
"description": "HTTPlug, the HTTP client abstraction for PHP",
"homepage": "http://httplug.io",
"keywords": [
"client",
"http"
],
"support": {
"issues": "https://github.com/php-http/httplug/issues",
"source": "https://github.com/php-http/httplug/tree/2.3.0"
},
"time": "2022-02-21T09:52:22+00:00"
},
{
"name": "php-http/message",
"version": "1.13.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/message.git",
"reference": "7886e647a30a966a1a8d1dad1845b71ca8678361"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/message/zipball/7886e647a30a966a1a8d1dad1845b71ca8678361",
"reference": "7886e647a30a966a1a8d1dad1845b71ca8678361",
"shasum": ""
},
"require": {
"clue/stream-filter": "^1.5",
"php": "^7.1 || ^8.0",
"php-http/message-factory": "^1.0.2",
"psr/http-message": "^1.0"
},
"provide": {
"php-http/message-factory-implementation": "1.0"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.6",
"ext-zlib": "*",
"guzzlehttp/psr7": "^1.0",
"laminas/laminas-diactoros": "^2.0",
"phpspec/phpspec": "^5.1 || ^6.3 || ^7.1",
"slim/slim": "^3.0"
},
"suggest": {
"ext-zlib": "Used with compressor/decompressor streams",
"guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories",
"laminas/laminas-diactoros": "Used with Diactoros Factories",
"slim/slim": "Used with Slim Framework PSR-7 implementation"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.10-dev"
}
},
"autoload": {
"files": [
"src/filters.php"
],
"psr-4": {
"Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "HTTP Message related tools",
"homepage": "http://php-http.org",
"keywords": [
"http",
"message",
"psr-7"
],
"support": {
"issues": "https://github.com/php-http/message/issues",
"source": "https://github.com/php-http/message/tree/1.13.0"
},
"time": "2022-02-11T13:41:14+00:00"
},
{
"name": "php-http/message-factory",
"version": "v1.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-http/message-factory.git",
"reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1",
"reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1",
"shasum": ""
},
"require": {
"php": ">=5.4",
"psr/http-message": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "Factory interfaces for PSR-7 HTTP Message",
"homepage": "http://php-http.org",
"keywords": [
"factory",
"http",
"message",
"stream",
"uri"
],
"support": {
"issues": "https://github.com/php-http/message-factory/issues",
"source": "https://github.com/php-http/message-factory/tree/master"
},
"time": "2015-12-19T14:08:53+00:00"
},
{
"name": "php-http/multipart-stream-builder",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/multipart-stream-builder.git",
"reference": "11c1d31f72e01c738bbce9e27649a7cca829c30e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/11c1d31f72e01c738bbce9e27649a7cca829c30e",
"reference": "11c1d31f72e01c738bbce9e27649a7cca829c30e",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"php-http/discovery": "^1.7",
"php-http/message-factory": "^1.0.2",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0"
},
"require-dev": {
"nyholm/psr7": "^1.0",
"php-http/message": "^1.5",
"phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Http\\Message\\MultipartStream\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com"
}
],
"description": "A builder class that help you create a multipart stream",
"homepage": "http://php-http.org",
"keywords": [
"factory",
"http",
"message",
"multipart stream",
"stream"
],
"support": {
"issues": "https://github.com/php-http/multipart-stream-builder/issues",
"source": "https://github.com/php-http/multipart-stream-builder/tree/1.2.0"
},
"time": "2021-05-21T08:32:01+00:00"
},
{
"name": "php-http/promise",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/promise.git",
"reference": "4c4c1f9b7289a2ec57cde7f1e9762a5789506f88"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/promise/zipball/4c4c1f9b7289a2ec57cde7f1e9762a5789506f88",
"reference": "4c4c1f9b7289a2ec57cde7f1e9762a5789506f88",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"friends-of-phpspec/phpspec-code-coverage": "^4.3.2",
"phpspec/phpspec": "^5.1.2 || ^6.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"autoload": {
"psr-4": {
"Http\\Promise\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Joel Wurtz",
"email": "joel.wurtz@gmail.com"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "Promise used for asynchronous HTTP requests",
"homepage": "http://httplug.io",
"keywords": [
"promise"
],
"support": {
"issues": "https://github.com/php-http/promise/issues",
"source": "https://github.com/php-http/promise/tree/1.1.0"
},
"time": "2020-07-07T09:29:14+00:00"
},
{
"name": "psr/cache",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/cache.git",
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Cache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for caching libraries",
"keywords": [
"cache",
"psr",
"psr-6"
],
"support": {
"source": "https://github.com/php-fig/cache/tree/3.0.0"
},
"time": "2021-02-03T23:26:27+00:00"
},
{
"name": "psr/http-client",
"version": "1.0.1",
@ -2022,73 +1308,6 @@
],
"time": "2021-11-01T23:48:49+00:00"
},
{
"name": "symfony/options-resolver",
"version": "v6.0.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
"reference": "51f7006670febe4cbcbae177cbffe93ff833250d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/51f7006670febe4cbcbae177cbffe93ff833250d",
"reference": "51f7006670febe4cbcbae177cbffe93ff833250d",
"shasum": ""
},
"require": {
"php": ">=8.0.2",
"symfony/deprecation-contracts": "^2.1|^3"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\OptionsResolver\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides an improved replacement for the array_replace PHP function",
"homepage": "https://symfony.com",
"keywords": [
"config",
"configuration",
"options"
],
"support": {
"source": "https://github.com/symfony/options-resolver/tree/v6.0.3"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-01-02T09:55:41+00:00"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.25.0",
@ -2375,5 +1594,5 @@
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.2.0"
"plugin-api-version": "2.0.0"
}

View file

@ -127,30 +127,17 @@ if (!$options || !$options->getOption('isInstalled')) {
}
/**
* Update
*
* Check for update every 24 hours.
* Database Update
*/
use Github\Client;
if ($options && $options->getOption('isInstalled')) {
$updateLastChecked = $options->getOption('updateLastChecked');
if (!$updateLastChecked || time() - $updateLastChecked >= 86400) {
try {
$client = new Client();
$release = $client->api('repo')->releases()->latest('grandeljay', 'wishthis');
$tag = $release['tag_name'];
$version = str_replace('v', '', $tag);
if (-1 === version_compare($options->version, $version)) {
if (-1 === version_compare($options->version, VERSION)) {
$options->setOption('updateAvailable', true);
}
} catch (\Github\Exception\RuntimeException $th) {
echo wishthis\Page::warning($th->getMessage());
}
$options->setOption('updateLastChecked', time());
if (isset($user->power) && 100 === $user->power) {
$page = 'update';
} else {
$page = 'maintenance';
}
}
}

View file

@ -433,16 +433,6 @@ class Page
);
}
global $options;
if ($options->getOption('updateAvailable') && isset($user->power) && 100 === $user->power) {
$pages[$system]['items'][] = array(
'text' => __('Update'),
'url' => '/?page=update',
'icon' => 'upload',
);
}
if (isset($user->power) && 100 === $user->power) {
$pages[$system]['items'][] = array(
'text' => __('Settings'),

View file

@ -1,28 +0,0 @@
<?php
/**
* Delete a directory with all of its contents.
*
* @author Jay Trees <github.jay@grandel.anonaddy.me>
*/
function delete_directory(string $directoryToDelete)
{
foreach (scandir($directoryToDelete) as $filename) {
if (in_array($filename, array('.', '..'))) {
continue;
}
$filepath = $directoryToDelete . '/' . $filename;
if (is_file($filepath) && !is_dir($filepath)) {
unlink($filepath);
}
if (is_dir($filepath)) {
delete_directory($filepath);
}
}
rmdir($directoryToDelete);
}

31
src/pages/maintenance.php Normal file
View file

@ -0,0 +1,31 @@
<?php
/**
* maintenance.php
*
* @author Jay Trees <github.jay@grandel.anonaddy.me>
*/
use wishthis\Page;
$page = new Page(__FILE__, __('Maintenance'));
$page->header();
$page->bodyStart();
$page->navigation();
?>
<main>
<div class="ui container">
<h1 class="ui header"><?= $page->title ?></h1>
<div class="ui segment">
<h2 class="ui header"><?= __('Temporarily unavailable') ?></h2>
<p><?= __('Due to maintenance, wishthis is temporarily not available. Please check back again in a minute.') ?></p>
</div>
</div>
</main>
<?php
$page->footer();
$page->bodyEnd();
?>

View file

@ -8,54 +8,10 @@
use wishthis\{Page, User};
$page = new Page(__FILE__, __('Update'), 100);
$page->header();
$page->bodyStart();
$page->navigation();
/**
* Update
*/
if ('POST' === $_SERVER['REQUEST_METHOD']) {
/**
* Files
*/
$zip_filename = __DIR__ . '/' . $tag . '.zip';
/** Download */
file_put_contents(
$zip_filename,
file_get_contents('https://github.com/grandeljay/wishthis/archive/refs/tags/' . $tag . '.zip')
);
/** Decompress */
$zip = new ZipArchive();
if ($zip->open($zip_filename)) {
$zip->extractTo(__DIR__);
$zip->close();
$directory_wishthis_github = __DIR__ . '/wishthis-' . $version;
foreach (scandir($directory_wishthis_github) as $filename) {
if (in_array($filename, array('.', '..', 'config'))) {
continue;
}
$filepath = __DIR__ . '/' . $filename;
$filepath_github = $directory_wishthis_github . '/' . $filename;
if (is_dir($filepath) && is_dir($filepath_github)) {
delete_directory($filepath);
}
rename($filepath_github, $filepath);
}
}
/** Delete */
unlink($zip_filename);
/**
* Database
*/
@ -87,12 +43,17 @@ if ('POST' === $_SERVER['REQUEST_METHOD']) {
}
/** Update version */
$options->setOption('version', $version);
$options->setOption('version', VERSION);
$options->setOption('updateAvailable', false);
header('Location: /?page=home');
die();
}
$page = new Page(__FILE__, __('Update'), 100);
$page->header();
$page->bodyStart();
$page->navigation();
?>
<main>
@ -100,33 +61,19 @@ if ('POST' === $_SERVER['REQUEST_METHOD']) {
<h1 class="ui header"><?= $page->title ?></h1>
<div class="ui segment">
<h2 class="ui header"><?= __('New version detected') ?></h2>
<p><?= __('An update is available. If you are brave, please click the button to start the self updater.') ?></p>
<div class="ui icon warning message">
<i class="exclamation triangle icon"></i>
<div class="content">
<div class="header">
<?= __('Use at own risk') ?>
</div>
<p><?= __('Be sure to make backups before proceeding.') ?></p>
</div>
</div>
<h2 class="ui header"><?= __('Database migration') ?></h2>
<p><?= __('Thank you for updating withthis! To complete this update, some changes are required to the database structure.') ?></p>
<form class="ui form" method="post">
<button class="ui orange button"
type="submit"
title="<?= sprintf(__('Update to %s'), 'v' . $version) ?>"
title="<?= sprintf(__('Migrate to %s'), 'v' . VERSION) ?>"
>
<i class="upload icon"></i>
<?= sprintf(__('Update to %s'), 'v' . $version) ?>
<?= sprintf(__('Migrate to %s'), 'v' . VERSION) ?>
</button>
</form>
</div>
<div class="ui segment">
<h2 class="ui header"><?= __('Changes') ?></h2>
<?= str_replace(PHP_EOL, '<br>', $release['body']) ?>
</div>
</div>
</main>

View file

@ -1,2 +0,0 @@
github: clue
custom: https://clue.engineering/support

View file

@ -1,86 +0,0 @@
# Changelog
## 1.6.0 (2022-02-21)
* Feature: Support PHP 8.1 release.
(#45 by @clue)
* Improve documentation to use fully-qualified function names.
(#43 by @SimonFrings and #42 by @PaulRotmann)
* Improve test suite and use GitHub actions for continuous integration (CI).
(#39 and #40 by @SimonFrings)
## 1.5.0 (2020-10-02)
* Feature: Improve performance by using global imports.
(#38 by @clue)
* Improve API documentation and add support / sponsorship info.
(#30 by @clue and #35 by @SimonFrings)
* Improve test suite and add `.gitattributes` to exclude dev files from exports.
Prepare PHP 8 support, update to PHPUnit 9 and simplify test matrix.
(#32 and #37 by @clue and #34 and #36 by @SimonFrings)
## 1.4.1 (2019-04-09)
* Fix: Check if the function is declared before declaring it.
(#23 by @Niko9911)
* Improve test suite to also test against PHP 7.2 and
add test for base64 encoding and decoding filters.
(#22 by @arubacao and #25 by @Nyholm and @clue)
## 1.4.0 (2017-08-18)
* Feature / Fix: The `fun()` function does not pass filter parameter `null`
to underlying `stream_filter_append()` by default
(#15 by @Nyholm)
Certain filters (such as `convert.quoted-printable-encode`) do not accept
a filter parameter at all. If no explicit filter parameter is given, we no
longer pass a default `null` value.
```php
$encode = Filter\fun('convert.quoted-printable-encode');
assert('t=C3=A4st' === $encode('täst'));
```
* Add examples and improve documentation
(#13 and #20 by @clue and #18 by @Nyholm)
* Improve test suite by adding PHPUnit to require-dev,
fix HHVM build for now again and ignore future HHVM build errors,
lock Travis distro so new future defaults will not break the build
and test on PHP 7.1
(#12, #14 and #19 by @clue and #16 by @Nyholm)
## 1.3.0 (2015-11-08)
* Feature: Support accessing built-in filters as callbacks
(#5 by @clue)
```php
$fun = Filter\fun('zlib.deflate');
$ret = $fun('hello') . $fun('world') . $fun();
assert('helloworld' === gzinflate($ret));
```
## 1.2.0 (2015-10-23)
* Feature: Invoke close event when closing filter (flush buffer)
(#9 by @clue)
## 1.1.0 (2015-10-22)
* Feature: Abort filter operation when catching an Exception
(#10 by @clue)
* Feature: Additional safeguards to prevent filter state corruption
(#7 by @clue)
## 1.0.0 (2015-10-18)
* First tagged release

View file

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2015 Christian Lück
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -1,326 +0,0 @@
# clue/stream-filter
[![CI status](https://github.com/clue/stream-filter/workflows/CI/badge.svg)](https://github.com/clue/stream-filter/actions)
[![installs on Packagist](https://img.shields.io/packagist/dt/clue/stream-filter?color=blue&label=installs%20on%20Packagist)](https://packagist.org/packages/clue/stream-filter)
A simple and modern approach to stream filtering in PHP
**Table of contents**
* [Why?](#why)
* [Support us](#support-us)
* [Usage](#usage)
* [append()](#append)
* [prepend()](#prepend)
* [fun()](#fun)
* [remove()](#remove)
* [Install](#install)
* [Tests](#tests)
* [License](#license)
## Why?
PHP's stream filtering system is great!
It offers very powerful stream filtering options and comes with a useful set of built-in filters.
These filters can be used to easily and efficiently perform various transformations on-the-fly, such as:
* read from a gzip'ed input file,
* transcode from ISO-8859-1 (Latin1) to UTF-8,
* write to a bzip output file
* and much more.
But let's face it:
Its API is [*difficult to work with*](https://www.php.net/manual/en/php-user-filter.filter.php)
and its documentation is [*subpar*](https://stackoverflow.com/questions/27103269/what-is-a-bucket-brigade).
This combined means its powerful features are often neglected.
This project aims to make these features more accessible to a broader audience.
* **Lightweight, SOLID design** -
Provides a thin abstraction that is [*just good enough*](https://en.wikipedia.org/wiki/Principle_of_good_enough)
and does not get in your way.
Custom filters require trivial effort.
* **Good test coverage** -
Comes with an automated tests suite and is regularly tested in the *real world*
## Support us
We invest a lot of time developing, maintaining and updating our awesome
open-source projects. You can help us sustain this high-quality of our work by
[becoming a sponsor on GitHub](https://github.com/sponsors/clue). Sponsors get
numerous benefits in return, see our [sponsoring page](https://github.com/sponsors/clue)
for details.
Let's take these projects to the next level together! 🚀
## Usage
This lightweight library consists only of a few simple functions.
All functions reside under the `Clue\StreamFilter` namespace.
The below examples refer to all functions with their fully-qualified names like this:
```php
Clue\StreamFilter\append(…);
```
As of PHP 5.6+ you can also import each required function into your code like this:
```php
use function Clue\StreamFilter\append;
append(…);
```
Alternatively, you can also use an import statement similar to this:
```php
use Clue\StreamFilter as Filter;
Filter\append(…);
```
### append()
The `append(resource<stream> $stream, callable $callback, int $read_write = STREAM_FILTER_ALL): resource<stream filter>` function can be used to
append a filter callback to the given stream.
Each stream can have a list of filters attached.
This function appends a filter to the end of this list.
If the given filter can not be added, it throws an `Exception`.
The `$stream` can be any valid stream resource, such as:
```php
$stream = fopen('demo.txt', 'w+');
```
The `$callback` should be a valid callable function which accepts
an individual chunk of data and should return the updated chunk:
```php
$filter = Clue\StreamFilter\append($stream, function ($chunk) {
// will be called each time you read or write a $chunk to/from the stream
return $chunk;
});
```
As such, you can also use native PHP functions or any other `callable`:
```php
Clue\StreamFilter\append($stream, 'strtoupper');
// will write "HELLO" to the underlying stream
fwrite($stream, 'hello');
```
If the `$callback` accepts invocation without parameters,
then this signature will be invoked once ending (flushing) the filter:
```php
Clue\StreamFilter\append($stream, function ($chunk = null) {
if ($chunk === null) {
// will be called once ending the filter
return 'end';
}
// will be called each time you read or write a $chunk to/from the stream
return $chunk;
});
fclose($stream);
```
> Note: Legacy PHP versions (PHP < 5.4) do not support passing additional data
from the end signal handler if the stream is being closed.
If your callback throws an `Exception`, then the filter process will be aborted.
In order to play nice with PHP's stream handling,
the `Exception` will be transformed to a PHP warning instead:
```php
Clue\StreamFilter\append($stream, function ($chunk) {
throw new \RuntimeException('Unexpected chunk');
});
// raises an E_USER_WARNING with "Error invoking filter: Unexpected chunk"
fwrite($stream, 'hello');
```
The optional `$read_write` parameter can be used to only invoke the `$callback`
when either writing to the stream or only when reading from the stream:
```php
Clue\StreamFilter\append($stream, function ($chunk) {
// will be called each time you write to the stream
return $chunk;
}, STREAM_FILTER_WRITE);
Clue\StreamFilter\append($stream, function ($chunk) {
// will be called each time you read from the stream
return $chunk;
}, STREAM_FILTER_READ);
```
This function returns a filter resource which can be passed to [`remove()`](#remove).
> Note that once a filter has been added to stream, the stream can no longer be passed to
> [`stream_select()`](https://www.php.net/manual/en/function.stream-select.php)
> (and family).
>
> > Warning: stream_select(): cannot cast a filtered stream on this system in {file} on line {line}
>
> This is due to limitations of PHP's stream filter support, as it can no longer reliably
> tell when the underlying stream resource is actually ready.
> As an alternative, consider calling `stream_select()` on the unfiltered stream and
> then pass the unfiltered data through the [`fun()`](#fun) function.
### prepend()
The `prepend(resource<stream> $stream, callable $callback, int $read_write = STREAM_FILTER_ALL): resource<stream filter>` function can be used to
prepend a filter callback to the given stream.
Each stream can have a list of filters attached.
This function prepends a filter to the start of this list.
If the given filter can not be added, it throws an `Exception`.
```php
$filter = Clue\StreamFilter\prepend($stream, function ($chunk) {
// will be called each time you read or write a $chunk to/from the stream
return $chunk;
});
```
This function returns a filter resource which can be passed to [`remove()`](#remove).
Except for the position in the list of filters, this function behaves exactly
like the [`append()`](#append) function.
For more details about its behavior, see also the [`append()`](#append) function.
### fun()
The `fun(string $filter, mixed $parameters = null): callable` function can be used to
create a filter function which uses the given built-in `$filter`.
PHP comes with a useful set of [built-in filters](https://www.php.net/manual/en/filters.php).
Using `fun()` makes accessing these as easy as passing an input string to filter
and getting the filtered output string.
```php
$fun = Clue\StreamFilter\fun('string.rot13');
assert('grfg' === $fun('test'));
assert('test' === $fun($fun('test'));
```
Please note that not all filter functions may be available depending
on installed PHP extensions and the PHP version in use.
In particular, [HHVM](https://hhvm.com/) may not offer the same filter functions
or parameters as Zend PHP.
Accessing an unknown filter function will result in a `RuntimeException`:
```php
Clue\StreamFilter\fun('unknown'); // throws RuntimeException
```
Some filters may accept or require additional filter parameters most
filters do not require filter parameters.
If given, the optional `$parameters` argument will be passed to the
underlying filter handler as-is.
In particular, note how *not passing* this parameter at all differs from
explicitly passing a `null` value (which many filters do not accept).
Please refer to the individual filter definition for more details.
For example, the `string.strip_tags` filter can be invoked like this:
```php
$fun = Clue\StreamFilter\fun('string.strip_tags', '<a><b>');
$ret = $fun('<b>h<br>i</b>');
assert('<b>hi</b>' === $ret);
```
Under the hood, this function allocates a temporary memory stream, so it's
recommended to clean up the filter function after use.
Also, some filter functions (in particular the
[zlib compression filters](https://www.php.net/manual/en/filters.compression.php))
may use internal buffers and may emit a final data chunk on close.
The filter function can be closed by invoking without any arguments:
```php
$fun = Clue\StreamFilter\fun('zlib.deflate');
$ret = $fun('hello') . $fun('world') . $fun();
assert('helloworld' === gzinflate($ret));
```
The filter function must not be used anymore after it has been closed.
Doing so will result in a `RuntimeException`:
```php
$fun = Clue\StreamFilter\fun('string.rot13');
$fun();
$fun('test'); // throws RuntimeException
```
> Note: If you're using the zlib compression filters, then you should be wary
about engine inconsistencies between different PHP versions and HHVM.
These inconsistencies exist in the underlying PHP engines and there's little we
can do about this in this library.
[Our test suite](tests/) contains several test cases that exhibit these issues.
If you feel some test case is missing or outdated, we're happy to accept PRs! :)
### remove()
The `remove(resource<stream filter> $filter): bool` function can be used to
remove a filter previously added via [`append()`](#append) or [`prepend()`](#prepend).
```php
$filter = Clue\StreamFilter\append($stream, function () {
// …
});
Clue\StreamFilter\remove($filter);
```
## Install
The recommended way to install this library is [through Composer](https://getcomposer.org/).
[New to Composer?](https://getcomposer.org/doc/00-intro.md)
This project follows [SemVer](https://semver.org/).
This will install the latest supported version:
```bash
$ composer require clue/stream-filter:^1.6
```
See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.
This project aims to run on any platform and thus does not require any PHP
extensions and supports running on legacy PHP 5.3 through current PHP 8+ and
HHVM.
It's *highly recommended to use the latest supported PHP version* for this project.
Older PHP versions may suffer from a number of inconsistencies documented above.
## Tests
To run the test suite, you first need to clone this repo and then install all
dependencies [through Composer](https://getcomposer.org/):
```bash
$ composer install
```
To run the test suite, go to the project root and run:
```bash
$ vendor/bin/phpunit
```
## License
This project is released under the permissive [MIT license](LICENSE).
> Did you know that I offer custom development services and issuing invoices for
sponsorships of releases and for contributions? Contact me (@clue) for details.

View file

@ -1,26 +0,0 @@
{
"name": "clue/stream-filter",
"description": "A simple and modern approach to stream filtering in PHP",
"keywords": ["stream", "callback", "filter", "php_user_filter", "stream_filter_append", "stream_filter_register", "bucket brigade"],
"homepage": "https://github.com/clue/php-stream-filter",
"license": "MIT",
"authors": [
{
"name": "Christian Lück",
"email": "christian@clue.engineering"
}
],
"require": {
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36"
},
"autoload": {
"psr-4": { "Clue\\StreamFilter\\": "src/" },
"files": [ "src/functions_include.php" ]
},
"autoload-dev": {
"psr-4": { "Clue\\Tests\\StreamFilter\\": "tests/" }
}
}

View file

@ -1,120 +0,0 @@
<?php
namespace Clue\StreamFilter;
/**
* @internal
* @see append()
* @see prepend()
*/
class CallbackFilter extends \php_user_filter
{
private $callback;
private $closed = true;
private $supportsClose = false;
/** @return bool */
#[\ReturnTypeWillChange]
public function onCreate()
{
$this->closed = false;
if (!\is_callable($this->params)) {
throw new \InvalidArgumentException('No valid callback parameter given to stream_filter_(append|prepend)');
}
$this->callback = $this->params;
// callback supports end event if it accepts invocation without arguments
$ref = new \ReflectionFunction($this->callback);
$this->supportsClose = ($ref->getNumberOfRequiredParameters() === 0);
return true;
}
/** @return void */
#[\ReturnTypeWillChange]
public function onClose()
{
$this->closed = true;
// callback supports closing and is not already closed
if ($this->supportsClose) {
$this->supportsClose = false;
// invoke without argument to signal end and discard resulting buffer
try {
\call_user_func($this->callback);
} catch (\Exception $ignored) {
// this might be called during engine shutdown, so it's not safe
// to raise any errors or exceptions here
// trigger_error('Error closing filter: ' . $ignored->getMessage(), E_USER_WARNING);
}
}
$this->callback = null;
}
/** @return int */
#[\ReturnTypeWillChange]
public function filter($in, $out, &$consumed, $closing)
{
// concatenate whole buffer from input brigade
$data = '';
while ($bucket = \stream_bucket_make_writeable($in)) {
$consumed += $bucket->datalen;
$data .= $bucket->data;
}
// skip processing callback that already ended
if ($this->closed) {
return \PSFS_FEED_ME;
}
// only invoke filter function if buffer is not empty
// this may skip flushing a closing filter
if ($data !== '') {
try {
$data = \call_user_func($this->callback, $data);
} catch (\Exception $e) {
// exception should mark filter as closed
$this->onClose();
\trigger_error('Error invoking filter: ' . $e->getMessage(), \E_USER_WARNING);
return \PSFS_ERR_FATAL;
}
}
// mark filter as closed after processing closing chunk
if ($closing) {
$this->closed = true;
// callback supports closing and is not already closed
if ($this->supportsClose) {
$this->supportsClose = false;
// invoke without argument to signal end and append resulting buffer
try {
$data .= \call_user_func($this->callback);
} catch (\Exception $e) {
\trigger_error('Error ending filter: ' . $e->getMessage(), \E_USER_WARNING);
return \PSFS_ERR_FATAL;
}
}
}
if ($data !== '') {
// create a new bucket for writing the resulting buffer to the output brigade
// reusing an existing bucket turned out to be bugged in some environments (ancient PHP versions and HHVM)
$bucket = @\stream_bucket_new($this->stream, $data);
// legacy PHP versions (PHP < 5.4) do not support passing data from the event signal handler
// because closing the stream invalidates the stream and its stream bucket brigade before
// invoking the filter close handler.
if ($bucket !== false) {
\stream_bucket_append($out, $bucket);
}
}
return \PSFS_PASS_ON;
}
}

View file

@ -1,327 +0,0 @@
<?php
namespace Clue\StreamFilter;
/**
* Append a filter callback to the given stream.
*
* Each stream can have a list of filters attached.
* This function appends a filter to the end of this list.
*
* If the given filter can not be added, it throws an `Exception`.
*
* The `$stream` can be any valid stream resource, such as:
*
* ```php
* $stream = fopen('demo.txt', 'w+');
* ```
*
* The `$callback` should be a valid callable function which accepts
* an individual chunk of data and should return the updated chunk:
*
* ```php
* $filter = Clue\StreamFilter\append($stream, function ($chunk) {
* // will be called each time you read or write a $chunk to/from the stream
* return $chunk;
* });
* ```
*
* As such, you can also use native PHP functions or any other `callable`:
*
* ```php
* Clue\StreamFilter\append($stream, 'strtoupper');
*
* // will write "HELLO" to the underlying stream
* fwrite($stream, 'hello');
* ```
*
* If the `$callback` accepts invocation without parameters,
* then this signature will be invoked once ending (flushing) the filter:
*
* ```php
* Clue\StreamFilter\append($stream, function ($chunk = null) {
* if ($chunk === null) {
* // will be called once ending the filter
* return 'end';
* }
* // will be called each time you read or write a $chunk to/from the stream
* return $chunk;
* });
*
* fclose($stream);
* ```
*
* > Note: Legacy PHP versions (PHP < 5.4) do not support passing additional data
* from the end signal handler if the stream is being closed.
*
* If your callback throws an `Exception`, then the filter process will be aborted.
* In order to play nice with PHP's stream handling,
* the `Exception` will be transformed to a PHP warning instead:
*
* ```php
* Clue\StreamFilter\append($stream, function ($chunk) {
* throw new \RuntimeException('Unexpected chunk');
* });
*
* // raises an E_USER_WARNING with "Error invoking filter: Unexpected chunk"
* fwrite($stream, 'hello');
* ```
*
* The optional `$read_write` parameter can be used to only invoke the `$callback`
* when either writing to the stream or only when reading from the stream:
*
* ```php
* Clue\StreamFilter\append($stream, function ($chunk) {
* // will be called each time you write to the stream
* return $chunk;
* }, STREAM_FILTER_WRITE);
*
* Clue\StreamFilter\append($stream, function ($chunk) {
* // will be called each time you read from the stream
* return $chunk;
* }, STREAM_FILTER_READ);
* ```
*
* This function returns a filter resource which can be passed to [`remove()`](#remove).
*
* > Note that once a filter has been added to stream, the stream can no longer be passed to
* > [`stream_select()`](https://www.php.net/manual/en/function.stream-select.php)
* > (and family).
* >
* > > Warning: stream_select(): cannot cast a filtered stream on this system in {file} on line {line}
* >
* > This is due to limitations of PHP's stream filter support, as it can no longer reliably
* > tell when the underlying stream resource is actually ready.
* > As an alternative, consider calling `stream_select()` on the unfiltered stream and
* > then pass the unfiltered data through the [`fun()`](#fun) function.
*
* @param resource $stream
* @param callable $callback
* @param int $read_write
* @return resource filter resource which can be used for `remove()`
* @throws \Exception on error
* @uses stream_filter_append()
*/
function append($stream, $callback, $read_write = STREAM_FILTER_ALL)
{
$ret = @\stream_filter_append($stream, register(), $read_write, $callback);
// PHP 8 throws above on type errors, older PHP and memory issues can throw here
// @codeCoverageIgnoreStart
if ($ret === false) {
$error = \error_get_last() + array('message' => '');
throw new \RuntimeException('Unable to append filter: ' . $error['message']);
}
// @codeCoverageIgnoreEnd
return $ret;
}
/**
* Prepend a filter callback to the given stream.
*
* Each stream can have a list of filters attached.
* This function prepends a filter to the start of this list.
*
* If the given filter can not be added, it throws an `Exception`.
*
* ```php
* $filter = Clue\StreamFilter\prepend($stream, function ($chunk) {
* // will be called each time you read or write a $chunk to/from the stream
* return $chunk;
* });
* ```
*
* This function returns a filter resource which can be passed to [`remove()`](#remove).
*
* Except for the position in the list of filters, this function behaves exactly
* like the [`append()`](#append) function.
* For more details about its behavior, see also the [`append()`](#append) function.
*
* @param resource $stream
* @param callable $callback
* @param int $read_write
* @return resource filter resource which can be used for `remove()`
* @throws \Exception on error
* @uses stream_filter_prepend()
*/
function prepend($stream, $callback, $read_write = STREAM_FILTER_ALL)
{
$ret = @\stream_filter_prepend($stream, register(), $read_write, $callback);
// PHP 8 throws above on type errors, older PHP and memory issues can throw here
// @codeCoverageIgnoreStart
if ($ret === false) {
$error = \error_get_last() + array('message' => '');
throw new \RuntimeException('Unable to prepend filter: ' . $error['message']);
}
// @codeCoverageIgnoreEnd
return $ret;
}
/**
* Create a filter function which uses the given built-in `$filter`.
*
* PHP comes with a useful set of [built-in filters](https://www.php.net/manual/en/filters.php).
* Using `fun()` makes accessing these as easy as passing an input string to filter
* and getting the filtered output string.
*
* ```php
* $fun = Clue\StreamFilter\fun('string.rot13');
*
* assert('grfg' === $fun('test'));
* assert('test' === $fun($fun('test'));
* ```
*
* Please note that not all filter functions may be available depending
* on installed PHP extensions and the PHP version in use.
* In particular, [HHVM](https://hhvm.com/) may not offer the same filter functions
* or parameters as Zend PHP.
* Accessing an unknown filter function will result in a `RuntimeException`:
*
* ```php
* Clue\StreamFilter\fun('unknown'); // throws RuntimeException
* ```
*
* Some filters may accept or require additional filter parameters most
* filters do not require filter parameters.
* If given, the optional `$parameters` argument will be passed to the
* underlying filter handler as-is.
* In particular, note how *not passing* this parameter at all differs from
* explicitly passing a `null` value (which many filters do not accept).
* Please refer to the individual filter definition for more details.
* For example, the `string.strip_tags` filter can be invoked like this:
*
* ```php
* $fun = Clue\StreamFilter\fun('string.strip_tags', '<a><b>');
*
* $ret = $fun('<b>h<br>i</b>');
* assert('<b>hi</b>' === $ret);
* ```
*
* Under the hood, this function allocates a temporary memory stream, so it's
* recommended to clean up the filter function after use.
* Also, some filter functions (in particular the
* [zlib compression filters](https://www.php.net/manual/en/filters.compression.php))
* may use internal buffers and may emit a final data chunk on close.
* The filter function can be closed by invoking without any arguments:
*
* ```php
* $fun = Clue\StreamFilter\fun('zlib.deflate');
*
* $ret = $fun('hello') . $fun('world') . $fun();
* assert('helloworld' === gzinflate($ret));
* ```
*
* The filter function must not be used anymore after it has been closed.
* Doing so will result in a `RuntimeException`:
*
* ```php
* $fun = Clue\StreamFilter\fun('string.rot13');
* $fun();
*
* $fun('test'); // throws RuntimeException
* ```
*
* > Note: If you're using the zlib compression filters, then you should be wary
* about engine inconsistencies between different PHP versions and HHVM.
* These inconsistencies exist in the underlying PHP engines and there's little we
* can do about this in this library.
* [Our test suite](tests/) contains several test cases that exhibit these issues.
* If you feel some test case is missing or outdated, we're happy to accept PRs! :)
*
* @param string $filter built-in filter name. See stream_get_filters() or http://php.net/manual/en/filters.php
* @param mixed $parameters (optional) parameters to pass to the built-in filter as-is
* @return callable a filter callback which can be append()'ed or prepend()'ed
* @throws \RuntimeException on error
* @link http://php.net/manual/en/filters.php
* @see stream_get_filters()
* @see append()
*/
function fun($filter, $parameters = null)
{
$fp = \fopen('php://memory', 'w');
if (\func_num_args() === 1) {
$filter = @\stream_filter_append($fp, $filter, \STREAM_FILTER_WRITE);
} else {
$filter = @\stream_filter_append($fp, $filter, \STREAM_FILTER_WRITE, $parameters);
}
if ($filter === false) {
\fclose($fp);
$error = \error_get_last() + array('message' => '');
throw new \RuntimeException('Unable to access built-in filter: ' . $error['message']);
}
// append filter function which buffers internally
$buffer = '';
append($fp, function ($chunk) use (&$buffer) {
$buffer .= $chunk;
// always return empty string in order to skip actually writing to stream resource
return '';
}, \STREAM_FILTER_WRITE);
$closed = false;
return function ($chunk = null) use ($fp, $filter, &$buffer, &$closed) {
if ($closed) {
throw new \RuntimeException('Unable to perform operation on closed stream');
}
if ($chunk === null) {
$closed = true;
$buffer = '';
\fclose($fp);
return $buffer;
}
// initialize buffer and invoke filters by attempting to write to stream
$buffer = '';
\fwrite($fp, $chunk);
// buffer now contains everything the filter function returned
return $buffer;
};
}
/**
* Remove a filter previously added via `append()` or `prepend()`.
*
* ```php
* $filter = Clue\StreamFilter\append($stream, function () {
* // …
* });
* Clue\StreamFilter\remove($filter);
* ```
*
* @param resource $filter
* @return bool true on success or false on error
* @throws \RuntimeException on error
* @uses stream_filter_remove()
*/
function remove($filter)
{
if (@\stream_filter_remove($filter) === false) {
// PHP 8 throws above on type errors, older PHP and memory issues can throw here
$error = \error_get_last();
throw new \RuntimeException('Unable to remove filter: ' . $error['message']);
}
}
/**
* Registers the callback filter and returns the resulting filter name
*
* There should be little reason to call this function manually.
*
* @return string filter name
* @uses CallbackFilter
*/
function register()
{
static $registered = null;
if ($registered === null) {
$registered = 'stream-callback';
\stream_filter_register($registered, __NAMESPACE__ . '\CallbackFilter');
}
return $registered;
}

View file

@ -1,6 +0,0 @@
<?php
// @codeCoverageIgnoreStart
if (!\function_exists('Clue\\StreamFilter\\append')) {
require __DIR__ . '/functions.php';
}

View file

@ -42,75 +42,30 @@ namespace Composer\Autoload;
*/
class ClassLoader
{
/** @var ?string */
private $vendorDir;
// PSR-4
/**
* @var array[]
* @psalm-var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, array<int, string>>
*/
private $prefixDirsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, string>
*/
private $fallbackDirsPsr4 = array();
// PSR-0
/**
* @var array[]
* @psalm-var array<string, array<string, string[]>>
*/
private $prefixesPsr0 = array();
/**
* @var array[]
* @psalm-var array<string, string>
*/
private $fallbackDirsPsr0 = array();
/** @var bool */
private $useIncludePath = false;
/**
* @var string[]
* @psalm-var array<string, string>
*/
private $classMap = array();
/** @var bool */
private $classMapAuthoritative = false;
/**
* @var bool[]
* @psalm-var array<string, bool>
*/
private $missingClasses = array();
/** @var ?string */
private $apcuPrefix;
/**
* @var self[]
*/
private static $registeredLoaders = array();
/**
* @param ?string $vendorDir
*/
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
}
/**
* @return string[]
*/
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
@ -120,47 +75,28 @@ class ClassLoader
return array();
}
/**
* @return array[]
* @psalm-return array<string, array<int, string>>
*/
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
/**
* @return array[]
* @psalm-return array<string, string>
*/
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
/**
* @return array[]
* @psalm-return array<string, string>
*/
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
/**
* @return string[] Array of classname => path
* @psalm-return array<string, string>
*/
public function getClassMap()
{
return $this->classMap;
}
/**
* @param string[] $classMap Class to filename map
* @psalm-param array<string, string> $classMap
*
* @return void
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
@ -176,10 +112,8 @@ class ClassLoader
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 root directories
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*
* @return void
*/
public function add($prefix, $paths, $prepend = false)
{
@ -223,12 +157,10 @@ class ClassLoader
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
@ -273,9 +205,7 @@ class ClassLoader
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 base directories
*
* @return void
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
@ -291,11 +221,9 @@ class ClassLoader
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function setPsr4($prefix, $paths)
{
@ -315,8 +243,6 @@ class ClassLoader
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*
* @return void
*/
public function setUseIncludePath($useIncludePath)
{
@ -339,8 +265,6 @@ class ClassLoader
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*
* @return void
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
@ -361,8 +285,6 @@ class ClassLoader
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*
* @return void
*/
public function setApcuPrefix($apcuPrefix)
{
@ -383,8 +305,6 @@ class ClassLoader
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*
* @return void
*/
public function register($prepend = false)
{
@ -404,8 +324,6 @@ class ClassLoader
/**
* Unregisters this instance as an autoloader.
*
* @return void
*/
public function unregister()
{
@ -420,7 +338,7 @@ class ClassLoader
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return true|null True if loaded, null otherwise
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
@ -429,8 +347,6 @@ class ClassLoader
return true;
}
return null;
}
/**
@ -485,11 +401,6 @@ class ClassLoader
return self::$registeredLoaders;
}
/**
* @param string $class
* @param string $ext
* @return string|false
*/
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
@ -561,10 +472,6 @@ class ClassLoader
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*
* @param string $file
* @return void
* @private
*/
function includeFile($file)
{

View file

@ -1,350 +1,512 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer;
use Composer\Autoload\ClassLoader;
use Composer\Semver\VersionParser;
/**
* This class is copied in every Composer installed project and available to all
*
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require its presence, you can require `composer-runtime-api ^2.0`
*/
class InstalledVersions
{
/**
* @var mixed[]|null
* @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
*/
private static $installed;
private static $installed = array (
'root' =>
array (
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'aliases' =>
array (
),
'reference' => '56e4f7e7ff00c70c04c56fb74af24e134a0e0ec9',
'name' => '__root__',
),
'versions' =>
array (
'__root__' =>
array (
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'aliases' =>
array (
),
'reference' => '56e4f7e7ff00c70c04c56fb74af24e134a0e0ec9',
),
'composer/ca-bundle' =>
array (
'pretty_version' => '1.3.1',
'version' => '1.3.1.0',
'aliases' =>
array (
),
'reference' => '4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b',
),
'dealerdirect/phpcodesniffer-composer-installer' =>
array (
'pretty_version' => 'v0.7.2',
'version' => '0.7.2.0',
'aliases' =>
array (
),
'reference' => '1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db',
),
'embed/embed' =>
array (
'pretty_version' => 'v4.4.3',
'version' => '4.4.3.0',
'aliases' =>
array (
),
'reference' => '2ac32581a8617c3bbe593e3d7799ca9db6974471',
),
'gettext/gettext' =>
array (
'pretty_version' => 'v5.6.1',
'version' => '5.6.1.0',
'aliases' =>
array (
),
'reference' => '017e249601d32b9a88c2eb4c10eac89bf582a7d3',
),
'gettext/languages' =>
array (
'pretty_version' => '2.9.0',
'version' => '2.9.0.0',
'aliases' =>
array (
),
'reference' => 'ed56dd2c7f4024cc953ed180d25f02f2640e3ffa',
),
'grandel/include-directory' =>
array (
'pretty_version' => 'v0.2.2',
'version' => '0.2.2.0',
'aliases' =>
array (
),
'reference' => 'a5c830e8f1527c818b521ab18f2accecb02f9919',
),
'guzzlehttp/guzzle' =>
array (
'pretty_version' => '7.4.1',
'version' => '7.4.1.0',
'aliases' =>
array (
),
'reference' => 'ee0a041b1760e6a53d2a39c8c34115adc2af2c79',
),
'guzzlehttp/promises' =>
array (
'pretty_version' => '1.5.1',
'version' => '1.5.1.0',
'aliases' =>
array (
),
'reference' => 'fe752aedc9fd8fcca3fe7ad05d419d32998a06da',
),
'guzzlehttp/psr7' =>
array (
'pretty_version' => '2.1.0',
'version' => '2.1.0.0',
'aliases' =>
array (
),
'reference' => '089edd38f5b8abba6cb01567c2a8aaa47cec4c72',
),
'http-interop/http-factory-guzzle' =>
array (
'pretty_version' => '1.2.0',
'version' => '1.2.0.0',
'aliases' =>
array (
),
'reference' => '8f06e92b95405216b237521cc64c804dd44c4a81',
),
'laminas/laminas-diactoros' =>
array (
'pretty_version' => '2.8.0',
'version' => '2.8.0.0',
'aliases' =>
array (
),
'reference' => '0c26ef1d95b6d7e6e3943a243ba3dc0797227199',
),
'ml/iri' =>
array (
'pretty_version' => '1.1.4',
'version' => '1.1.4.0',
'aliases' =>
array (
),
'reference' => 'cbd44fa913e00ea624241b38cefaa99da8d71341',
),
'ml/json-ld' =>
array (
'pretty_version' => '1.2.0',
'version' => '1.2.0.0',
'aliases' =>
array (
),
'reference' => 'c74a1aed5979ed1cfb1be35a55a305fd30e30b93',
),
'oscarotero/html-parser' =>
array (
'pretty_version' => 'v0.1.6',
'version' => '0.1.6.0',
'aliases' =>
array (
),
'reference' => 'b61e92f634d0dc184339d24630a6968d3ac64ded',
),
'psr/http-client' =>
array (
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'aliases' =>
array (
),
'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621',
),
'psr/http-client-implementation' =>
array (
'provided' =>
array (
0 => '1.0',
),
),
'psr/http-factory' =>
array (
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'aliases' =>
array (
),
'reference' => '12ac7fcd07e5b077433f5f2bee95b3a771bf61be',
),
'psr/http-factory-implementation' =>
array (
'provided' =>
array (
0 => '1.0',
1 => '^1.0',
),
),
'psr/http-message' =>
array (
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'aliases' =>
array (
),
'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363',
),
'psr/http-message-implementation' =>
array (
'provided' =>
array (
0 => '1.0',
),
),
'qferr/mjml-php' =>
array (
'pretty_version' => '1.1.0',
'version' => '1.1.0.0',
'aliases' =>
array (
),
'reference' => 'c6ea36c190e304e399a957f7e03b5a378faf41b9',
),
'ralouphie/getallheaders' =>
array (
'pretty_version' => '3.0.3',
'version' => '3.0.3.0',
'aliases' =>
array (
),
'reference' => '120b605dfeb996808c31b6477290a714d356e822',
),
'squizlabs/php_codesniffer' =>
array (
'pretty_version' => '3.6.2',
'version' => '3.6.2.0',
'aliases' =>
array (
),
'reference' => '5e4e71592f69da17871dba6e80dd51bce74a351a',
),
'symfony/deprecation-contracts' =>
array (
'pretty_version' => 'v3.0.0',
'version' => '3.0.0.0',
'aliases' =>
array (
),
'reference' => 'c726b64c1ccfe2896cb7df2e1331c357ad1c8ced',
),
'symfony/polyfill-php80' =>
array (
'pretty_version' => 'v1.25.0',
'version' => '1.25.0.0',
'aliases' =>
array (
),
'reference' => '4407588e0d3f1f52efb65fbe92babe41f37fe50c',
),
'symfony/process' =>
array (
'pretty_version' => 'v5.4.5',
'version' => '5.4.5.0',
'aliases' =>
array (
),
'reference' => '95440409896f90a5f85db07a32b517ecec17fa4c',
),
),
);
private static $canGetVendors;
private static $installedByVendor = array();
/**
* @var bool|null
*/
private static $canGetVendors;
/**
* @var array[]
* @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
*/
private static $installedByVendor = array();
/**
* Returns a list of all package names which are present, either by being installed, replaced or provided
*
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackages()
{
$packages = array();
foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']);
}
if (1 === \count($packages)) {
return $packages[0];
}
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}
/**
* Returns a list of all package names with a specific type e.g. 'library'
*
* @param string $type
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackagesByType($type)
{
$packagesByType = array();
foreach (self::getInstalled() as $installed) {
foreach ($installed['versions'] as $name => $package) {
if (isset($package['type']) && $package['type'] === $type) {
$packagesByType[] = $name;
}
}
}
return $packagesByType;
}
/**
* Checks whether the given package is installed
*
* This also returns true if the package name is provided or replaced by another package
*
* @param string $packageName
* @param bool $includeDevRequirements
* @return bool
*/
public static function isInstalled($packageName, $includeDevRequirements = true)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
}
}
return false;
}
/**
* Checks whether the given package satisfies a version constraint
*
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
*
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
*
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
* @param string $packageName
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
* @return bool
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints($constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
/**
* Returns a version constraint representing all the range(s) which are installed for a given package
*
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
* whether a given version of a package is installed, and not just whether it exists
*
* @param string $packageName
* @return string Version constraint usable with composer/semver
*/
public static function getVersionRanges($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
$ranges = array();
if (isset($installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['version'])) {
return null;
}
return $installed['versions'][$packageName]['version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getPrettyVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return $installed['versions'][$packageName]['pretty_version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
*/
public static function getReference($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}
return $installed['versions'][$packageName]['reference'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
*/
public static function getInstallPath($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @return array
* @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
*/
public static function getRootPackage()
{
$installed = self::getInstalled();
return $installed[0]['root'];
}
/**
* Returns the raw installed.php data for custom implementations
*
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[]
* @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
*/
public static function getRawData()
{
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = include __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
return self::$installed;
}
/**
* Returns the raw data of all installed.php which are currently loaded for custom implementations
*
* @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
*/
public static function getAllRawData()
{
return self::getInstalled();
}
/**
* Lets you reload the static array from another file
*
* This is only useful for complex integrations in which a project needs to use
* this class but then also needs to execute another project's autoloader in process,
* and wants to ensure both projects have access to their version of installed.php.
*
* A typical case would be PHPUnit, where it would need to make sure it reads all
* the data it needs from this class, then call reload() with
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
* the project in which it runs can then also use this class safely, without
* interference between PHPUnit's dependencies and the project's dependencies.
*
* @param array[] $data A vendor/composer/installed.php data set
* @return void
*
* @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
*/
public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
}
/**
* @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
*/
private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
}
}
}
}
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = require __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
$installed[] = self::$installed;
return $installed;
}
public static function getInstalledPackages()
{
$packages = array();
foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']);
}
if (1 === \count($packages)) {
return $packages[0];
}
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}
public static function isInstalled($packageName)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return true;
}
}
return false;
}
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints($constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
public static function getVersionRanges($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
$ranges = array();
if (isset($installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
public static function getVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['version'])) {
return null;
}
return $installed['versions'][$packageName]['version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
public static function getPrettyVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return $installed['versions'][$packageName]['pretty_version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
public static function getReference($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}
return $installed['versions'][$packageName]['reference'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
public static function getRootPackage()
{
$installed = self::getInstalled();
return $installed[0]['root'];
}
public static function getRawData()
{
return self::$installed;
}
public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
}
private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
}
}
}
$installed[] = self::$installed;
return $installed;
}
}

View file

@ -7,9 +7,11 @@ $baseDir = dirname($vendorDir);
return array(
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
'9c67151ae59aff4788964ce8eb2a0f43' => $vendorDir . '/clue/stream-filter/src/functions_include.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'09fc349b549513bf7f4291502426f919' => $vendorDir . '/embed/embed/src/functions.php',
'07d7f1a47144818725fd8d91a907ac57' => $vendorDir . '/laminas/laminas-diactoros/src/functions/create_uploaded_file.php',
'da94ac5d3ca7d2dbab84ce561ce72bfd' => $vendorDir . '/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.php',
'3d97c8dcdfba8cb85d3b34f116bb248b' => $vendorDir . '/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.php',
@ -26,8 +28,4 @@ return array(
'cc8e14526dc240491e17a838cb78508c' => $vendorDir . '/laminas/laminas-diactoros/src/functions/normalize_server.legacy.php',
'786bf90caabc9e09b6ad4cc5ca8f0e30' => $vendorDir . '/laminas/laminas-diactoros/src/functions/normalize_uploaded_files.legacy.php',
'751a5a3f463e4be759be31748b61737c' => $vendorDir . '/laminas/laminas-diactoros/src/functions/parse_cookie_header.legacy.php',
'8cff32064859f4559445b89279f3199c' => $vendorDir . '/php-http/message/src/filters.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'09fc349b549513bf7f4291502426f919' => $vendorDir . '/embed/embed/src/functions.php',
);

View file

@ -8,31 +8,20 @@ $baseDir = dirname($vendorDir);
return array(
'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
'Symfony\\Component\\OptionsResolver\\' => array($vendorDir . '/symfony/options-resolver'),
'Qferrer\\' => array($vendorDir . '/qferr/mjml-php/src'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
'ML\\JsonLD\\' => array($vendorDir . '/ml/json-ld'),
'Laminas\\Diactoros\\' => array($vendorDir . '/laminas/laminas-diactoros/src'),
'Http\\Promise\\' => array($vendorDir . '/php-http/promise/src'),
'Http\\Message\\MultipartStream\\' => array($vendorDir . '/php-http/multipart-stream-builder/src'),
'Http\\Message\\' => array($vendorDir . '/php-http/message/src', $vendorDir . '/php-http/message-factory/src'),
'Http\\Factory\\Guzzle\\' => array($vendorDir . '/http-interop/http-factory-guzzle/src'),
'Http\\Discovery\\' => array($vendorDir . '/php-http/discovery/src'),
'Http\\Client\\Common\\Plugin\\' => array($vendorDir . '/php-http/cache-plugin/src'),
'Http\\Client\\Common\\' => array($vendorDir . '/php-http/client-common/src'),
'Http\\Client\\' => array($vendorDir . '/php-http/httplug/src'),
'HtmlParser\\' => array($vendorDir . '/oscarotero/html-parser/src'),
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
'Grandel\\' => array($vendorDir . '/grandel/include-directory/src'),
'Github\\' => array($vendorDir . '/knplabs/github-api/lib/Github'),
'Gettext\\Languages\\' => array($vendorDir . '/gettext/languages/src'),
'Gettext\\' => array($vendorDir . '/gettext/gettext/src'),
'Embed\\' => array($vendorDir . '/embed/embed/src'),
'Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' => array($vendorDir . '/dealerdirect/phpcodesniffer-composer-installer/src'),
'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
'Clue\\StreamFilter\\' => array($vendorDir . '/clue/stream-filter/src'),
);

View file

@ -65,16 +65,11 @@ class ComposerAutoloaderInit5f3db9fc1d0cf1dd6a77a1d84501b4b1
}
}
/**
* @param string $fileIdentifier
* @param string $file
* @return void
*/
function composerRequire5f3db9fc1d0cf1dd6a77a1d84501b4b1($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}

View file

@ -8,9 +8,11 @@ class ComposerStaticInit5f3db9fc1d0cf1dd6a77a1d84501b4b1
{
public static $files = array (
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
'9c67151ae59aff4788964ce8eb2a0f43' => __DIR__ . '/..' . '/clue/stream-filter/src/functions_include.php',
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
'09fc349b549513bf7f4291502426f919' => __DIR__ . '/..' . '/embed/embed/src/functions.php',
'07d7f1a47144818725fd8d91a907ac57' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/create_uploaded_file.php',
'da94ac5d3ca7d2dbab84ce561ce72bfd' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.php',
'3d97c8dcdfba8cb85d3b34f116bb248b' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.php',
@ -27,10 +29,6 @@ class ComposerStaticInit5f3db9fc1d0cf1dd6a77a1d84501b4b1
'cc8e14526dc240491e17a838cb78508c' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/normalize_server.legacy.php',
'786bf90caabc9e09b6ad4cc5ca8f0e30' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/normalize_uploaded_files.legacy.php',
'751a5a3f463e4be759be31748b61737c' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/parse_cookie_header.legacy.php',
'8cff32064859f4559445b89279f3199c' => __DIR__ . '/..' . '/php-http/message/src/filters.php',
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
'09fc349b549513bf7f4291502426f919' => __DIR__ . '/..' . '/embed/embed/src/functions.php',
);
public static $prefixLengthsPsr4 = array (
@ -38,7 +36,6 @@ class ComposerStaticInit5f3db9fc1d0cf1dd6a77a1d84501b4b1
array (
'Symfony\\Polyfill\\Php80\\' => 23,
'Symfony\\Component\\Process\\' => 26,
'Symfony\\Component\\OptionsResolver\\' => 34,
),
'Q' =>
array (
@ -48,7 +45,6 @@ class ComposerStaticInit5f3db9fc1d0cf1dd6a77a1d84501b4b1
array (
'Psr\\Http\\Message\\' => 17,
'Psr\\Http\\Client\\' => 16,
'Psr\\Cache\\' => 10,
),
'M' =>
array (
@ -60,14 +56,7 @@ class ComposerStaticInit5f3db9fc1d0cf1dd6a77a1d84501b4b1
),
'H' =>
array (
'Http\\Promise\\' => 13,
'Http\\Message\\MultipartStream\\' => 29,
'Http\\Message\\' => 13,
'Http\\Factory\\Guzzle\\' => 20,
'Http\\Discovery\\' => 15,
'Http\\Client\\Common\\Plugin\\' => 26,
'Http\\Client\\Common\\' => 19,
'Http\\Client\\' => 12,
'HtmlParser\\' => 11,
),
'G' =>
@ -76,7 +65,6 @@ class ComposerStaticInit5f3db9fc1d0cf1dd6a77a1d84501b4b1
'GuzzleHttp\\Promise\\' => 19,
'GuzzleHttp\\' => 11,
'Grandel\\' => 8,
'Github\\' => 7,
'Gettext\\Languages\\' => 18,
'Gettext\\' => 8,
),
@ -91,7 +79,6 @@ class ComposerStaticInit5f3db9fc1d0cf1dd6a77a1d84501b4b1
'C' =>
array (
'Composer\\CaBundle\\' => 18,
'Clue\\StreamFilter\\' => 18,
),
);
@ -104,10 +91,6 @@ class ComposerStaticInit5f3db9fc1d0cf1dd6a77a1d84501b4b1
array (
0 => __DIR__ . '/..' . '/symfony/process',
),
'Symfony\\Component\\OptionsResolver\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/options-resolver',
),
'Qferrer\\' =>
array (
0 => __DIR__ . '/..' . '/qferr/mjml-php/src',
@ -121,10 +104,6 @@ class ComposerStaticInit5f3db9fc1d0cf1dd6a77a1d84501b4b1
array (
0 => __DIR__ . '/..' . '/psr/http-client/src',
),
'Psr\\Cache\\' =>
array (
0 => __DIR__ . '/..' . '/psr/cache/src',
),
'ML\\JsonLD\\' =>
array (
0 => __DIR__ . '/..' . '/ml/json-ld',
@ -133,39 +112,10 @@ class ComposerStaticInit5f3db9fc1d0cf1dd6a77a1d84501b4b1
array (
0 => __DIR__ . '/..' . '/laminas/laminas-diactoros/src',
),
'Http\\Promise\\' =>
array (
0 => __DIR__ . '/..' . '/php-http/promise/src',
),
'Http\\Message\\MultipartStream\\' =>
array (
0 => __DIR__ . '/..' . '/php-http/multipart-stream-builder/src',
),
'Http\\Message\\' =>
array (
0 => __DIR__ . '/..' . '/php-http/message/src',
1 => __DIR__ . '/..' . '/php-http/message-factory/src',
),
'Http\\Factory\\Guzzle\\' =>
array (
0 => __DIR__ . '/..' . '/http-interop/http-factory-guzzle/src',
),
'Http\\Discovery\\' =>
array (
0 => __DIR__ . '/..' . '/php-http/discovery/src',
),
'Http\\Client\\Common\\Plugin\\' =>
array (
0 => __DIR__ . '/..' . '/php-http/cache-plugin/src',
),
'Http\\Client\\Common\\' =>
array (
0 => __DIR__ . '/..' . '/php-http/client-common/src',
),
'Http\\Client\\' =>
array (
0 => __DIR__ . '/..' . '/php-http/httplug/src',
),
'HtmlParser\\' =>
array (
0 => __DIR__ . '/..' . '/oscarotero/html-parser/src',
@ -186,10 +136,6 @@ class ComposerStaticInit5f3db9fc1d0cf1dd6a77a1d84501b4b1
array (
0 => __DIR__ . '/..' . '/grandel/include-directory/src',
),
'Github\\' =>
array (
0 => __DIR__ . '/..' . '/knplabs/github-api/lib/Github',
),
'Gettext\\Languages\\' =>
array (
0 => __DIR__ . '/..' . '/gettext/languages/src',
@ -210,10 +156,6 @@ class ComposerStaticInit5f3db9fc1d0cf1dd6a77a1d84501b4b1
array (
0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
),
'Clue\\StreamFilter\\' =>
array (
0 => __DIR__ . '/..' . '/clue/stream-filter/src',
),
);
public static $prefixesPsr0 = array (

View file

@ -1,74 +1,5 @@
{
"packages": [
{
"name": "clue/stream-filter",
"version": "v1.6.0",
"version_normalized": "1.6.0.0",
"source": {
"type": "git",
"url": "https://github.com/clue/stream-filter.git",
"reference": "d6169430c7731d8509da7aecd0af756a5747b78e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/clue/stream-filter/zipball/d6169430c7731d8509da7aecd0af756a5747b78e",
"reference": "d6169430c7731d8509da7aecd0af756a5747b78e",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36"
},
"time": "2022-02-21T13:15:14+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"src/functions_include.php"
],
"psr-4": {
"Clue\\StreamFilter\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@clue.engineering"
}
],
"description": "A simple and modern approach to stream filtering in PHP",
"homepage": "https://github.com/clue/php-stream-filter",
"keywords": [
"bucket brigade",
"callback",
"filter",
"php_user_filter",
"stream",
"stream_filter_append",
"stream_filter_register"
],
"support": {
"issues": "https://github.com/clue/stream-filter/issues",
"source": "https://github.com/clue/stream-filter/tree/v1.6.0"
},
"funding": [
{
"url": "https://clue.engineering/support",
"type": "custom"
},
{
"url": "https://github.com/clue",
"type": "github"
}
],
"install-path": "../clue/stream-filter"
},
{
"name": "composer/ca-bundle",
"version": "1.3.1",
@ -908,97 +839,6 @@
},
"install-path": "../http-interop/http-factory-guzzle"
},
{
"name": "knplabs/github-api",
"version": "v3.5.1",
"version_normalized": "3.5.1.0",
"source": {
"type": "git",
"url": "https://github.com/KnpLabs/php-github-api.git",
"reference": "37b167998e8e1f318b3d99633675cfa007540565"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/KnpLabs/php-github-api/zipball/37b167998e8e1f318b3d99633675cfa007540565",
"reference": "37b167998e8e1f318b3d99633675cfa007540565",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": "^7.2.5 || ^8.0",
"php-http/cache-plugin": "^1.7.1",
"php-http/client-common": "^2.3",
"php-http/discovery": "^1.12",
"php-http/httplug": "^2.2",
"php-http/multipart-stream-builder": "^1.1.2",
"psr/cache": "^1.0|^2.0|^3.0",
"psr/http-client-implementation": "^1.0",
"psr/http-factory-implementation": "^1.0",
"psr/http-message": "^1.0",
"symfony/deprecation-contracts": "^2.2|^3.0",
"symfony/polyfill-php80": "^1.17"
},
"require-dev": {
"guzzlehttp/guzzle": "^7.2",
"guzzlehttp/psr7": "^1.7",
"http-interop/http-factory-guzzle": "^1.0",
"php-http/mock-client": "^1.4.1",
"phpstan/extension-installer": "^1.0.5",
"phpstan/phpstan": "^0.12.57",
"phpstan/phpstan-deprecation-rules": "^0.12.5",
"phpunit/phpunit": "^8.5 || ^9.4",
"symfony/cache": "^5.1.8",
"symfony/phpunit-bridge": "^5.2"
},
"time": "2022-02-19T11:15:46+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-2.x": "2.20.x-dev",
"dev-master": "3.4.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Github\\": "lib/Github/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "KnpLabs Team",
"homepage": "http://knplabs.com"
},
{
"name": "Thibault Duplessis",
"email": "thibault.duplessis@gmail.com",
"homepage": "http://ornicar.github.com"
}
],
"description": "GitHub API v3 client",
"homepage": "https://github.com/KnpLabs/php-github-api",
"keywords": [
"api",
"gh",
"gist",
"github"
],
"support": {
"issues": "https://github.com/KnpLabs/php-github-api/issues",
"source": "https://github.com/KnpLabs/php-github-api/tree/v3.5.1"
},
"funding": [
{
"url": "https://github.com/acrobat",
"type": "github"
}
],
"install-path": "../knplabs/github-api"
},
{
"name": "laminas/laminas-diactoros",
"version": "2.8.0",
@ -1267,593 +1107,6 @@
},
"install-path": "../oscarotero/html-parser"
},
{
"name": "php-http/cache-plugin",
"version": "1.7.5",
"version_normalized": "1.7.5.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/cache-plugin.git",
"reference": "63bc3f7242825c9a817db8f78e4c9703b0c471e2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/cache-plugin/zipball/63bc3f7242825c9a817db8f78e4c9703b0c471e2",
"reference": "63bc3f7242825c9a817db8f78e4c9703b0c471e2",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"php-http/client-common": "^1.9 || ^2.0",
"php-http/message-factory": "^1.0",
"psr/cache": "^1.0 || ^2.0 || ^3.0",
"symfony/options-resolver": "^2.6 || ^3.0 || ^4.0 || ^5.0 || ^6.0"
},
"require-dev": {
"phpspec/phpspec": "^5.1 || ^6.0"
},
"time": "2022-01-18T12:24:56+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.6-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Http\\Client\\Common\\Plugin\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "PSR-6 Cache plugin for HTTPlug",
"homepage": "http://httplug.io",
"keywords": [
"cache",
"http",
"httplug",
"plugin"
],
"support": {
"issues": "https://github.com/php-http/cache-plugin/issues",
"source": "https://github.com/php-http/cache-plugin/tree/1.7.5"
},
"install-path": "../php-http/cache-plugin"
},
{
"name": "php-http/client-common",
"version": "2.5.0",
"version_normalized": "2.5.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/client-common.git",
"reference": "d135751167d57e27c74de674d6a30cef2dc8e054"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/client-common/zipball/d135751167d57e27c74de674d6a30cef2dc8e054",
"reference": "d135751167d57e27c74de674d6a30cef2dc8e054",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"php-http/httplug": "^2.0",
"php-http/message": "^1.6",
"php-http/message-factory": "^1.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0",
"symfony/options-resolver": "~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0 || ^6.0",
"symfony/polyfill-php80": "^1.17"
},
"require-dev": {
"doctrine/instantiator": "^1.1",
"guzzlehttp/psr7": "^1.4",
"nyholm/psr7": "^1.2",
"phpspec/phpspec": "^5.1 || ^6.3 || ^7.1",
"phpspec/prophecy": "^1.10.2",
"phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3"
},
"suggest": {
"ext-json": "To detect JSON responses with the ContentTypePlugin",
"ext-libxml": "To detect XML responses with the ContentTypePlugin",
"php-http/cache-plugin": "PSR-6 Cache plugin",
"php-http/logger-plugin": "PSR-3 Logger plugin",
"php-http/stopwatch-plugin": "Symfony Stopwatch plugin"
},
"time": "2021-11-26T15:01:24+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Http\\Client\\Common\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "Common HTTP Client implementations and tools for HTTPlug",
"homepage": "http://httplug.io",
"keywords": [
"client",
"common",
"http",
"httplug"
],
"support": {
"issues": "https://github.com/php-http/client-common/issues",
"source": "https://github.com/php-http/client-common/tree/2.5.0"
},
"install-path": "../php-http/client-common"
},
{
"name": "php-http/discovery",
"version": "1.14.1",
"version_normalized": "1.14.1.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/discovery.git",
"reference": "de90ab2b41d7d61609f504e031339776bc8c7223"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/discovery/zipball/de90ab2b41d7d61609f504e031339776bc8c7223",
"reference": "de90ab2b41d7d61609f504e031339776bc8c7223",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"conflict": {
"nyholm/psr7": "<1.0"
},
"require-dev": {
"graham-campbell/phpspec-skip-example-extension": "^5.0",
"php-http/httplug": "^1.0 || ^2.0",
"php-http/message-factory": "^1.0",
"phpspec/phpspec": "^5.1 || ^6.1",
"puli/composer-plugin": "1.0.0-beta10"
},
"suggest": {
"php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories"
},
"time": "2021-09-18T07:57:46+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Http\\Discovery\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "Finds installed HTTPlug implementations and PSR-7 message factories",
"homepage": "http://php-http.org",
"keywords": [
"adapter",
"client",
"discovery",
"factory",
"http",
"message",
"psr7"
],
"support": {
"issues": "https://github.com/php-http/discovery/issues",
"source": "https://github.com/php-http/discovery/tree/1.14.1"
},
"install-path": "../php-http/discovery"
},
{
"name": "php-http/httplug",
"version": "2.3.0",
"version_normalized": "2.3.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/httplug.git",
"reference": "f640739f80dfa1152533976e3c112477f69274eb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/httplug/zipball/f640739f80dfa1152533976e3c112477f69274eb",
"reference": "f640739f80dfa1152533976e3c112477f69274eb",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"php-http/promise": "^1.1",
"psr/http-client": "^1.0",
"psr/http-message": "^1.0"
},
"require-dev": {
"friends-of-phpspec/phpspec-code-coverage": "^4.1",
"phpspec/phpspec": "^5.1 || ^6.0"
},
"time": "2022-02-21T09:52:22+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Http\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Eric GELOEN",
"email": "geloen.eric@gmail.com"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://sagikazarmark.hu"
}
],
"description": "HTTPlug, the HTTP client abstraction for PHP",
"homepage": "http://httplug.io",
"keywords": [
"client",
"http"
],
"support": {
"issues": "https://github.com/php-http/httplug/issues",
"source": "https://github.com/php-http/httplug/tree/2.3.0"
},
"install-path": "../php-http/httplug"
},
{
"name": "php-http/message",
"version": "1.13.0",
"version_normalized": "1.13.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/message.git",
"reference": "7886e647a30a966a1a8d1dad1845b71ca8678361"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/message/zipball/7886e647a30a966a1a8d1dad1845b71ca8678361",
"reference": "7886e647a30a966a1a8d1dad1845b71ca8678361",
"shasum": ""
},
"require": {
"clue/stream-filter": "^1.5",
"php": "^7.1 || ^8.0",
"php-http/message-factory": "^1.0.2",
"psr/http-message": "^1.0"
},
"provide": {
"php-http/message-factory-implementation": "1.0"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.6",
"ext-zlib": "*",
"guzzlehttp/psr7": "^1.0",
"laminas/laminas-diactoros": "^2.0",
"phpspec/phpspec": "^5.1 || ^6.3 || ^7.1",
"slim/slim": "^3.0"
},
"suggest": {
"ext-zlib": "Used with compressor/decompressor streams",
"guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories",
"laminas/laminas-diactoros": "Used with Diactoros Factories",
"slim/slim": "Used with Slim Framework PSR-7 implementation"
},
"time": "2022-02-11T13:41:14+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.10-dev"
}
},
"installation-source": "dist",
"autoload": {
"files": [
"src/filters.php"
],
"psr-4": {
"Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "HTTP Message related tools",
"homepage": "http://php-http.org",
"keywords": [
"http",
"message",
"psr-7"
],
"support": {
"issues": "https://github.com/php-http/message/issues",
"source": "https://github.com/php-http/message/tree/1.13.0"
},
"install-path": "../php-http/message"
},
{
"name": "php-http/message-factory",
"version": "v1.0.2",
"version_normalized": "1.0.2.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/message-factory.git",
"reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1",
"reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1",
"shasum": ""
},
"require": {
"php": ">=5.4",
"psr/http-message": "^1.0"
},
"time": "2015-12-19T14:08:53+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "Factory interfaces for PSR-7 HTTP Message",
"homepage": "http://php-http.org",
"keywords": [
"factory",
"http",
"message",
"stream",
"uri"
],
"support": {
"issues": "https://github.com/php-http/message-factory/issues",
"source": "https://github.com/php-http/message-factory/tree/master"
},
"install-path": "../php-http/message-factory"
},
{
"name": "php-http/multipart-stream-builder",
"version": "1.2.0",
"version_normalized": "1.2.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/multipart-stream-builder.git",
"reference": "11c1d31f72e01c738bbce9e27649a7cca829c30e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/11c1d31f72e01c738bbce9e27649a7cca829c30e",
"reference": "11c1d31f72e01c738bbce9e27649a7cca829c30e",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"php-http/discovery": "^1.7",
"php-http/message-factory": "^1.0.2",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0"
},
"require-dev": {
"nyholm/psr7": "^1.0",
"php-http/message": "^1.5",
"phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3"
},
"time": "2021-05-21T08:32:01+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Http\\Message\\MultipartStream\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com"
}
],
"description": "A builder class that help you create a multipart stream",
"homepage": "http://php-http.org",
"keywords": [
"factory",
"http",
"message",
"multipart stream",
"stream"
],
"support": {
"issues": "https://github.com/php-http/multipart-stream-builder/issues",
"source": "https://github.com/php-http/multipart-stream-builder/tree/1.2.0"
},
"install-path": "../php-http/multipart-stream-builder"
},
{
"name": "php-http/promise",
"version": "1.1.0",
"version_normalized": "1.1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/promise.git",
"reference": "4c4c1f9b7289a2ec57cde7f1e9762a5789506f88"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/promise/zipball/4c4c1f9b7289a2ec57cde7f1e9762a5789506f88",
"reference": "4c4c1f9b7289a2ec57cde7f1e9762a5789506f88",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"friends-of-phpspec/phpspec-code-coverage": "^4.3.2",
"phpspec/phpspec": "^5.1.2 || ^6.2"
},
"time": "2020-07-07T09:29:14+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Http\\Promise\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Joel Wurtz",
"email": "joel.wurtz@gmail.com"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "Promise used for asynchronous HTTP requests",
"homepage": "http://httplug.io",
"keywords": [
"promise"
],
"support": {
"issues": "https://github.com/php-http/promise/issues",
"source": "https://github.com/php-http/promise/tree/1.1.0"
},
"install-path": "../php-http/promise"
},
{
"name": "psr/cache",
"version": "3.0.0",
"version_normalized": "3.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/cache.git",
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
},
"time": "2021-02-03T23:26:27+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Psr\\Cache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for caching libraries",
"keywords": [
"cache",
"psr",
"psr-6"
],
"support": {
"source": "https://github.com/php-fig/cache/tree/3.0.0"
},
"install-path": "../psr/cache"
},
{
"name": "psr/http-client",
"version": "1.0.1",
@ -2243,76 +1496,6 @@
],
"install-path": "../symfony/deprecation-contracts"
},
{
"name": "symfony/options-resolver",
"version": "v6.0.3",
"version_normalized": "6.0.3.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
"reference": "51f7006670febe4cbcbae177cbffe93ff833250d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/51f7006670febe4cbcbae177cbffe93ff833250d",
"reference": "51f7006670febe4cbcbae177cbffe93ff833250d",
"shasum": ""
},
"require": {
"php": ">=8.0.2",
"symfony/deprecation-contracts": "^2.1|^3"
},
"time": "2022-01-02T09:55:41+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\OptionsResolver\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides an improved replacement for the array_replace PHP function",
"homepage": "https://symfony.com",
"keywords": [
"config",
"configuration",
"options"
],
"support": {
"source": "https://github.com/symfony/options-resolver/tree/v6.0.3"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"install-path": "../symfony/options-resolver"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.25.0",

View file

@ -1,363 +1,253 @@
<?php return array(
'root' => array(
<?php return array (
'root' =>
array (
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'a739fb797078662b318e799a9545755c6a03ce82',
'aliases' =>
array (
),
'reference' => '56e4f7e7ff00c70c04c56fb74af24e134a0e0ec9',
'name' => '__root__',
'dev' => true,
),
'versions' => array(
'__root__' => array(
'versions' =>
array (
'__root__' =>
array (
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'a739fb797078662b318e799a9545755c6a03ce82',
'dev_requirement' => false,
'aliases' =>
array (
),
'clue/stream-filter' => array(
'pretty_version' => 'v1.6.0',
'version' => '1.6.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../clue/stream-filter',
'aliases' => array(),
'reference' => 'd6169430c7731d8509da7aecd0af756a5747b78e',
'dev_requirement' => false,
'reference' => '56e4f7e7ff00c70c04c56fb74af24e134a0e0ec9',
),
'composer/ca-bundle' => array(
'composer/ca-bundle' =>
array (
'pretty_version' => '1.3.1',
'version' => '1.3.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/./ca-bundle',
'aliases' => array(),
'reference' => '4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b',
'dev_requirement' => false,
'aliases' =>
array (
),
'dealerdirect/phpcodesniffer-composer-installer' => array(
'reference' => '4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b',
),
'dealerdirect/phpcodesniffer-composer-installer' =>
array (
'pretty_version' => 'v0.7.2',
'version' => '0.7.2.0',
'type' => 'composer-plugin',
'install_path' => __DIR__ . '/../dealerdirect/phpcodesniffer-composer-installer',
'aliases' => array(),
'reference' => '1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db',
'dev_requirement' => true,
'aliases' =>
array (
),
'embed/embed' => array(
'reference' => '1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db',
),
'embed/embed' =>
array (
'pretty_version' => 'v4.4.3',
'version' => '4.4.3.0',
'type' => 'library',
'install_path' => __DIR__ . '/../embed/embed',
'aliases' => array(),
'reference' => '2ac32581a8617c3bbe593e3d7799ca9db6974471',
'dev_requirement' => false,
'aliases' =>
array (
),
'gettext/gettext' => array(
'reference' => '2ac32581a8617c3bbe593e3d7799ca9db6974471',
),
'gettext/gettext' =>
array (
'pretty_version' => 'v5.6.1',
'version' => '5.6.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/../gettext/gettext',
'aliases' => array(),
'reference' => '017e249601d32b9a88c2eb4c10eac89bf582a7d3',
'dev_requirement' => false,
'aliases' =>
array (
),
'gettext/languages' => array(
'reference' => '017e249601d32b9a88c2eb4c10eac89bf582a7d3',
),
'gettext/languages' =>
array (
'pretty_version' => '2.9.0',
'version' => '2.9.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../gettext/languages',
'aliases' => array(),
'reference' => 'ed56dd2c7f4024cc953ed180d25f02f2640e3ffa',
'dev_requirement' => false,
'aliases' =>
array (
),
'grandel/include-directory' => array(
'reference' => 'ed56dd2c7f4024cc953ed180d25f02f2640e3ffa',
),
'grandel/include-directory' =>
array (
'pretty_version' => 'v0.2.2',
'version' => '0.2.2.0',
'type' => 'library',
'install_path' => __DIR__ . '/../grandel/include-directory',
'aliases' => array(),
'reference' => 'a5c830e8f1527c818b521ab18f2accecb02f9919',
'dev_requirement' => false,
'aliases' =>
array (
),
'guzzlehttp/guzzle' => array(
'reference' => 'a5c830e8f1527c818b521ab18f2accecb02f9919',
),
'guzzlehttp/guzzle' =>
array (
'pretty_version' => '7.4.1',
'version' => '7.4.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/guzzle',
'aliases' => array(),
'reference' => 'ee0a041b1760e6a53d2a39c8c34115adc2af2c79',
'dev_requirement' => false,
'aliases' =>
array (
),
'guzzlehttp/promises' => array(
'reference' => 'ee0a041b1760e6a53d2a39c8c34115adc2af2c79',
),
'guzzlehttp/promises' =>
array (
'pretty_version' => '1.5.1',
'version' => '1.5.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/promises',
'aliases' => array(),
'reference' => 'fe752aedc9fd8fcca3fe7ad05d419d32998a06da',
'dev_requirement' => false,
'aliases' =>
array (
),
'guzzlehttp/psr7' => array(
'reference' => 'fe752aedc9fd8fcca3fe7ad05d419d32998a06da',
),
'guzzlehttp/psr7' =>
array (
'pretty_version' => '2.1.0',
'version' => '2.1.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/psr7',
'aliases' => array(),
'reference' => '089edd38f5b8abba6cb01567c2a8aaa47cec4c72',
'dev_requirement' => false,
'aliases' =>
array (
),
'http-interop/http-factory-guzzle' => array(
'reference' => '089edd38f5b8abba6cb01567c2a8aaa47cec4c72',
),
'http-interop/http-factory-guzzle' =>
array (
'pretty_version' => '1.2.0',
'version' => '1.2.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../http-interop/http-factory-guzzle',
'aliases' => array(),
'aliases' =>
array (
),
'reference' => '8f06e92b95405216b237521cc64c804dd44c4a81',
'dev_requirement' => false,
),
'knplabs/github-api' => array(
'pretty_version' => 'v3.5.1',
'version' => '3.5.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/../knplabs/github-api',
'aliases' => array(),
'reference' => '37b167998e8e1f318b3d99633675cfa007540565',
'dev_requirement' => false,
),
'laminas/laminas-diactoros' => array(
'laminas/laminas-diactoros' =>
array (
'pretty_version' => '2.8.0',
'version' => '2.8.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../laminas/laminas-diactoros',
'aliases' => array(),
'reference' => '0c26ef1d95b6d7e6e3943a243ba3dc0797227199',
'dev_requirement' => false,
'aliases' =>
array (
),
'ml/iri' => array(
'reference' => '0c26ef1d95b6d7e6e3943a243ba3dc0797227199',
),
'ml/iri' =>
array (
'pretty_version' => '1.1.4',
'version' => '1.1.4.0',
'type' => 'library',
'install_path' => __DIR__ . '/../ml/iri/ML/IRI',
'aliases' => array(),
'reference' => 'cbd44fa913e00ea624241b38cefaa99da8d71341',
'dev_requirement' => false,
'aliases' =>
array (
),
'ml/json-ld' => array(
'reference' => 'cbd44fa913e00ea624241b38cefaa99da8d71341',
),
'ml/json-ld' =>
array (
'pretty_version' => '1.2.0',
'version' => '1.2.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../ml/json-ld',
'aliases' => array(),
'reference' => 'c74a1aed5979ed1cfb1be35a55a305fd30e30b93',
'dev_requirement' => false,
'aliases' =>
array (
),
'oscarotero/html-parser' => array(
'reference' => 'c74a1aed5979ed1cfb1be35a55a305fd30e30b93',
),
'oscarotero/html-parser' =>
array (
'pretty_version' => 'v0.1.6',
'version' => '0.1.6.0',
'type' => 'library',
'install_path' => __DIR__ . '/../oscarotero/html-parser',
'aliases' => array(),
'aliases' =>
array (
),
'reference' => 'b61e92f634d0dc184339d24630a6968d3ac64ded',
'dev_requirement' => false,
),
'php-http/cache-plugin' => array(
'pretty_version' => '1.7.5',
'version' => '1.7.5.0',
'type' => 'library',
'install_path' => __DIR__ . '/../php-http/cache-plugin',
'aliases' => array(),
'reference' => '63bc3f7242825c9a817db8f78e4c9703b0c471e2',
'dev_requirement' => false,
),
'php-http/client-common' => array(
'pretty_version' => '2.5.0',
'version' => '2.5.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../php-http/client-common',
'aliases' => array(),
'reference' => 'd135751167d57e27c74de674d6a30cef2dc8e054',
'dev_requirement' => false,
),
'php-http/discovery' => array(
'pretty_version' => '1.14.1',
'version' => '1.14.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/../php-http/discovery',
'aliases' => array(),
'reference' => 'de90ab2b41d7d61609f504e031339776bc8c7223',
'dev_requirement' => false,
),
'php-http/httplug' => array(
'pretty_version' => '2.3.0',
'version' => '2.3.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../php-http/httplug',
'aliases' => array(),
'reference' => 'f640739f80dfa1152533976e3c112477f69274eb',
'dev_requirement' => false,
),
'php-http/message' => array(
'pretty_version' => '1.13.0',
'version' => '1.13.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../php-http/message',
'aliases' => array(),
'reference' => '7886e647a30a966a1a8d1dad1845b71ca8678361',
'dev_requirement' => false,
),
'php-http/message-factory' => array(
'pretty_version' => 'v1.0.2',
'version' => '1.0.2.0',
'type' => 'library',
'install_path' => __DIR__ . '/../php-http/message-factory',
'aliases' => array(),
'reference' => 'a478cb11f66a6ac48d8954216cfed9aa06a501a1',
'dev_requirement' => false,
),
'php-http/message-factory-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '1.0',
),
),
'php-http/multipart-stream-builder' => array(
'pretty_version' => '1.2.0',
'version' => '1.2.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../php-http/multipart-stream-builder',
'aliases' => array(),
'reference' => '11c1d31f72e01c738bbce9e27649a7cca829c30e',
'dev_requirement' => false,
),
'php-http/promise' => array(
'pretty_version' => '1.1.0',
'version' => '1.1.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../php-http/promise',
'aliases' => array(),
'reference' => '4c4c1f9b7289a2ec57cde7f1e9762a5789506f88',
'dev_requirement' => false,
),
'psr/cache' => array(
'pretty_version' => '3.0.0',
'version' => '3.0.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/cache',
'aliases' => array(),
'reference' => 'aa5030cfa5405eccfdcb1083ce040c2cb8d253bf',
'dev_requirement' => false,
),
'psr/http-client' => array(
'psr/http-client' =>
array (
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-client',
'aliases' => array(),
'aliases' =>
array (
),
'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621',
'dev_requirement' => false,
),
'psr/http-client-implementation' => array(
'dev_requirement' => false,
'provided' => array(
'psr/http-client-implementation' =>
array (
'provided' =>
array (
0 => '1.0',
),
),
'psr/http-factory' => array(
'psr/http-factory' =>
array (
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-factory',
'aliases' => array(),
'reference' => '12ac7fcd07e5b077433f5f2bee95b3a771bf61be',
'dev_requirement' => false,
'aliases' =>
array (
),
'psr/http-factory-implementation' => array(
'dev_requirement' => false,
'provided' => array(
'reference' => '12ac7fcd07e5b077433f5f2bee95b3a771bf61be',
),
'psr/http-factory-implementation' =>
array (
'provided' =>
array (
0 => '1.0',
1 => '^1.0',
),
),
'psr/http-message' => array(
'psr/http-message' =>
array (
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-message',
'aliases' => array(),
'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363',
'dev_requirement' => false,
'aliases' =>
array (
),
'psr/http-message-implementation' => array(
'dev_requirement' => false,
'provided' => array(
'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363',
),
'psr/http-message-implementation' =>
array (
'provided' =>
array (
0 => '1.0',
),
),
'qferr/mjml-php' => array(
'qferr/mjml-php' =>
array (
'pretty_version' => '1.1.0',
'version' => '1.1.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../qferr/mjml-php',
'aliases' => array(),
'reference' => 'c6ea36c190e304e399a957f7e03b5a378faf41b9',
'dev_requirement' => false,
'aliases' =>
array (
),
'ralouphie/getallheaders' => array(
'reference' => 'c6ea36c190e304e399a957f7e03b5a378faf41b9',
),
'ralouphie/getallheaders' =>
array (
'pretty_version' => '3.0.3',
'version' => '3.0.3.0',
'type' => 'library',
'install_path' => __DIR__ . '/../ralouphie/getallheaders',
'aliases' => array(),
'reference' => '120b605dfeb996808c31b6477290a714d356e822',
'dev_requirement' => false,
'aliases' =>
array (
),
'squizlabs/php_codesniffer' => array(
'reference' => '120b605dfeb996808c31b6477290a714d356e822',
),
'squizlabs/php_codesniffer' =>
array (
'pretty_version' => '3.6.2',
'version' => '3.6.2.0',
'type' => 'library',
'install_path' => __DIR__ . '/../squizlabs/php_codesniffer',
'aliases' => array(),
'reference' => '5e4e71592f69da17871dba6e80dd51bce74a351a',
'dev_requirement' => true,
'aliases' =>
array (
),
'symfony/deprecation-contracts' => array(
'reference' => '5e4e71592f69da17871dba6e80dd51bce74a351a',
),
'symfony/deprecation-contracts' =>
array (
'pretty_version' => 'v3.0.0',
'version' => '3.0.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
'aliases' => array(),
'aliases' =>
array (
),
'reference' => 'c726b64c1ccfe2896cb7df2e1331c357ad1c8ced',
'dev_requirement' => false,
),
'symfony/options-resolver' => array(
'pretty_version' => 'v6.0.3',
'version' => '6.0.3.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/options-resolver',
'aliases' => array(),
'reference' => '51f7006670febe4cbcbae177cbffe93ff833250d',
'dev_requirement' => false,
),
'symfony/polyfill-php80' => array(
'symfony/polyfill-php80' =>
array (
'pretty_version' => 'v1.25.0',
'version' => '1.25.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php80',
'aliases' => array(),
'reference' => '4407588e0d3f1f52efb65fbe92babe41f37fe50c',
'dev_requirement' => false,
'aliases' =>
array (
),
'symfony/process' => array(
'reference' => '4407588e0d3f1f52efb65fbe92babe41f37fe50c',
),
'symfony/process' =>
array (
'pretty_version' => 'v5.4.5',
'version' => '5.4.5.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/process',
'aliases' => array(),
'aliases' =>
array (
),
'reference' => '95440409896f90a5f85db07a32b517ecec17fa4c',
'dev_requirement' => false,
),
),
);

View file

@ -1,114 +0,0 @@
# Changelog
## 3.5.1
### Fixed
- Boolean private needed to create private repo! ([mruell](https://github.com/mruell)) [#1051](https://github.com/KnpLabs/php-github-api/issues/1051)
## 3.5.0
### Added
- added support for psr\cache 3.0 ([rconfig](https://github.com/rconfig)) [#1046](https://github.com/KnpLabs/php-github-api/issues/1046)
- Symfony: allow deprecation-contracts version 3 ([glaubinix](https://github.com/glaubinix)) [#1049](https://github.com/KnpLabs/php-github-api/issues/1049)
### Changed
- Fix internal doc link ([staudenmeir](https://github.com/staudenmeir)) [#1044](https://github.com/KnpLabs/php-github-api/issues/1044)
### Fixed
- Fix Client URL Prepending For GraphQL Endpoint on Enterprise ([asher-goldberg](https://github.com/asher-goldberg), [acrobat](https://github.com/acrobat)) [#1048](https://github.com/KnpLabs/php-github-api/issues/1048)
## 3.4.0
### Added
- Add create a repository using a template endpoint ([martinbean](https://github.com/martinbean)) [#994](https://github.com/KnpLabs/php-github-api/issues/994)
- Allow fetching repo readme for a specific ref ([bery](https://github.com/bery)) [#1019](https://github.com/KnpLabs/php-github-api/issues/1019)
- allow assigning role to organisation members ([luceos](https://github.com/luceos)) [#1018](https://github.com/KnpLabs/php-github-api/issues/1018)
- Branch lists . ( ? query per_page) ([pitonic](https://github.com/pitonic)) [#1020](https://github.com/KnpLabs/php-github-api/issues/1020)
- Php8.1 support ([acrobat](https://github.com/acrobat)) [#1025](https://github.com/KnpLabs/php-github-api/issues/1025)
- Allow psr/cache 2.0 as well as 1.0 ([johnnoel](https://github.com/johnnoel)) [#1029](https://github.com/KnpLabs/php-github-api/issues/1029)
- adding code_with_match (#1024) ([QuentinRa](https://github.com/QuentinRa)) [#1031](https://github.com/KnpLabs/php-github-api/issues/1031)
- Added dir parameter for Repo readme ([AlexandrePavy](https://github.com/AlexandrePavy)) [#1032](https://github.com/KnpLabs/php-github-api/issues/1032)
- refs #955: deprecate Client::AUTH_* constants and replace them with AuthMethod::AUTH_* const ([ipalo](https://github.com/ipalo)) [#1036](https://github.com/KnpLabs/php-github-api/issues/1036)
- feat: Add `visibility` option to repo create ([gerdemann](https://github.com/gerdemann)) [#1038](https://github.com/KnpLabs/php-github-api/issues/1038)
- Feature get authenticated app ([kdaniel95](https://github.com/kdaniel95)) [#1041](https://github.com/KnpLabs/php-github-api/issues/1041)
### Changed
- Fix up typos ([dereuromark](https://github.com/dereuromark)) [#1011](https://github.com/KnpLabs/php-github-api/issues/1011)
- Update integration authentication documentation for usage with lcobucci/jwt ^4 ([glaubinix](https://github.com/glaubinix)) [#1017](https://github.com/KnpLabs/php-github-api/issues/1017)
- Update result_pager.md ([tomsowerby](https://github.com/tomsowerby)) [#1023](https://github.com/KnpLabs/php-github-api/issues/1023)
- fix(doc): links to doc in CurrentUser class ([Nek-](https://github.com/Nek-)) [#1026](https://github.com/KnpLabs/php-github-api/issues/1026)
- Fix incorrect phpdoc ([gemal](https://github.com/gemal)) [#1034](https://github.com/KnpLabs/php-github-api/issues/1034)
### Fixed
- Add accept header for creating repo from template ([davidpeach](https://github.com/davidpeach)) [#1030](https://github.com/KnpLabs/php-github-api/issues/1030)
## 3.3.0
### Added
- Allow costume accept headers for GraphQL Endpoint. ([Necmttn](https://github.com/Necmttn)) [#1001](https://github.com/KnpLabs/php-github-api/issues/1001)
- Add endpoint for approve workflow run ([Nyholm](https://github.com/Nyholm)) [#1006](https://github.com/KnpLabs/php-github-api/issues/1006)
### Changed
- Update readme and add example for different http client usage ([acrobat](https://github.com/acrobat)) [#1002](https://github.com/KnpLabs/php-github-api/issues/1002)
- Bumped branch alias after new feature merged ([GrahamCampbell](https://github.com/GrahamCampbell)) [#1004](https://github.com/KnpLabs/php-github-api/issues/1004)
- Add comment on AbstractApi::$perPage() ([Nyholm](https://github.com/Nyholm)) [#1007](https://github.com/KnpLabs/php-github-api/issues/1007)
### Fixed
- Fix publicKey ([Yurunsoft](https://github.com/Yurunsoft)) [#1005](https://github.com/KnpLabs/php-github-api/issues/1005)
## 3.2.0
### Added
- Deprecate ResultPager::postFetch method ([acrobat](https://github.com/acrobat)) [#986](https://github.com/KnpLabs/php-github-api/issues/986)
- Add deprecations to the PR review methods to allow cleanup ([acrobat](https://github.com/acrobat)) [#984](https://github.com/KnpLabs/php-github-api/issues/984)
- Allow binary content downloads of assets ([acrobat](https://github.com/acrobat)) [#990](https://github.com/KnpLabs/php-github-api/issues/990)
- Deployments: added missing 'delete deployment' endpoint ([clxmstaab](https://github.com/clxmstaab)) [#991](https://github.com/KnpLabs/php-github-api/issues/991)
- Events list per authenticated user for all repos ([richard015ar](https://github.com/richard015ar)) [#1000](https://github.com/KnpLabs/php-github-api/issues/1000)
### Changed
- Fixed branch alias ([GrahamCampbell](https://github.com/GrahamCampbell)) [#975](https://github.com/KnpLabs/php-github-api/issues/975)
- fix typo ([staabm](https://github.com/staabm)) [#977](https://github.com/KnpLabs/php-github-api/issues/977)
- Improved bc check ([acrobat](https://github.com/acrobat)) [#982](https://github.com/KnpLabs/php-github-api/issues/982)
- Correctly link to github actions docs and fix backlinks ([acrobat](https://github.com/acrobat)) [#983](https://github.com/KnpLabs/php-github-api/issues/983)
- Add missing repo hooks documentation ([acrobat](https://github.com/acrobat)) [#987](https://github.com/KnpLabs/php-github-api/issues/987)
- Fix incorrect public key documentation ([acrobat](https://github.com/acrobat)) [#988](https://github.com/KnpLabs/php-github-api/issues/988)
- Fixed incorrect parameters in apps docs ([acrobat](https://github.com/acrobat)) [#989](https://github.com/KnpLabs/php-github-api/issues/989)
- phpdoc: fix typo ([clxmstaab](https://github.com/clxmstaab)) [#993](https://github.com/KnpLabs/php-github-api/issues/993)
- Fix upmerged usage of deprecated phpunit assert ([acrobat](https://github.com/acrobat)) [#995](https://github.com/KnpLabs/php-github-api/issues/995)
- Fix typo ([romainneutron](https://github.com/romainneutron)) [#997](https://github.com/KnpLabs/php-github-api/issues/997)
### Fixed
- Deployments: use proper media-type for in_progress/queued, inactive state ([staabm](https://github.com/staabm)) [#979](https://github.com/KnpLabs/php-github-api/issues/979)
- [952] doc - Specify lcobucci/jwt version, fix deprecation ([amacrobert-meq](https://github.com/amacrobert-meq), [acrobat](https://github.com/acrobat)) [#953](https://github.com/KnpLabs/php-github-api/issues/953)
- Replace deprecated organization team repository add/remove urls ([acrobat](https://github.com/acrobat)) [#985](https://github.com/KnpLabs/php-github-api/issues/985)
- fixed php warning in GithubExceptionThrower ([clxmstaab](https://github.com/clxmstaab), [acrobat](https://github.com/acrobat)) [#992](https://github.com/KnpLabs/php-github-api/issues/992)
## 3.1.0
### Added
- Add workflow dispatch and allow workflow names. ([fodinabor](https://github.com/fodinabor)) [#969](https://github.com/KnpLabs/php-github-api/issues/969)
### Changed
- Re-enable roave bc check for 3.x ([acrobat](https://github.com/acrobat)) [#958](https://github.com/KnpLabs/php-github-api/issues/958)
- Cleanup 3.0.0 changelog ([acrobat](https://github.com/acrobat)) [#957](https://github.com/KnpLabs/php-github-api/issues/957)
- Update new GitHub doc links in repo. ([fodinabor](https://github.com/fodinabor)) [#974](https://github.com/KnpLabs/php-github-api/issues/974)
### Fixed
- Add accept header for the checks API ([Agares](https://github.com/Agares)) [#968](https://github.com/KnpLabs/php-github-api/issues/968)
- ExceptionThrower: adjust rate limit detection ([glaubinix](https://github.com/glaubinix)) [#959](https://github.com/KnpLabs/php-github-api/issues/959)
## 3.0.0
### Added
- Switch to PSR18 client implementation and bump httplug minimum version to ^2.0 ([GrahamCampbell](https://github.com/GrahamCampbell)) [#885](https://github.com/KnpLabs/php-github-api/issues/885)
- Switch to PSR-17 and remove deprecated code ([GrahamCampbell](https://github.com/GrahamCampbell)) [#888](https://github.com/KnpLabs/php-github-api/issues/888)
- Allow PHP8 ([acrobat](https://github.com/acrobat)) [#934](https://github.com/KnpLabs/php-github-api/issues/934)
- [3.x] Make PHP 7.2.5 the minimum version ([GrahamCampbell](https://github.com/GrahamCampbell)) [#942](https://github.com/KnpLabs/php-github-api/issues/942)
- [3.x] Re-worked pagination to not mutate the api classes ([GrahamCampbell](https://github.com/GrahamCampbell)) [#907](https://github.com/KnpLabs/php-github-api/issues/907) & ([acrobat](https://github.com/acrobat)) [#956](https://github.com/KnpLabs/php-github-api/issues/956)
- Prepare 3.0 release and remove remaining deprecated code ([acrobat](https://github.com/acrobat)) [#948](https://github.com/KnpLabs/php-github-api/issues/948)
### Changed
- Remove BC check on 3.x ([GrahamCampbell](https://github.com/GrahamCampbell)) [#900](https://github.com/KnpLabs/php-github-api/issues/900)
- [3.x] Fix the HTTP methods client ([GrahamCampbell](https://github.com/GrahamCampbell)) [#910](https://github.com/KnpLabs/php-github-api/issues/910)
- fix typo ([michielkempen](https://github.com/michielkempen)) [#920](https://github.com/KnpLabs/php-github-api/issues/920)
- [3.x] Added some additional scalar types and return types ([GrahamCampbell](https://github.com/GrahamCampbell)) [#949](https://github.com/KnpLabs/php-github-api/issues/949)

View file

@ -1,438 +0,0 @@
# Changelog
## 2.20.0
### Added
- Deployments: added missing 'delete deployment' endpoint ([clxmstaab](https://github.com/clxmstaab)) [#991](https://github.com/KnpLabs/php-github-api/issues/991)
### Changed
- phpdoc: fix typo ([clxmstaab](https://github.com/clxmstaab)) [#993](https://github.com/KnpLabs/php-github-api/issues/993)
### Fixed
- fixed php warning in GithubExceptionThrower ([clxmstaab](https://github.com/clxmstaab), [acrobat](https://github.com/acrobat)) [#992](https://github.com/KnpLabs/php-github-api/issues/992)
## 2.19.2
### Changed
- Improved bc check ([acrobat](https://github.com/acrobat)) [#982](https://github.com/KnpLabs/php-github-api/issues/982)
- Correctly link to github actions docs and fix backlinks ([acrobat](https://github.com/acrobat)) [#983](https://github.com/KnpLabs/php-github-api/issues/983)
- Add missing repo hooks documentation ([acrobat](https://github.com/acrobat)) [#987](https://github.com/KnpLabs/php-github-api/issues/987)
- Fix incorrect public key documentation ([acrobat](https://github.com/acrobat)) [#988](https://github.com/KnpLabs/php-github-api/issues/988)
- Fixed incorrect parameters in apps docs ([acrobat](https://github.com/acrobat)) [#989](https://github.com/KnpLabs/php-github-api/issues/989)
### Fixed
- Deployments: use proper media-type for in_progress/queued, inactive state ([staabm](https://github.com/staabm)) [#979](https://github.com/KnpLabs/php-github-api/issues/979)
- backported #979 into 2.x ([staabm](https://github.com/staabm)) [#981](https://github.com/KnpLabs/php-github-api/issues/981)
- [952] doc - Specify lcobucci/jwt version, fix deprecation ([amacrobert-meq](https://github.com/amacrobert-meq), [acrobat](https://github.com/acrobat)) [#953](https://github.com/KnpLabs/php-github-api/issues/953)
- Replace deprecated organization team repository add/remove urls ([acrobat](https://github.com/acrobat)) [#985](https://github.com/KnpLabs/php-github-api/issues/985)
## 2.19.1
### Fixed
- ExceptionThrower: adjust rate limit detection ([glaubinix](https://github.com/glaubinix)) [#959](https://github.com/KnpLabs/php-github-api/issues/959)
## 2.19.0
### Added
- Mark some classes as final ([acrobat](https://github.com/acrobat)) [#954](https://github.com/KnpLabs/php-github-api/issues/954)
## 2.18.0
### Added
- Add parameters to PullRequest commits method ([seanmtaylor](https://github.com/seanmtaylor)) [#938](https://github.com/KnpLabs/php-github-api/issues/938)
- Actions (#872) ([lexor](https://github.com/lexor)) [#939](https://github.com/KnpLabs/php-github-api/issues/939)
- automated security endpoints (#868) ([lexor](https://github.com/lexor)) [#944](https://github.com/KnpLabs/php-github-api/issues/944)
### Changed
- Update apps.md ([clarkeash](https://github.com/clarkeash)) [#936](https://github.com/KnpLabs/php-github-api/issues/936)
### Fixed
- Throw exception for graphql errors ([acrobat](https://github.com/acrobat)) [#941](https://github.com/KnpLabs/php-github-api/issues/941)
## 2.17.0
### Added
- Improve checks api implementation ([acrobat](https://github.com/acrobat)) [#932](https://github.com/KnpLabs/php-github-api/issues/932)
### Changed
- Missing auth method in list of omitted passwords. ([tobyS](https://github.com/tobyS)) [#933](https://github.com/KnpLabs/php-github-api/issues/933)
- Improve github actions setup ([acrobat](https://github.com/acrobat)) [#935](https://github.com/KnpLabs/php-github-api/issues/935)
## 2.16.0
### Added
- Add support for SSO errors coming from the API ([eiriksm](https://github.com/eiriksm)) [#913](https://github.com/KnpLabs/php-github-api/issues/913)
- Add OutsideCollaborators api ([Matth--](https://github.com/Matth--)) [#925](https://github.com/KnpLabs/php-github-api/issues/925)
- Add support for creating a repo dispatch event ([Nyholm](https://github.com/Nyholm)) [#931](https://github.com/KnpLabs/php-github-api/issues/931)
### Changed
- Fix: Wrong PHPDoc description ([OskarStark](https://github.com/OskarStark)) [#922](https://github.com/KnpLabs/php-github-api/issues/922)
- Adding GitHub authentication to GraphQL documentation ([legionth](https://github.com/legionth)) [#927](https://github.com/KnpLabs/php-github-api/issues/927)
### Fixed
- Use RFC3986 for building URI query strings ([GrahamCampbell](https://github.com/GrahamCampbell)) [#908](https://github.com/KnpLabs/php-github-api/issues/908)
- Fix call to test a webhook method ([morrislaptop](https://github.com/morrislaptop)) [#915](https://github.com/KnpLabs/php-github-api/issues/915)
## 2.15.0
### Added
- Prepare deprecation of authentication methods ([acrobat](https://github.com/acrobat)) [#870](https://github.com/KnpLabs/php-github-api/issues/870)
- Add Support For GitData Reference Matching Methods ([nickpoulos](https://github.com/nickpoulos)) [#875](https://github.com/KnpLabs/php-github-api/issues/875)
- Make invalid request error more clear ([acrobat](https://github.com/acrobat)) [#880](https://github.com/KnpLabs/php-github-api/issues/880)
- Show user by ID ([genintho](https://github.com/genintho)) [#894](https://github.com/KnpLabs/php-github-api/issues/894)
- add additional check run methods ([bobeagan](https://github.com/bobeagan), [acrobat](https://github.com/acrobat)) [#865](https://github.com/KnpLabs/php-github-api/issues/865)
### Changed
- Added phpstan ([clxkoders](https://github.com/clxkoders)) [#871](https://github.com/KnpLabs/php-github-api/issues/871)
- Increase phpstan to level 4 ([acrobat](https://github.com/acrobat)) [#874](https://github.com/KnpLabs/php-github-api/issues/874)
- [Documentation] Add Missing Children to Pull Request Index ([jimlind](https://github.com/jimlind)) [#877](https://github.com/KnpLabs/php-github-api/issues/877)
- [Documentation] Include links to Pull Request Children on Pull Request Doc. ([jimlind](https://github.com/jimlind)) [#878](https://github.com/KnpLabs/php-github-api/issues/878)
- Fix typo in /lib/Github/Api/RateLimit.php ([yoonper](https://github.com/yoonper)) [#886](https://github.com/KnpLabs/php-github-api/issues/886)
- Don't use deprecated auth in examples ([GrahamCampbell](https://github.com/GrahamCampbell)) [#892](https://github.com/KnpLabs/php-github-api/issues/892)
- Removed shadow-cat ([GrahamCampbell](https://github.com/GrahamCampbell)) [#893](https://github.com/KnpLabs/php-github-api/issues/893)
- Don't urlencode integer values ([acrobat](https://github.com/acrobat)) [#895](https://github.com/KnpLabs/php-github-api/issues/895)
- phpstan level 6 fixes ([acrobat](https://github.com/acrobat), [GrahamCampbell](https://github.com/GrahamCampbell)) [#897](https://github.com/KnpLabs/php-github-api/issues/897)
### Fixed
- fix: use new media type for branch protections ([iBotPeaches](https://github.com/iBotPeaches)) [#881](https://github.com/KnpLabs/php-github-api/issues/881)
- Added missing 'machine-man-preview' accept headers ([vovayatsyuk](https://github.com/vovayatsyuk)) [#883](https://github.com/KnpLabs/php-github-api/issues/883)
- Fix broken roave/bc-check test ([acrobat](https://github.com/acrobat)) [#890](https://github.com/KnpLabs/php-github-api/issues/890)
- Fixed incorrect MissingArgumentException parent constructor values ([acrobat](https://github.com/acrobat)) [#896](https://github.com/KnpLabs/php-github-api/issues/896)
- Added AUTH_ACCESS_TOKEN to allowed methods ([GrahamCampbell](https://github.com/GrahamCampbell)) [#899](https://github.com/KnpLabs/php-github-api/issues/899)
## 2.14.0
### Added
- Replace deprecated Organization\Teams api calls ([lolos](https://github.com/lolos)) [#860](https://github.com/KnpLabs/php-github-api/issues/860)
- Add sort and direction for fetching organizations repos ([pgrimaud](https://github.com/pgrimaud)) [#863](https://github.com/KnpLabs/php-github-api/issues/863)
- Added parameters to Repo/milestones() method ([dereuromark](https://github.com/dereuromark)) [#856](https://github.com/KnpLabs/php-github-api/issues/856)
### Fixed
- Remove incorrect MissingArgumentException in Labels api ([bobeagan](https://github.com/bobeagan)) [#861](https://github.com/KnpLabs/php-github-api/issues/861)
### Changed
- Fix typos in test/Github/Tests/Api/RepoTest.php ([pgrimaud](https://github.com/pgrimaud)) [#862](https://github.com/KnpLabs/php-github-api/issues/862)
- further detail on ResultPager parameters ([sepiariver](https://github.com/sepiariver)) [#843](https://github.com/KnpLabs/php-github-api/issues/843)
- fix phpdoc in labels api ([staabm](https://github.com/staabm)) [#854](https://github.com/KnpLabs/php-github-api/issues/854)
- fix api link in Issue\Labels::add() phpdoc ([staabm](https://github.com/staabm)) [#853](https://github.com/KnpLabs/php-github-api/issues/853)
## 2.13.0
### Added
- Support the new authorizations API
- Repo community profile API endpoint
- Support for draft PRs
- Missing Apps endpoints
- Test against php 7.4
### Changed
- Allow create & remove to set and remove requests for teams
## 2.12.1
### Fixed
- Fixed bug in handling of validation errors
- Updated docs to not use deprected string parameter in issue assignee call
## 2.12.0
### Added
- Support for HTTPlug 2.0 and PSR-18
- Add support for GitHub Checks
- Add support for GitHub Pages
- Add support to update a Pull Request Review
- Add support to get specific revision of a gist
- Added a 4th argument `$parameters` to `PullRequest::files()`
- Added `Accept` headers to Github Apps
### Removed
- Active support for HHVM
- Support for PHP <7.1
### Changed
- Allow tags to be created without the `Tagger` object
- When updating DeployKeys we will first remove existing then add a new DeployKey
### Fixed
- In `Trees` we should check if `array_key_exists('sha', $tree)` instead of `isset` to avoid issues with `null`. (#822)
### Deprecated
- Passing an integer (`$page`) as 4th arugment in `Comments::all()` is deprecated. It should be an array.
## 2.11.0
### Added
- Support for Miscellaneous Licenses (#744)
- Structured Limit objects for rate limiting API (#733)
- Support for getting star creation timestamps in activity/starring endpoint (#729)
### Fixed
- Added missing has_projects parameter to repo create (#752)
- Proper type hinting for magic methods (#758)
- Allow symlink to files to be downloaded (#751)
### Changed
- Fix of PHP version in readme (#747)
- Fix documentation to get release for a tag (#755)
- Declare all used properties in RateLimitResource class (#762)
- Set correct property and return types (#764)
- Fixed install docs broken after 2.0 release of httplug lib (#767)
## 2.10.1
### Fixed
- Convert the assignee parameter to array to avoid getting a 422 error on github (#738)
- Fix GraphQL test warnings when they do not assert anything (#735)
### Changed
- Check for BC breaks during the travis build (#734)
## 2.10.0
### Added
- Support for "before" parameter on Notification API (#724)
### Changed
- Allow unspecified `event` when creating review (#723)
### Fixed
- Adjust: installationn access token endpoint (#731)
- Fixed "get single label" example and add correct example for getting issue's labels (#732)
- Add comment about `Key` constructor argument (#722)
## 2.9.0
### Added
- API endpoint `Github\Api\Repo::transfer()`
- API endpoint `Github\Api\Notification::markThreadRead()`
- API endpoint `Github\Api\Search::topics()`
### Fixed
- Make sure to always reset the "per page" in `Github\ResultPager::fetchAll()`.
## 2.8.0
### Added
- Allow our HTTP plugins to show up in the Symfony web profiler page. (#687)
- Repository documentation to current user (#671)
- Add collaborator permission call (#678)
- Add missing parameters for User/CurrentUser Repositories (#684)
- Pimp the readme with badge poser (#686)
### Fixed
- Typo in assignee documentation
- Missing use statement in security example
- Fixed phpdoc typo (#695)
- Replace use of deprecated api to the correct one in the security docs (#697)
### Changed
- Updated requirements in readme (#689)
## 2.7.0
### Added
- Phpunit 6 compatibility
- `Github\Api\AbstractApi::setPage()` to allow you to set the page on all endpoints.
- Support for query parameters and request headers on `Github\Api\User::following` and `Github\Api\User::followers`
- API endpoint `Github\Api\CurrentUser\Emails::allPublic()`
- API endpoint `Github\Api\Search::commits()`
- API endpoint `Github\Api\Miscellaneous\CodeOfConduct`
- API endpoint `Github\Api\Repo::topics()`
- API endpoint `Github\Api\Repo::replaceTopics()`
### Fixed
- Fixed bug in `PathPrepend` plugin where "api/vX" could be duplicated.
### Changed
- Improved documentation and doc blocks
### Removed
- Dropped support for php 5.5
### Deprecated
The following endpoints were deprecated by Github and are also deprecated in the client:
- `Github\Api\Repo::find()`
- `Github\Api\User::find()`
- `Github\Api\Issue::find()`
## 2.6.0
### Added
- Support for graphql api [variables](https://developer.github.com/v4/guides/forming-calls/#working-with-variables) (#612)
- Added missing branch protection methods (#616)
- Helper function `fromFile ` to get GraphQL queries from a file (#628)
- Extra parameter `params` to collaborators api calls (#623)
- Documentation for GitData API (#613)
### Fixed
- Remove `body` as a required parameter when creating an issue (#624)
- Minor fixes in example code (#617)
## 2.5.0
### Added
- Stable support for graphql api (V4) (#593)
- Stable support for apps (previously integrations) (#592)
- `Repo::events()`
### Fixed
- Incorrect link in repository search docs (#594)
- Added the required parameter `$message` on `Review::dismiss`.
## 2.4.0
### Added
- `Integrations::configure` to allow accessing early access program endpoints.
- Add support for pagination and parameters in the pull request comments
- Add the ability to fetch user installations (`CurrentUser::installations`)
- Allow getting repo info by id (`Repo::showById`)
- Allow fetching repositories for a specific installation and user (`CurrentUser::repositoriesByInstallation`)
### Changed
- `PullRequest\Review` and `PullRequest\ReviewRequest` is now part of the official API. No need to call `configure`.
## 2.3.0
### Fixed
- Issue where we serve the wrong cached response. We vary on authorization header now.
### Added
- `PullRequest::status`
- Throw InvalidArgumentException on `PullRequest::merge` when wrong merge method is used.
- Added `Protection::configure`
### Changed
- First argument to `Integrations::listRepositories()` is now optional.
- Moved tests from "functional" to "integration"
## 2.2.0
### Added
- API support for Pull Request Review Requests.
- API support for Traffic.
- API support for issue Assignees.
- API support for Miscellaneous Gitignore and Emojis.
- Added endpoints for issue lock, unlock and issue label show.
- Added more parameters to `User::starred`.
- Fluid interface by allowing `configure()` to return `$this`.
- `configure()` support for issues API.
### Fixed
- Cache issue where some requests are not cached
- Issue with `User::all()` creates a query with double question marks.
## 2.1.0
### Added
- Add support for retrieving a single notification info using his ID
- Add a function to get user organizations
- Added GraphQL support
- Add page variable to organization repo list (Organization::repositories())
- Add support for pull request review.
- Add support for adding branch protection.
### Fixed
- Bug with double slashes when using enterprise URL.
- Bug when headers not being passed to request (#529)
## 2.0.0
### Added
- Support for JWT authentication
- API for Organization\Members
- API for Integrations
- API for Repo\Cards
- API for Repo\Columns
- API for Repo\Projects
- API for User\MyRepositories
- Methods in Repo API for frequency and participation
### Changed
- `ApiLimitExceedException::__construct` has a new second parameter for the remaining API calls.
- First parameter of `Github\Client` has changed type from `\Http\Client\HttpClient` to
`Github\HttpClient\Builder`. A factory class was also added. To upgrade you need to change:
```php
// Old way does not work:
$github = new Github\Client($httpClient);
// New way will work:
$github = new Github\Client(new Github\HttpClient\Builder($httpClient));
$github = Github\Client::createWithHttpClient($httpClient);
```
- Renamed the currentuser `DeployKeys` api class to `PublicKeys` to reflect to github api name.
## 2.0.0-rc4
### Added
- HTTPlug to decouple from Guzzle
- `Github\Client::getLastResponse` was added
- Support for PSR-6 cache
- `Github\Client::addPlugin` and `Github\Client::removePlugin`
- `Github\Client::getApiVersion`
- `Github\Client::removeCache`
### Changed
- Uses of `Github\HttpClient\HttpClientInterface` is replaced by `Http\Client\HttpClient` ie the constructor of `Github\Client`.
- We use PSR-7's representation of HTTP message instead of `Guzzle\Http\Message\Response` and `Guzzle\Http\Message\Request`.
- `Github\Client::addHeaders` was added instead of `Github\Client::setHeaders`
- Signature of `Github\Client::useCache` has changed. First argument must be a `CacheItemPoolInterface`
- We use PSR-4 instead of PSR-0
### Removed
- Support for PHP 5.3 and 5.4
- `Github/HttpClient/HttpClientInterface` was removed
- `Github/HttpClient/HttpClient` was removed
- All classes in `Github/HttpClient/HttpClient/Listener/*` were removed
- `Github/HttpClient/CachedHttpClient` was removed
- All classes in `Github/HttpClient/Cache/*` were removed
## 1.7.1
No change log before this version

View file

@ -1,22 +0,0 @@
The MIT License
Copyright (c) 2012 KnpLabs
Copyright (c) 2010 Thibault Duplessis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -1,134 +0,0 @@
# PHP GitHub API
![Build Status](https://github.com/KnpLabs/php-github-api/actions/workflows/ci.yml/badge.svg)
[![StyleCI](https://styleci.io/repos/3948501/shield?style=flat)](https://styleci.io/repos/3948501)
[![Latest Stable Version](https://poser.pugx.org/knplabs/github-api/v/stable)](https://packagist.org/packages/knplabs/github-api)
[![Total Downloads](https://poser.pugx.org/knplabs/github-api/downloads)](https://packagist.org/packages/knplabs/github-api)
[![Monthly Downloads](https://poser.pugx.org/knplabs/github-api/d/monthly)](https://packagist.org/packages/knplabs/github-api)
[![Daily Downloads](https://poser.pugx.org/knplabs/github-api/d/daily)](https://packagist.org/packages/knplabs/github-api)
A simple Object Oriented wrapper for GitHub API, written with PHP.
Uses [GitHub API v3](http://developer.github.com/v3/) & supports [GitHub API v4](http://developer.github.com/v4). The object API (v3) is very similar to the RESTful API.
## Features
* Light and fast thanks to lazy loading of API classes
* Extensively tested and documented
## Requirements
* PHP >= 7.2
* A [PSR-17 implementation](https://packagist.org/providers/psr/http-factory-implementation)
* A [PSR-18 implementation](https://packagist.org/providers/psr/http-client-implementation)
## Quick install
Via [Composer](https://getcomposer.org).
This command will get you up and running quickly with a Guzzle HTTP client.
```bash
composer require knplabs/github-api:^3.0 guzzlehttp/guzzle:^7.0.1 http-interop/http-factory-guzzle:^1.0
```
## Advanced install
We are decoupled from any HTTP messaging client with help by [HTTPlug](https://httplug.io).
### Using a different http client
```bash
composer require knplabs/github-api:^3.0 symfony/http-client nyholm/psr7
```
To set up the Github client with this HTTP client
```php
use Github\Client;
use Symfony\Component\HttpClient\HttplugClient;
$client = Client::createWithHttpClient(new HttplugClient());
```
Read more about [using different clients in our docs](doc/customize.md).
## Framework integrations
### Laravel
To integrate this library in laravel [Graham Campbell](https://github.com/GrahamCampbell) created [graham-campbell/github](https://github.com/GrahamCampbell/Laravel-GitHub). See the [installation instructions](https://github.com/GrahamCampbell/Laravel-GitHub#installation) to get started in laravel.
## Basic usage of `php-github-api` client
```php
<?php
// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';
$client = new \Github\Client();
$repositories = $client->api('user')->repositories('ornicar');
```
From `$client` object, you have access to all available GitHub api endpoints.
## Cache usage
This example uses the PSR6 cache pool [redis-adapter](https://github.com/php-cache/redis-adapter). See http://www.php-cache.com/ for alternatives.
```php
<?php
// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';
use Cache\Adapter\Redis\RedisCachePool;
$client = new \Redis();
$client->connect('127.0.0.1', 6379);
// Create a PSR6 cache pool
$pool = new RedisCachePool($client);
$client = new \Github\Client();
$client->addCache($pool);
// Do some request
// Stop using cache
$client->removeCache();
```
Using cache, the client will get cached responses if resources haven't changed since last time,
**without** reaching the `X-Rate-Limit` [imposed by github](http://developer.github.com/v3/#rate-limiting).
## Documentation
See the [`doc` directory](doc/) for more detailed documentation.
## License
`php-github-api` is licensed under the MIT License - see the LICENSE file for details
## Maintainers
Please read [this post](https://knplabs.com/en/blog/news-for-our-foss-projects-maintenance) first.
This library is maintained by the following people (alphabetically sorted) :
- [@acrobat](https://github.com/acrobat)
- [@Nyholm](https://github.com/Nyholm)
## Contributors
- Thanks to [Thibault Duplessis aka. ornicar](https://github.com/ornicar) for his first version of this library.
- Thanks to [Joseph Bielawski aka. stloyd](https://github.com/stloyd) for his contributions and support.
- Thanks to [noloh](https://github.com/noloh) for his contribution on the Object API.
- Thanks to [bshaffer](https://github.com/bshaffer) for his contribution on the Repo API.
- Thanks to [Rolf van de Krol](https://github.com/rolfvandekrol) for his countless contributions.
- Thanks to [Nicolas Pastorino](https://github.com/jeanvoye) for his contribution on the Pull Request API.
- Thanks to [Edoardo Rivello](https://github.com/erivello) for his contribution on the Gists API.
- Thanks to [Miguel Piedrafita](https://github.com/m1guelpf) for his contribution to the v4 & Apps API.
- Thanks to [Emre DEGER](https://github.com/lexor) for his contribution to the Actions API.
Thanks to GitHub for the high quality API and documentation.

View file

@ -1,21 +0,0 @@
## UPGRADE from 2.x to 3.0
### General
* The `php-http/httplug` dependency requires is bumped to minimum ^2.1.
* A client implementing `psr/http-client-implementation` is required.
To upgrade your application (default install) switch from guzzle 6 to guzzle 7 (or replace `php-http/guzzle6-adapter` with any `psr/http-client-implementation`), see the install instructions in the [README file](README.md)
* All previous deprecated code in version 2 is removed.
* The following classes are now final
* `Github\HttpClient\Message\ResponseMediator`
* `Github\HttpClient\Plugin\Authentication`
* `Github\HttpClient\Plugin\GithubExceptionThrower`
* `Github\HttpClient\Plugin\History`
* `Github\HttpClient\Plugin\PathPrepend`
### Authentication methods
* `Github\Client::AUTH_URL_TOKEN` use `Github\Client::AUTH_ACCESS_TOKEN` instead.
* `Github\Client::AUTH_URL_CLIENT_ID` use `Github\Client::AUTH_CLIENT_ID` instead.
* `Github\Client::AUTH_HTTP_TOKEN` use `Github\Client::AUTH_ACCESS_TOKEN` instead.
* `Github\Client::AUTH_HTTP_PASSWORD` use `Github\Client::AUTH_ACCESS_TOKEN` instead.

View file

@ -1,11 +0,0 @@
## UPGRADE from 3.x to 4.0
### ResultPager
* `\Github\ResultPagerInterface::postFetch` is deprecated, and the method will be removed from the ResultPager interface/class.
### Authentication methods
* `Github\Client::AUTH_CLIENT_ID` is deprecated, use `Github\AuthMethod::CLIENT_ID` instead.
* `Github\Client::AUTH_ACCESS_TOKEN` is deprecated, use `Github\AuthMethod::ACCESS_TOKEN` instead.
* `Github\Client::AUTH_JWT` is deprecated, use `Github\AuthMethod::JWT` instead.

View file

@ -1,63 +0,0 @@
{
"name": "knplabs/github-api",
"type": "library",
"description": "GitHub API v3 client",
"homepage": "https://github.com/KnpLabs/php-github-api",
"keywords": ["github", "gh", "api", "gist"],
"license": "MIT",
"authors": [
{
"name": "KnpLabs Team",
"homepage": "http://knplabs.com"
},
{
"name": "Thibault Duplessis",
"email": "thibault.duplessis@gmail.com",
"homepage": "http://ornicar.github.com"
}
],
"require": {
"php": "^7.2.5 || ^8.0",
"ext-json": "*",
"php-http/cache-plugin": "^1.7.1",
"php-http/client-common": "^2.3",
"php-http/discovery": "^1.12",
"php-http/httplug": "^2.2",
"php-http/multipart-stream-builder": "^1.1.2",
"psr/cache": "^1.0|^2.0|^3.0",
"psr/http-client-implementation": "^1.0",
"psr/http-factory-implementation": "^1.0",
"psr/http-message": "^1.0",
"symfony/polyfill-php80": "^1.17",
"symfony/deprecation-contracts": "^2.2|^3.0"
},
"require-dev": {
"symfony/cache": "^5.1.8",
"guzzlehttp/psr7": "^1.7",
"http-interop/http-factory-guzzle": "^1.0",
"guzzlehttp/guzzle": "^7.2",
"php-http/mock-client": "^1.4.1",
"phpstan/phpstan": "^0.12.57",
"phpstan/extension-installer": "^1.0.5",
"phpstan/phpstan-deprecation-rules": "^0.12.5",
"phpunit/phpunit": "^8.5 || ^9.4",
"symfony/phpunit-bridge": "^5.2"
},
"autoload": {
"psr-4": { "Github\\": "lib/Github/" }
},
"autoload-dev": {
"psr-4": { "Github\\Tests\\": "test/Github/Tests/"}
},
"extra": {
"branch-alias": {
"dev-2.x": "2.20.x-dev",
"dev-master": "3.4.x-dev"
}
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
}
}
}

View file

@ -1,224 +0,0 @@
<?php
namespace Github\Api;
use Github\Client;
use Github\HttpClient\Message\ResponseMediator;
use Psr\Http\Message\ResponseInterface;
/**
* @author Joseph Bielawski <stloyd@gmail.com>
* @author Graham Campbell <graham@alt-three.com>
*/
abstract class AbstractApi
{
/**
* The client instance.
*
* @var Client
*/
private $client;
/**
* The per page parameter. It is used by the ResultPager.
*
* @var int|null
*/
private $perPage;
/**
* Create a new API instance.
*
* @param Client $client
*
* @return void
*/
public function __construct(Client $client)
{
$this->client = $client;
}
/**
* Get the client instance.
*
* @return Client
*/
protected function getClient(): Client
{
return $this->client;
}
/**
* Get the API version.
*
* @return string
*/
protected function getApiVersion(): string
{
return $this->client->getApiVersion();
}
/**
* @return $this
*/
public function configure()
{
return $this;
}
/**
* Send a GET request with query parameters.
*
* @param string $path Request path.
* @param array $parameters GET parameters.
* @param array $requestHeaders Request Headers.
*
* @return array|string
*/
protected function get(string $path, array $parameters = [], array $requestHeaders = [])
{
if (null !== $this->perPage && !isset($parameters['per_page'])) {
$parameters['per_page'] = $this->perPage;
}
if (array_key_exists('ref', $parameters) && null === $parameters['ref']) {
unset($parameters['ref']);
}
if (count($parameters) > 0) {
$path .= '?'.http_build_query($parameters, '', '&', PHP_QUERY_RFC3986);
}
$response = $this->client->getHttpClient()->get($path, $requestHeaders);
return ResponseMediator::getContent($response);
}
/**
* Send a HEAD request with query parameters.
*
* @param string $path Request path.
* @param array $parameters HEAD parameters.
* @param array $requestHeaders Request headers.
*
* @return ResponseInterface
*/
protected function head(string $path, array $parameters = [], array $requestHeaders = []): ResponseInterface
{
if (array_key_exists('ref', $parameters) && null === $parameters['ref']) {
unset($parameters['ref']);
}
return $this->client->getHttpClient()->head($path.'?'.http_build_query($parameters, '', '&', PHP_QUERY_RFC3986), $requestHeaders);
}
/**
* Send a POST request with JSON-encoded parameters.
*
* @param string $path Request path.
* @param array $parameters POST parameters to be JSON encoded.
* @param array $requestHeaders Request headers.
*
* @return array|string
*/
protected function post(string $path, array $parameters = [], array $requestHeaders = [])
{
return $this->postRaw(
$path,
$this->createJsonBody($parameters),
$requestHeaders
);
}
/**
* Send a POST request with raw data.
*
* @param string $path Request path.
* @param string $body Request body.
* @param array $requestHeaders Request headers.
*
* @return array|string
*/
protected function postRaw(string $path, $body, array $requestHeaders = [])
{
$response = $this->client->getHttpClient()->post(
$path,
$requestHeaders,
$body
);
return ResponseMediator::getContent($response);
}
/**
* Send a PATCH request with JSON-encoded parameters.
*
* @param string $path Request path.
* @param array $parameters POST parameters to be JSON encoded.
* @param array $requestHeaders Request headers.
*
* @return array|string
*/
protected function patch(string $path, array $parameters = [], array $requestHeaders = [])
{
$response = $this->client->getHttpClient()->patch(
$path,
$requestHeaders,
$this->createJsonBody($parameters)
);
return ResponseMediator::getContent($response);
}
/**
* Send a PUT request with JSON-encoded parameters.
*
* @param string $path Request path.
* @param array $parameters POST parameters to be JSON encoded.
* @param array $requestHeaders Request headers.
*
* @return array|string
*/
protected function put(string $path, array $parameters = [], array $requestHeaders = [])
{
$response = $this->client->getHttpClient()->put(
$path,
$requestHeaders,
$this->createJsonBody($parameters)
);
return ResponseMediator::getContent($response);
}
/**
* Send a DELETE request with JSON-encoded parameters.
*
* @param string $path Request path.
* @param array $parameters POST parameters to be JSON encoded.
* @param array $requestHeaders Request headers.
*
* @return array|string
*/
protected function delete(string $path, array $parameters = [], array $requestHeaders = [])
{
$response = $this->client->getHttpClient()->delete(
$path,
$requestHeaders,
$this->createJsonBody($parameters)
);
return ResponseMediator::getContent($response);
}
/**
* Create a JSON encoded version of an array of parameters.
*
* @param array $parameters Request parameters
*
* @return string|null
*/
protected function createJsonBody(array $parameters): ?string
{
return (count($parameters) === 0) ? null : json_encode($parameters, empty($parameters) ? JSON_FORCE_OBJECT : 0);
}
}

View file

@ -1,66 +0,0 @@
<?php
namespace Github\Api;
use Psr\Http\Message\ResponseInterface;
/**
* A trait to make sure we add accept headers on all requests.
*
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
*/
trait AcceptHeaderTrait
{
/** @var string */
protected $acceptHeaderValue;
protected function get(string $path, array $parameters = [], array $requestHeaders = [])
{
return parent::get($path, $parameters, $this->mergeHeaders($requestHeaders));
}
protected function head(string $path, array $parameters = [], array $requestHeaders = []): ResponseInterface
{
return parent::head($path, $parameters, $this->mergeHeaders($requestHeaders));
}
protected function post(string $path, array $parameters = [], array $requestHeaders = [])
{
return parent::post($path, $parameters, $this->mergeHeaders($requestHeaders));
}
protected function postRaw(string $path, $body, array $requestHeaders = [])
{
return parent::postRaw($path, $body, $this->mergeHeaders($requestHeaders));
}
protected function patch(string $path, array $parameters = [], array $requestHeaders = [])
{
return parent::patch($path, $parameters, $this->mergeHeaders($requestHeaders));
}
protected function put(string $path, array $parameters = [], array $requestHeaders = [])
{
return parent::put($path, $parameters, $this->mergeHeaders($requestHeaders));
}
protected function delete(string $path, array $parameters = [], array $requestHeaders = [])
{
return parent::delete($path, $parameters, $this->mergeHeaders($requestHeaders));
}
/**
* Append a new accept header on all requests.
*
* @return array
*/
private function mergeHeaders(array $headers = []): array
{
$default = [];
if ($this->acceptHeaderValue) {
$default = ['Accept' => $this->acceptHeaderValue];
}
return array_merge($default, $headers);
}
}

View file

@ -1,201 +0,0 @@
<?php
namespace Github\Api;
/**
* @link https://developer.github.com/v3/apps/
*
* @author Nils Adermann <naderman@naderman.de>
*/
class Apps extends AbstractApi
{
use AcceptHeaderTrait;
private function configurePreviewHeader()
{
$this->acceptHeaderValue = 'application/vnd.github.machine-man-preview+json';
}
/**
* Create an access token for an installation.
*
* @param int $installationId An integration installation id
* @param int $userId An optional user id on behalf of whom the
* token will be requested
*
* @link https://developer.github.com/v3/apps/#create-a-new-installation-token
*
* @return array token and token metadata
*/
public function createInstallationToken($installationId, $userId = null)
{
$parameters = [];
if ($userId) {
$parameters['user_id'] = $userId;
}
$this->configurePreviewHeader();
return $this->post('/app/installations/'.$installationId.'/access_tokens', $parameters);
}
/**
* Find all installations for the authenticated application.
*
* @link https://developer.github.com/v3/apps/#find-installations
*
* @return array
*/
public function findInstallations()
{
$this->configurePreviewHeader();
return $this->get('/app/installations');
}
/**
* Get an installation of the application.
*
* @link https://developer.github.com/v3/apps/#get-an-installation
*
* @param int $installationId An integration installation id
*
* @return array
*/
public function getInstallation($installationId)
{
$this->configurePreviewHeader();
return $this->get('/app/installations/'.$installationId);
}
/**
* Get an installation of the application for an organization.
*
* @link https://developer.github.com/v3/apps/#get-an-organization-installation
*
* @param string $org An organization
*
* @return array
*/
public function getInstallationForOrganization($org)
{
$this->configurePreviewHeader();
return $this->get('/org/'.rawurldecode($org).'/installation');
}
/**
* Get an installation of the application for a repository.
*
* @link https://developer.github.com/v3/apps/#get-a-repository-installation
*
* @param string $owner the owner of a repository
* @param string $repo the name of the repository
*
* @return array
*/
public function getInstallationForRepo($owner, $repo)
{
$this->configurePreviewHeader();
return $this->get('/repos/'.rawurldecode($owner).'/'.rawurldecode($repo).'/installation');
}
/**
* Get an installation of the application for a user.
*
* @link https://developer.github.com/v3/apps/#get-a-user-installation
*
* @param string $username
*
* @return array
*/
public function getInstallationForUser($username)
{
$this->configurePreviewHeader();
return $this->get('/users/'.rawurldecode($username).'/installation');
}
/**
* Delete an installation of the application.
*
* @link https://developer.github.com/v3/apps/#delete-an-installation
*
* @param int $installationId An integration installation id
*/
public function removeInstallation($installationId)
{
$this->configurePreviewHeader();
$this->delete('/app/installations/'.$installationId);
}
/**
* List repositories that are accessible to the authenticated installation.
*
* @link https://developer.github.com/v3/apps/installations/#list-repositories
*
* @param int $userId
*
* @return array
*/
public function listRepositories($userId = null)
{
$parameters = [];
if ($userId) {
$parameters['user_id'] = $userId;
}
$this->configurePreviewHeader();
return $this->get('/installation/repositories', $parameters);
}
/**
* Add a single repository to an installation.
*
* @link https://developer.github.com/v3/apps/installations/#add-repository-to-installation
*
* @param int $installationId
* @param int $repositoryId
*
* @return array
*/
public function addRepository($installationId, $repositoryId)
{
$this->configurePreviewHeader();
return $this->put('/installations/'.$installationId.'/repositories/'.$repositoryId);
}
/**
* Remove a single repository from an installation.
*
* @link https://developer.github.com/v3/apps/installations/#remove-repository-from-installation
*
* @param int $installationId
* @param int $repositoryId
*
* @return array
*/
public function removeRepository($installationId, $repositoryId)
{
$this->configurePreviewHeader();
return $this->delete('/installations/'.$installationId.'/repositories/'.$repositoryId);
}
/**
* Get the currently authenticated app.
*
* @link https://docs.github.com/en/rest/reference/apps#get-the-authenticated-app
*
* @return array
*/
public function getAuthenticatedApp()
{
return $this->get('/app');
}
}

View file

@ -1,65 +0,0 @@
<?php
namespace Github\Api;
/**
* Creating, deleting and listing authorizations.
*
* @link http://developer.github.com/v3/oauth_authorizations/
*
* @author Evgeniy Guseletov <d46k16@gmail.com>
*/
class Authorizations extends AbstractApi
{
/**
* Check an application token.
*
* @param string $clientId
* @param string|null $token
*
* @return array
*/
public function checkToken($clientId, $token = null)
{
return $this->post('/applications/'.rawurlencode($clientId).'/token', $token ? ['access_token' => $token] : []);
}
/**
* Reset an application token.
*
* @param string $clientId
* @param string|null $token
*
* @return array
*/
public function resetToken($clientId, $token = null)
{
return $this->patch('/applications/'.rawurlencode($clientId).'/token', $token ? ['access_token' => $token] : []);
}
/**
* Revoke an application token.
*
* @param string $clientId
* @param string|null $token
*
* @return void
*/
public function deleteToken($clientId, $token = null)
{
$this->delete('/applications/'.rawurlencode($clientId).'/token', $token ? ['access_token' => $token] : []);
}
/**
* Revoke an application authorization.
*
* @param string $clientId
* @param string|null $token
*
* @return void
*/
public function deleteGrant($clientId, $token = null)
{
$this->delete('/applications/'.rawurlencode($clientId).'/grant', $token ? ['access_token' => $token] : []);
}
}

View file

@ -1,193 +0,0 @@
<?php
namespace Github\Api;
use Github\Api\CurrentUser\Emails;
use Github\Api\CurrentUser\Followers;
use Github\Api\CurrentUser\Memberships;
use Github\Api\CurrentUser\Notifications;
use Github\Api\CurrentUser\PublicKeys;
use Github\Api\CurrentUser\Starring;
use Github\Api\CurrentUser\Watchers;
/**
* @link http://developer.github.com/v3/users/
*
* @author Joseph Bielawski <stloyd@gmail.com>
* @author Felipe Valtl de Mello <eu@felipe.im>
*/
class CurrentUser extends AbstractApi
{
use AcceptHeaderTrait;
public function show()
{
return $this->get('/user');
}
public function update(array $params)
{
return $this->patch('/user', $params);
}
/**
* @return Emails
*/
public function emails()
{
return new Emails($this->getClient());
}
/**
* @return Followers
*/
public function follow()
{
return new Followers($this->getClient());
}
public function followers($page = 1)
{
return $this->get('/user/followers', [
'page' => $page,
]);
}
/**
* @link https://docs.github.com/en/rest/reference/issues#list-user-account-issues-assigned-to-the-authenticated-user
*
* @param array $params
* @param bool $includeOrgIssues
*
* @return array
*/
public function issues(array $params = [], $includeOrgIssues = true)
{
return $this->get($includeOrgIssues ? '/issues' : '/user/issues', array_merge(['page' => 1], $params));
}
/**
* @return PublicKeys
*/
public function keys()
{
return new PublicKeys($this->getClient());
}
/**
* @return Notifications
*/
public function notifications()
{
return new Notifications($this->getClient());
}
/**
* @return Memberships
*/
public function memberships()
{
return new Memberships($this->getClient());
}
/**
* @link https://docs.github.com/en/rest/reference/orgs#list-organizations-for-the-authenticated-user
*
* @return array
*/
public function organizations()
{
return $this->get('/user/orgs');
}
/**
* @link https://developer.github.com/v3/orgs/teams/#list-user-teams
*
* @return array
*/
public function teams()
{
return $this->get('/user/teams');
}
/**
* @link https://docs.github.com/en/rest/reference/repos#list-repositories-for-the-authenticated-user
*
* @param string $type role in the repository
* @param string $sort sort by
* @param string $direction direction of sort, asc or desc
* @param string $visibility visibility of repository
* @param string $affiliation relationship to repository
*
* @return array
*/
public function repositories($type = 'owner', $sort = 'full_name', $direction = 'asc', $visibility = null, $affiliation = null)
{
$params = [
'type' => $type,
'sort' => $sort,
'direction' => $direction,
];
if (null !== $visibility) {
unset($params['type']);
$params['visibility'] = $visibility;
}
if (null !== $affiliation) {
unset($params['type']);
$params['affiliation'] = $affiliation;
}
return $this->get('/user/repos', $params);
}
/**
* @return Watchers
*/
public function watchers()
{
return new Watchers($this->getClient());
}
/**
* @return Starring
*/
public function starring()
{
return new Starring($this->getClient());
}
/**
* @link https://docs.github.com/en/rest/reference/activity#list-repositories-watched-by-the-authenticated-user
*/
public function subscriptions()
{
return $this->get('/user/subscriptions');
}
/**
* @link https://docs.github.com/en/rest/reference/apps#list-app-installations-accessible-to-the-user-access-token
*
* @param array $params
*/
public function installations(array $params = [])
{
$this->acceptHeaderValue = 'application/vnd.github.machine-man-preview+json';
return $this->get('/user/installations', array_merge(['page' => 1], $params));
}
/**
* @link https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-access-token
*
* @param string $installationId the ID of the Installation
* @param array $params
*/
public function repositoriesByInstallation($installationId, array $params = [])
{
$this->acceptHeaderValue = 'application/vnd.github.machine-man-preview+json';
return $this->get(sprintf('/user/installations/%s/repositories', $installationId), array_merge(['page' => 1], $params));
}
}

View file

@ -1,94 +0,0 @@
<?php
namespace Github\Api\CurrentUser;
use Github\Api\AbstractApi;
use Github\Exception\InvalidArgumentException;
/**
* @link http://developer.github.com/v3/users/emails/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Emails extends AbstractApi
{
/**
* List emails for the authenticated user.
*
* @link http://developer.github.com/v3/users/emails/
*
* @return array
*/
public function all()
{
return $this->get('/user/emails');
}
/**
* List public email addresses for a user.
*
* @link https://developer.github.com/v3/users/emails/#list-public-email-addresses-for-a-user
*
* @return array
*/
public function allPublic()
{
return $this->get('/user/public_emails');
}
/**
* Adds one or more email for the authenticated user.
*
* @link http://developer.github.com/v3/users/emails/
*
* @param string|array $emails
*
* @throws \Github\Exception\InvalidArgumentException
*
* @return array
*/
public function add($emails)
{
if (is_string($emails)) {
$emails = [$emails];
} elseif (0 === count($emails)) {
throw new InvalidArgumentException('The user emails parameter should be a single email or an array of emails');
}
return $this->post('/user/emails', $emails);
}
/**
* Removes one or more email for the authenticated user.
*
* @link http://developer.github.com/v3/users/emails/
*
* @param string|array $emails
*
* @throws \Github\Exception\InvalidArgumentException
*
* @return array
*/
public function remove($emails)
{
if (is_string($emails)) {
$emails = [$emails];
} elseif (0 === count($emails)) {
throw new InvalidArgumentException('The user emails parameter should be a single email or an array of emails');
}
return $this->delete('/user/emails', $emails);
}
/**
* Toggle primary email visibility.
*
* @link https://developer.github.com/v3/users/emails/#toggle-primary-email-visibility
*
* @return array
*/
public function toggleVisibility()
{
return $this->patch('/user/email/visibility');
}
}

View file

@ -1,71 +0,0 @@
<?php
namespace Github\Api\CurrentUser;
use Github\Api\AbstractApi;
/**
* @link http://developer.github.com/v3/users/followers/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Followers extends AbstractApi
{
/**
* List followed users by the authenticated user.
*
* @link http://developer.github.com/v3/repos/followers/
*
* @param int $page
*
* @return array
*/
public function all($page = 1)
{
return $this->get('/user/following', [
'page' => $page,
]);
}
/**
* Check that the authenticated user follows a user.
*
* @link http://developer.github.com/v3/repos/followers/
*
* @param string $username the username to follow
*
* @return array
*/
public function check($username)
{
return $this->get('/user/following/'.rawurlencode($username));
}
/**
* Make the authenticated user follow a user.
*
* @link http://developer.github.com/v3/repos/followers/
*
* @param string $username the username to follow
*
* @return array
*/
public function follow($username)
{
return $this->put('/user/following/'.rawurlencode($username));
}
/**
* Make the authenticated user un-follow a user.
*
* @link http://developer.github.com/v3/repos/followers/
*
* @param string $username the username to un-follow
*
* @return array
*/
public function unfollow($username)
{
return $this->delete('/user/following/'.rawurlencode($username));
}
}

View file

@ -1,48 +0,0 @@
<?php
namespace Github\Api\CurrentUser;
use Github\Api\AbstractApi;
class Memberships extends AbstractApi
{
/**
* List your organization memberships.
*
* @link https://developer.github.com/v3/orgs/members/#get-your-organization-membership
*
* @return array
*/
public function all()
{
return $this->get('/user/memberships/orgs');
}
/**
* Get your organization membership.
*
* @link https://developer.github.com/v3/orgs/members/#get-your-organization-membership
*
* @param string $organization
*
* @return array
*/
public function organization($organization)
{
return $this->get('/user/memberships/orgs/'.rawurlencode($organization));
}
/**
* Edit your organization membership.
*
* @link https://developer.github.com/v3/orgs/members/#edit-your-organization-membership
*
* @param string $organization
*
* @return array
*/
public function edit($organization)
{
return $this->patch('/user/memberships/orgs/'.rawurlencode($organization), ['state' => 'active']);
}
}

View file

@ -1,145 +0,0 @@
<?php
namespace Github\Api\CurrentUser;
use Github\Api\AbstractApi;
/**
* @link http://developer.github.com/v3/activity/notifications/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Notifications extends AbstractApi
{
/**
* List all notifications for the authenticated user.
*
* @link http://developer.github.com/v3/activity/notifications/#list-your-notifications
*
* @param array $params
*
* @return array
*/
public function all(array $params = [])
{
return $this->get('/notifications', $params);
}
/**
* List all notifications for the authenticated user in selected repository.
*
* @link http://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
* @param array $params
*
* @return array
*/
public function allInRepository($username, $repository, array $params = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params);
}
/**
* Mark all notifications as read.
*
* @link http://developer.github.com/v3/activity/notifications/#mark-as-read
*
* @param array $params
*
* @return array
*/
public function markAsReadAll(array $params = [])
{
return $this->put('/notifications', $params);
}
/**
* Mark all notifications for a repository as read.
*
* @link http://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
* @param array $params
*
* @return array
*/
public function markAsReadInRepository($username, $repository, array $params = [])
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params);
}
/**
* Mark a notification as read.
*
* @link http://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read
*
* @param int $id the notification number
* @param array $params
*
* @return array
*/
public function markAsRead($id, array $params)
{
return $this->patch('/notifications/threads/'.$id, $params);
}
/**
* Show a notification.
*
* @link http://developer.github.com/v3/activity/notifications/#view-a-single-thread
*
* @param int $id the notification number
*
* @return array
*/
public function show($id)
{
return $this->get('/notifications/threads/'.$id);
}
/**
* Show a subscription.
*
* @link http://developer.github.com/v3/activity/notifications/#get-a-thread-subscription
*
* @param int $id the notification number
*
* @return array
*/
public function showSubscription($id)
{
return $this->get('/notifications/threads/'.$id.'/subscription');
}
/**
* Create a subscription.
*
* @link http://developer.github.com/v3/activity/notifications/#set-a-thread-subscription
*
* @param int $id the notification number
* @param array $params
*
* @return array
*/
public function createSubscription($id, array $params)
{
return $this->put('/notifications/threads/'.$id.'/subscription', $params);
}
/**
* Delete a subscription.
*
* @link http://developer.github.com/v3/activity/notifications/#delete-a-thread-subscription
*
* @param int $id the notification number
*
* @return array
*/
public function removeSubscription($id)
{
return $this->delete('/notifications/threads/'.$id.'/subscription');
}
}

View file

@ -1,74 +0,0 @@
<?php
namespace Github\Api\CurrentUser;
use Github\Api\AbstractApi;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/users/keys/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class PublicKeys extends AbstractApi
{
/**
* List deploy keys for the authenticated user.
*
* @link https://developer.github.com/v3/users/keys/
*
* @return array
*/
public function all()
{
return $this->get('/user/keys');
}
/**
* Shows deploy key for the authenticated user.
*
* @link https://developer.github.com/v3/users/keys/
*
* @param int $id
*
* @return array
*/
public function show($id)
{
return $this->get('/user/keys/'.$id);
}
/**
* Adds deploy key for the authenticated user.
*
* @link https://developer.github.com/v3/users/keys/
*
* @param array $params
*
* @throws \Github\Exception\MissingArgumentException
*
* @return array
*/
public function create(array $params)
{
if (!isset($params['title'], $params['key'])) {
throw new MissingArgumentException(['title', 'key']);
}
return $this->post('/user/keys', $params);
}
/**
* Removes deploy key for the authenticated user.
*
* @link https://developer.github.com/v3/users/keys/
*
* @param int $id
*
* @return array
*/
public function remove($id)
{
return $this->delete('/user/keys/'.$id);
}
}

View file

@ -1,97 +0,0 @@
<?php
namespace Github\Api\CurrentUser;
use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
/**
* @link https://developer.github.com/v3/activity/starring/
*
* @author Felipe Valtl de Mello <eu@felipe.im>
*/
class Starring extends AbstractApi
{
use AcceptHeaderTrait;
/**
* Configure the body type.
*
* @see https://developer.github.com/v3/activity/starring/#list-stargazers
*
* @param string $bodyType
*
* @return $this
*/
public function configure($bodyType = null)
{
if ('star' === $bodyType) {
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.star+json', $this->getApiVersion());
}
return $this;
}
/**
* List repositories starred by the authenticated user.
*
* @link https://developer.github.com/v3/activity/starring/
*
* @param int $page
* @param int $perPage
*
* @return array
*/
public function all($page = 1, $perPage = 30)
{
return $this->get('/user/starred', [
'page' => $page,
'per_page' => $perPage,
]);
}
/**
* Check that the authenticated user starres a repository.
*
* @link https://developer.github.com/v3/activity/starring/
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
*
* @return array
*/
public function check($username, $repository)
{
return $this->get('/user/starred/'.rawurlencode($username).'/'.rawurlencode($repository));
}
/**
* Make the authenticated user star a repository.
*
* @link https://developer.github.com/v3/activity/starring/
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
*
* @return array
*/
public function star($username, $repository)
{
return $this->put('/user/starred/'.rawurlencode($username).'/'.rawurlencode($repository));
}
/**
* Make the authenticated user unstar a repository.
*
* @link https://developer.github.com/v3/activity/starring
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
*
* @return array
*/
public function unstar($username, $repository)
{
return $this->delete('/user/starred/'.rawurlencode($username).'/'.rawurlencode($repository));
}
}

View file

@ -1,75 +0,0 @@
<?php
namespace Github\Api\CurrentUser;
use Github\Api\AbstractApi;
/**
* @link https://developer.github.com/v3/activity/watching/
*
* @author Joseph Bielawski <stloyd@gmail.com>
* @revised Felipe Valtl de Mello <eu@felipe.im>
*/
class Watchers extends AbstractApi
{
/**
* List repositories watched by the authenticated user.
*
* @link https://developer.github.com/v3/activity/watching/
*
* @param int $page
*
* @return array
*/
public function all($page = 1)
{
return $this->get('/user/subscriptions', [
'page' => $page,
]);
}
/**
* Check that the authenticated user watches a repository.
*
* @link https://developer.github.com/v3/activity/watching/
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
*
* @return array
*/
public function check($username, $repository)
{
return $this->get('/user/subscriptions/'.rawurlencode($username).'/'.rawurlencode($repository));
}
/**
* Make the authenticated user watch a repository.
*
* @link https://developer.github.com/v3/activity/watching/
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
*
* @return array
*/
public function watch($username, $repository)
{
return $this->put('/user/subscriptions/'.rawurlencode($username).'/'.rawurlencode($repository));
}
/**
* Make the authenticated user unwatch a repository.
*
* @link https://developer.github.com/v3/activity/watching/
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
*
* @return array
*/
public function unwatch($username, $repository)
{
return $this->delete('/user/subscriptions/'.rawurlencode($username).'/'.rawurlencode($repository));
}
}

View file

@ -1,133 +0,0 @@
<?php
namespace Github\Api;
use Github\Exception\MissingArgumentException;
/**
* Listing, creating and updating deployments.
*
* @link https://developer.github.com/v3/repos/deployments/
*/
class Deployment extends AbstractApi
{
use AcceptHeaderTrait;
/**
* List deployments for a particular repository.
*
* @link https://developer.github.com/v3/repos/deployments/#list-deployments
*
* @param string $username the username of the user who owns the repository
* @param string $repository the name of the repository
* @param array $params query parameters to filter deployments by (see link)
*
* @return array the deployments requested
*/
public function all($username, $repository, array $params = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments', $params);
}
/**
* Get a deployment in selected repository.
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
* @param int $id the id of the deployment
*
* @return array
*/
public function show($username, $repository, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.$id);
}
/**
* Create a new deployment for the given username and repo.
*
* @link https://developer.github.com/v3/repos/deployments/#create-a-deployment
*
* Important: Once a deployment is created, it cannot be updated. Changes are indicated by creating new statuses.
* @see updateStatus
*
* @param string $username the username
* @param string $repository the repository
* @param array $params the new deployment data
*
* @throws MissingArgumentException
*
* @return array information about the deployment
*/
public function create($username, $repository, array $params)
{
if (!isset($params['ref'])) {
throw new MissingArgumentException(['ref']);
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments', $params);
}
/**
* Delete a deployment for the given username and repo.
*
* @link https://docs.github.com/en/rest/reference/repos#delete-a-deployment
*
* Important: Deployments can only be deleted when in inactive state
* @see updateStatus
*
* @return mixed null on success, array on error with 'message'
*/
public function remove(string $username, string $repository, int $id)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.$id);
}
/**
* Updates a deployment by creating a new status update.
*
* @link https://developer.github.com/v3/repos/deployments/#create-a-deployment-status
*
* @param string $username the username
* @param string $repository the repository
* @param int $id the deployment number
* @param array $params The information about the deployment update.
* Must include a "state" field of pending, success, error, or failure.
* May also be given a target_url and description, see link for more details.
*
* @throws MissingArgumentException
*
* @return array information about the deployment
*/
public function updateStatus($username, $repository, $id, array $params)
{
if (!isset($params['state'])) {
throw new MissingArgumentException(['state']);
}
// adjust media-type per github docs
// https://docs.github.com/en/rest/reference/repos#create-a-deployment-status
if ($params['state'] === 'inactive') {
$this->acceptHeaderValue = 'application/vnd.github.ant-man-preview+json';
}
if ($params['state'] === 'in_progress' || $params['state'] === 'queued') {
$this->acceptHeaderValue = 'application/vnd.github.flash-preview+json';
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.$id.'/statuses', $params);
}
/**
* Gets all of the status updates tied to a given deployment.
*
* @param string $username the username
* @param string $repository the repository
* @param int $id the deployment identifier
*
* @return array the deployment statuses
*/
public function getStatuses($username, $repository, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.$id.'/statuses');
}
}

View file

@ -1,51 +0,0 @@
<?php
namespace Github\Api;
use Github\Api\Enterprise\License;
use Github\Api\Enterprise\ManagementConsole;
use Github\Api\Enterprise\Stats;
use Github\Api\Enterprise\UserAdmin;
/**
* Getting information about a GitHub Enterprise instance.
*
* @link https://developer.github.com/v3/enterprise/
*
* @author Joseph Bielawski <stloyd@gmail.com>
* @author Guillermo A. Fisher <guillermoandraefisher@gmail.com>
*/
class Enterprise extends AbstractApi
{
/**
* @return Stats
*/
public function stats()
{
return new Stats($this->getClient());
}
/**
* @return License
*/
public function license()
{
return new License($this->getClient());
}
/**
* @return ManagementConsole
*/
public function console()
{
return new ManagementConsole($this->getClient());
}
/**
* @return UserAdmin
*/
public function userAdmin()
{
return new UserAdmin($this->getClient());
}
}

View file

@ -1,20 +0,0 @@
<?php
namespace Github\Api\Enterprise;
use Github\Api\AbstractApi;
class License extends AbstractApi
{
/**
* Provides information about your Enterprise license (only available to site admins).
*
* @link https://developer.github.com/v3/enterprise/license/
*
* @return array array of license information
*/
public function show()
{
return $this->get('/enterprise/settings/license');
}
}

View file

@ -1,77 +0,0 @@
<?php
namespace Github\Api\Enterprise;
use Github\Api\AbstractApi;
class ManagementConsole extends AbstractApi
{
/**
* Checks the status of your installations most recent configuration process.
*
* @link https://developer.github.com/v3/enterprise/management_console/#check-configuration-status
*
* @param string $hash md5 hash of your license
*
* @return array array of configuration status information
*/
public function configcheck($hash)
{
return $this->getWithLicenseHash('/setup/api/configcheck', $hash);
}
/**
* Retrieves your installations settings.
*
* @link https://developer.github.com/v3/enterprise/management_console/#retrieve-settings
*
* @param string $hash md5 hash of your license
*
* @return array array of settings
*/
public function settings($hash)
{
return $this->getWithLicenseHash('/setup/api/settings', $hash);
}
/**
* Checks your installations maintenance status.
*
* @link https://developer.github.com/v3/enterprise/management_console/#check-maintenance-status
*
* @param string $hash md5 hash of your license
*
* @return array array of maintenance status information
*/
public function maintenance($hash)
{
return $this->getWithLicenseHash('/setup/api/maintenance', $hash);
}
/**
* Retrieves your installations authorized SSH keys.
*
* @link https://developer.github.com/v3/enterprise/management_console/#retrieve-authorized-ssh-keys
*
* @param string $hash md5 hash of your license
*
* @return array array of authorized keys
*/
public function keys($hash)
{
return $this->getWithLicenseHash('/setup/api/settings/authorized-keys', $hash);
}
/**
* Sends an authenticated GET request.
*
* @param string $uri the request URI
* @param string $hash md5 hash of your license
*
* @return array|string
*/
protected function getWithLicenseHash($uri, $hash)
{
return $this->get($uri, ['license_md5' => rawurlencode($hash)]);
}
}

View file

@ -1,128 +0,0 @@
<?php
namespace Github\Api\Enterprise;
use Github\Api\AbstractApi;
class Stats extends AbstractApi
{
/**
* Returns the number of open and closed issues.
*
* @return array array with totals of open and closed issues
*/
public function issues()
{
return $this->show('issues');
}
/**
* Returns the number of active and inactive hooks.
*
* @return array array with totals of active and inactive hooks
*/
public function hooks()
{
return $this->show('hooks');
}
/**
* Returns the number of open and closed milestones.
*
* @return array array with totals of open and closed milestones
*/
public function milestones()
{
return $this->show('milestones');
}
/**
* Returns the number of organizations, teams, team members, and disabled organizations.
*
* @return array array with totals of organizations, teams, team members, and disabled organizations
*/
public function orgs()
{
return $this->show('orgs');
}
/**
* Returns the number of comments on issues, pull requests, commits, and gists.
*
* @return array array with totals of comments on issues, pull requests, commits, and gists
*/
public function comments()
{
return $this->show('comments');
}
/**
* Returns the number of GitHub Pages sites.
*
* @return array array with totals of GitHub Pages sites
*/
public function pages()
{
return $this->show('pages');
}
/**
* Returns the number of suspended and admin users.
*
* @return array array with totals of suspended and admin users
*/
public function users()
{
return $this->show('users');
}
/**
* Returns the number of private and public gists.
*
* @return array array with totals of private and public gists
*/
public function gists()
{
return $this->show('gists');
}
/**
* Returns the number of merged, mergeable, and unmergeable pull requests.
*
* @return array array with totals of merged, mergeable, and unmergeable pull requests
*/
public function pulls()
{
return $this->show('pulls');
}
/**
* Returns the number of organization-owned repositories, root repositories, forks, pushed commits, and wikis.
*
* @return array array with totals of organization-owned repositories, root repositories, forks, pushed commits, and wikis
*/
public function repos()
{
return $this->show('repos');
}
/**
* Returns all of the statistics.
*
* @return array array with all of the statistics
*/
public function all()
{
return $this->show('all');
}
/**
* @param string $type The type of statistics to show
*
* @return array
*/
public function show($type)
{
return $this->get('/enterprise/stats/'.rawurlencode($type));
}
}

View file

@ -1,36 +0,0 @@
<?php
namespace Github\Api\Enterprise;
use Github\Api\AbstractApi;
class UserAdmin extends AbstractApi
{
/**
* Suspend a user.
*
* @link https://developer.github.com/v3/users/administration/#suspend-a-user
*
* @param string $username
*
* @return array
*/
public function suspend($username)
{
return $this->put('/users/'.rawurldecode($username).'/suspended', ['Content-Length' => 0]);
}
/**
* Unsuspend a user.
*
* @link https://developer.github.com/v3/users/administration/#unsuspend-a-user
*
* @param string $username
*
* @return array
*/
public function unsuspend($username)
{
return $this->delete('/users/'.rawurldecode($username).'/suspended');
}
}

View file

@ -1,101 +0,0 @@
<?php
namespace Github\Api\Gist;
use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
/**
* @link https://developer.github.com/v3/gists/comments/
*
* @author Kayla Daniels <kayladnls@gmail.com>
*/
class Comments extends AbstractApi
{
use AcceptHeaderTrait;
/**
* Configure the body type.
*
* @link https://developer.github.com/v3/gists/comments/#custom-media-types
*
* @param string|null $bodyType
*
* @return $this
*/
public function configure($bodyType = null)
{
if (!in_array($bodyType, ['text', 'html', 'full'])) {
$bodyType = 'raw';
}
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s+json', $this->getApiVersion(), $bodyType);
return $this;
}
/**
* Get all comments for a gist.
*
* @param string $gist
*
* @return array
*/
public function all($gist)
{
return $this->get('/gists/'.rawurlencode($gist).'/comments');
}
/**
* Get a comment of a gist.
*
* @param string $gist
* @param int $comment
*
* @return array
*/
public function show($gist, $comment)
{
return $this->get('/gists/'.rawurlencode($gist).'/comments/'.$comment);
}
/**
* Create a comment for gist.
*
* @param string $gist
* @param string $body
*
* @return array
*/
public function create($gist, $body)
{
return $this->post('/gists/'.rawurlencode($gist).'/comments', ['body' => $body]);
}
/**
* Create a comment for a gist.
*
* @param string $gist
* @param int $comment_id
* @param string $body
*
* @return array
*/
public function update($gist, $comment_id, $body)
{
return $this->patch('/gists/'.rawurlencode($gist).'/comments/'.$comment_id, ['body' => $body]);
}
/**
* Delete a comment for a gist.
*
* @param string $gist
* @param int $comment
*
* @return array
*/
public function remove($gist, $comment)
{
return $this->delete('/gists/'.rawurlencode($gist).'/comments/'.$comment);
}
}

View file

@ -1,182 +0,0 @@
<?php
namespace Github\Api;
use Github\Api\Gist\Comments;
use Github\Exception\MissingArgumentException;
/**
* Creating, editing, deleting and listing gists.
*
* @link http://developer.github.com/v3/gists/
*
* @author Joseph Bielawski <stloyd@gmail.com>
* @author Edoardo Rivello <edoardo.rivello at gmail dot com>
*/
class Gists extends AbstractApi
{
use AcceptHeaderTrait;
/**
* Configure the body type.
*
* @link https://developer.github.com/v3/gists/#custom-media-types
*
* @param string|null $bodyType
*
* @return $this
*/
public function configure($bodyType = null)
{
if ('base64' !== $bodyType) {
$bodyType = 'raw';
}
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s', $this->getApiVersion(), $bodyType);
return $this;
}
/**
* @param string|null $type
*
* @return array|string
*/
public function all($type = null)
{
if (!in_array($type, ['public', 'starred'])) {
return $this->get('/gists');
}
return $this->get('/gists/'.rawurlencode($type));
}
/**
* @param string $number
*
* @return array
*/
public function show($number)
{
return $this->get('/gists/'.rawurlencode($number));
}
/**
* Get a specific revision of a gist.
*
* @param string $number
* @param string $sha
*
* @link https://developer.github.com/v3/gists/#get-a-specific-revision-of-a-gist
*
* @return array
*/
public function revision($number, $sha)
{
return $this->get('/gists/'.rawurlencode($number).'/'.rawurlencode($sha));
}
public function create(array $params)
{
if (!isset($params['files']) || (!is_array($params['files']) || 0 === count($params['files']))) {
throw new MissingArgumentException('files');
}
$params['public'] = (bool) $params['public'];
return $this->post('/gists', $params);
}
/**
* @param string $id
* @param array $params
*
* @return array
*/
public function update($id, array $params)
{
return $this->patch('/gists/'.rawurlencode($id), $params);
}
/**
* @param string $id
*
* @return array
*/
public function commits($id)
{
return $this->get('/gists/'.rawurlencode($id).'/commits');
}
/**
* @param string $id
*
* @return array
*/
public function fork($id)
{
return $this->post('/gists/'.rawurlencode($id).'/fork');
}
/**
* @param string $id
*
* @return array
*/
public function forks($id)
{
return $this->get('/gists/'.rawurlencode($id).'/forks');
}
/**
* @param string $id
*
* @return array
*/
public function remove($id)
{
return $this->delete('/gists/'.rawurlencode($id));
}
/**
* @param string $id
*
* @return array
*/
public function check($id)
{
return $this->get('/gists/'.rawurlencode($id).'/star');
}
/**
* @param string $id
*
* @return array
*/
public function star($id)
{
return $this->put('/gists/'.rawurlencode($id).'/star');
}
/**
* @param string $id
*
* @return array
*/
public function unstar($id)
{
return $this->delete('/gists/'.rawurlencode($id).'/star');
}
/**
* Get a gist's comments.
*
* @link http://developer.github.com/v3/gists/comments/
*
* @return Comments
*/
public function comments()
{
return new Comments($this->getClient());
}
}

View file

@ -1,59 +0,0 @@
<?php
namespace Github\Api;
use Github\Api\GitData\Blobs;
use Github\Api\GitData\Commits;
use Github\Api\GitData\References;
use Github\Api\GitData\Tags;
use Github\Api\GitData\Trees;
/**
* Getting full versions of specific files and trees in your Git repositories.
*
* @link http://developer.github.com/v3/git/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class GitData extends AbstractApi
{
/**
* @return Blobs
*/
public function blobs()
{
return new Blobs($this->getClient());
}
/**
* @return Commits
*/
public function commits()
{
return new Commits($this->getClient());
}
/**
* @return References
*/
public function references()
{
return new References($this->getClient());
}
/**
* @return Tags
*/
public function tags()
{
return new Tags($this->getClient());
}
/**
* @return Trees
*/
public function trees()
{
return new Trees($this->getClient());
}
}

View file

@ -1,68 +0,0 @@
<?php
namespace Github\Api\GitData;
use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/git/blobs/
*
* @author Joseph Bielawski <stloyd@gmail.com>
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
*/
class Blobs extends AbstractApi
{
use AcceptHeaderTrait;
/**
* Configure the Accept header depending on the blob type.
*
* @param string|null $bodyType
*
* @return $this
*/
public function configure($bodyType = null)
{
if ('raw' === $bodyType) {
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.raw', $this->getApiVersion());
}
return $this;
}
/**
* Show a blob of a sha for a repository.
*
* @param string $username
* @param string $repository
* @param string $sha
*
* @return array
*/
public function show($username, $repository, $sha)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/blobs/'.rawurlencode($sha));
}
/**
* Create a blob of a sha for a repository.
*
* @param string $username
* @param string $repository
* @param array $params
*
* @throws \Github\Exception\MissingArgumentException
*
* @return array
*/
public function create($username, $repository, array $params)
{
if (!isset($params['content'], $params['encoding'])) {
throw new MissingArgumentException(['content', 'encoding']);
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/blobs', $params);
}
}

View file

@ -1,48 +0,0 @@
<?php
namespace Github\Api\GitData;
use Github\Api\AbstractApi;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/git/commits/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Commits extends AbstractApi
{
/**
* Show a commit for a repository.
*
* @param string $username
* @param string $repository
* @param string $sha
*
* @return array
*/
public function show($username, $repository, $sha)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/commits/'.rawurlencode($sha));
}
/**
* Create a commit for a repository.
*
* @param string $username
* @param string $repository
* @param array $params
*
* @throws \Github\Exception\MissingArgumentException
*
* @return array
*/
public function create($username, $repository, array $params)
{
if (!isset($params['message'], $params['tree'], $params['parents'])) {
throw new MissingArgumentException(['message', 'tree', 'parents']);
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/commits', $params);
}
}

View file

@ -1,156 +0,0 @@
<?php
namespace Github\Api\GitData;
use Github\Api\AbstractApi;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/git/references/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class References extends AbstractApi
{
/**
* Get all references of a repository.
*
* @param string $username
* @param string $repository
*
* @return array
*/
public function all($username, $repository)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs');
}
/**
* Get all matching references for the supplied reference name.
*
* @param string $username
* @param string $repository
* @param string $reference
*
* @return array
*/
public function matching(string $username, string $repository, string $reference): array
{
$reference = $this->encodeReference($reference);
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/matching-refs/'.$reference);
}
/**
* Get all branches of a repository.
*
* @param string $username
* @param string $repository
*
* @return array
*/
public function branches($username, $repository)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/heads');
}
/**
* Get all tags of a repository.
*
* @param string $username
* @param string $repository
*
* @return array
*/
public function tags($username, $repository)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/tags');
}
/**
* Show the reference of a repository.
*
* @param string $username
* @param string $repository
* @param string $reference
*
* @return array
*/
public function show($username, $repository, $reference)
{
$reference = $this->encodeReference($reference);
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference);
}
/**
* Create a reference for a repository.
*
* @param string $username
* @param string $repository
* @param array $params
*
* @throws \Github\Exception\MissingArgumentException
*
* @return array
*/
public function create($username, $repository, array $params)
{
if (!isset($params['ref'], $params['sha'])) {
throw new MissingArgumentException(['ref', 'sha']);
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs', $params);
}
/**
* Update a reference for a repository.
*
* @param string $username
* @param string $repository
* @param string $reference
* @param array $params
*
* @throws \Github\Exception\MissingArgumentException
*
* @return array
*/
public function update($username, $repository, $reference, array $params)
{
if (!isset($params['sha'])) {
throw new MissingArgumentException('sha');
}
$reference = $this->encodeReference($reference);
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference, $params);
}
/**
* Delete a reference of a repository.
*
* @param string $username
* @param string $repository
* @param string $reference
*
* @return array
*/
public function remove($username, $repository, $reference)
{
$reference = $this->encodeReference($reference);
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference);
}
/**
* Encode the raw reference.
*
* @param string $rawReference
*
* @return string
*/
private function encodeReference($rawReference)
{
return implode('/', array_map('rawurlencode', explode('/', $rawReference)));
}
}

View file

@ -1,65 +0,0 @@
<?php
namespace Github\Api\GitData;
use Github\Api\AbstractApi;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/git/tags/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Tags extends AbstractApi
{
/**
* Get all tags for a repository.
*
* @param string $username
* @param string $repository
*
* @return array
*/
public function all($username, $repository)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/tags');
}
/**
* Get a tag for a repository.
*
* @param string $username
* @param string $repository
* @param string $sha
*
* @return array
*/
public function show($username, $repository, $sha)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/tags/'.rawurlencode($sha));
}
/**
* Create a tag for a repository.
*
* @param string $username
* @param string $repository
* @param array $params
*
* @throws \Github\Exception\MissingArgumentException
*
* @return array
*/
public function create($username, $repository, array $params)
{
if (!isset($params['tag'], $params['message'], $params['object'], $params['type'])) {
throw new MissingArgumentException(['tag', 'message', 'object', 'type']);
}
if (isset($params['tagger']) && !isset($params['tagger']['name'], $params['tagger']['email'], $params['tagger']['date'])) {
throw new MissingArgumentException(['tagger.name', 'tagger.email', 'tagger.date']);
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/tags', $params);
}
}

View file

@ -1,64 +0,0 @@
<?php
namespace Github\Api\GitData;
use Github\Api\AbstractApi;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/git/trees/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Trees extends AbstractApi
{
/**
* Get the tree for a repository.
*
* @param string $username
* @param string $repository
* @param string $sha
* @param bool $recursive
*
* @return array
*/
public function show($username, $repository, $sha, $recursive = false)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/trees/'.rawurlencode($sha), $recursive ? ['recursive' => 1] : []);
}
/**
* Create tree for a repository.
*
* @param string $username
* @param string $repository
* @param array $params
*
* @throws \Github\Exception\MissingArgumentException
*
* @return array
*/
public function create($username, $repository, array $params)
{
if (!isset($params['tree']) || !is_array($params['tree'])) {
throw new MissingArgumentException('tree');
}
if (!isset($params['tree'][0])) {
$params['tree'] = [$params['tree']];
}
foreach ($params['tree'] as $key => $tree) {
if (!isset($tree['path'], $tree['mode'], $tree['type'])) {
throw new MissingArgumentException(["tree.$key.path", "tree.$key.mode", "tree.$key.type"]);
}
// If `sha` is not set, `content` is required
if (!array_key_exists('sha', $tree) && !isset($tree['content'])) {
throw new MissingArgumentException("tree.$key.content");
}
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/trees', $params);
}
}

View file

@ -1,48 +0,0 @@
<?php
namespace Github\Api;
/**
* GraphQL API.
*
* Part of the Github v4 API
*
* @link https://developer.github.com/v4/
*
* @author Miguel Piedrafita <soy@miguelpiedrafita.com>
*/
class GraphQL extends AbstractApi
{
use AcceptHeaderTrait;
/**
* @param string $query
* @param array $variables
* @param string $acceptHeaderValue
*
* @return array
*/
public function execute($query, array $variables = [], string $acceptHeaderValue = 'application/vnd.github.v4+json')
{
$this->acceptHeaderValue = $acceptHeaderValue;
$params = [
'query' => $query,
];
if (!empty($variables)) {
$params['variables'] = json_encode($variables);
}
return $this->post('/graphql', $params);
}
/**
* @param string $file
* @param array $variables
*
* @return array
*/
public function fromFile($file, array $variables = [])
{
return $this->execute(file_get_contents($file), $variables);
}
}

View file

@ -1,241 +0,0 @@
<?php
namespace Github\Api;
use Github\Api\Issue\Assignees;
use Github\Api\Issue\Comments;
use Github\Api\Issue\Events;
use Github\Api\Issue\Labels;
use Github\Api\Issue\Milestones;
use Github\Api\Issue\Timeline;
use Github\Exception\MissingArgumentException;
/**
* Listing issues, searching, editing and closing your projects issues.
*
* @link http://develop.github.com/p/issues.html
*
* @author Thibault Duplessis <thibault.duplessis at gmail dot com>
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Issue extends AbstractApi
{
use AcceptHeaderTrait;
/**
* Configure the body type.
*
* @link https://developer.github.com/v3/issues/#custom-media-types
*
* @param string|null $bodyType
*
* @return $this
*/
public function configure($bodyType = null)
{
if (!in_array($bodyType, ['text', 'html', 'full'])) {
$bodyType = 'raw';
}
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s+json', $this->getApiVersion(), $bodyType);
return $this;
}
/**
* List issues by username, repo and state.
*
* @link http://developer.github.com/v3/issues/
*
* @param string $username the username
* @param string $repository the repository
* @param array $params the additional parameters like milestone, assignees, labels, sort, direction
*
* @return array list of issues found
*/
public function all($username, $repository, array $params = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues', array_merge(['page' => 1], $params));
}
/**
* List issues by organization.
*
* @link http://developer.github.com/v3/issues/
*
* @param string $organization the organization
* @param string $state the issue state, can be open or closed
* @param array $params the additional parameters like milestone, assignees, labels, sort, direction
*
* @return array list of issues found
*/
public function org($organization, $state, array $params = [])
{
if (!in_array($state, ['open', 'closed'])) {
$state = 'open';
}
return $this->get('/orgs/'.rawurlencode($organization).'/issues', array_merge(['page' => 1, 'state' => $state], $params));
}
/**
* Get extended information about an issue by its username, repo and number.
*
* @link http://developer.github.com/v3/issues/
*
* @param string $username the username
* @param string $repository the repository
* @param int $id the issue number
*
* @return array information about the issue
*/
public function show($username, $repository, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$id);
}
/**
* Create a new issue for the given username and repo.
* The issue is assigned to the authenticated user. Requires authentication.
*
* @link http://developer.github.com/v3/issues/
*
* @param string $username the username
* @param string $repository the repository
* @param array $params the new issue data
*
* @throws MissingArgumentException
*
* @return array information about the issue
*/
public function create($username, $repository, array $params)
{
if (!isset($params['title'])) {
throw new MissingArgumentException(['title']);
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues', $params);
}
/**
* Update issue information's by username, repo and issue number. Requires authentication.
*
* @link http://developer.github.com/v3/issues/
*
* @param string $username the username
* @param string $repository the repository
* @param int $id the issue number
* @param array $params key=>value user attributes to update.
* key can be title or body
*
* @return array information about the issue
*/
public function update($username, $repository, $id, array $params)
{
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$id, $params);
}
/**
* Lock an issue. Users with push access can lock an issue's conversation.
*
* @link https://developer.github.com/v3/issues/#lock-an-issue
*
* @param string $username
* @param string $repository
* @param int $id
*
* @return string
*/
public function lock($username, $repository, $id)
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$id.'/lock');
}
/**
* Unlock an issue. Users with push access can unlock an issue's conversation.
*
* @link https://developer.github.com/v3/issues/#lock-an-issue
*
* @param string $username
* @param string $repository
* @param int $id
*
* @return string
*/
public function unlock($username, $repository, $id)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$id.'/lock');
}
/**
* List an issue comments.
*
* @link http://developer.github.com/v3/issues/comments/
*
* @return Comments
*/
public function comments()
{
return new Comments($this->getClient());
}
/**
* List all project events.
*
* @link http://developer.github.com/v3/issues/events/
*
* @return Events
*/
public function events()
{
return new Events($this->getClient());
}
/**
* List all project labels.
*
* @link http://developer.github.com/v3/issues/labels/
*
* @return Labels
*/
public function labels()
{
return new Labels($this->getClient());
}
/**
* List all project milestones.
*
* @link http://developer.github.com/v3/issues/milestones/
*
* @return Milestones
*/
public function milestones()
{
return new Milestones($this->getClient());
}
/**
* List all assignees.
*
* @link https://developer.github.com/v3/issues/assignees/
*
* @return Assignees
*/
public function assignees()
{
return new Assignees($this->getClient());
}
/**
* List all events.
*
* @link https://developer.github.com/v3/issues/timeline/
*
* @return Timeline
*/
public function timeline()
{
return new Timeline($this->getClient());
}
}

View file

@ -1,91 +0,0 @@
<?php
namespace Github\Api\Issue;
use Github\Api\AbstractApi;
use Github\Exception\InvalidArgumentException;
use Github\Exception\MissingArgumentException;
class Assignees extends AbstractApi
{
/**
* List all the available assignees to which issues may be assigned.
*
* @param string $username
* @param string $repository
* @param array $parameters
*
* @return array
*/
public function listAvailable($username, $repository, array $parameters = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/assignees', $parameters);
}
/**
* Check to see if a particular user is an assignee for a repository.
*
* @link https://developer.github.com/v3/issues/assignees/#check-assignee
*
* @param string $username
* @param string $repository
* @param string $assignee
*
* @return array
*/
public function check($username, $repository, $assignee)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/assignees/'.rawurlencode($assignee));
}
/**
* Add assignees to an Issue.
*
* @link https://developer.github.com/v3/issues/assignees/#add-assignees-to-an-issue
*
* @param string $username
* @param string $repository
* @param string $issue
* @param array $parameters
*
* @throws InvalidArgumentException
* @throws MissingArgumentException
*
* @return string
*/
public function add($username, $repository, $issue, array $parameters)
{
if (!isset($parameters['assignees'])) {
throw new MissingArgumentException('assignees');
}
if (!is_array($parameters['assignees'])) {
throw new InvalidArgumentException('The assignees parameter should be an array of assignees');
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/assignees', $parameters);
}
/**
* Remove assignees from an Issue.
*
* @link https://developer.github.com/v3/issues/assignees/#remove-assignees-from-an-issue
*
* @param string $username
* @param string $repository
* @param string $issue
* @param array $parameters
*
* @throws MissingArgumentException
*
* @return string
*/
public function remove($username, $repository, $issue, array $parameters)
{
if (!isset($parameters['assignees'])) {
throw new MissingArgumentException('assignees');
}
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/assignees', $parameters);
}
}

View file

@ -1,133 +0,0 @@
<?php
namespace Github\Api\Issue;
use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/issues/comments/
*
* @author Joseph Bielawski <stloyd@gmail.com>
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
*/
class Comments extends AbstractApi
{
use AcceptHeaderTrait;
/**
* Configure the body type.
*
* @link https://developer.github.com/v3/issues/comments/#custom-media-types
*
* @param string|null $bodyType
*
* @return $this
*/
public function configure($bodyType = null)
{
if (!in_array($bodyType, ['raw', 'text', 'html'])) {
$bodyType = 'full';
}
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s+json', $this->getApiVersion(), $bodyType);
return $this;
}
/**
* Get all comments for an issue.
*
* @link https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue
*
* @param string $username
* @param string $repository
* @param int $issue
* @param array $params
*
* @return array
*/
public function all($username, $repository, $issue, array $params = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$issue.'/comments', $params);
}
/**
* Get a comment for an issue.
*
* @link https://developer.github.com/v3/issues/comments/#get-a-single-comment
*
* @param string $username
* @param string $repository
* @param int $comment
*
* @return array
*/
public function show($username, $repository, $comment)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.$comment);
}
/**
* Create a comment for an issue.
*
* @link https://developer.github.com/v3/issues/comments/#create-a-comment
*
* @param string $username
* @param string $repository
* @param int $issue
* @param array $params
*
* @throws \Github\Exception\MissingArgumentException
*
* @return array
*/
public function create($username, $repository, $issue, array $params)
{
if (!isset($params['body'])) {
throw new MissingArgumentException('body');
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$issue.'/comments', $params);
}
/**
* Update a comment for an issue.
*
* @link https://developer.github.com/v3/issues/comments/#edit-a-comment
*
* @param string $username
* @param string $repository
* @param int $comment
* @param array $params
*
* @throws \Github\Exception\MissingArgumentException
*
* @return array
*/
public function update($username, $repository, $comment, array $params)
{
if (!isset($params['body'])) {
throw new MissingArgumentException('body');
}
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.$comment, $params);
}
/**
* Delete a comment for an issue.
*
* @link https://developer.github.com/v3/issues/comments/#delete-a-comment
*
* @param string $username
* @param string $repository
* @param int $comment
*
* @return array
*/
public function remove($username, $repository, $comment)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.$comment);
}
}

View file

@ -1,54 +0,0 @@
<?php
namespace Github\Api\Issue;
use Github\Api\AbstractApi;
/**
* @link http://developer.github.com/v3/issues/events/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Events extends AbstractApi
{
/**
* Get all events for an issue.
*
* @link https://developer.github.com/v3/issues/events/#list-events-for-an-issue
*
* @param string $username
* @param string $repository
* @param int|null $issue
* @param int $page
*
* @return array
*/
public function all($username, $repository, $issue = null, $page = 1)
{
if (null !== $issue) {
$path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$issue.'/events';
} else {
$path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/events';
}
return $this->get($path, [
'page' => $page,
]);
}
/**
* Display an event for an issue.
*
* @link https://developer.github.com/v3/issues/events/#get-a-single-event
*
* @param string $username
* @param string $repository
* @param string $event
*
* @return array
*/
public function show($username, $repository, $event)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/events/'.rawurlencode($event));
}
}

View file

@ -1,192 +0,0 @@
<?php
namespace Github\Api\Issue;
use Github\Api\AbstractApi;
use Github\Exception\InvalidArgumentException;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/issues/labels/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Labels extends AbstractApi
{
/**
* Get all labels for a repository or the labels for a specific issue.
*
* @link https://developer.github.com/v3/issues/labels/#list-labels-on-an-issue
*
* @param string $username
* @param string $repository
* @param int|null $issue
*
* @return array
*/
public function all($username, $repository, $issue = null)
{
if ($issue === null) {
$path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels';
} else {
$path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$issue.'/labels';
}
return $this->get($path);
}
/**
* Get a single label.
*
* @link https://developer.github.com/v3/issues/labels/#get-a-single-label
*
* @param string $username
* @param string $repository
* @param string $label
*
* @return array
*/
public function show($username, $repository, $label)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label));
}
/**
* Create a label for a repository.
*
* @link https://developer.github.com/v3/issues/labels/#create-a-label
*
* @param string $username
* @param string $repository
* @param array $params
*
* @throws \Github\Exception\MissingArgumentException
*
* @return array
*/
public function create($username, $repository, array $params)
{
if (!isset($params['name'])) {
throw new MissingArgumentException('name');
}
if (!isset($params['color'])) {
$params['color'] = 'FFFFFF';
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels', $params);
}
/**
* Delete a label for a repository.
*
* @link https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue
*
* @param string $username
* @param string $repository
* @param string $label
*
* @return array
*/
public function deleteLabel($username, $repository, $label)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label));
}
/**
* Edit a label for a repository.
*
* @link https://developer.github.com/v3/issues/labels/#update-a-label
*
* @param string $username
* @param string $repository
* @param string $label
* @param string $newName
* @param string $color
*
* @return array
*/
public function update($username, $repository, $label, $newName, $color)
{
$params = [
'name' => $newName,
'color' => $color,
];
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label), $params);
}
/**
* Add a label to an issue.
*
* @link https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue
*
* @param string $username
* @param string $repository
* @param int $issue
* @param string|array $labels
*
* @return array
*
* @thorws \Github\Exception\InvalidArgumentException
*/
public function add($username, $repository, $issue, $labels)
{
if (is_string($labels)) {
$labels = [$labels];
} elseif (0 === count($labels)) {
throw new InvalidArgumentException('The labels parameter should be a single label or an array of labels');
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$issue.'/labels', $labels);
}
/**
* Replace labels for an issue.
*
* @link https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue
*
* @param string $username
* @param string $repository
* @param int $issue
* @param array $params
*
* @return array
*/
public function replace($username, $repository, $issue, array $params)
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$issue.'/labels', $params);
}
/**
* Remove a label for an issue.
*
* @link https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue
*
* @param string $username
* @param string $repository
* @param int $issue
* @param string $label
*
* @return array|string
*/
public function remove($username, $repository, $issue, $label)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$issue.'/labels/'.rawurlencode($label));
}
/**
* Remove all labels from an issue.
*
* @link https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue
*
* @param string $username
* @param string $repository
* @param int $issue
*
* @return array|string
*/
public function clear($username, $repository, $issue)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$issue.'/labels');
}
}

View file

@ -1,139 +0,0 @@
<?php
namespace Github\Api\Issue;
use Github\Api\AbstractApi;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/issues/milestones/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Milestones extends AbstractApi
{
/**
* Get all milestones for a repository.
*
* @link https://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
*
* @param string $username
* @param string $repository
* @param array $params
*
* @return array
*/
public function all($username, $repository, array $params = [])
{
if (isset($params['state']) && !in_array($params['state'], ['open', 'closed', 'all'])) {
$params['state'] = 'open';
}
if (isset($params['sort']) && !in_array($params['sort'], ['due_date', 'completeness'])) {
$params['sort'] = 'due_date';
}
if (isset($params['direction']) && !in_array($params['direction'], ['asc', 'desc'])) {
$params['direction'] = 'asc';
}
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones', array_merge([
'page' => 1,
'state' => 'open',
'sort' => 'due_date',
'direction' => 'asc',
], $params));
}
/**
* Get a milestone for a repository.
*
* @link https://developer.github.com/v3/issues/milestones/#get-a-single-milestone
*
* @param string $username
* @param string $repository
* @param int $id
*
* @return array
*/
public function show($username, $repository, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.$id);
}
/**
* Create a milestone for a repository.
*
* @link https://developer.github.com/v3/issues/milestones/#create-a-milestone
*
* @param string $username
* @param string $repository
* @param array $params
*
* @throws \Github\Exception\MissingArgumentException
*
* @return array
*/
public function create($username, $repository, array $params)
{
if (!isset($params['title'])) {
throw new MissingArgumentException('title');
}
if (isset($params['state']) && !in_array($params['state'], ['open', 'closed'])) {
$params['state'] = 'open';
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones', $params);
}
/**
* Update a milestone for a repository.
*
* @link https://developer.github.com/v3/issues/milestones/#update-a-milestone
*
* @param string $username
* @param string $repository
* @param int $id
* @param array $params
*
* @return array
*/
public function update($username, $repository, $id, array $params)
{
if (isset($params['state']) && !in_array($params['state'], ['open', 'closed'])) {
$params['state'] = 'open';
}
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.$id, $params);
}
/**
* Delete a milestone for a repository.
*
* @link https://developer.github.com/v3/issues/milestones/#delete-a-milestone
*
* @param string $username
* @param string $repository
* @param int $id
*
* @return array|string
*/
public function remove($username, $repository, $id)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.$id);
}
/**
* Get the labels of a milestone.
*
* @link https://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone
*
* @param string $username
* @param string $repository
* @param int $id
*
* @return array
*/
public function labels($username, $repository, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.$id.'/labels');
}
}

View file

@ -1,34 +0,0 @@
<?php
namespace Github\Api\Issue;
use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
class Timeline extends AbstractApi
{
use AcceptHeaderTrait;
public function configure()
{
$this->acceptHeaderValue = 'application/vnd.github.mockingbird-preview';
return $this;
}
/**
* Get all events for a specific issue.
*
* @link https://developer.github.com/v3/issues/timeline/#list-events-for-an-issue
*
* @param string $username
* @param string $repository
* @param int $issue
*
* @return array
*/
public function all($username, $repository, $issue)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$issue.'/timeline');
}
}

View file

@ -1,49 +0,0 @@
<?php
namespace Github\Api;
/**
* Markdown Rendering API.
*
* @link http://developer.github.com/v3/markdown/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Markdown extends AbstractApi
{
/**
* @param string $text
* @param string $mode
* @param string $context
*
* @return string
*/
public function render($text, $mode = 'markdown', $context = null)
{
if (!in_array($mode, ['gfm', 'markdown'])) {
$mode = 'markdown';
}
$params = [
'text' => $text,
'mode' => $mode,
];
if (null !== $context && 'gfm' === $mode) {
$params['context'] = $context;
}
return $this->post('/markdown', $params);
}
/**
* @param string $file
*
* @return string
*/
public function renderRaw($file)
{
return $this->post('/markdown/raw', [
'file' => $file,
]);
}
}

View file

@ -1,23 +0,0 @@
<?php
namespace Github\Api;
/**
* Getting GitHub service information.
*
* @link https://developer.github.com/v3/meta/
*
* @author Claude Dioudonnat <claude.dioudonnat@gmail.com>
*/
class Meta extends AbstractApi
{
/**
* Get the ip address of the hook and git servers for the GitHub.com service.
*
* @return array Information about the service of GitHub.com
*/
public function service()
{
return $this->get('/meta');
}
}

View file

@ -1,44 +0,0 @@
<?php
namespace Github\Api\Miscellaneous;
use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
class CodeOfConduct extends AbstractApi
{
use AcceptHeaderTrait;
public function configure()
{
$this->acceptHeaderValue = 'application/vnd.github.scarlet-witch-preview+json';
return $this;
}
/**
* List all codes of conduct.
*
* @link https://developer.github.com/v3/codes_of_conduct/#list-all-codes-of-conduct
*
* @return array
*/
public function all()
{
return $this->get('/codes_of_conduct');
}
/**
* Get an individual code of conduct.
*
* @link https://developer.github.com/v3/codes_of_conduct/#get-an-individual-code-of-conduct
*
* @param string $key
*
* @return array
*/
public function show($key)
{
return $this->get('/codes_of_conduct/'.rawurlencode($key));
}
}

View file

@ -1,20 +0,0 @@
<?php
namespace Github\Api\Miscellaneous;
use Github\Api\AbstractApi;
class Emojis extends AbstractApi
{
/**
* Lists all the emojis available to use on GitHub.
*
* @link https://developer.github.com/v3/emojis/
*
* @return array
*/
public function all()
{
return $this->get('/emojis');
}
}

View file

@ -1,34 +0,0 @@
<?php
namespace Github\Api\Miscellaneous;
use Github\Api\AbstractApi;
class Gitignore extends AbstractApi
{
/**
* List all templates available to pass as an option when creating a repository.
*
* @link https://developer.github.com/v3/gitignore/#listing-available-templates
*
* @return array
*/
public function all()
{
return $this->get('/gitignore/templates');
}
/**
* Get a single template.
*
* @link https://developer.github.com/v3/gitignore/#get-a-single-template
*
* @param string $template
*
* @return array
*/
public function show($template)
{
return $this->get('/gitignore/templates/'.rawurlencode($template));
}
}

View file

@ -1,34 +0,0 @@
<?php
namespace Github\Api\Miscellaneous;
use Github\Api\AbstractApi;
class Licenses extends AbstractApi
{
/**
* Lists all the licenses available on GitHub.
*
* @link https://developer.github.com/v3/licenses/
*
* @return array
*/
public function all()
{
return $this->get('/licenses');
}
/**
* Get an individual license by its license key.
*
* @link https://developer.github.com/v3/licenses/#get-an-individual-license
*
* @param string $license
*
* @return array
*/
public function show($license)
{
return $this->get('/licenses/'.rawurlencode($license));
}
}

View file

@ -1,91 +0,0 @@
<?php
namespace Github\Api;
use DateTime;
/**
* API for accessing Notifications from your Git/Github repositories.
*
* Important! You have to be authenticated to perform these methods
*
* @link https://developer.github.com/v3/activity/notifications/
*
* @author Dennis de Greef <github@link0.net>
*/
class Notification extends AbstractApi
{
/**
* Get a listing of notifications.
*
* @link https://developer.github.com/v3/activity/notifications/
*
* @param bool $includingRead
* @param bool $participating
* @param DateTime|null $since
* @param DateTime|null $before
*
* @return array array of notifications
*/
public function all($includingRead = false, $participating = false, DateTime $since = null, DateTime $before = null)
{
$parameters = [
'all' => $includingRead,
'participating' => $participating,
];
if ($since !== null) {
$parameters['since'] = $since->format(DateTime::ISO8601);
}
if ($before !== null) {
$parameters['before'] = $before->format(DateTime::ISO8601);
}
return $this->get('/notifications', $parameters);
}
/**
* Marks all notifications as read from the current date.
*
* Optionally give DateTime to mark as read before that date.
*
* @link https://developer.github.com/v3/activity/notifications/#mark-as-read
*
* @param DateTime|null $since
*/
public function markRead(DateTime $since = null)
{
$parameters = [];
if ($since !== null) {
$parameters['last_read_at'] = $since->format(DateTime::ISO8601);
}
$this->put('/notifications', $parameters);
}
/**
* Mark a single thread as read using its ID.
*
* @link https://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read
*
* @param int $id
*/
public function markThreadRead($id)
{
$this->patch('/notifications/threads/'.$id);
}
/**
* Gets a single thread using its ID.
*
* @link https://developer.github.com/v3/activity/notifications/#view-a-single-thread
*
* @param int $id
*/
public function id($id)
{
return $this->get('/notifications/threads/'.$id);
}
}

View file

@ -1,134 +0,0 @@
<?php
namespace Github\Api;
use Github\Api\Organization\Actions\Secrets;
use Github\Api\Organization\Hooks;
use Github\Api\Organization\Members;
use Github\Api\Organization\OutsideCollaborators;
use Github\Api\Organization\Teams;
/**
* Getting organization information and managing authenticated organization account information.
*
* @link http://developer.github.com/v3/orgs/
*
* @author Antoine Berranger <antoine at ihqs dot net>
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Organization extends AbstractApi
{
/**
* @link https://developer.github.com/v3/orgs/#list-all-organizations
*
* @return array the organizations
*/
public function all($since = '')
{
return $this->get('/organizations?since='.rawurlencode($since));
}
/**
* Get extended information about an organization by its name.
*
* @link http://developer.github.com/v3/orgs/#get
*
* @param string $organization the organization to show
*
* @return array information about the organization
*/
public function show($organization)
{
return $this->get('/orgs/'.rawurlencode($organization));
}
public function update($organization, array $params)
{
return $this->patch('/orgs/'.rawurlencode($organization), $params);
}
/**
* List all repositories across all the organizations that you can access.
*
* @link http://developer.github.com/v3/repos/#list-organization-repositories
*
* @param string $organization the user name
* @param string $type the type of repositories
* @param int $page the page
* @param string $sort sort by
* @param string $direction direction of sort, asc or desc
*
* @return array the repositories
*/
public function repositories($organization, $type = 'all', $page = 1, $sort = null, $direction = null)
{
$parameters = [
'type' => $type,
'page' => $page,
];
if ($sort !== null) {
$parameters['sort'] = $sort;
}
if ($direction !== null) {
$parameters['direction'] = $direction;
}
return $this->get('/orgs/'.rawurlencode($organization).'/repos', $parameters);
}
/**
* @return Members
*/
public function members()
{
return new Members($this->getClient());
}
/**
* @return Hooks
*/
public function hooks()
{
return new Hooks($this->getClient());
}
/**
* @return Teams
*/
public function teams()
{
return new Teams($this->getClient());
}
/**
* @return Secrets
*/
public function secrets(): Secrets
{
return new Secrets($this->getClient());
}
/**
* @return OutsideCollaborators
*/
public function outsideCollaborators()
{
return new OutsideCollaborators($this->getClient());
}
/**
* @link http://developer.github.com/v3/issues/#list-issues
*
* @param string $organization
* @param array $params
* @param int $page
*
* @return array
*/
public function issues($organization, array $params = [], $page = 1)
{
return $this->get('/orgs/'.rawurlencode($organization).'/issues', array_merge(['page' => $page], $params));
}
}

View file

@ -1,144 +0,0 @@
<?php
namespace Github\Api\Organization\Actions;
use Github\Api\AbstractApi;
/**
* @link https://docs.github.com/en/rest/reference/actions#secrets
*/
class Secrets extends AbstractApi
{
/**
* @link https://docs.github.com/en/rest/reference/actions#list-organization-secrets
*
* @param string $organization
*
* @return array|string
*/
public function all(string $organization)
{
return $this->get('/orgs/'.rawurlencode($organization).'/actions/secrets');
}
/**
* @link https://docs.github.com/en/rest/reference/actions#get-an-organization-secret
*
* @param string $organization
* @param string $secretName
*
* @return array|string
*/
public function show(string $organization, string $secretName)
{
return $this->get('/orgs/'.rawurlencode($organization).'/actions/secrets/'.rawurlencode($secretName));
}
/**
* @link https://docs.github.com/en/rest/reference/actions#create-or-update-an-organization-secret
*
* @param string $organization
* @param string $secretName
* @param array $parameters
*
* @return array|string
*/
public function create(string $organization, string $secretName, array $parameters = [])
{
return $this->put('/orgs/'.rawurlencode($organization).'/actions/secrets/'.rawurlencode($secretName), $parameters);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#create-or-update-an-organization-secret
*
* @param string $organization
* @param string $secretName
* @param array $parameters
*
* @return array|string
*/
public function update(string $organization, string $secretName, array $parameters = [])
{
return $this->put('/orgs/'.rawurlencode($organization).'/actions/secrets/'.rawurlencode($secretName), $parameters);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#delete-an-organization-secret
*
* @param string $organization
* @param string $secretName
*
* @return array|string
*/
public function remove(string $organization, string $secretName)
{
return $this->delete('/orgs/'.rawurlencode($organization).'/actions/secrets/'.rawurlencode($secretName));
}
/**
* @link https://docs.github.com/en/rest/reference/actions#list-selected-repositories-for-an-organization-secret
*
* @param string $organization
* @param string $secretName
*
* @return array|string
*/
public function selectedRepositories(string $organization, string $secretName)
{
return $this->get('/orgs/'.rawurlencode($organization).'/actions/secrets/'.rawurlencode($secretName).'/repositories');
}
/**
* @link https://docs.github.com/en/rest/reference/actions#set-selected-repositories-for-an-organization-secret
*
* @param string $organization
* @param string $secretName
* @param array $parameters
*
* @return array|string
*/
public function setSelectedRepositories(string $organization, string $secretName, array $parameters = [])
{
return $this->put('/orgs/'.rawurlencode($organization).'/actions/secrets/'.rawurlencode($secretName).'/repositories', $parameters);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#add-selected-repository-to-an-organization-secret
*
* @param string $organization
* @param string $repositoryId
* @param string $secretName
*
* @return array|string
*/
public function addSecret(string $organization, string $repositoryId, string $secretName)
{
return $this->put('/orgs/'.rawurlencode($organization).'/actions/secrets/'.rawurlencode($secretName).'/repositories/'.$repositoryId);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#remove-selected-repository-from-an-organization-secret
*
* @param string $organization
* @param string $repositoryId
* @param string $secretName
*
* @return array|string
*/
public function removeSecret(string $organization, string $repositoryId, string $secretName)
{
return $this->delete('/orgs/'.rawurlencode($organization).'/actions/secrets/'.rawurlencode($secretName).'/repositories/'.$repositoryId);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#get-an-organization-public-key
*
* @param string $organization
*
* @return array|string
*/
public function publicKey(string $organization)
{
return $this->get('/orgs/'.rawurlencode($organization).'/actions/secrets/public-key');
}
}

View file

@ -1,111 +0,0 @@
<?php
namespace Github\Api\Organization;
use Github\Api\AbstractApi;
use Github\Exception\MissingArgumentException;
class Hooks extends AbstractApi
{
/**
* List hooks.
*
* @link https://developer.github.com/v3/orgs/hooks/#list-hooks
*
* @param string $organization
*
* @return array
*/
public function all($organization)
{
return $this->get('/orgs/'.rawurlencode($organization).'/hooks');
}
/**
* Get a single hook.
*
* @link https://developer.github.com/v3/orgs/hooks/#get-single-hook
*
* @param string $organization
* @param int $id
*
* @return array
*/
public function show($organization, $id)
{
return $this->get('/orgs/'.rawurlencode($organization).'/hooks/'.$id);
}
/**
* Create a hook.
*
* @link https://developer.github.com/v3/orgs/hooks/#create-a-hook
*
* @param string $organization
* @param array $params
*
* @throws \Github\Exception\MissingArgumentException
*
* @return array
*/
public function create($organization, array $params)
{
if (!isset($params['name'], $params['config'])) {
throw new MissingArgumentException(['name', 'config']);
}
return $this->post('/orgs/'.rawurlencode($organization).'/hooks', $params);
}
/**
* Edit a hook.
*
* @link https://developer.github.com/v3/orgs/hooks/#edit-a-hook
*
* @param string $organization
* @param int $id
* @param array $params
*
* @throws \Github\Exception\MissingArgumentException
*
* @return array
*/
public function update($organization, $id, array $params)
{
if (!isset($params['config'])) {
throw new MissingArgumentException(['config']);
}
return $this->patch('/orgs/'.rawurlencode($organization).'/hooks/'.$id, $params);
}
/**
* Ping a hook.
*
* @link https://developer.github.com/v3/orgs/hooks/#ping-a-hook
*
* @param string $organization
* @param int $id
*
* @return array|string
*/
public function ping($organization, $id)
{
return $this->post('/orgs/'.rawurlencode($organization).'/hooks/'.$id.'/pings');
}
/**
* Delete a hook.
*
* @link https://developer.github.com/v3/orgs/hooks/#delete-a-hook
*
* @param string $organization
* @param int $id
*
* @return array|string
*/
public function remove($organization, $id)
{
return $this->delete('/orgs/'.rawurlencode($organization).'/hooks/'.$id);
}
}

View file

@ -1,75 +0,0 @@
<?php
namespace Github\Api\Organization;
use Github\Api\AbstractApi;
/**
* @link http://developer.github.com/v3/orgs/members/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Members extends AbstractApi
{
public function all($organization, $type = null, $filter = 'all', $role = null)
{
$parameters = [];
$path = '/orgs/'.rawurlencode($organization).'/';
if (null === $type) {
$path .= 'members';
if (null !== $filter) {
$parameters['filter'] = $filter;
}
if (null !== $role) {
$parameters['role'] = $role;
}
} else {
$path .= 'public_members';
}
return $this->get($path, $parameters);
}
public function show($organization, $username)
{
return $this->get('/orgs/'.rawurlencode($organization).'/members/'.rawurlencode($username));
}
public function member($organization, $username)
{
return $this->get('/orgs/'.rawurlencode($organization).'/memberships/'.rawurlencode($username));
}
public function check($organization, $username)
{
return $this->get('/orgs/'.rawurlencode($organization).'/public_members/'.rawurlencode($username));
}
public function publicize($organization, $username)
{
return $this->put('/orgs/'.rawurlencode($organization).'/public_members/'.rawurlencode($username));
}
public function conceal($organization, $username)
{
return $this->delete('/orgs/'.rawurlencode($organization).'/public_members/'.rawurlencode($username));
}
/*
* Add user to organization
*/
public function add($organization, $username, array $params = [])
{
return $this->put('/orgs/'.rawurlencode($organization).'/memberships/'.rawurlencode($username), $params);
}
public function addMember($organization, $username)
{
return $this->add($organization, $username);
}
public function remove($organization, $username)
{
return $this->delete('/orgs/'.rawurlencode($organization).'/members/'.rawurlencode($username));
}
}

View file

@ -1,52 +0,0 @@
<?php
namespace Github\Api\Organization;
use Github\Api\AbstractApi;
/**
* @link https://developer.github.com/v3/orgs/outside_collaborators/
*
* @author Matthieu Calie <matthieu@calie.be>
*/
class OutsideCollaborators extends AbstractApi
{
/**
* @link https://developer.github.com/v3/orgs/outside_collaborators/#list-outside-collaborators-for-an-organization
*
* @param string $organization the organization
* @param array $params
*
* @return array the organizations
*/
public function all($organization, array $params = [])
{
return $this->get('/orgs/'.rawurlencode($organization).'/outside_collaborators', $params);
}
/**
* @link https://developer.github.com/v3/orgs/outside_collaborators/#convert-an-organization-member-to-outside-collaborator
*
* @param string $organization the organization
* @param string $username the github username
*
* @return array
*/
public function convert($organization, $username)
{
return $this->put('/orgs/'.rawurlencode($organization).'/outside_collaborators/'.rawurldecode($username));
}
/**
* @link https://developer.github.com/v3/orgs/outside_collaborators/#remove-outside-collaborator-from-an-organization
*
* @param string $organization the organization
* @param string $username the username
*
* @return array
*/
public function remove($organization, $username)
{
return $this->delete('/orgs/'.rawurlencode($organization).'/outside_collaborators/'.rawurldecode($username));
}
}

View file

@ -1,23 +0,0 @@
<?php
namespace Github\Api\Organization;
use Github\Api\Project\AbstractProjectApi;
use Github\Exception\MissingArgumentException;
class Projects extends AbstractProjectApi
{
public function all($organization, array $params = [])
{
return $this->get('/orgs/'.rawurlencode($organization).'/projects', array_merge(['page' => 1], $params));
}
public function create($organization, array $params)
{
if (!isset($params['name'])) {
throw new MissingArgumentException(['name']);
}
return $this->post('/orgs/'.rawurlencode($organization).'/projects', $params);
}
}

View file

@ -1,121 +0,0 @@
<?php
namespace Github\Api\Organization;
use Github\Api\AbstractApi;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/orgs/teams/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Teams extends AbstractApi
{
public function all($organization)
{
return $this->get('/orgs/'.rawurlencode($organization).'/teams');
}
public function create($organization, array $params)
{
if (!isset($params['name'])) {
throw new MissingArgumentException('name');
}
if (isset($params['repo_names']) && !is_array($params['repo_names'])) {
$params['repo_names'] = [$params['repo_names']];
}
if (isset($params['permission']) && !in_array($params['permission'], ['pull', 'push', 'admin'])) {
$params['permission'] = 'pull';
}
return $this->post('/orgs/'.rawurlencode($organization).'/teams', $params);
}
/**
* @link https://developer.github.com/v3/teams/#list-teams
*/
public function show($team, $organization)
{
return $this->get('/orgs/'.rawurlencode($organization).'/teams/'.rawurlencode($team));
}
/**
* @link https://developer.github.com/v3/teams/#edit-team
*/
public function update($team, array $params, $organization)
{
if (!isset($params['name'])) {
throw new MissingArgumentException('name');
}
if (isset($params['permission']) && !in_array($params['permission'], ['pull', 'push', 'admin'])) {
$params['permission'] = 'pull';
}
return $this->patch('/orgs/'.rawurlencode($organization).'/teams/'.rawurlencode($team), $params);
}
/**
* @link https://developer.github.com/v3/teams/#delete-team
*/
public function remove($team, $organization)
{
return $this->delete('/orgs/'.rawurlencode($organization).'/teams/'.rawurlencode($team));
}
/**
* @link https://developer.github.com/v3/teams/members/#list-team-members
*/
public function members($team, $organization)
{
return $this->get('/orgs/'.rawurlencode($organization).'/teams/'.rawurlencode($team).'/members');
}
/**
* @link https://developer.github.com/v3/teams/members/#get-team-membership
*/
public function check($team, $username, $organization)
{
return $this->get('/orgs/'.rawurlencode($organization).'/teams/'.rawurlencode($team).'/memberships/'.rawurlencode($username));
}
/**
* @link https://developer.github.com/v3/teams/members/#add-or-update-team-membership
*/
public function addMember($team, $username, $organization)
{
return $this->put('/orgs/'.rawurlencode($organization).'/teams/'.rawurlencode($team).'/memberships/'.rawurlencode($username));
}
/**
* @link https://developer.github.com/v3/teams/members/#remove-team-membership
*/
public function removeMember($team, $username, $organization)
{
return $this->delete('/orgs/'.rawurlencode($organization).'/teams/'.rawurlencode($team).'/memberships/'.rawurlencode($username));
}
public function repositories($team)
{
return $this->get('/teams/'.rawurlencode($team).'/repos');
}
public function repository($team, $organization, $repository)
{
return $this->get('/teams/'.rawurlencode($team).'/repos/'.rawurlencode($organization).'/'.rawurlencode($repository));
}
public function addRepository($team, $organization, $repository, $params = [])
{
if (isset($params['permission']) && !in_array($params['permission'], ['pull', 'push', 'admin', 'maintain', 'triage'])) {
$params['permission'] = 'pull';
}
return $this->put('/orgs/'.rawurlencode($organization).'/teams/'.rawurlencode($team).'/repos/'.rawurlencode($organization).'/'.rawurlencode($repository), $params);
}
public function removeRepository($team, $organization, $repository)
{
return $this->delete('/orgs/'.rawurlencode($organization).'/teams/'.rawurlencode($team).'/repos/'.rawurlencode($organization).'/'.rawurlencode($repository));
}
}

View file

@ -1,45 +0,0 @@
<?php
namespace Github\Api\Project;
use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
abstract class AbstractProjectApi extends AbstractApi
{
use AcceptHeaderTrait;
/**
* Configure the accept header for Early Access to the projects api.
*
* @see https://developer.github.com/v3/repos/projects/#projects
*
* @return $this
*/
public function configure()
{
$this->acceptHeaderValue = 'application/vnd.github.inertia-preview+json';
return $this;
}
public function show($id, array $params = [])
{
return $this->get('/projects/'.rawurlencode($id), array_merge(['page' => 1], $params));
}
public function update($id, array $params)
{
return $this->patch('/projects/'.rawurlencode($id), $params);
}
public function deleteProject($id)
{
return $this->delete('/projects/'.rawurlencode($id));
}
public function columns()
{
return new Columns($this->getClient());
}
}

View file

@ -1,60 +0,0 @@
<?php
namespace Github\Api\Project;
use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
use Github\Exception\MissingArgumentException;
class Cards extends AbstractApi
{
use AcceptHeaderTrait;
/**
* Configure the accept header for Early Access to the projects api.
*
* @see https://developer.github.com/v3/repos/projects/#projects
*
* @return $this
*/
public function configure()
{
$this->acceptHeaderValue = 'application/vnd.github.inertia-preview+json';
return $this;
}
public function all($columnId, array $params = [])
{
return $this->get('/projects/columns/'.rawurlencode($columnId).'/cards', array_merge(['page' => 1], $params));
}
public function show($id)
{
return $this->get('/projects/columns/cards/'.rawurlencode($id));
}
public function create($columnId, array $params)
{
return $this->post('/projects/columns/'.rawurlencode($columnId).'/cards', $params);
}
public function update($id, array $params)
{
return $this->patch('/projects/columns/cards/'.rawurlencode($id), $params);
}
public function deleteCard($id)
{
return $this->delete('/projects/columns/cards/'.rawurlencode($id));
}
public function move($id, array $params)
{
if (!isset($params['position'])) {
throw new MissingArgumentException(['position']);
}
return $this->post('/projects/columns/cards/'.rawurlencode($id).'/moves', $params);
}
}

View file

@ -1,73 +0,0 @@
<?php
namespace Github\Api\Project;
use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
use Github\Exception\MissingArgumentException;
class Columns extends AbstractApi
{
use AcceptHeaderTrait;
/**
* Configure the accept header for Early Access to the projects api.
*
* @see https://developer.github.com/v3/repos/projects/#projects
*
* return self
*/
public function configure()
{
$this->acceptHeaderValue = 'application/vnd.github.inertia-preview+json';
return $this;
}
public function all($projectId, array $params = [])
{
return $this->get('/projects/'.rawurlencode($projectId).'/columns', array_merge(['page' => 1], $params));
}
public function show($id)
{
return $this->get('/projects/columns/'.rawurlencode($id));
}
public function create($projectId, array $params)
{
if (!isset($params['name'])) {
throw new MissingArgumentException(['name']);
}
return $this->post('/projects/'.rawurlencode($projectId).'/columns', $params);
}
public function update($id, array $params)
{
if (!isset($params['name'])) {
throw new MissingArgumentException(['name']);
}
return $this->patch('/projects/columns/'.rawurlencode($id), $params);
}
public function deleteColumn($id)
{
return $this->delete('/projects/columns/'.rawurlencode($id));
}
public function move($id, array $params)
{
if (!isset($params['position'])) {
throw new MissingArgumentException(['position']);
}
return $this->post('/projects/columns/'.rawurlencode($id).'/moves', $params);
}
public function cards()
{
return new Cards($this->getClient());
}
}

View file

@ -1,198 +0,0 @@
<?php
namespace Github\Api;
use Github\Api\PullRequest\Comments;
use Github\Api\PullRequest\Review;
use Github\Api\PullRequest\ReviewRequest;
use Github\Exception\InvalidArgumentException;
use Github\Exception\MissingArgumentException;
/**
* API for accessing Pull Requests from your Git/Github repositories.
*
* @see http://developer.github.com/v3/pulls/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class PullRequest extends AbstractApi
{
use AcceptHeaderTrait;
/**
* Configure the body type.
*
* @link https://developer.github.com/v3/pulls/#custom-media-types
*
* @param string|null $bodyType
* @param string|null $apiVersion
*
* @return $this
*/
public function configure($bodyType = null, $apiVersion = null)
{
if (null === $apiVersion) {
$apiVersion = $this->getApiVersion();
}
if (!in_array($bodyType, ['text', 'html', 'full', 'diff', 'patch'])) {
$bodyType = 'raw';
}
if (!in_array($bodyType, ['diff', 'patch'])) {
$bodyType .= '+json';
}
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s', $apiVersion, $bodyType);
return $this;
}
/**
* Get a listing of a project's pull requests by the username, repository and (optionally) state.
*
* @link http://developer.github.com/v3/pulls/
*
* @param string $username the username
* @param string $repository the repository
* @param array $parameters a list of extra parameters.
*
* @return array array of pull requests for the project
*/
public function all($username, $repository, array $parameters = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls', $parameters);
}
/**
* Show all details of a pull request, including the discussions.
*
* @link http://developer.github.com/v3/pulls/
*
* @param string $username the username
* @param string $repository the repository
* @param int $id the ID of the pull request for which details are retrieved
*
* @return array|string pull request details
*/
public function show($username, $repository, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$id);
}
public function commits($username, $repository, $id, array $parameters = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/commits', $parameters);
}
public function files($username, $repository, $id, array $parameters = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/files', $parameters);
}
/**
* All statuses which are the statuses of its head branch.
*
* @see http://developer.github.com/v3/pulls/
*
* @param string $username the username
* @param string $repository the repository
* @param int $id the ID of the pull request for which statuses are retrieved
*
* @return array array of statuses for the project
*/
public function status($username, $repository, $id)
{
$link = $this->show($username, $repository, $id)['_links']['statuses']['href'];
return $this->get($link);
}
public function comments()
{
return new Comments($this->getClient());
}
public function reviews()
{
return new Review($this->getClient());
}
public function reviewRequests()
{
return new ReviewRequest($this->getClient());
}
/**
* Create a pull request.
*
* @link http://developer.github.com/v3/pulls/
*
* @param string $username the username
* @param string $repository the repository
* @param array $params A String of the branch or commit SHA that you want your changes to be pulled to.
* A String of the branch or commit SHA of your changes. Typically this will be a branch.
* If the branch is in a fork of the original repository, specify the username first:
* "my-user:some-branch". The String title of the Pull Request. The String body of
* the Pull Request. The issue number. Used when title and body is not set.
*
* @throws MissingArgumentException
*
* @return array
*/
public function create($username, $repository, array $params)
{
// Two ways to create PR, using issue or title
if (!isset($params['issue']) && !isset($params['title'])) {
throw new MissingArgumentException(['issue', 'title']);
}
if (!isset($params['base'], $params['head'])) {
throw new MissingArgumentException(['base', 'head']);
}
// If `issue` is not sent, then `body` must be sent
if (!isset($params['issue']) && !isset($params['body'])) {
throw new MissingArgumentException(['issue', 'body']);
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls', $params);
}
public function update($username, $repository, $id, array $params)
{
if (isset($params['state']) && !in_array($params['state'], ['open', 'closed'])) {
$params['state'] = 'open';
}
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id), $params);
}
public function merged($username, $repository, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/merge');
}
public function merge($username, $repository, $id, $message, $sha, $mergeMethod = 'merge', $title = null)
{
if (is_bool($mergeMethod)) {
$mergeMethod = $mergeMethod ? 'squash' : 'merge';
}
if (!in_array($mergeMethod, ['merge', 'squash', 'rebase'], true)) {
throw new InvalidArgumentException(sprintf('"$mergeMethod" must be one of ["merge", "squash", "rebase"] ("%s" given).', $mergeMethod));
}
$params = [
'commit_message' => $message,
'sha' => $sha,
'merge_method' => $mergeMethod,
];
if (is_string($title)) {
$params['commit_title'] = $title;
}
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/merge', $params);
}
}

View file

@ -1,153 +0,0 @@
<?php
namespace Github\Api\PullRequest;
use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/pulls/comments/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Comments extends AbstractApi
{
use AcceptHeaderTrait;
/**
* Configure the body type.
*
* @link https://developer.github.com/v3/pulls/comments/#custom-media-types
*
* @param string|null $bodyType
* @param string|null $apiVersion
*
* @return $this
*/
public function configure($bodyType = null, $apiVersion = null)
{
if ($apiVersion !== 'squirrel-girl-preview') {
$apiVersion = $this->getApiVersion();
}
if (!in_array($bodyType, ['text', 'html', 'full'])) {
$bodyType = 'raw';
}
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s+json', $apiVersion, $bodyType);
return $this;
}
/**
* Get a listing of a pull request's comments by the username, repository and pull request number
* or all repository comments by the username and repository.
*
* @link https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request
* @link https://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository
*
* @param string $username the username
* @param string $repository the repository
* @param int|null $pullRequest the pull request number
* @param array $params a list of extra parameters.
*
* @return array
*/
public function all($username, $repository, $pullRequest = null, array $params = [])
{
if (null !== $pullRequest) {
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/comments');
}
$parameters = array_merge([
'page' => 1,
'per_page' => 30,
], $params);
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments', $parameters);
}
/**
* Get a single pull request comment by the username, repository and comment id.
*
* @link https://developer.github.com/v3/pulls/comments/#get-a-single-comment
*
* @param string $username the username
* @param string $repository the repository
* @param int $comment the comment id
*
* @return array
*/
public function show($username, $repository, $comment)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.$comment);
}
/**
* Create a pull request comment by the username, repository and pull request number.
*
* @link https://developer.github.com/v3/pulls/comments/#create-a-comment
*
* @param string $username the username
* @param string $repository the repository
* @param int $pullRequest the pull request number
* @param array $params a list of extra parameters.
*
* @throws MissingArgumentException
*
* @return array
*/
public function create($username, $repository, $pullRequest, array $params)
{
if (!isset($params['body'])) {
throw new MissingArgumentException('body');
}
// If `in_reply_to` is set, other options are not necessary anymore
if (!isset($params['in_reply_to']) && !isset($params['commit_id'], $params['path'], $params['position'])) {
throw new MissingArgumentException(['commit_id', 'path', 'position']);
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/comments', $params);
}
/**
* Update a pull request comment by the username, repository and comment id.
*
* @link https://developer.github.com/v3/pulls/comments/#edit-a-comment
*
* @param string $username the username
* @param string $repository the repository
* @param int $comment the comment id
* @param array $params a list of extra parameters.
*
* @throws MissingArgumentException
*
* @return array
*/
public function update($username, $repository, $comment, array $params)
{
if (!isset($params['body'])) {
throw new MissingArgumentException('body');
}
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.$comment, $params);
}
/**
* Delete a pull request comment by the username, repository and comment id.
*
* @link https://developer.github.com/v3/pulls/comments/#delete-a-comment
*
* @param string $username the username
* @param string $repository the repository
* @param int $comment the comment id
*
* @return string
*/
public function remove($username, $repository, $comment)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.$comment);
}
}

View file

@ -1,211 +0,0 @@
<?php
namespace Github\Api\PullRequest;
use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
use Github\Exception\InvalidArgumentException;
use Github\Exception\MissingArgumentException;
/**
* API for accessing Pull Request Reviews from your Git/Github repositories.
*
* @link https://developer.github.com/v3/pulls/reviews/
*
* @author Christian Flothmann <christian.flothmann@sensiolabs.de>
*/
class Review extends AbstractApi
{
use AcceptHeaderTrait;
public function configure()
{
trigger_deprecation('KnpLabs/php-github-api', '3.2', 'The "%s" is deprecated and will be removed.', __METHOD__);
return $this;
}
/**
* Get a listing of a pull request's reviews by the username, repository and pull request number.
*
* @link https://developer.github.com/v3/pulls/reviews/#list-reviews-on-a-pull-request
*
* @param string $username the username
* @param string $repository the repository
* @param int $pullRequest the pull request number
* @param array $params a list of extra parameters.
*
* @return array array of pull request reviews for the pull request
*/
public function all($username, $repository, $pullRequest, array $params = [])
{
if (!empty($params)) {
trigger_deprecation('KnpLabs/php-github-api', '3.2', 'The "$params" parameter is deprecated, to paginate the results use the "ResultPager" instead.');
}
$parameters = array_merge([
'page' => 1,
'per_page' => 30,
], $params);
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews', $parameters);
}
/**
* Get a single pull request review by the username, repository, pull request number and the review id.
*
* @link https://developer.github.com/v3/pulls/reviews/#get-a-single-review
*
* @param string $username the username
* @param string $repository the repository
* @param int $pullRequest the pull request number
* @param int $id the review id
*
* @return array the pull request review
*/
public function show($username, $repository, $pullRequest, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id);
}
/**
* Delete a single pull request review by the username, repository, pull request number and the review id.
*
* @link https://developer.github.com/v3/pulls/reviews/#delete-a-pending-review
*
* @param string $username the username
* @param string $repository the repository
* @param int $pullRequest the pull request number
* @param int $id the review id
*
* @return array|string
*/
public function remove($username, $repository, $pullRequest, $id)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id);
}
/**
* Get comments for a single pull request review.
*
* @link https://developer.github.com/v3/pulls/reviews/#get-comments-for-a-single-review
*
* @param string $username the username
* @param string $repository the repository
* @param int $pullRequest the pull request number
* @param int $id the review id
*
* @return array|string
*/
public function comments($username, $repository, $pullRequest, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id.'/comments');
}
/**
* Create a pull request review by the username, repository and pull request number.
*
* @link https://developer.github.com/v3/pulls/reviews/#create-a-pull-request-review
*
* @param string $username the username
* @param string $repository the repository
* @param int $pullRequest the pull request number
* @param array $params a list of extra parameters.
*
* @throws MissingArgumentException
*
* @return array the pull request review
*/
public function create($username, $repository, $pullRequest, array $params = [])
{
if (array_key_exists('event', $params) && !in_array($params['event'], ['APPROVE', 'REQUEST_CHANGES', 'COMMENT'], true)) {
throw new InvalidArgumentException(sprintf('"event" must be one of ["APPROVE", "REQUEST_CHANGES", "COMMENT"] ("%s" given).', $params['event']));
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews', $params);
}
/**
* Submit a pull request review by the username, repository, pull request number and the review id.
*
* @link https://developer.github.com/v3/pulls/reviews/#submit-a-pull-request-review
*
* @param string $username the username
* @param string $repository the repository
* @param int $pullRequest the pull request number
* @param int $id the review id
* @param array $params a list of extra parameters.
*
* @throws MissingArgumentException
*
* @return array the pull request review
*/
public function submit($username, $repository, $pullRequest, $id, array $params = [])
{
if (!isset($params['event'])) {
throw new MissingArgumentException('event');
}
if (!in_array($params['event'], ['APPROVE', 'REQUEST_CHANGES', 'COMMENT'], true)) {
throw new InvalidArgumentException(sprintf('"event" must be one of ["APPROVE", "REQUEST_CHANGES", "COMMENT"] ("%s" given).', $params['event']));
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id.'/events', $params);
}
/**
* Dismiss a pull request review by the username, repository, pull request number and the review id.
*
* @link https://developer.github.com/v3/pulls/reviews/#dismiss-a-pull-request-review
*
* @param string $username the username
* @param string $repository the repository
* @param int $pullRequest the pull request number
* @param int $id the review id
* @param string $message a mandatory dismissal message
*
* @return array|string
*/
public function dismiss($username, $repository, $pullRequest, $id, $message)
{
if (!is_string($message)) {
throw new InvalidArgumentException(sprintf('"message" must be a valid string ("%s" given).', gettype($message)));
}
if (empty($message)) {
throw new InvalidArgumentException('"message" is mandatory and cannot be empty');
}
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id.'/dismissals', [
'message' => $message,
]);
}
/**
* Update a pull request review by the username, repository, pull request number and the review id.
*
* @link https://developer.github.com/v3/pulls/reviews/#update-a-pull-request-review
*
* @param string $username the username
* @param string $repository the repository
* @param int $pullRequest the pull request number
* @param int $id the review id
* @param string $body a mandatory dismissal message
*
* @return array|string
*/
public function update($username, $repository, $pullRequest, $id, $body)
{
if (!is_string($body)) {
throw new InvalidArgumentException(sprintf('"body" must be a valid string ("%s" given).', gettype($body)));
}
if (empty($body)) {
throw new InvalidArgumentException('"body" is mandatory and cannot be empty');
}
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id, [
'body' => $body,
]);
}
}

View file

@ -1,72 +0,0 @@
<?php
namespace Github\Api\PullRequest;
use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
/**
* @link https://developer.github.com/v3/pulls/review_requests/
*/
class ReviewRequest extends AbstractApi
{
use AcceptHeaderTrait;
public function configure()
{
trigger_deprecation('KnpLabs/php-github-api', '3.2', 'The "%s" is deprecated and will be removed.', __METHOD__);
return $this;
}
/**
* @link https://developer.github.com/v3/pulls/review_requests/#list-review-requests
*
* @param string $username
* @param string $repository
* @param int $pullRequest
* @param array $params
*
* @return array
*/
public function all($username, $repository, $pullRequest, array $params = [])
{
if (!empty($params)) {
trigger_deprecation('KnpLabs/php-github-api', '3.2', 'The "$params" parameter is deprecated, to paginate the results use the "ResultPager" instead.');
}
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/requested_reviewers', $params);
}
/**
* @link https://developer.github.com/v3/pulls/review_requests/#create-a-review-request
*
* @param string $username
* @param string $repository
* @param int $pullRequest
* @param array $reviewers
* @param array $teamReviewers
*
* @return string
*/
public function create($username, $repository, $pullRequest, array $reviewers = [], array $teamReviewers = [])
{
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/requested_reviewers', ['reviewers' => $reviewers, 'team_reviewers' => $teamReviewers]);
}
/**
* @link https://developer.github.com/v3/pulls/review_requests/#delete-a-review-request
*
* @param string $username
* @param string $repository
* @param int $pullRequest
* @param array $reviewers
* @param array $teamReviewers
*
* @return string
*/
public function remove($username, $repository, $pullRequest, array $reviewers = [], array $teamReviewers = [])
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/requested_reviewers', ['reviewers' => $reviewers, 'team_reviewers' => $teamReviewers]);
}
}

View file

@ -1,70 +0,0 @@
<?php
namespace Github\Api;
use Github\Api\RateLimit\RateLimitResource;
/**
* Get rate limits.
*
* @link https://developer.github.com/v3/rate_limit/
*
* @author Jeff Finley <quickliketurtle@gmail.com>
*/
class RateLimit extends AbstractApi
{
/**
* @var RateLimitResource[]
*/
protected $resources = [];
/**
* Gets the rate limit resource objects.
*
* @return RateLimitResource[]
*/
public function getResources()
{
$this->fetchLimits();
return $this->resources;
}
/**
* Returns a rate limit resource object by the given name.
*
* @param string $name
*
* @return RateLimitResource|false
*/
public function getResource($name)
{
// Fetch once per instance
if (empty($this->resources)) {
$this->fetchLimits();
}
if (!isset($this->resources[$name])) {
return false;
}
return $this->resources[$name];
}
/**
* Returns the data directly from the GitHub API endpoint.
*
* @return array
*/
protected function fetchLimits()
{
$result = $this->get('/rate_limit') ?: [];
// Assemble Limit instances
foreach ($result['resources'] as $resourceName => $resource) {
$this->resources[$resourceName] = new RateLimitResource($resourceName, $resource);
}
return $result;
}
}

View file

@ -1,73 +0,0 @@
<?php
namespace Github\Api\RateLimit;
/**
* Represents the data block for a GitHub rate limit response, grouped by a name.
*/
class RateLimitResource
{
/** @var string */
private $name;
/** @var int */
private $limit;
/** @var int */
private $reset;
/** @var int */
private $remaining;
/**
* @param string $name
* @param array $data
*/
public function __construct($name, array $data)
{
$this->name = $name;
$this->limit = $data['limit'];
$this->remaining = $data['remaining'];
$this->reset = $data['reset'];
}
/**
* The name of the Limit, e.g. "core", "graphql", "search".
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* The rate limit amount.
*
* @return int
*/
public function getLimit()
{
return $this->limit;
}
/**
* Number of requests remaining in time period before hitting the rate limit.
*
* @return int
*/
public function getRemaining()
{
return $this->remaining;
}
/**
* Timestamp for when the rate limit will be reset.
*
* @return int
*/
public function getReset()
{
return $this->reset;
}
}

View file

@ -1,823 +0,0 @@
<?php
namespace Github\Api;
use Github\Api\Repository\Actions\Artifacts;
use Github\Api\Repository\Actions\Secrets;
use Github\Api\Repository\Actions\SelfHostedRunners;
use Github\Api\Repository\Actions\WorkflowJobs;
use Github\Api\Repository\Actions\WorkflowRuns;
use Github\Api\Repository\Actions\Workflows;
use Github\Api\Repository\Checks\CheckRuns;
use Github\Api\Repository\Checks\CheckSuites;
use Github\Api\Repository\Collaborators;
use Github\Api\Repository\Comments;
use Github\Api\Repository\Commits;
use Github\Api\Repository\Contents;
use Github\Api\Repository\DeployKeys;
use Github\Api\Repository\Downloads;
use Github\Api\Repository\Forks;
use Github\Api\Repository\Hooks;
use Github\Api\Repository\Labels;
use Github\Api\Repository\Pages;
use Github\Api\Repository\Projects;
use Github\Api\Repository\Protection;
use Github\Api\Repository\Releases;
use Github\Api\Repository\Stargazers;
use Github\Api\Repository\Statuses;
use Github\Api\Repository\Traffic;
/**
* Searching repositories, getting repository information
* and managing repository information for authenticated users.
*
* @link http://developer.github.com/v3/repos/
*
* @author Joseph Bielawski <stloyd@gmail.com>
* @author Thibault Duplessis <thibault.duplessis at gmail dot com>
*/
class Repo extends AbstractApi
{
use AcceptHeaderTrait;
/**
* List all public repositories.
*
* @link https://developer.github.com/v3/repos/#list-all-public-repositories
*
* @param int|null $id The integer ID of the last Repository that youve seen.
*
* @return array list of users found
*/
public function all($id = null)
{
if (!is_int($id)) {
return $this->get('/repositories');
}
return $this->get('/repositories', ['since' => $id]);
}
/**
* Get the last year of commit activity for a repository grouped by week.
*
* @link http://developer.github.com/v3/repos/statistics/#commit-activity
*
* @param string $username the user who owns the repository
* @param string $repository the name of the repository
*
* @return array commit activity grouped by week
*/
public function activity($username, $repository)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stats/commit_activity');
}
/**
* Get contributor commit statistics for a repository.
*
* @link http://developer.github.com/v3/repos/statistics/#contributors
*
* @param string $username the user who owns the repository
* @param string $repository the name of the repository
*
* @return array list of contributors and their commit statistics
*/
public function statistics($username, $repository)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stats/contributors');
}
/**
* Get a weekly aggregate of the number of additions and deletions pushed to a repository.
*
* @link http://developer.github.com/v3/repos/statistics/#code-frequency
*
* @param string $username the user who owns the repository
* @param string $repository the name of the repository
*
* @return array list of weeks and their commit statistics
*/
public function frequency($username, $repository)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stats/code_frequency');
}
/**
* Get the weekly commit count for the repository owner and everyone else.
*
* @link http://developer.github.com/v3/repos/statistics/#participation
*
* @param string $username the user who owns the repository
* @param string $repository the name of the repository
*
* @return array list of weekly commit count grouped by 'all' and 'owner'
*/
public function participation($username, $repository)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stats/participation');
}
/**
* List all repositories for an organization.
*
* @link http://developer.github.com/v3/repos/#list-organization-repositories
*
* @param string $organization the name of the organization
* @param array $params
*
* @return array list of organization repositories
*/
public function org($organization, array $params = [])
{
return $this->get('/orgs/'.$organization.'/repos', array_merge(['start_page' => 1], $params));
}
/**
* Get extended information about a repository by its username and repository name.
*
* @link http://developer.github.com/v3/repos/
*
* @param string $username the user who owns the repository
* @param string $repository the name of the repository
*
* @return array information about the repository
*/
public function show($username, $repository)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository));
}
/**
* Get extended information about a repository by its id.
* Note: at time of writing this is an undocumented feature but GitHub support have advised that it can be relied on.
*
* @link http://developer.github.com/v3/repos/
* @link https://github.com/piotrmurach/github/issues/283
* @link https://github.com/piotrmurach/github/issues/282
*
* @param int $id the id of the repository
*
* @return array information about the repository
*/
public function showById($id)
{
return $this->get('/repositories/'.$id);
}
/**
* Create repository.
*
* @link http://developer.github.com/v3/repos/
*
* @param string $name name of the repository
* @param string $description repository description
* @param string $homepage homepage url
* @param bool $public `true` for public, `false` for private
* @param string|null $organization username of organization if applicable
* @param bool $hasIssues `true` to enable issues for this repository, `false` to disable them
* @param bool $hasWiki `true` to enable the wiki for this repository, `false` to disable it
* @param bool $hasDownloads `true` to enable downloads for this repository, `false` to disable them
* @param int $teamId The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization.
* @param bool $autoInit `true` to create an initial commit with empty README, `false` for no initial commit
* @param bool $hasProjects `true` to enable projects for this repository or false to disable them.
* @param string|null $visibility
*
* @return array returns repository data
*/
public function create(
$name,
$description = '',
$homepage = '',
$public = true,
$organization = null,
$hasIssues = false,
$hasWiki = false,
$hasDownloads = false,
$teamId = null,
$autoInit = false,
$hasProjects = true,
$visibility = null
) {
$path = null !== $organization ? '/orgs/'.$organization.'/repos' : '/user/repos';
$parameters = [
'name' => $name,
'description' => $description,
'homepage' => $homepage,
'private' => ($visibility ?? ($public ? 'public' : 'private')) === 'private',
'visibility' => $visibility ?? ($public ? 'public' : 'private'),
'has_issues' => $hasIssues,
'has_wiki' => $hasWiki,
'has_downloads' => $hasDownloads,
'auto_init' => $autoInit,
'has_projects' => $hasProjects,
];
if ($organization && $teamId) {
$parameters['team_id'] = $teamId;
}
return $this->post($path, $parameters);
}
/**
* Set information of a repository.
*
* @link http://developer.github.com/v3/repos/
*
* @param string $username the user who owns the repository
* @param string $repository the name of the repository
* @param array $values the key => value pairs to post
*
* @return array information about the repository
*/
public function update($username, $repository, array $values)
{
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository), $values);
}
/**
* Delete a repository.
*
* @link http://developer.github.com/v3/repos/
*
* @param string $username the user who owns the repository
* @param string $repository the name of the repository
*
* @return mixed null on success, array on error with 'message'
*/
public function remove($username, $repository)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository));
}
/**
* Get the readme content for a repository by its username and repository name.
*
* @link http://developer.github.com/v3/repos/contents/#get-the-readme
*
* @param string $username the user who owns the repository
* @param string $repository the name of the repository
* @param string $format one of formats: "raw", "html", or "v3+json"
* @param string $dir The alternate path to look for a README file
* @param array $params additional query params like "ref" to fetch readme for branch/tag
*
* @return string|array the readme content
*/
public function readme($username, $repository, $format = 'raw', $dir = null, $params = [])
{
$path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme';
if (null !== $dir) {
$path .= '/'.rawurlencode($dir);
}
return $this->get($path, $params, [
'Accept' => "application/vnd.github.$format",
]);
}
/**
* Create a repository dispatch event.
*
* @link https://developer.github.com/v3/repos/#create-a-repository-dispatch-event
*
* @param string $username the user who owns the repository
* @param string $repository the name of the repository
* @param string $eventType A custom webhook event name
*
* @return mixed null on success, array on error with 'message'
*/
public function dispatch($username, $repository, $eventType, array $clientPayload)
{
return $this->post(\sprintf('/repos/%s/%s/dispatches', rawurlencode($username), rawurlencode($repository)), [
'event_type' => $eventType,
'client_payload' => $clientPayload,
]);
}
/**
* Manage the collaborators of a repository.
*
* @link http://developer.github.com/v3/repos/collaborators/
*
* @return Collaborators
*/
public function collaborators()
{
return new Collaborators($this->getClient());
}
/**
* Manage the comments of a repository.
*
* @link http://developer.github.com/v3/repos/comments/
*
* @return Comments
*/
public function comments()
{
return new Comments($this->getClient());
}
/**
* Manage the commits of a repository.
*
* @link http://developer.github.com/v3/repos/commits/
*
* @return Commits
*/
public function commits()
{
return new Commits($this->getClient());
}
/**
* @link https://docs.github.com/en/rest/reference/checks#check-runs
*/
public function checkRuns(): CheckRuns
{
return new CheckRuns($this->getClient());
}
/**
* @link https://docs.github.com/en/rest/reference/checks#check-suites
*/
public function checkSuites(): CheckSuites
{
return new CheckSuites($this->getClient());
}
/**
* @link https://developer.github.com/v3/actions/artifacts/#artifacts
*/
public function artifacts(): Artifacts
{
return new Artifacts($this->getClient());
}
/**
* @link https://docs.github.com/en/rest/reference/actions#workflows
*/
public function workflows(): Workflows
{
return new Workflows($this->getClient());
}
/**
* @link https://docs.github.com/en/rest/reference/actions#workflow-runs
*/
public function workflowRuns(): WorkflowRuns
{
return new WorkflowRuns($this->getClient());
}
/**
* @link https://docs.github.com/en/rest/reference/actions#workflow-jobs
*/
public function workflowJobs(): WorkflowJobs
{
return new WorkflowJobs($this->getClient());
}
/**
* @link https://docs.github.com/en/rest/reference/actions#self-hosted-runners
*/
public function selfHostedRunners(): SelfHostedRunners
{
return new SelfHostedRunners($this->getClient());
}
/**
* @link https://docs.github.com/en/rest/reference/actions#secrets
*/
public function secrets(): Secrets
{
return new Secrets($this->getClient());
}
/**
* Manage the content of a repository.
*
* @link http://developer.github.com/v3/repos/contents/
*
* @return Contents
*/
public function contents()
{
return new Contents($this->getClient());
}
/**
* Manage the content of a repository.
*
* @link http://developer.github.com/v3/repos/downloads/
*
* @return Downloads
*/
public function downloads()
{
return new Downloads($this->getClient());
}
/**
* Manage the releases of a repository (Currently Undocumented).
*
* @link http://developer.github.com/v3/repos/
*
* @return Releases
*/
public function releases()
{
return new Releases($this->getClient());
}
/**
* Manage the deploy keys of a repository.
*
* @link http://developer.github.com/v3/repos/keys/
*
* @return DeployKeys
*/
public function keys()
{
return new DeployKeys($this->getClient());
}
/**
* Manage the forks of a repository.
*
* @link http://developer.github.com/v3/repos/forks/
*
* @return Forks
*/
public function forks()
{
return new Forks($this->getClient());
}
/**
* Manage the stargazers of a repository.
*
* @link https://developer.github.com/v3/activity/starring/#list-stargazers
*
* @return Stargazers
*/
public function stargazers()
{
return new Stargazers($this->getClient());
}
/**
* Manage the hooks of a repository.
*
* @link http://developer.github.com/v3/issues/jooks/
*
* @return Hooks
*/
public function hooks()
{
return new Hooks($this->getClient());
}
/**
* Manage the labels of a repository.
*
* @link http://developer.github.com/v3/issues/labels/
*
* @return Labels
*/
public function labels()
{
return new Labels($this->getClient());
}
/**
* Manage the statuses of a repository.
*
* @link http://developer.github.com/v3/repos/statuses/
*
* @return Statuses
*/
public function statuses()
{
return new Statuses($this->getClient());
}
/**
* Get the branch(es) of a repository.
*
* @link http://developer.github.com/v3/repos/
*
* @param string $username the username
* @param string $repository the name of the repository
* @param string $branch the name of the branch
* @param array $parameters parameters for the query string
*
* @return array list of the repository branches
*/
public function branches($username, $repository, $branch = null, array $parameters = [])
{
$url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches';
if (null !== $branch) {
$url .= '/'.rawurlencode($branch);
}
return $this->get($url, $parameters);
}
/**
* Manage the protection of a repository branch.
*
* @link https://developer.github.com/v3/repos/branches/#get-branch-protection
*
* @return Protection
*/
public function protection()
{
return new Protection($this->getClient());
}
/**
* Get the contributors of a repository.
*
* @link http://developer.github.com/v3/repos/
*
* @param string $username the user who owns the repository
* @param string $repository the name of the repository
* @param bool $includingAnonymous by default, the list only shows GitHub users.
* You can include non-users too by setting this to true
*
* @return array list of the repo contributors
*/
public function contributors($username, $repository, $includingAnonymous = false)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contributors', [
'anon' => $includingAnonymous ?: null,
]);
}
/**
* Get the language breakdown of a repository.
*
* @link http://developer.github.com/v3/repos/
*
* @param string $username the user who owns the repository
* @param string $repository the name of the repository
*
* @return array list of the languages
*/
public function languages($username, $repository)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/languages');
}
/**
* Get the tags of a repository.
*
* @link http://developer.github.com/v3/repos/
*
* @param string $username the user who owns the repository
* @param string $repository the name of the repository
* @param array $params the additional parameters like milestone, assignees, labels, sort, direction
*
* @return array list of the repository tags
*/
public function tags($username, $repository, array $params = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/tags', $params);
}
/**
* Get the teams of a repository.
*
* @link http://developer.github.com/v3/repos/
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
*
* @return array list of the languages
*/
public function teams($username, $repository)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/teams');
}
/**
* @param string $username
* @param string $repository
* @param int $page
*
* @return array
*/
public function subscribers($username, $repository, $page = 1)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/subscribers', [
'page' => $page,
]);
}
/**
* Perform a merge.
*
* @link http://developer.github.com/v3/repos/merging/
*
* @param string $username
* @param string $repository
* @param string $base The name of the base branch that the head will be merged into.
* @param string $head The head to merge. This can be a branch name or a commit SHA1.
* @param string $message Commit message to use for the merge commit. If omitted, a default message will be used.
*
* @return array|string
*/
public function merge($username, $repository, $base, $head, $message = null)
{
$parameters = [
'base' => $base,
'head' => $head,
];
if (is_string($message)) {
$parameters['commit_message'] = $message;
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/merges', $parameters);
}
/**
* @param string $username
* @param string $repository
* @param array $parameters
*
* @return array
*/
public function milestones($username, $repository, array $parameters = [])
{
return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/milestones', $parameters);
}
/**
* @link https://docs.github.com/en/rest/reference/repos#enable-automated-security-fixes
*
* @param string $username
* @param string $repository
*
* @return array|string
*/
public function enableAutomatedSecurityFixes(string $username, string $repository)
{
$this->acceptHeaderValue = 'application/vnd.github.london-preview+json';
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/automated-security-fixes');
}
/**
* @link https://docs.github.com/en/rest/reference/repos#disable-automated-security-fixes
*
* @param string $username
* @param string $repository
*
* @return array|string
*/
public function disableAutomatedSecurityFixes(string $username, string $repository)
{
$this->acceptHeaderValue = 'application/vnd.github.london-preview+json';
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/automated-security-fixes');
}
public function projects()
{
return new Projects($this->getClient());
}
public function traffic()
{
return new Traffic($this->getClient());
}
public function pages()
{
return new Pages($this->getClient());
}
/**
* @param string $username
* @param string $repository
* @param int $page
*
* @return array|string
*
* @see https://developer.github.com/v3/activity/events/#list-repository-events
*/
public function events($username, $repository, $page = 1)
{
return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/events', ['page' => $page]);
}
/**
* Get the community profile metrics for a repository.
*
* @link https://developer.github.com/v3/repos/community/#retrieve-community-profile-metrics
*
* @param string $username
* @param string $repository
*
* @return array
*/
public function communityProfile($username, $repository)
{
//This api is in preview mode, so set the correct accept-header
$this->acceptHeaderValue = 'application/vnd.github.black-panther-preview+json';
return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/community/profile');
}
/**
* Get the contents of a repository's code of conduct.
*
* @link https://developer.github.com/v3/codes_of_conduct/#get-the-contents-of-a-repositorys-code-of-conduct
*
* @param string $username
* @param string $repository
*
* @return array
*/
public function codeOfConduct($username, $repository)
{
//This api is in preview mode, so set the correct accept-header
$this->acceptHeaderValue = 'application/vnd.github.scarlet-witch-preview+json';
return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/community/code_of_conduct');
}
/**
* List all topics for a repository.
*
* @link https://developer.github.com/v3/repos/#list-all-topics-for-a-repository
*
* @param string $username
* @param string $repository
*
* @return array
*/
public function topics($username, $repository)
{
//This api is in preview mode, so set the correct accept-header
$this->acceptHeaderValue = 'application/vnd.github.mercy-preview+json';
return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/topics');
}
/**
* Replace all topics for a repository.
*
* @link https://developer.github.com/v3/repos/#replace-all-topics-for-a-repository
*
* @param string $username
* @param string $repository
* @param array $topics
*
* @return array
*/
public function replaceTopics($username, $repository, array $topics)
{
//This api is in preview mode, so set the correct accept-header
$this->acceptHeaderValue = 'application/vnd.github.mercy-preview+json';
return $this->put('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/topics', ['names' => $topics]);
}
/**
* Transfer a repository.
*
* @link https://developer.github.com/v3/repos/#transfer-a-repository
*
* @param string $username
* @param string $repository
* @param string $newOwner
* @param array $teamId
*
* @return array
*/
public function transfer($username, $repository, $newOwner, $teamId = [])
{
return $this->post('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/transfer', ['new_owner' => $newOwner, 'team_id' => $teamId]);
}
/**
* Create a repository using a template.
*
* @link https://developer.github.com/v3/repos/#create-a-repository-using-a-template
*
* @return array
*/
public function createFromTemplate(string $templateOwner, string $templateRepo, array $parameters = [])
{
//This api is in preview mode, so set the correct accept-header
$this->acceptHeaderValue = 'application/vnd.github.baptiste-preview+json';
return $this->post('/repos/'.rawurldecode($templateOwner).'/'.rawurldecode($templateRepo).'/generate', $parameters);
}
}

View file

@ -1,82 +0,0 @@
<?php
namespace Github\Api\Repository\Actions;
use Github\Api\AbstractApi;
/**
* @link https://docs.github.com/en/rest/reference/actions#artifacts
*/
class Artifacts extends AbstractApi
{
/**
* @link https://docs.github.com/en/rest/reference/actions#list-artifacts-for-a-repository
*
* @param string $username
* @param string $repository
* @param array $parameters
*
* @return array
*/
public function all(string $username, string $repository, array $parameters = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/artifacts', $parameters);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#list-workflow-run-artifacts
*
* @param string $username
* @param string $repository
* @param int $runId
*
* @return array
*/
public function runArtifacts(string $username, string $repository, int $runId)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/runs/'.$runId.'/artifacts');
}
/**
* @link https://docs.github.com/en/rest/reference/actions#get-an-artifact
*
* @param string $username
* @param string $repository
* @param int $artifactId
*
* @return array
*/
public function show(string $username, string $repository, int $artifactId)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/artifacts/'.$artifactId);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#delete-an-artifact
*
* @param string $username
* @param string $repository
* @param int $artifactId
*
* @return array
*/
public function remove(string $username, string $repository, int $artifactId)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/artifacts/'.$artifactId);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#download-an-artifact
*
* @param string $username
* @param string $repository
* @param int $artifactId
* @param string $format
*
* @return array
*/
public function download(string $username, string $repository, int $artifactId, string $format = 'zip')
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/artifacts/'.$artifactId.'/'.$format);
}
}

View file

@ -1,95 +0,0 @@
<?php
namespace Github\Api\Repository\Actions;
use Github\Api\AbstractApi;
/**
* @link https://docs.github.com/en/rest/reference/actions#secrets
*/
class Secrets extends AbstractApi
{
/**
* @link https://docs.github.com/en/rest/reference/actions#list-repository-secrets
*
* @param string $username
* @param string $repository
*
* @return array|string
*/
public function all(string $username, string $repository)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/secrets');
}
/**
* @link https://docs.github.com/en/rest/reference/actions#get-a-repository-secret
*
* @param string $username
* @param string $repository
* @param string $secretName
*
* @return array|string
*/
public function show(string $username, string $repository, string $secretName)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/secrets/'.rawurlencode($secretName));
}
/**
* @link https://docs.github.com/en/rest/reference/actions#create-or-update-a-repository-secret
*
* @param string $username
* @param string $repository
* @param string $secretName
* @param array $parameters
*
* @return array|string
*/
public function create(string $username, string $repository, string $secretName, array $parameters = [])
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/secrets/'.rawurlencode($secretName), $parameters);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#create-or-update-a-repository-secret
*
* @param string $username
* @param string $repository
* @param string $secretName
* @param array $parameters
*
* @return array|string
*/
public function update(string $username, string $repository, string $secretName, array $parameters = [])
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/secrets/'.rawurlencode($secretName), $parameters);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#delete-a-repository-secret
*
* @param string $username
* @param string $repository
* @param string $secretName
*
* @return array|string
*/
public function remove(string $username, string $repository, string $secretName)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/secrets/'.rawurlencode($secretName));
}
/**
* @link https://docs.github.com/en/rest/reference/actions#get-a-repository-public-key
*
* @param string $username
* @param string $repository
*
* @return array|string
*/
public function publicKey(string $username, string $repository)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/secrets/public-key');
}
}

View file

@ -1,65 +0,0 @@
<?php
namespace Github\Api\Repository\Actions;
use Github\Api\AbstractApi;
/**
* @link https://docs.github.com/en/rest/reference/actions#self-hosted-runners
*/
class SelfHostedRunners extends AbstractApi
{
/**
* @link https://docs.github.com/en/rest/reference/actions#list-self-hosted-runners-for-a-repository
*
* @param string $username
* @param string $repository
*
* @return array|string
*/
public function all(string $username, string $repository)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurldecode($repository).'/actions/runners');
}
/**
* @link https://docs.github.com/en/rest/reference/actions#get-a-self-hosted-runner-for-a-repository
*
* @param string $username
* @param string $repository
* @param int $runnerId
*
* @return array|string
*/
public function show(string $username, string $repository, int $runnerId)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurldecode($repository).'/actions/runners/'.$runnerId);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#delete-a-self-hosted-runner-from-a-repository
*
* @param string $username
* @param string $repository
* @param int $runnerId
*
* @return array|string
*/
public function remove(string $username, string $repository, int $runnerId)
{
return $this->delete('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/actions/runners/'.$runnerId);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#list-runner-applications-for-a-repository
*
* @param string $username
* @param string $repository
*
* @return array|string
*/
public function applications(string $username, string $repository)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/runners/downloads');
}
}

View file

@ -1,54 +0,0 @@
<?php
namespace Github\Api\Repository\Actions;
use Github\Api\AbstractApi;
/**
* @link https://docs.github.com/en/rest/reference/actions#workflow-jobs
*/
class WorkflowJobs extends AbstractApi
{
/**
* @link https://docs.github.com/en/rest/reference/actions#list-jobs-for-a-workflow-run
*
* @param string $username
* @param string $repository
* @param int $runId
* @param array $parameters
*
* @return array
*/
public function all(string $username, string $repository, int $runId, array $parameters = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/runs/'.$runId.'/jobs', $parameters);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#get-a-job-for-a-workflow-run
*
* @param string $username
* @param string $repository
* @param int $jobId
*
* @return array
*/
public function show(string $username, string $repository, int $jobId)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/jobs/'.$jobId);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#download-job-logs-for-a-workflow-run
*
* @param string $username
* @param string $repository
* @param int $jobId
*
* @return array
*/
public function downloadLogs(string $username, string $repository, int $jobId)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/jobs/'.$jobId.'/logs');
}
}

View file

@ -1,155 +0,0 @@
<?php
namespace Github\Api\Repository\Actions;
use Github\Api\AbstractApi;
/**
* @link https://docs.github.com/en/rest/reference/actions#workflow-runs
*/
class WorkflowRuns extends AbstractApi
{
/**
* @link https://docs.github.com/en/rest/reference/actions#list-workflow-runs-for-a-repository
*
* @param string $username
* @param string $repository
* @param array $parameters
*
* @return array
*/
public function all(string $username, string $repository, array $parameters = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/runs', $parameters);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#list-workflow-runs
*
* @param string $username
* @param string $repository
* @param string $workflow
* @param array $parameters
*
* @return array
*/
public function listRuns(string $username, string $repository, string $workflow, array $parameters = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/workflows/'.rawurlencode($workflow).'/runs', $parameters);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#get-a-workflow-run
*
* @param string $username
* @param string $repository
* @param int $runId
* @param array $parameters
*
* @return array
*/
public function show(string $username, string $repository, int $runId, array $parameters = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/runs/'.$runId, $parameters);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#delete-a-workflow-run
*
* @param string $username
* @param string $repository
* @param int $runId
*
* @return array|string
*/
public function remove(string $username, string $repository, int $runId)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/runs/'.$runId);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#re-run-a-workflow
*
* @param string $username
* @param string $repository
* @param int $runId
*
* @return array
*/
public function rerun(string $username, string $repository, int $runId)
{
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/runs/'.$runId.'/rerun');
}
/**
* @link https://docs.github.com/en/rest/reference/actions#cancel-a-workflow-run
*
* @param string $username
* @param string $repository
* @param int $runId
*
* @return array
*/
public function cancel(string $username, string $repository, int $runId)
{
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/runs/'.$runId.'/cancel');
}
/**
* @link https://docs.github.com/en/rest/reference/actions#get-workflow-run-usage
*
* @param string $username
* @param string $repository
* @param int $runId
*
* @return array
*/
public function usage(string $username, string $repository, int $runId)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/runs/'.$runId.'/timing');
}
/**
* @link https://docs.github.com/en/rest/reference/actions#download-workflow-run-logs
*
* @param string $username
* @param string $repository
* @param int $runId
*
* @return array|string
*/
public function downloadLogs(string $username, string $repository, int $runId)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/runs/'.$runId.'/logs');
}
/**
* @link https://docs.github.com/en/rest/reference/actions#delete-workflow-run-logs
*
* @param string $username
* @param string $repository
* @param int $runId
*
* @return array|string
*/
public function deleteLogs(string $username, string $repository, int $runId)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/runs/'.$runId.'/logs');
}
/**
* @link https://docs.github.com/en/rest/reference/actions#approve-a-workflow-run-for-a-fork-pull-request
*
* @param string $username
* @param string $repository
* @param int $runId
*
* @return array|string
*
* @experimental This endpoint is currently in beta.
*/
public function approve(string $username, string $repository, int $runId)
{
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/runs/'.$runId.'/approve');
}
}

View file

@ -1,82 +0,0 @@
<?php
namespace Github\Api\Repository\Actions;
use Github\Api\AbstractApi;
/**
* @link https://docs.github.com/en/rest/reference/actions#workflows
*/
class Workflows extends AbstractApi
{
/**
* @link https://docs.github.com/en/rest/reference/actions#list-repository-workflows
*
* @param string $username
* @param string $repository
* @param array $parameters
*
* @return array
*/
public function all(string $username, string $repository, array $parameters = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/workflows', $parameters);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#get-a-workflow
*
* @param string $username
* @param string $repository
* @param string|int $workflow
*
* @return array
*/
public function show(string $username, string $repository, $workflow)
{
if (is_string($workflow)) {
$workflow = rawurlencode($workflow);
}
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/workflows/'.$workflow);
}
/**
* @link https://docs.github.com/en/rest/reference/actions#get-workflow-usage
*
* @param string $username
* @param string $repository
* @param string|int $workflow
*
* @return array|string
*/
public function usage(string $username, string $repository, $workflow)
{
if (is_string($workflow)) {
$workflow = rawurlencode($workflow);
}
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/workflows/'.$workflow.'/timing');
}
/**
* @link https://docs.github.com/en/rest/reference/actions#create-a-workflow-dispatch-event
*
* @param string $username
* @param string $repository
* @param string|int $workflow
* @param string $ref
* @param array $inputs
*
* @return array|string empty
*/
public function dispatches(string $username, string $repository, $workflow, string $ref, array $inputs = null)
{
if (is_string($workflow)) {
$workflow = rawurlencode($workflow);
}
$parameters = array_filter(['ref' => $ref, 'inputs' => $inputs]);
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/workflows/'.$workflow.'/dispatches', $parameters);
}
}

View file

@ -1,123 +0,0 @@
<?php
namespace Github\Api\Repository;
use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
use Github\Exception\ErrorException;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/repos/releases/
*
* @author Evgeniy Guseletov <d46k16@gmail.com>
*/
class Assets extends AbstractApi
{
use AcceptHeaderTrait;
/**
* Get all release's assets in selected repository
* GET /repos/:owner/:repo/releases/:id/assets.
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
* @param int $id the id of the release
*
* @return array
*/
public function all($username, $repository, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/'.$id.'/assets');
}
/**
* Get an asset in selected repository's release
* GET /repos/:owner/:repo/releases/assets/:id.
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
* @param int $id the id of the asset
*
* @return array|string
*/
public function show($username, $repository, $id, bool $returnBinaryContent = false)
{
if ($returnBinaryContent) {
$this->acceptHeaderValue = 'application/octet-stream';
}
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/assets/'.$id);
}
/**
* Create an asset for selected repository's release
* POST /repos/:owner/:repo/releases/:id/assets?name=:filename.
*
* Creating an asset requires support for server name indentification (SNI)
* so this must be supported by your PHP version.
*
* @see http://developer.github.com/v3/repos/releases/#upload-a-release-asset
* @see http://php.net/manual/en/openssl.constsni.php
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
* @param int $id the id of the release
* @param string $name the filename for the asset
* @param string $contentType the content type for the asset
* @param string $content the content of the asset
*
* @throws MissingArgumentException
* @throws ErrorException
*
* @return array
*/
public function create($username, $repository, $id, $name, $contentType, $content)
{
if (!defined('OPENSSL_TLSEXT_SERVER_NAME') || OPENSSL_TLSEXT_SERVER_NAME == 0) {
throw new ErrorException('Asset upload support requires Server Name Indication. This is not supported by your PHP version. See https://www.php.net/manual/en/openssl.constsni.php.');
}
// Asset creation requires a separate endpoint, uploads.github.com.
// Change the base url for the HTTP client temporarily while we execute
// this request.
return $this->postRaw('https://uploads.github.com/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/'.$id.'/assets?name='.$name, $content, ['Content-Type' => $contentType]);
}
/**
* Edit an asset in selected repository's release
* PATCH /repos/:owner/:repo/releases/assets/:id.
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
* @param int $id the id of the asset
* @param array $params request parameters
*
* @throws MissingArgumentException
*
* @return array
*/
public function edit($username, $repository, $id, array $params)
{
if (!isset($params['name'])) {
throw new MissingArgumentException('name');
}
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/assets/'.$id, $params);
}
/**
* Delete an asset in selected repository's release
* DELETE /repos/:owner/:repo/releases/assets/:id.
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
* @param int $id the id of the asset
*
* @return array
*/
public function remove($username, $repository, $id)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/assets/'.$id);
}
}

View file

@ -1,86 +0,0 @@
<?php
namespace Github\Api\Repository\Checks;
use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
/**
* @link https://docs.github.com/en/rest/reference/checks
*/
class CheckRuns extends AbstractApi
{
use AcceptHeaderTrait;
/**
* @link https://docs.github.com/en/rest/reference/checks#create-a-check-run
*
* @return array
*/
public function create(string $username, string $repository, array $params = [])
{
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-runs', $params);
}
/**
* @link https://docs.github.com/en/rest/reference/checks#get-a-check-run
*
* @return array
*/
public function show(string $username, string $repository, int $checkRunId)
{
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-runs/'.$checkRunId);
}
/**
* @link https://docs.github.com/en/rest/reference/checks#update-a-check-run
*
* @return array
*/
public function update(string $username, string $repository, int $checkRunId, array $params = [])
{
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-runs/'.$checkRunId, $params);
}
/**
* @link https://docs.github.com/en/rest/reference/checks#list-check-run-annotations
*
* @return array
*/
public function annotations(string $username, string $repository, int $checkRunId)
{
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-runs/'.$checkRunId.'/annotations');
}
/**
* @link https://docs.github.com/en/rest/reference/checks#list-check-runs-in-a-check-suite
*
* @return array
*/
public function allForCheckSuite(string $username, string $repository, int $checkSuiteId, array $params = [])
{
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-suites/'.$checkSuiteId.'/check-runs', $params);
}
/**
* @link https://docs.github.com/en/rest/reference/checks#list-check-runs-for-a-git-reference
*
* @return array
*/
public function allForReference(string $username, string $repository, string $ref, array $params = [])
{
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($ref).'/check-runs', $params);
}
}

View file

@ -1,74 +0,0 @@
<?php
namespace Github\Api\Repository\Checks;
use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
/**
* @link https://docs.github.com/en/rest/reference/checks
*/
class CheckSuites extends AbstractApi
{
use AcceptHeaderTrait;
/**
* @link https://docs.github.com/en/rest/reference/checks#create-a-check-suite
*
* @return array
*/
public function create(string $username, string $repository, array $params = [])
{
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-suites', $params);
}
/**
* @link https://docs.github.com/en/rest/reference/checks#update-repository-preferences-for-check-suites
*
* @return array
*/
public function updatePreferences(string $username, string $repository, array $params = [])
{
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-suites/preferences', $params);
}
/**
* @link https://docs.github.com/en/rest/reference/checks#get-a-check-suite
*
* @return array
*/
public function getCheckSuite(string $username, string $repository, int $checkSuiteId)
{
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-suites/'.$checkSuiteId);
}
/**
* @link https://docs.github.com/en/rest/reference/checks#rerequest-a-check-suite
*
* @return array
*/
public function rerequest(string $username, string $repository, int $checkSuiteId)
{
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-suites/'.$checkSuiteId.'/rerequest');
}
/**
* @link https://docs.github.com/en/rest/reference/checks#list-check-suites-for-a-git-reference
*
* @return array
*/
public function allForReference(string $username, string $repository, string $ref, array $params = [])
{
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($ref).'/check-suites', $params);
}
}

View file

@ -1,84 +0,0 @@
<?php
namespace Github\Api\Repository;
use Github\Api\AbstractApi;
/**
* @link http://developer.github.com/v3/repos/collaborators/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Collaborators extends AbstractApi
{
/**
* @link https://developer.github.com/v3/repos/collaborators/#list-collaborators
*
* @param string $username
* @param string $repository
* @param array $params
*
* @return array|string
*/
public function all($username, $repository, array $params = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators', $params);
}
/**
* @link https://developer.github.com/v3/repos/collaborators/#check-if-a-user-is-a-collaborator
*
* @param string $username
* @param string $repository
* @param string $collaborator
*
* @return array|string
*/
public function check($username, $repository, $collaborator)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator));
}
/**
* @link https://developer.github.com/v3/repos/collaborators/#add-user-as-a-collaborator
*
* @param string $username
* @param string $repository
* @param string $collaborator
* @param array $params
*
* @return array|string
*/
public function add($username, $repository, $collaborator, array $params = [])
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator), $params);
}
/**
* @link https://developer.github.com/v3/repos/collaborators/#remove-user-as-a-collaborator
*
* @param string $username
* @param string $repository
* @param string $collaborator
*
* @return array|string
*/
public function remove($username, $repository, $collaborator)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator));
}
/**
* @link https://developer.github.com/v3/repos/collaborators/#review-a-users-permission-level
*
* @param string $username
* @param string $repository
* @param string $collaborator
*
* @return array|string
*/
public function permission($username, $repository, $collaborator)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator).'/permission');
}
}

View file

@ -1,75 +0,0 @@
<?php
namespace Github\Api\Repository;
use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/repos/comments/
*
* @author Joseph Bielawski <stloyd@gmail.com>
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
*/
class Comments extends AbstractApi
{
use AcceptHeaderTrait;
/**
* Configure the body type.
*
* @link https://developer.github.com/v3/repos/comments/#custom-media-types
*
* @param string|null $bodyType
*
* @return $this
*/
public function configure($bodyType = null)
{
if (!in_array($bodyType, ['raw', 'text', 'html'])) {
$bodyType = 'full';
}
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s+json', $this->getApiVersion(), $bodyType);
return $this;
}
public function all($username, $repository, $sha = null)
{
if (null === $sha) {
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments');
}
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha).'/comments');
}
public function show($username, $repository, $comment)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments/'.rawurlencode($comment));
}
public function create($username, $repository, $sha, array $params)
{
if (!isset($params['body'])) {
throw new MissingArgumentException('body');
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha).'/comments', $params);
}
public function update($username, $repository, $comment, array $params)
{
if (!isset($params['body'])) {
throw new MissingArgumentException('body');
}
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments/'.rawurlencode($comment), $params);
}
public function remove($username, $repository, $comment)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments/'.rawurlencode($comment));
}
}

View file

@ -1,33 +0,0 @@
<?php
namespace Github\Api\Repository;
use Github\Api\AbstractApi;
/**
* @link http://developer.github.com/v3/repos/commits/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Commits extends AbstractApi
{
public function all($username, $repository, array $params)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits', $params);
}
public function compare($username, $repository, $base, $head, $mediaType = null)
{
$headers = [];
if (null !== $mediaType) {
$headers['Accept'] = $mediaType;
}
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/compare/'.rawurlencode($base).'...'.rawurlencode($head), [], $headers);
}
public function show($username, $repository, $sha)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha));
}
}

Some files were not shown because too many files have changed in this diff Show more