Skip to content

Commit

Permalink
Merge pull request #9 from ojhaujjwal/feature/energy
Browse files Browse the repository at this point in the history
Created new quantity energy
  • Loading branch information
crisu83 committed Jun 17, 2014
2 parents a751ca6 + 3f8fe6b commit 909405b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/Crisu83/Conversion/Quantity/Energy/Energy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/*
* This file is part of Conversion.
*
* (c) 2013 Christoffer Niska
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Crisu83\Conversion\Quantity\Energy;

use Crisu83\Conversion\Quantity\Quantity;

/**
* Class Energy
* @package Crisu83\Conversion\Quantity\Energy
*/
class Energy extends Quantity
{
/**
* @var string native unit name
*/
protected static $native = Unit::JOULE;

/**
* @var array conversion map (unit => native unit)
*/
protected static $conversionMap = [
Unit::JOULE => 1,
Unit::CALORIE => 4.184,
Unit::KILOWATT_HOUR => 3.6e+6,
];
}
24 changes: 24 additions & 0 deletions src/Crisu83/Conversion/Quantity/Energy/Unit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/*
* This file is part of Conversion.
*
* (c) 2013 Christoffer Niska
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Crisu83\Conversion\Quantity\Energy;

use Crisu83\Conversion\Quantity\Unit as BaseUnit;

/**
* Class Unit
* @package Crisu83\Conversion\Quantity\Power
*/
class Unit extends BaseUnit
{
const JOULE = 'J';
const CALORIE = 'Cal';
const KILOWATT_HOUR = 'kWh';
}

0 comments on commit 909405b

Please sign in to comment.