Skip to content

Commit

Permalink
Merge pull request #17 from veewee/less-spammy-options
Browse files Browse the repository at this point in the history
Wrap option during parse-time, not during read-time
  • Loading branch information
veewee authored Jun 13, 2024
2 parents b81101c + 2c36406 commit df48620
Show file tree
Hide file tree
Showing 2 changed files with 212 additions and 160 deletions.
141 changes: 81 additions & 60 deletions src/Metadata/Model/MethodMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,92 +9,113 @@
final class MethodMeta
{
/**
* @var string|null
* @var Option<string>
*/
private $docs;
private Option $docs;

/**
* @var string|null
* @var Option<string>
*/
private $action;
private Option $action;

/**
* @var string|null
* @var Option<string>
*/
private $operationName;
private Option $operationName;

/**
* @var string|null
* @var Option<string>
*/
private $location;
private Option $location;

/**
* @var string|null
* @var Option<string>
*/
private $targetNamespace;
private Option $targetNamespace;

/**
* @var string|null
* @var Option<string>
*/
private $soapVersion;
private Option $soapVersion;

/**
* @var string|null
* @var Option<string>
*/
private $transport;
private Option $transport;

/**
* @var string|null
* @var Option<string>
*/
private $bindingStyle;
private Option $bindingStyle;

/**
* @var string|null
* @var Option<string>
*/
private $inputBindingUsage;
private Option $inputBindingUsage;

/**
* @var string|null
* @var Option<string>
*/
private $inputNamespace;
private Option $inputNamespace;

/**
* @var string|null
* @var Option<string>
*/
private $inputEncodingStyle;
private Option $inputEncodingStyle;

/**
* @var string|null
* @var Option<string>
*/
private $outputBindingUsage;
private Option $outputBindingUsage;

/**
* @var string|null
* @var Option<string>
*/
private $outputNamespace;
private Option $outputNamespace;

/**
* @var string|null
* @var Option<string>
*/
private $outputEncodingStyle;
private Option $outputEncodingStyle;

/**
* @var bool|null
* @var Option<bool>
*/
private $isOneWay;
private Option $isOneWay;

public function __construct()
{
$none = Option::none();

$this->docs = $none;
$this->action = $none;
$this->operationName = $none;
$this->location = $none;
$this->targetNamespace = $none;
$this->soapVersion = $none;
$this->transport = $none;
$this->bindingStyle = $none;
$this->isOneWay = $none;
$this->inputBindingUsage = $none;
$this->inputNamespace = $none;
$this->inputEncodingStyle = $none;
$this->outputBindingUsage = $none;
$this->outputNamespace = $none;
$this->outputEncodingStyle = $none;
}

/**
* @return Option<string>
*/
public function docs(): Option
{
return from_nullable($this->docs);
return $this->docs;
}

public function withDocs(?string $docs): self
{
$new = clone $this;
$new->docs = $docs;
$new->docs = from_nullable($docs);

return $new;
}
Expand All @@ -104,13 +125,13 @@ public function withDocs(?string $docs): self
*/
public function action(): Option
{
return from_nullable($this->action);
return $this->action;
}

public function withAction(?string $action): self
{
$new = clone $this;
$new->action = $action;
$new->action = from_nullable($action);

return $new;
}
Expand All @@ -120,13 +141,13 @@ public function withAction(?string $action): self
*/
public function operationName(): Option
{
return from_nullable($this->operationName);
return $this->operationName;
}

public function withOperationName(?string $operationName): self
{
$new = clone $this;
$new->operationName = $operationName;
$new->operationName = from_nullable($operationName);

return $new;
}
Expand All @@ -136,13 +157,13 @@ public function withOperationName(?string $operationName): self
*/
public function location(): Option
{
return from_nullable($this->location);
return $this->location;
}

public function withlocation(?string $location): self
{
$new = clone $this;
$new->location = $location;
$new->location = from_nullable($location);

return $new;
}
Expand All @@ -152,13 +173,13 @@ public function withlocation(?string $location): self
*/
public function targetNamespace(): Option
{
return from_nullable($this->targetNamespace);
return $this->targetNamespace;
}

public function withTargetNamespace(?string $targetNamespace): self
{
$new = clone $this;
$new->targetNamespace = $targetNamespace;
$new->targetNamespace = from_nullable($targetNamespace);

return $new;
}
Expand All @@ -168,13 +189,13 @@ public function withTargetNamespace(?string $targetNamespace): self
*/
public function soapVersion(): Option
{
return from_nullable($this->soapVersion);
return $this->soapVersion;
}

public function withSoapVersion(?string $soapVersion): self
{
$new = clone $this;
$new->soapVersion = $soapVersion;
$new->soapVersion = from_nullable($soapVersion);

return $new;
}
Expand All @@ -184,13 +205,13 @@ public function withSoapVersion(?string $soapVersion): self
*/
public function transport(): Option
{
return from_nullable($this->transport);
return $this->transport;
}

public function withTransport(?string $transport): self
{
$new = clone $this;
$new->transport = $transport;
$new->transport = from_nullable($transport);

return $new;
}
Expand All @@ -200,13 +221,13 @@ public function withTransport(?string $transport): self
*/
public function bindingStyle(): Option
{
return from_nullable($this->bindingStyle);
return $this->bindingStyle;
}

public function withBindingStyle(?string $bindingStyle): self
{
$new = clone $this;
$new->bindingStyle = $bindingStyle;
$new->bindingStyle = from_nullable($bindingStyle);

return $new;
}
Expand All @@ -216,13 +237,13 @@ public function withBindingStyle(?string $bindingStyle): self
*/
public function isOneWay(): Option
{
return from_nullable($this->isOneWay);
return $this->isOneWay;
}

public function withIsOneWay(?bool $isOneWay): self
{
$new = clone $this;
$new->isOneWay = $isOneWay;
$new->isOneWay = from_nullable($isOneWay);

return $new;
}
Expand All @@ -232,13 +253,13 @@ public function withIsOneWay(?bool $isOneWay): self
*/
public function inputBindingUsage(): Option
{
return from_nullable($this->inputBindingUsage);
return $this->inputBindingUsage;
}

public function withInputBindingUsage(?string $inputBindingUsage): self
{
$new = clone $this;
$new->inputBindingUsage = $inputBindingUsage;
$new->inputBindingUsage = from_nullable($inputBindingUsage);

return $new;
}
Expand All @@ -248,13 +269,13 @@ public function withInputBindingUsage(?string $inputBindingUsage): self
*/
public function inputNamespace(): Option
{
return from_nullable($this->inputNamespace);
return $this->inputNamespace;
}

public function withInputNamespace(?string $inputNamespace): self
{
$new = clone $this;
$new->inputNamespace = $inputNamespace;
$new->inputNamespace = from_nullable($inputNamespace);

return $new;
}
Expand All @@ -264,13 +285,13 @@ public function withInputNamespace(?string $inputNamespace): self
*/
public function inputEncodingStyle(): Option
{
return from_nullable($this->inputEncodingStyle);
return $this->inputEncodingStyle;
}

public function withInputEncodingStyle(?string $inputEncodingStyle): self
{
$new = clone $this;
$new->inputEncodingStyle = $inputEncodingStyle;
$new->inputEncodingStyle = from_nullable($inputEncodingStyle);

return $new;
}
Expand All @@ -281,13 +302,13 @@ public function withInputEncodingStyle(?string $inputEncodingStyle): self
*/
public function outputBindingUsage(): Option
{
return from_nullable($this->outputBindingUsage);
return $this->outputBindingUsage;
}

public function withOutputBindingUsage(?string $outputBindingUsage): self
{
$new = clone $this;
$new->outputBindingUsage = $outputBindingUsage;
$new->outputBindingUsage = from_nullable($outputBindingUsage);

return $new;
}
Expand All @@ -297,13 +318,13 @@ public function withOutputBindingUsage(?string $outputBindingUsage): self
*/
public function outputNamespace(): Option
{
return from_nullable($this->outputNamespace);
return $this->outputNamespace;
}

public function withOutputNamespace(?string $outputNamespace): self
{
$new = clone $this;
$new->outputNamespace = $outputNamespace;
$new->outputNamespace = from_nullable($outputNamespace);

return $new;
}
Expand All @@ -313,13 +334,13 @@ public function withOutputNamespace(?string $outputNamespace): self
*/
public function outputEncodingStyle(): Option
{
return from_nullable($this->outputEncodingStyle);
return $this->outputEncodingStyle;
}

public function withOutputEncodingStyle(?string $outputEncodingStyle): self
{
$new = clone $this;
$new->outputEncodingStyle = $outputEncodingStyle;
$new->outputEncodingStyle = from_nullable($outputEncodingStyle);

return $new;
}
Expand Down
Loading

0 comments on commit df48620

Please sign in to comment.