Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Market/AlternativeMarketForJeedom.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ public static function cmpByOrder($obj1, $obj2)
if ($obj1Order == $obj2Order) {
$result = 0;
} else {
$result = 1;
if ($obj1Order < $obj2Order) {
$result = -1;
} else {
$result = 1;
}
}
return $result;
Expand Down
8 changes: 4 additions & 4 deletions src/Market/GitManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class GitManager
*
* @var string
*/
private $githubApiDomain = 'https://api.github.com';
const GITHUB_API_DOMAIN = 'https://api.github.com';

/**
* Constructeur du gestionnaire Git
Expand Down Expand Up @@ -99,10 +99,10 @@ public function updateRepositoriesList()
protected function downloadRepositoriesList()
{
$result = false;
$content = DownloadManager::downloadContent($this->githubApiDomain . '/orgs/' . $this->gitId . '/repos?per_page=100');
$content = DownloadManager::downloadContent(self::GITHUB_API_DOMAIN . '/orgs/' . $this->gitId . '/repos?per_page=100');
// Limite de l'API GitHub atteinte
if (strstr($content, 'API rate limit exceeded')) {
$content = DownloadManager::downloadContent($this->githubApiDomain . '/rate_limit');
$content = DownloadManager::downloadContent(self::GITHUB_API_DOMAIN . '/rate_limit');
$gitHubLimitData = json_decode($content, true);
$refreshDate = date('H:i', $gitHubLimitData['resources']['core']['reset']);
throw new CoreException('Limite de l\'API GitHub atteinte. Le rafraichissement sera accessible à ' . $refreshDate);
Expand All @@ -113,7 +113,7 @@ protected function downloadRepositoriesList()
// Test si c'est un dépôt d'organisation
if (strstr($content, '"message":"Not Found"')) {
// Test d'un téléchargement pour un utilisateur
$content = DownloadManager::downloadContent($this->githubApiDomain . '/users/' . $this->gitId . '/repos?per_page=100');
$content = DownloadManager::downloadContent(self::GITHUB_API_DOMAIN . '/users/' . $this->gitId . '/repos?per_page=100');
// Test si c'est un dépot d'utilisateur
if (strstr($content, '"message":"Not Found"') || strlen($content) < 10) {
throw new CoreException('Le dépôt ' . $this->gitId . ' n\'existe pas.');
Expand Down