Skip to content

Commit 953c998

Browse files
thefeqygithub-actions[bot]
authored andcommitted
Fix styling
1 parent bcf211a commit 953c998

File tree

10 files changed

+29
-28
lines changed

10 files changed

+29
-28
lines changed

config/grok.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
| Default Temperature
4545
|--------------------------------------------------------------------------
4646
|
47-
| Controls the randomness of the AI’s responses.
47+
| Controls the randomness of the AI’s responses.
4848
| Lower values (e.g., 0.1) make responses more deterministic,
4949
| while higher values (e.g., 1.5) make them more creative.
5050
|
@@ -56,7 +56,7 @@
5656
| Streaming Mode
5757
|--------------------------------------------------------------------------
5858
|
59-
| Enable or disable streaming responses. When enabled, responses
59+
| Enable or disable streaming responses. When enabled, responses
6060
| will be returned in real-time as they are generated.
6161
|
6262
| Accepted values: true or false

src/Commands/InstallGrokCommand.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
class InstallGrokCommand extends Command
99
{
1010
protected $signature = 'grok:install';
11+
1112
protected $description = 'Prepares the Grok AI client for use in Laravel.';
1213

1314
private const REPO_URL = 'https://github.com/grok-php/laravel';
@@ -17,6 +18,7 @@ public function handle(): void
1718
// Check if the package is already installed
1819
if ($this->isAlreadyInstalled()) {
1920
$this->warn('⚠️ Grok AI is already installed. No changes were made.');
21+
2022
return;
2123
}
2224

@@ -60,6 +62,7 @@ private function copyConfig(): void
6062
{
6163
if (file_exists(config_path('grok.php'))) {
6264
$this->warn('⚠️ Config file already exists: config/grok.php');
65+
6366
return;
6467
}
6568

@@ -79,13 +82,14 @@ private function addEnvKeys(string $envFile): void
7982

8083
if (! file_exists($filePath)) {
8184
$this->warn("⚠️ Skipping: {$envFile} not found.");
85+
8286
return;
8387
}
8488

8589
$fileContent = file_get_contents($filePath);
8690

8791
// Grok AI environment variables with comments
88-
$envSection = <<<EOL
92+
$envSection = <<<'EOL'
8993
9094
# --------------------------------------------------------------------------
9195
# 🧠 GROK AI CONFIGURATION
@@ -104,11 +108,12 @@ private function addEnvKeys(string $envFile): void
104108
// Check if any of the variables already exist
105109
if (str_contains($fileContent, 'GROK_API_KEY')) {
106110
$this->info("{$envFile} is already up to date.");
111+
107112
return;
108113
}
109114

110115
// Append the section to the .env file
111-
file_put_contents($filePath, PHP_EOL . $envSection . PHP_EOL, FILE_APPEND);
116+
file_put_contents($filePath, PHP_EOL.$envSection.PHP_EOL, FILE_APPEND);
112117

113118
$this->info("✅ Added Grok AI environment variables to {$envFile}");
114119
}
@@ -133,11 +138,11 @@ private function openRepositoryInBrowser(): void
133138
$this->info('Opening GitHub repository... 🌍');
134139

135140
if (PHP_OS_FAMILY === 'Darwin') {
136-
exec('open ' . self::REPO_URL);
141+
exec('open '.self::REPO_URL);
137142
} elseif (PHP_OS_FAMILY === 'Windows') {
138-
exec('start ' . self::REPO_URL);
143+
exec('start '.self::REPO_URL);
139144
} elseif (PHP_OS_FAMILY === 'Linux') {
140-
exec('xdg-open ' . self::REPO_URL);
145+
exec('xdg-open '.self::REPO_URL);
141146
}
142147
}
143148
}

src/Providers/GrokServiceProvider.php

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

33
namespace GrokPHP\Laravel\Providers;
44

5-
use GrokPHP\Laravel\Commands\InstallGrokCommand;
6-
use GrokPHP\Laravel\Services\GrokAI;
7-
use Illuminate\Support\ServiceProvider;
85
use GrokPHP\Client\Clients\GrokClient;
96
use GrokPHP\Client\Config\GrokConfig;
107
use GrokPHP\Client\Enums\DefaultConfig;
8+
use GrokPHP\Laravel\Commands\InstallGrokCommand;
9+
use GrokPHP\Laravel\Services\GrokAI;
10+
use Illuminate\Support\ServiceProvider;
1111

1212
class GrokServiceProvider extends ServiceProvider
1313
{
1414
public function register(): void
1515
{
16-
$this->mergeConfigFrom(__DIR__ . '/../../config/grok.php', 'grok');
16+
$this->mergeConfigFrom(__DIR__.'/../../config/grok.php', 'grok');
1717

1818
$this->app->singleton(GrokConfig::class, function () {
1919
return new GrokConfig(
@@ -38,7 +38,7 @@ public function boot(): void
3838
]);
3939

4040
$this->publishes([
41-
__DIR__ . '/../../config/grok.php' => config_path('grok.php'),
41+
__DIR__.'/../../config/grok.php' => config_path('grok.php'),
4242
], 'grok-config');
4343
}
4444
}

src/Services/GrokAI.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ public function __construct(GrokClient $client)
1919

2020
/**
2121
* Send a chat completion request to Grok API.
22-
* @param array $messages
23-
* @param ChatOptions|null $options
24-
* @return GrokResponse
22+
*
2523
* @throws GrokException
2624
*/
2725
public function chat(array $messages, ?ChatOptions $options = null): GrokResponse
@@ -39,7 +37,6 @@ public function chat(array $messages, ?ChatOptions $options = null): GrokRespons
3937

4038
/**
4139
* Analyze an image using Grok Vision models.
42-
* @return GrokVision
4340
*/
4441
public function vision(): GrokVision
4542
{

src/Services/GrokVision.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public function __construct(GrokClient $client)
1818

1919
/**
2020
* Analyze an image using Grok Vision models.
21+
*
2122
* @throws GrokException
2223
*/
2324
public function analyze(string $imagePath, string $prompt, ?Model $model = null): GrokResponse

src/Support/GrokResponse.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public function usage(): array
3737

3838
/**
3939
* Allow the GrokResponse object to be serialized to JSON.
40-
* @return array
4140
*/
4241
public function jsonSerialize(): array
4342
{

tests/Feature/GrokAiTest.php

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

33
namespace Tests\Feature;
44

5+
use GrokPHP\Client\Exceptions\GrokException;
56
use GrokPHP\Laravel\Facades\GrokAI;
67
use Illuminate\Foundation\Testing\RefreshDatabase;
78
use Tests\TestCase;
8-
use GrokPHP\Client\Exceptions\GrokException;
99

1010
class GrokAiTest extends TestCase
1111
{
@@ -17,7 +17,7 @@ class GrokAiTest extends TestCase
1717
public function test_it_can_send_a_chat_request(): void
1818
{
1919
$response = GrokAI::chat([
20-
['role' => 'user', 'content' => 'Tell me a joke!']
20+
['role' => 'user', 'content' => 'Tell me a joke!'],
2121
])->full();
2222

2323
$this->assertArrayHasKey('choices', $response);
@@ -31,7 +31,7 @@ public function test_it_can_send_a_chat_request(): void
3131
public function test_it_returns_only_ai_response(): void
3232
{
3333
$content = GrokAI::chat([
34-
['role' => 'user', 'content' => 'Tell me a joke!']
34+
['role' => 'user', 'content' => 'Tell me a joke!'],
3535
])->content();
3636

3737
$this->assertIsString($content);
@@ -64,13 +64,12 @@ public function test_it_throws_exception_for_empty_api_key(): void
6464
$this->expectExceptionMessage('No API key provided');
6565

6666
GrokAI::chat([
67-
['role' => 'user', 'content' => 'Tell me a joke!']
67+
['role' => 'user', 'content' => 'Tell me a joke!'],
6868
]);
6969
}
7070

7171
/**
7272
* Test exception handling when using an invalid API key.
73-
* @return void
7473
*/
7574
public function test_it_throws_exception_for_invalid_api_key(): void
7675
{
@@ -80,7 +79,7 @@ public function test_it_throws_exception_for_invalid_api_key(): void
8079
$this->expectExceptionMessageMatches('/Incorrect API key/');
8180

8281
GrokAI::chat([
83-
['role' => 'user', 'content' => 'Tell me a joke!']
82+
['role' => 'user', 'content' => 'Tell me a joke!'],
8483
]);
8584
}
8685

tests/Feature/GrokServiceProviderTest.php

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

33
namespace Tests\Feature;
44

5-
use Tests\TestCase;
65
use GrokPHP\Laravel\Services\GrokAI;
76
use Illuminate\Support\Facades\App;
7+
use Tests\TestCase;
88

99
class GrokServiceProviderTest extends TestCase
1010
{
11-
public function test_it_registers_GrokAI_in_the_service_container()
11+
public function test_it_registers_grok_a_i_in_the_service_container()
1212
{
1313
$grokAI = App::make(GrokAI::class);
1414

tests/TestCase.php

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

33
namespace Tests;
44

5-
use Orchestra\Testbench\TestCase as BaseTestCase;
6-
use GrokPHP\Laravel\Providers\GrokServiceProvider;
75
use GrokPHP\Laravel\Facades\GrokAI;
6+
use GrokPHP\Laravel\Providers\GrokServiceProvider;
7+
use Orchestra\Testbench\TestCase as BaseTestCase;
88

99
abstract class TestCase extends BaseTestCase
1010
{

tests/Unit/GrokConfigTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace Tests\Unit;
44

5-
use PHPUnit\Framework\TestCase;
65
use GrokPHP\Client\Config\GrokConfig;
76
use GrokPHP\Client\Enums\DefaultConfig;
7+
use PHPUnit\Framework\TestCase;
88

99
class GrokConfigTest extends TestCase
1010
{

0 commit comments

Comments
 (0)