Skip to content

Commit 31faced

Browse files
rennokkiStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent 5767f73 commit 31faced

File tree

7 files changed

+42
-42
lines changed

7 files changed

+42
-42
lines changed

src/Kinds/K8sResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public static function getUniqueCrdMacro(?string $kind = null, ?string $defaultV
6666
$kind = $kind ?: static::getKind();
6767
$defaultVersion = $defaultVersion ?: static::getDefaultVersion();
6868

69-
return Str::of($kind . explode('/', $defaultVersion)[0])->camel()->slug();
69+
return Str::of($kind.explode('/', $defaultVersion)[0])->camel()->slug();
7070
}
7171

7272
/**

src/KubernetesCluster.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ protected function watchLogsPath(string $path, Closure $callback, array $query =
387387
$line = substr($buffer, 0, $pos);
388388
$buffer = substr($buffer, $pos + 1);
389389

390-
$call = call_user_func($callback, $line . "\n");
390+
$call = call_user_func($callback, $line."\n");
391391

392392
if (! is_null($call)) {
393393
fclose($sock);

src/Traits/Cluster/LoadsFromKubeConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ protected function writeTempFileForContext(
243243
/** @var \RenokiCo\PhpK8s\KubernetesCluster $this */
244244
$tempFolder = static::$tempFolder ?: sys_get_temp_dir();
245245

246-
$tempFilePath = $tempFolder . DIRECTORY_SEPARATOR . Str::slug("ctx-{$context}-{$userName}-{$url}") . "-{$fileName}";
246+
$tempFilePath = $tempFolder.DIRECTORY_SEPARATOR.Str::slug("ctx-{$context}-{$userName}-{$url}")."-{$fileName}";
247247

248248
if (file_exists($tempFilePath)) {
249249
return $tempFilePath;

src/Traits/RunsClusterOperations.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ public function watchAll(Closure $callback, array $query = ['pretty' => 1])
382382
{
383383
if (! $this instanceof Watchable) {
384384
throw new KubernetesWatchException(
385-
'The resource ' . get_class($this) . ' does not support watch actions.'
385+
'The resource '.get_class($this).' does not support watch actions.'
386386
);
387387
}
388388

@@ -407,7 +407,7 @@ public function watch(Closure $callback, array $query = ['pretty' => 1])
407407
{
408408
if (! $this instanceof Watchable) {
409409
throw new KubernetesWatchException(
410-
'The resource ' . get_class($this) . ' does not support watch actions.'
410+
'The resource '.get_class($this).' does not support watch actions.'
411411
);
412412
}
413413

@@ -433,7 +433,7 @@ public function logs(array $query = ['pretty' => 1])
433433
{
434434
if (! $this instanceof Loggable) {
435435
throw new KubernetesLogsException(
436-
'The resource ' . get_class($this) . ' does not support logs.'
436+
'The resource '.get_class($this).' does not support logs.'
437437
);
438438
}
439439

@@ -459,13 +459,13 @@ public function watchLogs(Closure $callback, array $query = ['pretty' => 1])
459459
{
460460
if (! $this instanceof Loggable) {
461461
throw new KubernetesWatchException(
462-
'The resource ' . get_class($this) . ' does not support logs.'
462+
'The resource '.get_class($this).' does not support logs.'
463463
);
464464
}
465465

466466
if (! $this instanceof Watchable) {
467467
throw new KubernetesLogsException(
468-
'The resource ' . get_class($this) . ' does not support watch actions.'
468+
'The resource '.get_class($this).' does not support watch actions.'
469469
);
470470
}
471471

@@ -493,7 +493,7 @@ public function scaler(): K8sScale
493493
{
494494
if (! $this instanceof Scalable) {
495495
throw new KubernetesScalingException(
496-
'The resource ' . get_class($this) . ' does not support scaling.'
496+
'The resource '.get_class($this).' does not support scaling.'
497497
);
498498
}
499499

@@ -527,7 +527,7 @@ public function exec(
527527
) {
528528
if (! $this instanceof Executable) {
529529
throw new KubernetesExecException(
530-
'The resource ' . get_class($this) . ' does not support exec commands.'
530+
'The resource '.get_class($this).' does not support exec commands.'
531531
);
532532
}
533533

@@ -556,7 +556,7 @@ public function attach(
556556
) {
557557
if (! $this instanceof Attachable) {
558558
throw new KubernetesAttachException(
559-
'The resource ' . get_class($this) . ' does not support attach commands.'
559+
'The resource '.get_class($this).' does not support attach commands.'
560560
);
561561
}
562562

@@ -575,63 +575,63 @@ public function attach(
575575
*/
576576
public function allResourcesPath(bool $withNamespace = true): string
577577
{
578-
return "{$this->getApiPathPrefix($withNamespace)}/" . static::getPlural();
578+
return "{$this->getApiPathPrefix($withNamespace)}/".static::getPlural();
579579
}
580580

581581
/**
582582
* Get the path, prefixed by '/', that points to the specific resource.
583583
*/
584584
public function resourcePath(): string
585585
{
586-
return "{$this->getApiPathPrefix()}/" . static::getPlural() . "/{$this->getIdentifier()}";
586+
return "{$this->getApiPathPrefix()}/".static::getPlural()."/{$this->getIdentifier()}";
587587
}
588588

589589
/**
590590
* Get the path, prefixed by '/', that points to the resource watch.
591591
*/
592592
public function allResourcesWatchPath(): string
593593
{
594-
return "{$this->getApiPathPrefix(false)}/watch/" . static::getPlural();
594+
return "{$this->getApiPathPrefix(false)}/watch/".static::getPlural();
595595
}
596596

597597
/**
598598
* Get the path, prefixed by '/', that points to the specific resource to watch.
599599
*/
600600
public function resourceWatchPath(): string
601601
{
602-
return "{$this->getApiPathPrefix(true, 'watch')}/" . static::getPlural() . "/{$this->getIdentifier()}";
602+
return "{$this->getApiPathPrefix(true, 'watch')}/".static::getPlural()."/{$this->getIdentifier()}";
603603
}
604604

605605
/**
606606
* Get the path, prefixed by '/', that points to the resource scale.
607607
*/
608608
public function resourceScalePath(): string
609609
{
610-
return "{$this->getApiPathPrefix()}/" . static::getPlural() . "/{$this->getIdentifier()}/scale";
610+
return "{$this->getApiPathPrefix()}/".static::getPlural()."/{$this->getIdentifier()}/scale";
611611
}
612612

613613
/**
614614
* Get the path, prefixed by '/', that points to the specific resource to log.
615615
*/
616616
public function resourceLogPath(): string
617617
{
618-
return "{$this->getApiPathPrefix()}/" . static::getPlural() . "/{$this->getIdentifier()}/log";
618+
return "{$this->getApiPathPrefix()}/".static::getPlural()."/{$this->getIdentifier()}/log";
619619
}
620620

621621
/**
622622
* Get the path, prefixed by '/', that points to the specific resource to exec.
623623
*/
624624
public function resourceExecPath(): string
625625
{
626-
return "{$this->getApiPathPrefix()}/" . static::getPlural() . "/{$this->getIdentifier()}/exec";
626+
return "{$this->getApiPathPrefix()}/".static::getPlural()."/{$this->getIdentifier()}/exec";
627627
}
628628

629629
/**
630630
* Get the path, prefixed by '/', that points to the specific resource to attach.
631631
*/
632632
public function resourceAttachPath(): string
633633
{
634-
return "{$this->getApiPathPrefix()}/" . static::getPlural() . "/{$this->getIdentifier()}/attach";
634+
return "{$this->getApiPathPrefix()}/".static::getPlural()."/{$this->getIdentifier()}/attach";
635635
}
636636

637637
/**

tests/CronJobTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function test_cronjob_from_yaml()
5656
->restartOnFailure()
5757
->neverRestart();
5858

59-
$cronjob = $this->cluster->fromYamlFile(__DIR__ . '/yaml/cronjob.yaml');
59+
$cronjob = $this->cluster->fromYamlFile(__DIR__.'/yaml/cronjob.yaml');
6060

6161
$this->assertEquals('batch/v1', $cronjob->getApiVersion());
6262
$this->assertEquals('pi', $cronjob->getName());

tests/KubeConfigTest.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ protected function setUp(): void
2020
{
2121
parent::setUp();
2222

23-
$this->tempFolder = __DIR__ . DIRECTORY_SEPARATOR . 'temp';
23+
$this->tempFolder = __DIR__.DIRECTORY_SEPARATOR.'temp';
2424
KubernetesCluster::setTempFolder($this->tempFolder);
2525
}
2626

@@ -36,19 +36,19 @@ protected function tearDown(): void
3636

3737
public function test_kube_config_from_yaml_file_with_base64_encoded_ssl()
3838
{
39-
$cluster = KubernetesCluster::fromKubeConfigYamlFile(__DIR__ . '/cluster/kubeconfig.yaml', 'minikube');
39+
$cluster = KubernetesCluster::fromKubeConfigYamlFile(__DIR__.'/cluster/kubeconfig.yaml', 'minikube');
4040

4141
[
4242
'verify' => $caPath,
4343
'cert' => $certPath,
4444
'ssl_key' => $keyPath,
4545
] = $cluster->getClient()->getConfig();
4646

47-
$tempFilePath = $this->tempFolder . DIRECTORY_SEPARATOR . 'ctx-minikube-minikube-httpsminikube8443-';
47+
$tempFilePath = $this->tempFolder.DIRECTORY_SEPARATOR.'ctx-minikube-minikube-httpsminikube8443-';
4848

49-
$this->assertSame($tempFilePath . 'ca-cert.pem', $caPath);
50-
$this->assertSame($tempFilePath . 'client-cert.pem', $certPath);
51-
$this->assertSame($tempFilePath . 'client-key.pem', $keyPath);
49+
$this->assertSame($tempFilePath.'ca-cert.pem', $caPath);
50+
$this->assertSame($tempFilePath.'client-cert.pem', $certPath);
51+
$this->assertSame($tempFilePath.'client-key.pem', $keyPath);
5252

5353
$this->assertEquals("some-ca\n", file_get_contents($caPath));
5454
$this->assertEquals("some-cert\n", file_get_contents($certPath));
@@ -57,7 +57,7 @@ public function test_kube_config_from_yaml_file_with_base64_encoded_ssl()
5757

5858
public function test_kube_config_from_yaml_file_with_paths_to_ssl()
5959
{
60-
$cluster = KubernetesCluster::fromKubeConfigYamlFile(__DIR__ . '/cluster/kubeconfig.yaml', 'minikube-2');
60+
$cluster = KubernetesCluster::fromKubeConfigYamlFile(__DIR__.'/cluster/kubeconfig.yaml', 'minikube-2');
6161

6262
[
6363
'verify' => $caPath,
@@ -72,7 +72,7 @@ public function test_kube_config_from_yaml_file_with_paths_to_ssl()
7272

7373
public function test_kube_config_from_yaml_file_with_skip_tols()
7474
{
75-
$cluster = KubernetesCluster::fromKubeConfigYamlFile(__DIR__ . '/cluster/kubeconfig.yaml', 'minikube-skip-tls');
75+
$cluster = KubernetesCluster::fromKubeConfigYamlFile(__DIR__.'/cluster/kubeconfig.yaml', 'minikube-skip-tls');
7676

7777
[
7878
'verify' => $verify,
@@ -87,7 +87,7 @@ public function test_kube_config_from_yaml_file_with_skip_tols()
8787

8888
public function test_cluster_can_get_correct_config_for_token_socket_connection()
8989
{
90-
$cluster = KubernetesCluster::fromUrl('http://127.0.0.1:8080')->loadTokenFromFile(__DIR__ . '/cluster/token.txt');
90+
$cluster = KubernetesCluster::fromUrl('http://127.0.0.1:8080')->loadTokenFromFile(__DIR__.'/cluster/token.txt');
9191

9292
$reflectionMethod = new \ReflectionMethod($cluster, 'buildStreamContextOptions');
9393

@@ -123,7 +123,7 @@ public function test_cluster_can_get_correct_config_for_user_pass_socket_connect
123123

124124
public function test_cluster_can_get_correct_config_for_ssl_socket_connection()
125125
{
126-
$cluster = KubernetesCluster::fromKubeConfigYamlFile(__DIR__ . '/cluster/kubeconfig.yaml', 'minikube-2');
126+
$cluster = KubernetesCluster::fromKubeConfigYamlFile(__DIR__.'/cluster/kubeconfig.yaml', 'minikube-2');
127127

128128
$reflectionMethod = new \ReflectionMethod($cluster, 'buildStreamContextOptions');
129129

@@ -145,28 +145,28 @@ public function test_kube_config_from_yaml_cannot_load_if_no_cluster()
145145
{
146146
$this->expectException(KubeConfigClusterNotFound::class);
147147

148-
KubernetesCluster::fromKubeConfigYamlFile(__DIR__ . '/cluster/kubeconfig.yaml', 'minikube-without-cluster');
148+
KubernetesCluster::fromKubeConfigYamlFile(__DIR__.'/cluster/kubeconfig.yaml', 'minikube-without-cluster');
149149
}
150150

151151
public function test_kube_config_from_yaml_cannot_load_if_no_user()
152152
{
153153
$this->expectException(KubeConfigUserNotFound::class);
154154

155-
$cluster = KubernetesCluster::fromKubeConfigYamlFile(__DIR__ . '/cluster/kubeconfig.yaml', 'minikube-without-user');
155+
$cluster = KubernetesCluster::fromKubeConfigYamlFile(__DIR__.'/cluster/kubeconfig.yaml', 'minikube-without-user');
156156
}
157157

158158
public function test_kube_config_from_yaml_cannot_load_if_wrong_context()
159159
{
160160
$this->expectException(KubeConfigContextNotFound::class);
161161

162-
KubernetesCluster::fromKubeConfigYamlFile(__DIR__ . '/cluster/kubeconfig.yaml', 'inexistent-context');
162+
KubernetesCluster::fromKubeConfigYamlFile(__DIR__.'/cluster/kubeconfig.yaml', 'inexistent-context');
163163
}
164164

165165
public function test_kube_config_from_yaml_invalid_base64_ca()
166166
{
167167
$this->expectException(KubeConfigBaseEncodedDataInvalid::class);
168168

169-
KubernetesCluster::fromKubeConfigYamlFile(__DIR__ . '/cluster/kubeconfig.yaml', 'minikube-invalid-base64-ca');
169+
KubernetesCluster::fromKubeConfigYamlFile(__DIR__.'/cluster/kubeconfig.yaml', 'minikube-invalid-base64-ca');
170170
}
171171

172172
public function test_http_authentication()
@@ -180,7 +180,7 @@ public function test_http_authentication()
180180

181181
public function test_bearer_token_authentication()
182182
{
183-
$cluster = KubernetesCluster::fromUrl('http://127.0.0.1:8080')->loadTokenFromFile(__DIR__ . '/cluster/token.txt');
183+
$cluster = KubernetesCluster::fromUrl('http://127.0.0.1:8080')->loadTokenFromFile(__DIR__.'/cluster/token.txt');
184184

185185
['headers' => ['authorization' => $token]] = $cluster->getClient()->getConfig();
186186

@@ -208,7 +208,7 @@ public function test_in_cluster_config()
208208
*/
209209
public function test_from_environment_variable(?string $context = null, ?string $expectedDomain = null)
210210
{
211-
$_SERVER['KUBECONFIG'] = __DIR__ . '/cluster/kubeconfig.yaml::' . __DIR__ . '/cluster/kubeconfig-2.yaml';
211+
$_SERVER['KUBECONFIG'] = __DIR__.'/cluster/kubeconfig.yaml::'.__DIR__.'/cluster/kubeconfig-2.yaml';
212212

213213
$cluster = KubernetesCluster::fromKubeConfigVariable($context);
214214

@@ -224,7 +224,7 @@ public static function environmentVariableContextProvider(): iterable
224224

225225
public function test_kube_config_from_array_with_base64_encoded_ssl()
226226
{
227-
$cluster = KubernetesCluster::fromKubeConfigArray(yaml_parse_file(__DIR__ . '/cluster/kubeconfig.yaml'), 'minikube');
227+
$cluster = KubernetesCluster::fromKubeConfigArray(yaml_parse_file(__DIR__.'/cluster/kubeconfig.yaml'), 'minikube');
228228

229229
[
230230
'verify' => $caPath,
@@ -239,7 +239,7 @@ public function test_kube_config_from_array_with_base64_encoded_ssl()
239239

240240
public function test_kube_config_from_yaml_file_with_cmd_auth_as_json()
241241
{
242-
$cluster = KubernetesCluster::fromKubeConfigYamlFile(__DIR__ . '/cluster/kubeconfig-command.yaml', 'minikube');
242+
$cluster = KubernetesCluster::fromKubeConfigYamlFile(__DIR__.'/cluster/kubeconfig-command.yaml', 'minikube');
243243

244244
['headers' => ['authorization' => $token]] = $cluster->getClient()->getConfig();
245245

@@ -248,7 +248,7 @@ public function test_kube_config_from_yaml_file_with_cmd_auth_as_json()
248248

249249
public function test_kube_config_from_yaml_file_with_cmd_auth_as_string()
250250
{
251-
$cluster = KubernetesCluster::fromKubeConfigYamlFile(__DIR__ . '/cluster/kubeconfig-command.yaml', 'minikube-2');
251+
$cluster = KubernetesCluster::fromKubeConfigYamlFile(__DIR__.'/cluster/kubeconfig-command.yaml', 'minikube-2');
252252

253253
['headers' => ['authorization' => $token]] = $cluster->getClient()->getConfig();
254254

tests/VolumeSnapshotTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function test_volume_snapshot_from_yaml()
3131
{
3232
VolumeSnapshot::register();
3333

34-
$vs = $this->cluster->fromYamlFile(__DIR__ . '/yaml/volumesnapshot.yaml');
34+
$vs = $this->cluster->fromYamlFile(__DIR__.'/yaml/volumesnapshot.yaml');
3535

3636
// Handle case where CRD registration returns array
3737
if (is_array($vs)) {
@@ -56,7 +56,7 @@ public function test_volume_snapshot_from_crd_yaml()
5656
{
5757
VolumeSnapshot::register();
5858

59-
$vs = $this->cluster->fromYamlFile(__DIR__ . '/yaml/volumesnapshot.yaml');
59+
$vs = $this->cluster->fromYamlFile(__DIR__.'/yaml/volumesnapshot.yaml');
6060

6161
// When a CRD is registered AND a regular method exists, both are created
6262
// So we expect an array with 2 items
@@ -206,7 +206,7 @@ public function runCreationTests()
206206
// Check if snapshot was created successfully or if it failed due to missing VolumeSnapshotClass
207207
if ($vs->hasFailed()) {
208208
// This is expected in test environments without proper CSI setup
209-
$this->addWarning('VolumeSnapshot creation failed - this is expected in test environments without CSI driver: ' . $vs->getErrorMessage());
209+
$this->addWarning('VolumeSnapshot creation failed - this is expected in test environments without CSI driver: '.$vs->getErrorMessage());
210210
} else {
211211
$this->assertTrue($vs->isReady());
212212
}

0 commit comments

Comments
 (0)