Skip to content

Commit

Permalink
fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
MartkCz committed Jul 27, 2017
1 parent 5861745 commit b9878d3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Data/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Item {
* @param int|float $price
* @throws InvoiceException
*/
public function __construct(string $name, $count, $price) {
public function __construct(string $name, $price, $count) {
$this->name = $name;
$this->count = $count;
$this->price = $price;
Expand Down
6 changes: 3 additions & 3 deletions src/Data/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Order {
* @param PaymentInformation $payment
* @param \DateTime|NULL $created
*/
public function __construct($number, \DateTime $dueDate, Account $account, PaymentInformation $payment,
public function __construct($number, ?\DateTime $dueDate, ?Account $account, PaymentInformation $payment,
\DateTime $created = NULL) {
$this->number = $number;
$this->dueDate = $dueDate;
Expand Down Expand Up @@ -77,14 +77,14 @@ public function getNumber() {
/**
* @return \DateTime
*/
public function getDueDate(): \DateTime {
public function getDueDate(): ?\DateTime {
return $this->dueDate;
}

/**
* @return Account
*/
public function getAccount(): Account {
public function getAccount(): ?Account {
return $this->account;
}

Expand Down
8 changes: 4 additions & 4 deletions src/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ protected function itemsHeader() {
protected function paymentInformation() {
$multiplier = 0;

if ($this->order->getDueDate()) {
if ($this->order->getAccount() && $this->order->getDueDate()) {
$this->image->text('', 1445, 710 + ($multiplier * 55), function (Font $font) {
$font->color($this->template->getPrimaryColor());
$font->file($this->template->getIconFont());
Expand All @@ -640,7 +640,7 @@ protected function paymentInformation() {
$multiplier++;
}

if ($this->order->getAccount()->getAccountNumber()) {
if ($this->order->getAccount() && $this->order->getAccount()->getAccountNumber()) {
$this->image->text('', 1445, 710 + ($multiplier * 55), function (Font $font) {
$font->color($this->template->getPrimaryColor());
$font->file($this->template->getIconFont());
Expand All @@ -659,7 +659,7 @@ protected function paymentInformation() {
$multiplier++;
}

if ($this->order->getAccount()->getIBan()) {
if ($this->order->getAccount() && $this->order->getAccount()->getIBan()) {
$this->image->text('', 1445, 710 + ($multiplier * 55), function (Font $font) {
$font->color($this->template->getPrimaryColor());
$font->file($this->template->getIconFont());
Expand All @@ -678,7 +678,7 @@ protected function paymentInformation() {
$multiplier++;
}

if ($this->order->getAccount()->getSwift()) {
if ($this->order->getAccount() && $this->order->getAccount()->getSwift()) {
$this->image->text('', 1445, 710 + ($multiplier * 55), function (Font $font) {
$font->color($this->template->getPrimaryColor());
$font->file($this->template->getIconFont());
Expand Down
2 changes: 1 addition & 1 deletion src/InvoiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function createCustomer($name, $town, $address, $zip, $country, $tin = NU
* @param \DateTime|NULL $created
* @return Order
*/
public function createOrder($number, \DateTime $dueDate, Account $account, PaymentInformation $payment, \DateTime $created = NULL): Order {
public function createOrder($number, ?\DateTime $dueDate, ?Account $account, PaymentInformation $payment, \DateTime $created = NULL): Order {
return new Order($number, $dueDate, $account, $payment, $created);
}

Expand Down

0 comments on commit b9878d3

Please sign in to comment.