Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add resources #136

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 143 additions & 0 deletions src/Activity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<?php

namespace PhpTwinfield;

use PhpTwinfield\Transactions\TransactionFields\OfficeField;

/**
* Class Activity
*
* @author Yannick Aerssens <[email protected]>
*/
class Activity extends BaseObject
{
use OfficeField;

private $behaviour;
private $code;
private $inUse;
private $name;
private $shortName;
private $status;
private $touched;
private $type;
private $uid;
private $vatCode;
private $projects;

public function getBehaviour()
{
return $this->behaviour;
}

public function setBehaviour($behaviour)
{
$this->behaviour = $behaviour;
}

public function getCode()
{
return $this->code;
}

public function setCode($code)
{
$this->code = $code;
}

public function getInUse()
{
return $this->inUse;
}

public function setInUse($inUse)
{
$this->inUse = $inUse;
}

public function getName()
{
return $this->name;
}

public function setName($name)
{
$this->name = $name;
}

public function getShortName()
{
return $this->shortName;
}

public function setShortName($shortName)
{
$this->shortName = $shortName;
}

public function getStatus()
{
return $this->status;
}

public function setStatus($status)
{
$this->status = $status;
return $this;
}

public function getTouched()
{
return $this->touched;
}

public function setTouched($touched)
{
$this->touched = $touched;
return $this;
}

public function getType()
{
return $this->type;
}

public function setType($type)
{
$this->type = $type;
return $this;
}

public function getUID()
{
return $this->uid;
}

public function setUID($uid)
{
$this->uid = $uid;
return $this;
}

public function getVatCode()
{
return $this->vatCode;
}

public function setVatCode($vatCode)
{
$this->vatCode = $vatCode;
return $this;
}

public function getProjects(): ActivityProjects
{
return $this->projects;
}

public function setProjects(ActivityProjects $projects)
{
$this->projects = $projects;
return $this;
}
}
117 changes: 117 additions & 0 deletions src/ActivityProjects.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?php

namespace PhpTwinfield;

/**
* @see https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/Activities
* @todo Add documentation and typehints to all properties.
*/
class ActivityProjects
{
private $authoriser;
private $billable;
private $customer;
private $invoiceDescription;
private $rate;
private $validFrom;
private $validTill;
private $quantities = [];

public function getAuthoriser()
{
return $this->authoriser;
}

public function setAuthoriser($authoriser)
{
$this->authoriser = $authoriser;
return $this;
}

public function getBillable()
{
return $this->billable;
}

public function setBillable($billable)
{
$this->billable = $billable;
return $this;
}

public function getCustomer(): Customer
{
return $this->customer;
}

public function setCustomer(Customer $customer)
{
$this->customer = $customer;
return $this;
}

public function getInvoiceDescription()
{
return $this->invoiceDescription;
}

public function setInvoiceDescription($invoiceDescription)
{
$this->invoiceDescription = $invoiceDescription;
return $this;
}

public function getRate()
{
return $this->rate;
}

public function setRate($rate)
{
$this->rate = $rate;
return $this;
}

public function getValidFrom()
{
return $this->validFrom;
}

public function setValidFrom($validFrom)
{
$this->validFrom = $validFrom;
return $this;
}

public function getValidTill()
{
return $this->validTill;
}

public function setValidTill($validTill)
{
$this->validTill = $validTill;
return $this;
}

public function getQuantities()
{
return $this->quantities;
}

public function addQuantity(ActivityQuantity $quantity)
{
$this->quantities[] = $quantity;
return $this;
}

public function removeQuantity($index)
{
if (array_key_exists($index, $this->quantities)) {
unset($this->quantities[$index]);
return true;
} else {
return false;
}
}
}
59 changes: 59 additions & 0 deletions src/ActivityQuantity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

namespace PhpTwinfield;

/**
* @see https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/Activities
* @todo Add documentation and typehints to all properties.
*/
class ActivityQuantity
{
private $billable;
private $label;
private $mandatory;
private $rate;

public function getBillable()
{
return $this->billable;
}

public function setBillable($billable)
{
$this->billable = $billable;
return $this;
}

public function getLabel()
{
return $this->label;
}

public function setLabel($label)
{
$this->label = $label;
return $this;
}

public function getMandatory()
{
return $this->mandatory;
}

public function setMandatory($mandatory)
{
$this->mandatory = $mandatory;
return $this;
}

public function getRate()
{
return $this->rate;
}

public function setRate($rate)
{
$this->rate = $rate;
return $this;
}
}
Loading