Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding energy units #33

Merged
merged 4 commits into from
Nov 12, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/UnitConverter/Unit/Energy/Calorie.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@

namespace UnitConverter\Unit\Energy;

use UnitConverter\Measure;
use UnitConverter\Unit\{ AbstractUnit, UnitInterface };

/**
* Calorie unit data class.
*
Expand Down
2 changes: 1 addition & 1 deletion src/UnitConverter/Unit/Energy/EnergyUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace UnitConverter\Unit\Energy;

use UnitConverter\Measure;
use UnitConverter\Unit\{ AbstractUnit, UnitInterface };
use UnitConverter\Unit\{ AbstractUnit };

/**
* Energy base data class. Any new energy units should
Expand Down
3 changes: 0 additions & 3 deletions src/UnitConverter/Unit/Energy/FootPound.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@

namespace UnitConverter\Unit\Energy;

use UnitConverter\Measure;
use UnitConverter\Unit\{ AbstractUnit, UnitInterface };

/**
* FootPound unit data class.
*
Expand Down
5 changes: 1 addition & 4 deletions src/UnitConverter/Unit/Energy/Joule.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@

namespace UnitConverter\Unit\Energy;

use UnitConverter\Measure;
use UnitConverter\Unit\{ AbstractUnit, UnitInterface };

/**
* Joule unit data class.
*
Expand All @@ -31,7 +28,7 @@ protected function configure () : void
$this
->setName("joule")

->setSymbol("j")
->setSymbol("J")

->setUnits(1)
;
Expand Down
36 changes: 36 additions & 0 deletions src/UnitConverter/Unit/Energy/Kilojoule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* This file is part of the jordanbrauer/unit-converter PHP package.
*
* @copyright 2017 Jordan Brauer <[email protected]>
* @license MIT
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types = 1);

namespace UnitConverter\Unit\Energy;

/**
* Kilojoule unit data class.
*
* @version 1.0.0
* @since 1.0.0
* @author Andrew Boerema <[email protected]>
*/
class Kilojoule extends EnergyUnit
{
protected function configure () : void
{
$this
->setName("kilojoule")

->setSymbol("kJ")

->setUnits(1000)
;
}
}
36 changes: 36 additions & 0 deletions src/UnitConverter/Unit/Energy/KilowattHour.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* This file is part of the jordanbrauer/unit-converter PHP package.
*
* @copyright 2017 Jordan Brauer <[email protected]>
* @license MIT
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types = 1);

namespace UnitConverter\Unit\Energy;

/**
* KilowattHour unit data class.
*
* @version 1.0.0
* @since 1.0.0
* @author Andrew Boerema <[email protected]>
*/
class KilowattHour extends EnergyUnit
{
protected function configure () : void
{
$this
->setName("kilowatt hour")

->setSymbol("kWh")

->setUnits(3600005.4468)
;
}
}
36 changes: 36 additions & 0 deletions src/UnitConverter/Unit/Energy/Megaelectronvolt.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* This file is part of the jordanbrauer/unit-converter PHP package.
*
* @copyright 2017 Jordan Brauer <[email protected]>
* @license MIT
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types = 1);

namespace UnitConverter\Unit\Energy;

/**
* Megaelectronvolt unit data class.
*
* @version 1.0.0
* @since 1.0.0
* @author Andrew Boerema <[email protected]>
*/
class Megaelectronvolt extends EnergyUnit
{
protected function configure () : void
{
$this
->setName("megaelectronvolt")

->setSymbol("MeV")

->setUnits(1.60218e-13)
;
}
}
36 changes: 36 additions & 0 deletions src/UnitConverter/Unit/Energy/Megajoule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* This file is part of the jordanbrauer/unit-converter PHP package.
*
* @copyright 2017 Jordan Brauer <[email protected]>
* @license MIT
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types = 1);

namespace UnitConverter\Unit\Energy;

/**
* Megajoule unit data class.
*
* @version 1.0.0
* @since 1.0.0
* @author Andrew Boerema <[email protected]>
*/
class Megajoule extends EnergyUnit
{
protected function configure () : void
{
$this
->setName("megajoule")

->setSymbol("MJ")

->setUnits(1000000)
;
}
}
36 changes: 36 additions & 0 deletions src/UnitConverter/Unit/Energy/MegawattHour.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* This file is part of the jordanbrauer/unit-converter PHP package.
*
* @copyright 2017 Jordan Brauer <[email protected]>
* @license MIT
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types = 1);

namespace UnitConverter\Unit\Energy;

/**
* MegawattHour unit data class.
*
* @version 1.0.0
* @since 1.0.0
* @author Andrew Boerema <[email protected]>
*/
class MegawattHour extends EnergyUnit
{
protected function configure () : void
{
$this
->setName("megawatt hour")

->setSymbol("MWh")

->setUnits(3600005446.8)
;
}
}
36 changes: 36 additions & 0 deletions src/UnitConverter/Unit/Energy/NewtonMeter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* This file is part of the jordanbrauer/unit-converter PHP package.
*
* @copyright 2017 Jordan Brauer <[email protected]>
* @license MIT
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types = 1);

namespace UnitConverter\Unit\Energy;

/**
* NewtonMeter unit data class.
*
* @version 1.0.0
* @since 1.0.0
* @author Andrew Boerema <[email protected]>
*/
class NewtonMeter extends EnergyUnit
{
protected function configure () : void
{
$this
->setName("newton meter")

->setSymbol("Nm")

->setUnits(1)
;
}
}
5 changes: 1 addition & 4 deletions src/UnitConverter/Unit/Energy/WattHour.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@

namespace UnitConverter\Unit\Energy;

use UnitConverter\Measure;
use UnitConverter\Unit\{ AbstractUnit, UnitInterface };

/**
* WattHour unit data class.
*
Expand All @@ -31,7 +28,7 @@ protected function configure () : void
$this
->setName("watt hour")

->setSymbol("whr")
->setSymbol("Wh")

->setUnits(3600.0054468)
;
Expand Down