Skip to content

Commit

Permalink
optimize imports project-wide
Browse files Browse the repository at this point in the history
  • Loading branch information
ericwang401 committed Nov 6, 2023
1 parent 3eb0769 commit 5889d1a
Show file tree
Hide file tree
Showing 442 changed files with 1,062 additions and 1,102 deletions.
2 changes: 1 addition & 1 deletion app/Actions/Fortify/CreateNewUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Convoy\Actions\Fortify;

use Convoy\Models\User;
use Illuminate\Validation\Rule;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
use Laravel\Fortify\Contracts\CreatesNewUsers;

class CreateNewUser implements CreatesNewUsers
Expand Down
4 changes: 2 additions & 2 deletions app/Actions/Fortify/UpdateUserProfileInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Convoy\Actions\Fortify;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
use Illuminate\Support\Facades\Validator;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;

class UpdateUserProfileInformation implements UpdatesUserProfileInformation
Expand Down
2 changes: 1 addition & 1 deletion app/Casts/MebibytesToAndFromBytes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Convoy\Casts;

use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;

class MebibytesToAndFromBytes implements CastsAttributes
{
Expand Down
4 changes: 2 additions & 2 deletions app/Casts/NullableEncrypter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Convoy\Casts;

use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
use Illuminate\Contracts\Encryption\Encrypter;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Encryption\Encrypter;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;

class NullableEncrypter implements CastsAttributes
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Convoy\Console\Commands\Maintenance;

use Carbon\CarbonImmutable;
use Convoy\Repositories\Eloquent\BackupRepository;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Illuminate\Console\Command;
use Convoy\Repositories\Eloquent\BackupRepository;

class PruneOrphanedBackupsCommand extends Command
{
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Maintenance/PruneUsersCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Convoy\Console\Commands\Maintenance;

use Convoy\Jobs\Node\PruneUsersJob;
use Convoy\Models\Node;
use Illuminate\Console\Command;
use Convoy\Jobs\Node\PruneUsersJob;
use Illuminate\Console\View\Components\Task;

class PruneUsersCommand extends Command
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Server/UpdateRateLimitsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Convoy\Console\Commands\Server;

use Convoy\Jobs\Node\SyncServerRateLimitsJob;
use Convoy\Models\Node;
use Illuminate\Console\Command;
use Illuminate\Console\View\Components\Task;
use Convoy\Jobs\Node\SyncServerRateLimitsJob;

class UpdateRateLimitsCommand extends Command
{
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Server/UpdateUsagesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Convoy\Console\Commands\Server;

use Convoy\Jobs\Node\SyncServerUsagesJob;
use Convoy\Models\Node;
use Illuminate\Console\Command;
use Convoy\Jobs\Node\SyncServerUsagesJob;
use Illuminate\Console\View\Components\Task;

class UpdateUsagesCommand extends Command
Expand Down
4 changes: 2 additions & 2 deletions app/Console/Commands/User/MakeUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@

namespace Convoy\Console\Commands\User;

use Convoy\Exceptions\Model\DataValidationException;
use Convoy\Models\User;
use Exception;
use Convoy\Models\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Hash;
use Convoy\Exceptions\Model\DataValidationException;

class MakeUserCommand extends Command
{
Expand Down
10 changes: 5 additions & 5 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

namespace Convoy\Console;

use Convoy\Console\Commands\Maintenance\PruneOrphanedBackupsCommand;
use Convoy\Console\Commands\Maintenance\PruneUsersCommand;
use Convoy\Console\Commands\Server\ResetUsagesCommand;
use Convoy\Console\Commands\Server\UpdateRateLimitsCommand;
use Convoy\Console\Commands\Server\UpdateUsagesCommand;
use Convoy\Models\ActivityLog;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Database\Console\PruneCommand;
use Convoy\Console\Commands\Server\ResetUsagesCommand;
use Convoy\Console\Commands\Server\UpdateUsagesCommand;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Convoy\Console\Commands\Maintenance\PruneUsersCommand;
use Convoy\Console\Commands\Server\UpdateRateLimitsCommand;
use Convoy\Console\Commands\Maintenance\PruneOrphanedBackupsCommand;

class Kernel extends ConsoleKernel
{
Expand Down
2 changes: 1 addition & 1 deletion app/Contracts/Repository/ActivityRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Convoy\Contracts\Repository;

use Convoy\Models\ActivityLog;
use Convoy\Models\Server;
use Convoy\Models\ActivityLog;

interface ActivityRepositoryInterface extends RepositoryInterface
{
Expand Down
4 changes: 2 additions & 2 deletions app/Contracts/Repository/RepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Convoy\Contracts\Repository;

use Closure;
use Illuminate\Support\Collection;
use Convoy\Exceptions\Model\DataValidationException;
use Convoy\Exceptions\Repository\RecordNotFoundException;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
use Convoy\Exceptions\Repository\RecordNotFoundException;

interface RepositoryInterface
{
Expand Down
2 changes: 1 addition & 1 deletion app/Contracts/Repository/ServerRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Convoy\Contracts\Repository;

use Convoy\Exceptions\Repository\RecordNotFoundException;
use Convoy\Models\Server;
use Convoy\Exceptions\Repository\RecordNotFoundException;

interface ServerRepositoryInterface extends RepositoryInterface
{
Expand Down
7 changes: 4 additions & 3 deletions app/Data/Helpers/ChecksumData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

namespace Convoy\Data\Helpers;

use Convoy\Enums\Helpers\ChecksumAlgorithm;
use Spatie\LaravelData\Data;
use Convoy\Enums\Helpers\ChecksumAlgorithm;

class ChecksumData extends Data
{
public function __construct(
public string $checksum,
public string $checksum,
public ChecksumAlgorithm $algorithm,
) {
)
{
}
}
27 changes: 14 additions & 13 deletions app/Data/Node/Access/CreateUserData.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@
namespace Convoy\Data\Node\Access;

use Carbon\Carbon;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Casts\EnumCast;
use Convoy\Enums\Node\Access\RealmType;
use Spatie\LaravelData\Attributes\Validation\Max;
use Spatie\LaravelData\Attributes\Validation\Min;
use Spatie\LaravelData\Attributes\WithCast;
use Spatie\LaravelData\Casts\EnumCast;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Attributes\Validation\Min;
use Spatie\LaravelData\Attributes\Validation\Max;

class CreateUserData extends Data
{
public function __construct(
#[WithCast(EnumCast::class)]
public RealmType $realm_type,
public bool $enabled,
#[Min(1), Max(60)]
public ?string $username = null,
#[Min(1), Max(64)]
public ?string $password = null,
public ?Carbon $expires_at = null,
) {
#[WithCast(EnumCast::class)]
public RealmType $realm_type,
public bool $enabled,
#[Min(1), Max(60)]
public ?string $username = null,
#[Min(1), Max(64)]
public ?string $password = null,
public ?Carbon $expires_at = null,
)
{
}
}
2 changes: 1 addition & 1 deletion app/Data/Node/Access/UserCredentialsData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Convoy\Data\Node\Access;

use Convoy\Enums\Node\Access\RealmType;
use Spatie\LaravelData\Data;
use Convoy\Enums\Node\Access\RealmType;

class UserCredentialsData extends Data
{
Expand Down
23 changes: 12 additions & 11 deletions app/Data/Node/Access/UserData.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@
namespace Convoy\Data\Node\Access;

use Carbon\Carbon;
use Convoy\Enums\Node\Access\RealmType;
use Illuminate\Support\Arr;
use Spatie\LaravelData\Attributes\WithCast;
use Spatie\LaravelData\Casts\EnumCast;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Casts\EnumCast;
use Convoy\Enums\Node\Access\RealmType;
use Spatie\LaravelData\Attributes\WithCast;

class UserData extends Data
{
public function __construct(
public string $username,
public ?string $email,
#[WithCast(EnumCast::class)]
public RealmType $realm_type,
public bool $enabled,
public ?Carbon $expires_at,
) {
public string $username,
public ?string $email,
#[WithCast(EnumCast::class)]
public RealmType $realm_type,
public bool $enabled,
public ?Carbon $expires_at,
)
{
}

public static function fromRaw(array $raw): UserData
Expand All @@ -27,7 +28,7 @@ public static function fromRaw(array $raw): UserData
'username' => explode('@', $raw['userid'])[0],
'email' => Arr::get($raw, 'email'),
'realm_type' => RealmType::from($raw['realm-type']),
'enabled' => (bool) $raw['enable'],
'enabled' => (bool)$raw['enable'],
'expires_at' => Arr::get($raw, 'expire') ? Carbon::createFromTimestamp($raw['expire']) : null,
]);
}
Expand Down
5 changes: 3 additions & 2 deletions app/Data/Node/Storage/FileMetaData.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class FileMetaData extends Data
public function __construct(
public string $file_name,
public string $mime_type,
public int $size,
) {
public int $size,
)
{
}
}
1 change: 0 additions & 1 deletion app/Data/Node/Storage/IsoData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Convoy\Data\Node\Storage;

use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Spatie\LaravelData\Data;

Expand Down
9 changes: 5 additions & 4 deletions app/Data/Server/Deployments/CloudinitAddressConfigData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

namespace Convoy\Data\Server\Deployments;

use Convoy\Data\Server\Eloquent\AddressData;
use Spatie\LaravelData\Data;
use Convoy\Data\Server\Eloquent\AddressData;

class CloudinitAddressConfigData extends Data
{
public function __construct(
public ?AddressData $ipv4,
public ?AddressData $ipv6,
) {
public ?AddressData $ipv4,
public ?AddressData $ipv6,
)
{
}
}
11 changes: 6 additions & 5 deletions app/Data/Server/Deployments/ServerDeploymentData.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
class ServerDeploymentData extends Data
{
public function __construct(
public Server $server,
public Server $server,
public ?Template $template,
public ?string $account_password,
public bool $should_create_server,
public bool $start_on_completion,
) {
public ?string $account_password,
public bool $should_create_server,
public bool $start_on_completion,
)
{
}
}
27 changes: 14 additions & 13 deletions app/Data/Server/Eloquent/AddressData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@

namespace Convoy\Data\Server\Eloquent;

use Spatie\LaravelData\Attributes\Validation\In;
use Spatie\LaravelData\Attributes\Validation\IP;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Attributes\Validation\IP;
use Spatie\LaravelData\Attributes\Validation\In;

class AddressData extends Data
{
public function __construct(
public int $id,
public int $address_pool_id,
public ?int $server_id,
#[In(['ipv4', 'ipv6'])]
public string $type,
#[IP]
public string $address,
public int $cidr,
public string $gateway,
public ?string $mac_address,
) {
public int $id,
public int $address_pool_id,
public ?int $server_id,
#[In(['ipv4', 'ipv6'])]
public string $type,
#[IP]
public string $address,
public int $cidr,
public string $gateway,
public ?string $mac_address,
)
{
}
}
13 changes: 7 additions & 6 deletions app/Data/Server/Eloquent/ServerAddressesData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

namespace Convoy\Data\Server\Eloquent;

use Spatie\LaravelData\Attributes\DataCollectionOf;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\DataCollection;
use Spatie\LaravelData\Attributes\DataCollectionOf;

class ServerAddressesData extends Data
{
public function __construct(
#[DataCollectionOf(AddressData::class)]
public DataCollection $ipv4,
#[DataCollectionOf(AddressData::class)]
public DataCollection $ipv6,
) {
#[DataCollectionOf(AddressData::class)]
public DataCollection $ipv4,
#[DataCollectionOf(AddressData::class)]
public DataCollection $ipv6,
)
{
}
}
Loading

0 comments on commit 5889d1a

Please sign in to comment.