first commit
This commit is contained in:
39
autoload/shop/class.Shop.php
Normal file
39
autoload/shop/class.Shop.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?
|
||||
namespace shop;
|
||||
class Shop implements \ArrayAccess
|
||||
{
|
||||
static public function shortPrice( $price )
|
||||
{
|
||||
if ( self::isWholeNumber( $price ) )
|
||||
$price = round( $price, 0 );
|
||||
else
|
||||
$price = \S::decimal( $price );
|
||||
|
||||
return $price;
|
||||
}
|
||||
|
||||
static public function isWholeNumber( $value )
|
||||
{
|
||||
return (is_numeric($value) && (round($value, 3) == round($value)));
|
||||
}
|
||||
|
||||
public function offsetExists( $offset )
|
||||
{
|
||||
return isset( $this -> $offset );
|
||||
}
|
||||
|
||||
public function offsetGet( $offset )
|
||||
{
|
||||
return $this -> $offset;
|
||||
}
|
||||
|
||||
public function offsetSet( $offset, $value )
|
||||
{
|
||||
$this -> $offset = $value;
|
||||
}
|
||||
|
||||
public function offsetUnset( $offset )
|
||||
{
|
||||
unset( $this -> $offset );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user