Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #13 from loopline-systems/feature/add_fluent_inter…
Browse files Browse the repository at this point in the history
…face_to_model_classes

adding fluent interface to models
  • Loading branch information
Michael Devery committed Mar 8, 2016
2 parents 006d25b + 7372d58 commit a8643bf
Show file tree
Hide file tree
Showing 8 changed files with 389 additions and 133 deletions.
49 changes: 35 additions & 14 deletions src/LooplineSystems/CloseIoApiWrapper/Model/Address.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Close.io Api Wrapper - LLS Internet GmbH - Loopline Systems
*
* @link https://github.com/loopline-systems/closeio-api-wrapper for the canonical source repository
* @copyright Copyright (c) 2014 LLS Internet GmbH - Loopline Systems (http://www.loopline-systems.com)
* @license https://github.com/loopline-systems/closeio-api-wrapper/blob/master/LICENSE (MIT Licence)
*/
* Close.io Api Wrapper - LLS Internet GmbH - Loopline Systems
*
* @link https://github.com/loopline-systems/closeio-api-wrapper for the canonical source repository
* @copyright Copyright (c) 2014 LLS Internet GmbH - Loopline Systems (http://www.loopline-systems.com)
* @license https://github.com/loopline-systems/closeio-api-wrapper/blob/master/LICENSE (MIT Licence)
*/

namespace LooplineSystems\CloseIoApiWrapper\Model;

Expand Down Expand Up @@ -58,7 +58,7 @@ class Address implements \JsonSerializable
public function __construct(array $data = null)
{
if ($data) {
$this->hydrate($data, [], array('setAddress_1' => 'setAddress1', 'setAddress_2' => 'setAddress2'));
$this->hydrate($data, [], ['setAddress_1' => 'setAddress1', 'setAddress_2' => 'setAddress2']);
}
}

Expand All @@ -71,11 +71,14 @@ public function getAddress1()
}

/**
* @param string $address_1
* @param $address_1
* @return $this
*/
public function setAddress1($address_1)
{
$this->address_1 = $address_1;

return $this;
}

/**
Expand All @@ -87,11 +90,14 @@ public function getAddress2()
}

/**
* @param string $address_2
* @param $address_2
* @return $this
*/
public function setAddress2($address_2)
{
$this->address_2 = $address_2;

return $this;
}

/**
Expand All @@ -103,11 +109,14 @@ public function getCity()
}

/**
* @param string $city
* @param $city
* @return $this
*/
public function setCity($city)
{
$this->city = $city;

return $this;
}

/**
Expand All @@ -119,11 +128,14 @@ public function getCountry()
}

/**
* @param string $country
* @param $country
* @return $this
*/
public function setCountry($country)
{
$this->country = $country;

return $this;
}

/**
Expand All @@ -135,11 +147,14 @@ public function getLabel()
}

/**
* @param string $label
* @param $label
* @return $this
*/
public function setLabel($label)
{
$this->label = $label;

return $this;
}

/**
Expand All @@ -151,11 +166,14 @@ public function getState()
}

/**
* @param string $state
* @param $state
* @return $this
*/
public function setState($state)
{
$this->state = $state;

return $this;
}

/**
Expand All @@ -167,10 +185,13 @@ public function getZipcode()
}

/**
* @param string $zipcode
* @param $zipcode
* @return $this
*/
public function setZipcode($zipcode)
{
$this->zipcode = $zipcode;

return $this;
}
}
61 changes: 50 additions & 11 deletions src/LooplineSystems/CloseIoApiWrapper/Model/Contact.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Close.io Api Wrapper - LLS Internet GmbH - Loopline Systems
*
* @link https://github.com/loopline-systems/closeio-api-wrapper for the canonical source repository
* @copyright Copyright (c) 2014 LLS Internet GmbH - Loopline Systems (http://www.loopline-systems.com)
* @license https://github.com/loopline-systems/closeio-api-wrapper/blob/master/LICENSE (MIT Licence)
*/
* Close.io Api Wrapper - LLS Internet GmbH - Loopline Systems
*
* @link https://github.com/loopline-systems/closeio-api-wrapper for the canonical source repository
* @copyright Copyright (c) 2014 LLS Internet GmbH - Loopline Systems (http://www.loopline-systems.com)
* @license https://github.com/loopline-systems/closeio-api-wrapper/blob/master/LICENSE (MIT Licence)
*/

namespace LooplineSystems\CloseIoApiWrapper\Model;

Expand Down Expand Up @@ -93,18 +93,24 @@ public function getEmails()

/**
* @param Email $email
* @return $this
*/
public function addEmail(Email $email)
{
$this->emails[] = $email;

return $this;
}

/**
* @param Email[] $emails
* @return $this
*/
public function setEmails(array $emails)
{
$this->emails = $emails;

return $this;
}

/**
Expand All @@ -117,10 +123,13 @@ public function getName()

/**
* @param $name
* @return $this
*/
public function setName($name)
{
$this->name = $name;

return $this;
}

/**
Expand All @@ -133,18 +142,24 @@ public function getPhones()

/**
* @param Phone $phone
* @return $this
*/
public function addPhone(Phone $phone)
{
$this->phones[] = $phone;

return $this;
}

/**
* @param Phone[] $phones
* @return $this
*/
public function setPhones(array $phones)
{
$this->phones = $phones;

return $this;
}

/**
Expand All @@ -157,10 +172,13 @@ public function getTitle()

/**
* @param $title
* @return $this
*/
public function setTitle($title)
{
$this->title = $title;

return $this;
}

/**
Expand All @@ -173,10 +191,13 @@ public function getCreatedBy()

/**
* @param $created_by
* @return $this
*/
public function setCreatedBy($created_by)
{
$this->created_by = $created_by;

return $this;
}

/**
Expand All @@ -189,10 +210,13 @@ public function getDateCreated()

/**
* @param $date_created
* @return $this
*/
public function setDateCreated($date_created)
{
$this->date_created = $date_created;

return $this;
}

/**
Expand All @@ -205,10 +229,13 @@ public function getDateUpdated()

/**
* @param $date_updated
* @return $this
*/
public function setDateUpdated($date_updated)
{
$this->date_updated = $date_updated;

return $this;
}

/**
Expand All @@ -221,10 +248,13 @@ public function getId()

/**
* @param $id
* @return $this
*/
public function setId($id)
{
$this->id = $id;

return $this;
}

/**
Expand All @@ -237,10 +267,13 @@ public function getOrganizationId()

/**
* @param $organization_id
* @return $this
*/
public function setOrganizationId($organization_id)
{
$this->organization_id = $organization_id;

return $this;
}

/**
Expand All @@ -252,11 +285,14 @@ public function getUpdatedBy()
}

/**
* @param string $updated_by
* @param $updated_by
* @return $this
*/
public function setUpdatedBy($updated_by)
{
$this->updated_by = $updated_by;

return $this;
}

/**
Expand All @@ -268,10 +304,13 @@ public function getUrls()
}

/**
* @param $urls
* @param Url[] $urls
* @return $this
*/
public function setUrls($urls)
public function setUrls(array $urls)
{
$this->urls = $urls;

return $this;
}
}
22 changes: 14 additions & 8 deletions src/LooplineSystems/CloseIoApiWrapper/Model/Email.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php
/**
* Close.io Api Wrapper - LLS Internet GmbH - Loopline Systems
*
* @link https://github.com/loopline-systems/closeio-api-wrapper for the canonical source repository
* @copyright Copyright (c) 2014 LLS Internet GmbH - Loopline Systems (http://www.loopline-systems.com)
* @license https://github.com/loopline-systems/closeio-api-wrapper/blob/master/LICENSE (MIT Licence)
*/
* Close.io Api Wrapper - LLS Internet GmbH - Loopline Systems
*
* @link https://github.com/loopline-systems/closeio-api-wrapper for the canonical source repository
* @copyright Copyright (c) 2014 LLS Internet GmbH - Loopline Systems (http://www.loopline-systems.com)
* @license https://github.com/loopline-systems/closeio-api-wrapper/blob/master/LICENSE (MIT Licence)
*/

namespace LooplineSystems\CloseIoApiWrapper\Model;

use LooplineSystems\CloseIoApiWrapper\Library\Exception\InvalidParamException;
use LooplineSystems\CloseIoApiWrapper\Library\ObjectHydrateHelperTrait;
use LooplineSystems\CloseIoApiWrapper\Library\JsonSerializableHelperTrait;
use LooplineSystems\CloseIoApiWrapper\Library\ObjectHydrateHelperTrait;
use Symfony\Component\Config\Definition\Exception\Exception;

class Email implements \JsonSerializable
Expand Down Expand Up @@ -54,6 +54,7 @@ public function getEmail()

/**
* @param $email
* @return $this
* @throws InvalidParamException
*/
public function setEmail($email)
Expand All @@ -63,6 +64,8 @@ public function setEmail($email)
} else {
$this->email = $email;
}

return $this;
}

/**
Expand All @@ -74,10 +77,13 @@ public function getType()
}

/**
* @param string $type
* @param $type
* @return $this
*/
public function setType($type)
{
$this->type = $type;

return $this;
}
}
Loading

0 comments on commit a8643bf

Please sign in to comment.