-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix typed properties used before initialization and return type for s…
…tatic[]
- Loading branch information
1 parent
e1e88af
commit c859372
Showing
9 changed files
with
35 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** @noinspection PhpUnusedPrivateFieldInspection */ | ||
|
||
namespace Platformsh\Client\Model\Subscription; | ||
|
||
final class SubscriptionOptions | ||
final readonly class SubscriptionOptions | ||
{ | ||
private ?string $project_region; | ||
private array $options; | ||
|
||
private ?string $project_title; | ||
|
||
private ?string $default_branch; | ||
|
||
private ?string $options_url; | ||
|
||
private ?array $options_custom; | ||
|
||
private ?string $plan; | ||
|
||
private ?int $environments; | ||
|
||
private ?int $storage; | ||
|
||
private ?string $owner; | ||
private function __construct(array $options) | ||
{ | ||
$this->options = $options; | ||
} | ||
|
||
/** | ||
* @deprecated This is no longer supported. Poll the subscription instead of submitting a callback. | ||
* @param array{ | ||
* project_region: ?string, | ||
* project_title: ?string, | ||
* default_branch: ?string, | ||
* options_url: ?string, | ||
* options_custom: ?array, | ||
* plan: ?string, | ||
* environments: ?int, | ||
* storage: ?int, | ||
* organization_id: ?string, | ||
* } $options | ||
*/ | ||
private ?array $activation_callback; | ||
|
||
private ?string $organization_id; | ||
|
||
public static function fromArray(array $options): self | ||
{ | ||
$obj = new self(); | ||
foreach ($options as $key => $value) { | ||
if (\property_exists($obj, $key)) { | ||
$obj->{$key} = $value; | ||
} else { | ||
throw new \InvalidArgumentException('Unknown property: ' . $key); | ||
} | ||
} | ||
return $obj; | ||
return new self($options); | ||
} | ||
|
||
public function toArray(): array | ||
{ | ||
$arr = []; | ||
foreach ($this as $key => $value) { | ||
if ($value !== null && $value !== 'organization_id') { | ||
$arr[$key] = $value; | ||
} | ||
} | ||
return $arr; | ||
return $this->options; | ||
} | ||
|
||
public function organizationId(): ?string | ||
{ | ||
return $this->organization_id; | ||
return $this->options['organization_id'] ?? null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters