Skip to content

Commit

Permalink
Minor fixes and php version upgraded to 7.4 features project
Browse files Browse the repository at this point in the history
  • Loading branch information
danish981 committed Nov 9, 2022
1 parent bfacbf1 commit e137d06
Show file tree
Hide file tree
Showing 8 changed files with 1,965 additions and 1,964 deletions.
2 changes: 1 addition & 1 deletion admin_add.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
$descr = validateField($_POST['descr']);
$descr = mysqli_real_escape_string($conn, $descr);

$price = floatval(validateField($_POST['price']));
$price = (float)validateField($_POST['price']);
$price = mysqli_real_escape_string($conn, $price);

// it is drop down, no need of its validation
Expand Down
62 changes: 31 additions & 31 deletions models/goods/Book.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,33 @@
});

class Book implements Damage {
private static $objects = [];
private $id;
private $name;
private $author;
private $publisher;
private $genre;
private $isbn;
private $sellPrice;
private $buyPrice;
private $image;
private $description;
private $actualQuantity;
private $quantity;
private static array $objects = [];
private int $id;
private string $name;
private string $author;
private string $publisher;
private string $genre;
private string $isbn;
private float $sellPrice;
private float $buyPrice;
private string $image;
private string $description;
private int $actualQuantity;
private int $quantity;

public function __construct(
$id,
$name,
int $isbn,
float $sellPrice,
float $buyPrice,
string $image,
string $description,
int $actualQuantity,
int $quantity,
Author $author = NULL,
int $id,
string $name,
string $isbn,
float $sellPrice,
float $buyPrice,
string $image,
string $description,
int $actualQuantity,
int $quantity,
Author $author = NULL,
Publishers $publisher = NULL,
Genre $genre = NULL) {
Genre $genre = NULL) {
$this->id = $id;
$this->name = $name;
$this->author = $author;
Expand Down Expand Up @@ -69,25 +69,25 @@ public function add($quantity) {
$this->actualQuantity += $quantity;
}

public function backBook($amount) {
public function increaseBooks($amount) {
$this->quantity += $amount;
}

public function delivering_done($amount) {
public function deliveringDone($amount) {
$this->actualQuantity -= $amount;
}

public function damageAllData() {
$this->id = NULL;
$this->id = -1;
$this->name = NULL;
$this->quantity = NULL;
$this->quantity = 0;
$this->author = NULL;
$this->isbn = NULL;
$this->buyPrice = NULL;
$this->sellPrice = NULL;
$this->buyPrice = 0;
$this->sellPrice = -1;
$this->image = NULL;
$this->description = NULL;
$this->actualQuantity = NULL;
$this->actualQuantity = -1;
$this->genre = NULL;
}

Expand Down
4 changes: 2 additions & 2 deletions models/goods/Genre.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
});

class Genre {
private $description;
private string $description;
private $id;

public function __construct($description, $id = NULL) {
$this->description = $description;
$this->id = $id;
}

public function getDescription() {
public function getDescription() : string {
return $this->description;
}

Expand Down
4 changes: 2 additions & 2 deletions models/goods/Publishers.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
});

class Publishers {
private $name;
private string $name;
private $address;
private $id;

Expand All @@ -20,7 +20,7 @@ public function __construct($name, $id = NULL, $address = NULL) {
$this->id = $id;
}

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

Expand Down
12 changes: 6 additions & 6 deletions models/image/ResizeImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private function setImage($filename) {
/**
* Save the image as the image type the original image was
* @param $savePath
* @param string $imageQuality - The qulaity level of image to create
* @param string $imageQuality - The qulaity level of image to create
* @param bool $download
* @return Saves the image
* @internal param $String [type] $savePath - The path to store the new image
Expand Down Expand Up @@ -109,9 +109,9 @@ public function saveImage($savePath, $imageQuality = "100", $download = false) {

/**
* Resize the image to these set dimensions
* @param int $width - Max width of the image
* @param int $height - Max height of the image
* @param string $resizeOption - Scale option for the image
* @param int $width - Max width of the image
* @param int $height - Max height of the image
* @param string $resizeOption - Scale option for the image
* @return Save new image
*/
public function resizeTo($width, $height, $resizeOption = 'default') {
Expand Down Expand Up @@ -149,7 +149,7 @@ public function resizeTo($width, $height, $resizeOption = 'default') {

/**
* Get the resized height from the width keeping the aspect ratio
* @param int $width - Max image width
* @param int $width - Max image width
* @return float
*/
private function resizeHeightByWidth($width) {
Expand All @@ -158,7 +158,7 @@ private function resizeHeightByWidth($width) {

/**
* Get the resized width from the height keeping the aspect ratio
* @param int $height - Max image height
* @param int $height - Max image height
* @return float
*/
private function resizeWidthByHeight($height) {
Expand Down
Loading

0 comments on commit e137d06

Please sign in to comment.