mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-25 05:14:36 +02:00
Used PHP_CS_Fixer with symfony preset on codebase.
This commit is contained in:
parent
0f3ba9b6a8
commit
e2f7aafa2d
43 changed files with 971 additions and 1068 deletions
|
@ -1,10 +1,11 @@
|
|||
<?php declare(strict_types=1);
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
*
|
||||
* part-db version 0.1
|
||||
* Copyright (C) 2005 Christoph Lechner
|
||||
* http://www.cl-projects.de/
|
||||
* http://www.cl-projects.de/.
|
||||
*
|
||||
* part-db version 0.2+
|
||||
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||
|
@ -27,24 +28,20 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Class Pricedetail
|
||||
* @package App\Entity
|
||||
* Class Pricedetail.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table("pricedetails")
|
||||
*/
|
||||
class Pricedetail extends DBElement
|
||||
class Pricedetail extends DBElement
|
||||
{
|
||||
/**
|
||||
* @var Orderdetail
|
||||
|
@ -82,7 +79,6 @@ class Pricedetail extends DBElement
|
|||
*/
|
||||
protected $last_modified;
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
*
|
||||
* Getters
|
||||
|
@ -90,29 +86,28 @@ class Pricedetail extends DBElement
|
|||
*********************************************************************************/
|
||||
|
||||
/**
|
||||
* Get the orderdetails of this pricedetails
|
||||
*
|
||||
* @return Orderdetail the orderdetails object
|
||||
* Get the orderdetails of this pricedetails.
|
||||
*
|
||||
* @return Orderdetail the orderdetails object
|
||||
*/
|
||||
public function getOrderdetails() : Orderdetail
|
||||
public function getOrderdetails(): Orderdetail
|
||||
{
|
||||
return $this->orderdetail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the price
|
||||
* Get the price.
|
||||
*
|
||||
* @param boolean $as_money_string * if true, this method returns a money string incl. currency
|
||||
* * if false, this method returns the price as float
|
||||
* @param integer $multiplier The returned price (float or string) will be multiplied
|
||||
* with this multiplier.
|
||||
* @param bool $as_money_string * if true, this method returns a money string incl. currency
|
||||
* * if false, this method returns the price as float
|
||||
* @param int $multiplier The returned price (float or string) will be multiplied
|
||||
* with this multiplier.
|
||||
*
|
||||
* You will get the price for $multiplier parts. If you want the price which is stored
|
||||
* in the database, you have to pass the "price_related_quantity" count as $multiplier.
|
||||
*
|
||||
* @return float the price as a float number (if "$as_money_string == false")
|
||||
* @return string the price as a string incl. currency (if "$as_money_string == true")
|
||||
* @return float the price as a float number (if "$as_money_string == false")
|
||||
* @return string the price as a string incl. currency (if "$as_money_string == true")
|
||||
*
|
||||
* @see floatToMoneyString()
|
||||
*/
|
||||
|
@ -129,30 +124,30 @@ class Pricedetail extends DBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the price related quantity
|
||||
* Get the price related quantity.
|
||||
*
|
||||
* This is the quantity, for which the price is valid.
|
||||
*
|
||||
* @return integer the price related quantity
|
||||
* @return int the price related quantity
|
||||
*
|
||||
* @see Pricedetails::setPriceRelatedQuantity()
|
||||
*/
|
||||
public function getPriceRelatedQuantity() : int
|
||||
public function getPriceRelatedQuantity(): int
|
||||
{
|
||||
return $this->price_related_quantity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the minimum discount quantity
|
||||
* Get the minimum discount quantity.
|
||||
*
|
||||
* "Minimum discount quantity" means the minimum order quantity for which the price
|
||||
* of this orderdetails is valid.
|
||||
*
|
||||
* @return integer the minimum discount quantity
|
||||
* @return int the minimum discount quantity
|
||||
*
|
||||
* @see Pricedetails::setMinDiscountQuantity()
|
||||
*/
|
||||
public function getMinDiscountQuantity() : int
|
||||
public function getMinDiscountQuantity(): int
|
||||
{
|
||||
return $this->min_discount_quantity;
|
||||
}
|
||||
|
@ -164,9 +159,9 @@ class Pricedetail extends DBElement
|
|||
*********************************************************************************/
|
||||
|
||||
/**
|
||||
* Set the price
|
||||
* Set the price.
|
||||
*
|
||||
* @param float $new_price the new price as a float number
|
||||
* @param float $new_price the new price as a float number
|
||||
*
|
||||
* * This is the price for "price_related_quantity" parts!!
|
||||
* * Example: if "price_related_quantity" is '10',
|
||||
|
@ -174,7 +169,7 @@ class Pricedetail extends DBElement
|
|||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setPrice(float $new_price) : self
|
||||
public function setPrice(float $new_price): self
|
||||
{
|
||||
Assert::natural($new_price, 'The new price must be positive! Got %s!');
|
||||
|
||||
|
@ -184,7 +179,7 @@ class Pricedetail extends DBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the price related quantity
|
||||
* Set the price related quantity.
|
||||
*
|
||||
* This is the quantity, for which the price is valid.
|
||||
*
|
||||
|
@ -192,13 +187,12 @@ class Pricedetail extends DBElement
|
|||
* If 100pcs costs 20$, you have to set the price to 20$ and the price related
|
||||
* quantity to 100. The single price (20$/100 = 0.2$) will be calculated automatically.
|
||||
*
|
||||
* @param integer $new_price_related_quantity the price related quantity
|
||||
* @param int $new_price_related_quantity the price related quantity
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setPriceRelatedQuantity(int $new_price_related_quantity) : self
|
||||
public function setPriceRelatedQuantity(int $new_price_related_quantity): self
|
||||
{
|
||||
|
||||
Assert::greaterThan($new_price_related_quantity, 0,
|
||||
'The new price related quantity must be greater zero! Got %s.');
|
||||
|
||||
|
@ -208,7 +202,7 @@ class Pricedetail extends DBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the minimum discount quantity
|
||||
* Set the minimum discount quantity.
|
||||
*
|
||||
* "Minimum discount quantity" means the minimum order quantity for which the price
|
||||
* of this orderdetails is valid. This way, you're able to use different prices
|
||||
|
@ -222,11 +216,11 @@ class Pricedetail extends DBElement
|
|||
* (Each of this examples would be an own Pricedetails-object.
|
||||
* So the orderdetails would have three Pricedetails for one supplier.)
|
||||
*
|
||||
* @param integer $new_min_discount_quantity the minimum discount quantity
|
||||
* @param int $new_min_discount_quantity the minimum discount quantity
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setMinDiscountQuantity(int $new_min_discount_quantity) : self
|
||||
public function setMinDiscountQuantity(int $new_min_discount_quantity): self
|
||||
{
|
||||
Assert::greaterThan($new_min_discount_quantity, 0,
|
||||
'The new minimum discount quantity must be greater zero! Got %s.');
|
||||
|
@ -236,16 +230,14 @@ class Pricedetail extends DBElement
|
|||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the ID as an string, defined by the element class.
|
||||
* This should have a form like P000014, for a part with ID 14.
|
||||
*
|
||||
* @return string The ID as a string;
|
||||
*/
|
||||
public function getIDString(): string
|
||||
{
|
||||
return 'PD' . sprintf('%06d', $this->getID());
|
||||
return 'PD'.sprintf('%06d', $this->getID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue