findById($appId); } public static function findByKey(string $appKey): ?App { return app(AppProvider::class)->findByKey($appKey); } public function __construct($appId, string $appKey, string $appSecret, ?string $name) { if (!is_numeric($appId)) { throw InvalidApp::appIdIsNotNumeric($appId); } if ($appKey === '') { throw InvalidApp::valueIsRequired('appKey', $appId); } if ($appSecret === '') { throw InvalidApp::valueIsRequired('appSecret', $appId); } $this->id = $appId; $this->key = $appKey; $this->secret = $appSecret; $this->name = $name; } }