diff options
author | Camil Staps | 2016-08-01 14:11:06 +0200 |
---|---|---|
committer | Camil Staps | 2016-08-01 14:11:06 +0200 |
commit | 46198a89ccc8e6750a37e1b9127f57238242fadf (patch) | |
tree | de6c0bc2f55b759a0db6471fc0b820ee5433e648 /classes | |
parent | Use Model::search in child::get* methods (diff) |
Array shorthands
Diffstat (limited to 'classes')
-rw-r--r-- | classes/Client.php | 4 | ||||
-rw-r--r-- | classes/Contact.php | 2 | ||||
-rw-r--r-- | classes/Correspondence.php | 2 | ||||
-rw-r--r-- | classes/Offer.php | 24 | ||||
-rw-r--r-- | classes/Response.php | 2 |
5 files changed, 17 insertions, 17 deletions
diff --git a/classes/Client.php b/classes/Client.php index 0f0a2f8..1f04f21 100644 --- a/classes/Client.php +++ b/classes/Client.php @@ -79,7 +79,7 @@ class Client extends Model { */ public function createContact($name, $email, $address, $address_2, $postal_code, $city, $country) { $stmt = $this->pdo->prepare("INSERT INTO `".Constants::db_prefix."contact` (`clientId`,`name`,`email`,`address`,`address_2`,`postal_code`,`city`,`country`) VALUES (?,?,?,?,?,?,?,?)"); - $stmt->execute(array( + $stmt->execute([ $this->id, $name, $email, @@ -88,7 +88,7 @@ class Client extends Model { $postal_code, $city, $country - )); + ]); if ($stmt->rowCount() == 1) { return new Contact($this->pdo, $this->pdo->lastInsertId()); } else { diff --git a/classes/Contact.php b/classes/Contact.php index 7689ef7..bf816ea 100644 --- a/classes/Contact.php +++ b/classes/Contact.php @@ -65,7 +65,7 @@ class Contact extends Model { */ public function createOffer() { $stmt = $this->pdo->prepare("INSERT INTO `".Constants::db_prefix."offer` (`contactId`) VALUES (?)"); - $stmt->execute(array($this->id)); + $stmt->execute([$this->id]); if ($stmt->rowCount() == 1) { return new Offer($this->pdo, $this->pdo->lastInsertId()); } else { diff --git a/classes/Correspondence.php b/classes/Correspondence.php index 1c965df..7e5c9ae 100644 --- a/classes/Correspondence.php +++ b/classes/Correspondence.php @@ -241,7 +241,7 @@ class Correspondence extends FPDF { * @param string $lang The language, two letter code ('en', 'nl', ...) */ function SetLangauge($lang) { - $supported = array('nl', 'en'); + $supported = ['nl', 'en']; if (!in_array($lang, $supported)) { throw new Exception("Language not supported"); } else { diff --git a/classes/Offer.php b/classes/Offer.php index 8da2095..1422721 100644 --- a/classes/Offer.php +++ b/classes/Offer.php @@ -282,14 +282,14 @@ class Offer extends Model{ */ public function createAssignment($title, $description, $hours, $price_per_hour, $vat) { $stmt = $this->pdo->prepare("INSERT INTO `".Constants::db_prefix."assignment` (`offerId`,`title`,`description`,`hours`,`price_per_hour`,`VAT_percentage`) VALUES (?,?,?,?,?,?)"); - $stmt->execute(array( + $stmt->execute([ $this->id, $title, $description, $hours, $price_per_hour, $vat - )); + ]); if ($stmt->rowCount() == 1) { return new Assignment($this->pdo, $this->pdo->lastInsertId()); } else { @@ -313,13 +313,13 @@ class Offer extends Model{ */ public function createDiscount($title, $description, $value, $vat) { $stmt = $this->pdo->prepare("INSERT INTO `".Constants::db_prefix."discount` (`offerId`,`title`,`description`,`value`,`VAT_percentage`) VALUES (?,?,?,?,?)"); - $stmt->execute(array( + $stmt->execute([ $this->id, $title, $description, $value, $vat - )); + ]); if ($stmt->rowCount() == 1) { return new Discount($this->pdo, $this->pdo->lastInsertId()); } else { @@ -372,24 +372,24 @@ class Offer extends Model{ $this->invoice_fileId = $file->id; } else { - $invoice_nr = str_replace(array('invoice-','.pdf'), array('',''), $file->filename); + $invoice_nr = str_replace(['invoice-','.pdf'], ['', ''], $file->filename); } - $list = array(); + $list = []; foreach ($this->getAssignments() as $assignment) - $list[] = array( + $list[] = [ $assignment->title, $assignment->price_per_hour * $assignment->hours, $assignment->VAT_percentage . "%", $assignment->price_per_hour * $assignment->hours * (1 + $assignment->VAT_percentage / 100) - ); + ]; foreach ($this->getDiscounts() as $discount) - $list[] = array( + $list[] = [ $discount->title, $discount->calculate(Calculatable::SUBTOTAL), $discount->VAT_percentage . "%", $discount->calculate(Calculatable::TOTAL) - ); + ]; $pdf = new Correspondence(); $pdf->SetContact($this->getContact()); @@ -404,9 +404,9 @@ class Offer extends Model{ $pdf->SetTextColor(0); $pdf->Ln(); - $width = array(90,25,20,25); + $width = [90, 25, 20, 25]; $subtotal = 0; - $btw = array(); + $btw = []; $total = 0; // Header diff --git a/classes/Response.php b/classes/Response.php index f37b6e9..ffb3e20 100644 --- a/classes/Response.php +++ b/classes/Response.php @@ -34,7 +34,7 @@ class Response { * Create a new instance */ public function __construct() { - $this->response = array(); + $this->response = []; $this->http_response_code = 200; } |