Skip to content

Commit ad3a954

Browse files
committed
Rename APIKey to ApiKey
1 parent 7aa540b commit ad3a954

File tree

14 files changed

+53
-53
lines changed

14 files changed

+53
-53
lines changed

app/Contracts/Repository/ApiKeyRepositoryInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99

1010
namespace Pterodactyl\Contracts\Repository;
1111

12-
use Pterodactyl\Models\APIKey;
12+
use Pterodactyl\Models\ApiKey;
1313

1414
interface ApiKeyRepositoryInterface extends RepositoryInterface
1515
{
1616
/**
1717
* Load permissions for a key onto the model.
1818
*
19-
* @param \Pterodactyl\Models\APIKey $model
19+
* @param \Pterodactyl\Models\ApiKey $model
2020
* @param bool $refresh
2121
* @deprecated
22-
* @return \Pterodactyl\Models\APIKey
22+
* @return \Pterodactyl\Models\ApiKey
2323
*/
24-
public function loadPermissions(APIKey $model, bool $refresh = false): APIKey;
24+
public function loadPermissions(ApiKey $model, bool $refresh = false): ApiKey;
2525
}

app/Http/Middleware/Api/Admin/AuthenticateKey.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Closure;
66
use Illuminate\Http\Request;
7-
use Pterodactyl\Models\APIKey;
7+
use Pterodactyl\Models\ApiKey;
88
use Illuminate\Auth\AuthManager;
99
use Illuminate\Contracts\Encryption\Encrypter;
1010
use Symfony\Component\HttpKernel\Exception\HttpException;
@@ -61,8 +61,8 @@ public function handle(Request $request, Closure $next)
6161
}
6262

6363
$raw = $request->bearerToken();
64-
$identifier = substr($raw, 0, APIKey::IDENTIFIER_LENGTH);
65-
$token = substr($raw, APIKey::IDENTIFIER_LENGTH);
64+
$identifier = substr($raw, 0, ApiKey::IDENTIFIER_LENGTH);
65+
$token = substr($raw, ApiKey::IDENTIFIER_LENGTH);
6666

6767
try {
6868
$model = $this->repository->findFirstWhere([['identifier', '=', $identifier]]);

app/Http/Requests/API/Admin/ApiAdminRequest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Pterodactyl\Http\Requests\API\Admin;
44

5-
use Pterodactyl\Models\APIKey;
5+
use Pterodactyl\Models\ApiKey;
66
use Illuminate\Foundation\Http\FormRequest;
77
use Pterodactyl\Exceptions\PterodactylException;
88
use Pterodactyl\Services\Acl\Api\AdminAcl as Acl;
@@ -66,9 +66,9 @@ public function rules(): array
6666
/**
6767
* Return the API key being used for the request.
6868
*
69-
* @return \Pterodactyl\Models\APIKey
69+
* @return \Pterodactyl\Models\ApiKey
7070
*/
71-
public function key(): APIKey
71+
public function key(): ApiKey
7272
{
7373
return $this->attributes->get('api_key');
7474
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Sofa\Eloquence\Contracts\CleansAttributes;
1111
use Sofa\Eloquence\Contracts\Validable as ValidableContract;
1212

13-
class APIKey extends Model implements CleansAttributes, ValidableContract
13+
class ApiKey extends Model implements CleansAttributes, ValidableContract
1414
{
1515
use Eloquence, Validable;
1616

app/Providers/MacroServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Cache;
1414
use Carbon;
1515
use Request;
16-
use Pterodactyl\Models\APIKey;
16+
use Pterodactyl\Models\ApiKey;
1717
use Illuminate\Support\ServiceProvider;
1818
use Pterodactyl\Services\ApiKeyService;
1919

@@ -51,7 +51,7 @@ public function boot()
5151
'ApiKeyMacro',
5252
'ApiKeyMacro:Key:' . $parts[0],
5353
])->remember('ApiKeyMacro.' . $parts[0], Carbon::now()->addMinutes(15), function () use ($parts) {
54-
return APIKey::where('public', $parts[0])->first();
54+
return ApiKey::where('public', $parts[0])->first();
5555
});
5656
}
5757

app/Repositories/Eloquent/ApiKeyRepository.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Pterodactyl\Repositories\Eloquent;
44

5-
use Pterodactyl\Models\APIKey;
5+
use Pterodactyl\Models\ApiKey;
66
use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface;
77

88
class ApiKeyRepository extends EloquentRepository implements ApiKeyRepositoryInterface
@@ -14,18 +14,18 @@ class ApiKeyRepository extends EloquentRepository implements ApiKeyRepositoryInt
1414
*/
1515
public function model()
1616
{
17-
return APIKey::class;
17+
return ApiKey::class;
1818
}
1919

2020
/**
2121
* Load permissions for a key onto the model.
2222
*
23-
* @param \Pterodactyl\Models\APIKey $model
23+
* @param \Pterodactyl\Models\ApiKey $model
2424
* @param bool $refresh
2525
* @deprecated
26-
* @return \Pterodactyl\Models\APIKey
26+
* @return \Pterodactyl\Models\ApiKey
2727
*/
28-
public function loadPermissions(APIKey $model, bool $refresh = false): APIKey
28+
public function loadPermissions(ApiKey $model, bool $refresh = false): ApiKey
2929
{
3030
if (! $model->relationLoaded('permissions') || $refresh) {
3131
$model->load('permissions');

app/Services/Acl/Api/AdminAcl.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Pterodactyl\Services\Acl\Api;
44

5-
use Pterodactyl\Models\APIKey;
5+
use Pterodactyl\Models\ApiKey;
66

77
class AdminAcl
88
{
@@ -54,12 +54,12 @@ public static function can(int $permission, int $action = self::READ)
5454
* Determine if an API Key model has permission to access a given resource
5555
* at a specific action level.
5656
*
57-
* @param \Pterodactyl\Models\APIKey $key
57+
* @param \Pterodactyl\Models\ApiKey $key
5858
* @param string $resource
5959
* @param int $action
6060
* @return bool
6161
*/
62-
public static function check(APIKey $key, string $resource, int $action = self::READ)
62+
public static function check(ApiKey $key, string $resource, int $action = self::READ)
6363
{
6464
return self::can(data_get($key, self::COLUMN_IDENTIFER . $resource, self::NONE), $action);
6565
}

app/Services/Api/KeyCreationService.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Pterodactyl\Services\Api;
44

5-
use Pterodactyl\Models\APIKey;
5+
use Pterodactyl\Models\ApiKey;
66
use Illuminate\Contracts\Encryption\Encrypter;
77
use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface;
88

@@ -36,15 +36,15 @@ public function __construct(ApiKeyRepositoryInterface $repository, Encrypter $en
3636
* stored in the database.
3737
*
3838
* @param array $data
39-
* @return \Pterodactyl\Models\APIKey
39+
* @return \Pterodactyl\Models\ApiKey
4040
*
4141
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
4242
*/
43-
public function handle(array $data): APIKey
43+
public function handle(array $data): ApiKey
4444
{
4545
$data = array_merge($data, [
46-
'identifier' => str_random(APIKey::IDENTIFIER_LENGTH),
47-
'token' => $this->encrypter->encrypt(str_random(APIKey::KEY_LENGTH)),
46+
'identifier' => str_random(ApiKey::IDENTIFIER_LENGTH),
47+
'token' => $this->encrypter->encrypt(str_random(ApiKey::KEY_LENGTH)),
4848
]);
4949

5050
$instance = $this->repository->create($data, true, true);

app/Transformers/Api/Admin/BaseTransformer.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Pterodactyl\Transformers\Api\Admin;
44

55
use Cake\Chronos\Chronos;
6-
use Pterodactyl\Models\APIKey;
6+
use Pterodactyl\Models\ApiKey;
77
use Illuminate\Container\Container;
88
use League\Fractal\TransformerAbstract;
99
use Pterodactyl\Services\Acl\Api\AdminAcl;
@@ -13,17 +13,17 @@ abstract class BaseTransformer extends TransformerAbstract
1313
const RESPONSE_TIMEZONE = 'UTC';
1414

1515
/**
16-
* @var \Pterodactyl\Models\APIKey
16+
* @var \Pterodactyl\Models\ApiKey
1717
*/
1818
private $key;
1919

2020
/**
2121
* Set the HTTP request class being used for this request.
2222
*
23-
* @param \Pterodactyl\Models\APIKey $key
23+
* @param \Pterodactyl\Models\ApiKey $key
2424
* @return $this
2525
*/
26-
public function setKey(APIKey $key)
26+
public function setKey(ApiKey $key)
2727
{
2828
$this->key = $key;
2929

@@ -33,9 +33,9 @@ public function setKey(APIKey $key)
3333
/**
3434
* Return the request instance being used for this transformer.
3535
*
36-
* @return \Pterodactyl\Models\APIKey
36+
* @return \Pterodactyl\Models\ApiKey
3737
*/
38-
public function getKey(): APIKey
38+
public function getKey(): ApiKey
3939
{
4040
return $this->key;
4141
}

database/factories/ModelFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,11 @@
223223
];
224224
});
225225

226-
$factory->define(Pterodactyl\Models\APIKey::class, function (Faker $faker) {
226+
$factory->define(Pterodactyl\Models\ApiKey::class, function (Faker $faker) {
227227
return [
228228
'id' => $faker->unique()->randomNumber(),
229229
'user_id' => $faker->randomNumber(),
230-
'identifier' => str_random(Pterodactyl\Models\APIKey::IDENTIFIER_LENGTH),
230+
'identifier' => str_random(Pterodactyl\Models\ApiKey::IDENTIFIER_LENGTH),
231231
'token' => 'encrypted_string',
232232
'memo' => 'Test Function Key',
233233
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),

0 commit comments

Comments
 (0)