Skip to content

Commit

Permalink
Improve validation
Browse files Browse the repository at this point in the history
  • Loading branch information
oojacoboo committed Oct 7, 2020
1 parent 9a14948 commit 5c71c3c
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions src/Model/PhysicalAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@

namespace Rentpost\ForteApi\Model;

use Rentpost\ForteApi\Model as Model;
use Rentpost\ForteApi\Attribute as Attribute;
use Symfony\Component\Validator\Constraints as Assert;

/**
* PhysicalAddress Model
*
* @author Sam Anthony <[email protected]>
* @author Jacob Thomason <[email protected]>
*/
class PhysicalAddress extends AbstractModel
{

/**
* @var string
* @Assert\NotBlank()
* @Assert\Length(max=35)
*/
protected $streetLine1;
Expand All @@ -23,27 +30,33 @@ class PhysicalAddress extends AbstractModel
protected $streetLine2;

/**
* town/village/city
* Town/village/city
*
* @var string
* @Assert\NotBlank()
* @Assert\Length(max=25)
*/
protected $locality;

/**
* state or province
* State or province
*
* @var string
* @Assert\NotBlank()
* @Assert\Length(max=2)
*/
protected $region;

/**
* @var Attribute\PostalCode
* @Assert\NotBlank()
* @Assert\Length(max=15)
*/
protected $postalCode;


/**
* @return string
* Gets the street address
*/
public function getStreetLine1(): string
{
Expand All @@ -52,9 +65,7 @@ public function getStreetLine1(): string


/**
* @param string $streetLine1
*
* @return self
* Sets street address
*/
public function setStreetLine1(string $streetLine1): self
{
Expand All @@ -65,7 +76,7 @@ public function setStreetLine1(string $streetLine1): self


/**
* @return string|null
* Get apt, suite, etc.
*/
public function getStreetLine2(): ?string
{
Expand All @@ -74,9 +85,7 @@ public function getStreetLine2(): ?string


/**
* @param string|null $streetLine2
*
* @return self
* Set apt, suite, etc.
*/
public function setStreetLine2(?string $streetLine2): self
{
Expand All @@ -87,7 +96,7 @@ public function setStreetLine2(?string $streetLine2): self


/**
* @return string
* Gets the locatlity
*/
public function getLocality(): string
{
Expand All @@ -96,9 +105,7 @@ public function getLocality(): string


/**
* @param string $locality
*
* @return self
* Sets the locality
*/
public function setLocality(string $locality): self
{
Expand All @@ -109,7 +116,7 @@ public function setLocality(string $locality): self


/**
* @return string
* Gets the region
*/
public function getRegion(): string
{
Expand All @@ -118,9 +125,7 @@ public function getRegion(): string


/**
* @param string $region
*
* @return self
* Sets the region
*/
public function setRegion(string $region): self
{
Expand All @@ -131,7 +136,7 @@ public function setRegion(string $region): self


/**
* @return Attribute\PostalCode
* Gets the postal code
*/
public function getPostalCode(): Attribute\PostalCode
{
Expand All @@ -140,18 +145,12 @@ public function getPostalCode(): Attribute\PostalCode


/**
* @param Attribute\PostalCode $postalCode
*
* @return self
* Sets the postal code
*/
public function setPostalCode(Attribute\PostalCode $postalCode): self
{
$this->postalCode = $postalCode;

return $this;
}




}

0 comments on commit 5c71c3c

Please sign in to comment.