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
1 change: 1 addition & 0 deletions resources/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
require_once __DIR__ . "/lib/exceptions/NoDieException.php";
require_once __DIR__ . "/lib/exceptions/SSOException.php";
require_once __DIR__ . "/lib/exceptions/ArrayKeyException.php";
require_once __DIR__ . "/lib/exceptions/CurlException.php";
require_once __DIR__ . "/lib/exceptions/EntryNotFoundException.php";
require_once __DIR__ . "/lib/exceptions/EnsureException.php";
require_once __DIR__ . "/lib/exceptions/EncodingUnknownException.php";
Expand Down
7 changes: 6 additions & 1 deletion resources/lib/UnityGithub.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

namespace UnityWebPortal\lib;
use UnityWebPortal\lib\exceptions\CurlException;

class UnityGithub
{
Expand All @@ -13,7 +14,11 @@ public function getSshPublicKeys(string $username): array
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$keys = json_decode(curl_exec($curl), false);
$curl_output = curl_exec($curl);
if ($curl_output === false) {
throw new CurlException(curl_error($curl));
}
$keys = json_decode($curl_output, false);
curl_close($curl);

// normally returns array of objects each with a ->key attribute
Expand Down
5 changes: 5 additions & 0 deletions resources/lib/exceptions/CurlException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

namespace UnityWebPortal\lib\exceptions;

class CurlException extends \Exception {}
1 change: 1 addition & 0 deletions test/phpunit-bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
require_once __DIR__ . "/../resources/lib/exceptions/NoDieException.php";
require_once __DIR__ . "/../resources/lib/exceptions/SSOException.php";
require_once __DIR__ . "/../resources/lib/exceptions/ArrayKeyException.php";
require_once __DIR__ . "/../resources/lib/exceptions/CurlException.php";
require_once __DIR__ . "/../resources/lib/exceptions/EntryNotFoundException.php";
require_once __DIR__ . "/../resources/lib/exceptions/EnsureException.php";
require_once __DIR__ . "/../resources/lib/exceptions/EncodingUnknownException.php";
Expand Down