Skip to content

Commit

Permalink
Code formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavis1982 committed Mar 19, 2019
1 parent f728649 commit 52f771a
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 44 deletions.
3 changes: 2 additions & 1 deletion src/Duration.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
declare(strict_types=1);

declare(strict_types = 1);

namespace MatthewDavis\Duration;

Expand Down
38 changes: 15 additions & 23 deletions src/DurationInterface.php
Original file line number Diff line number Diff line change
@@ -1,42 +1,34 @@
<?php
declare(strict_types=1);

declare(strict_types = 1);

namespace MatthewDavis\Duration;

interface DurationInterface
{
const SECONDS_IN_MINUTE = 60;
const SECONDS_IN_HOUR = 60 * self::SECONDS_IN_MINUTE;
const SECONDS_IN_DAY = 24 * self::SECONDS_IN_HOUR;
const SECONDS_IN_WEEK = 7 * self::SECONDS_IN_DAY;

public static function second(): DurationInterface;

public static function seconds(int $seconds): DurationInterface;

public static function minute(): DurationInterface;

public static function minutes(int $minutes): DurationInterface;
const SECONDS_IN_HOUR = 60 * self::SECONDS_IN_MINUTE;
const SECONDS_IN_DAY = 24 * self::SECONDS_IN_HOUR;
const SECONDS_IN_WEEK = 7 * self::SECONDS_IN_DAY;

public static function hour(): DurationInterface;
public static function second(): self;
public static function seconds(int $seconds): self;

public static function hours(int $hours): DurationInterface;
public static function minute(): self;
public static function minutes(int $minutes): self;

public static function day(): DurationInterface;
public static function hour(): self;
public static function hours(int $hours): self;

public static function days(int $days): DurationInterface;
public static function day(): self;
public static function days(int $days): self;

public static function week(): DurationInterface;

public static function weeks(int $weeks): DurationInterface;
public static function week(): self;
public static function weeks(int $weeks): self;

public function inSeconds(): int;

public function inMinutes(): float;

public function inHours(): float;

public function inDays(): float;

public function inWeeks(): float;
}
6 changes: 3 additions & 3 deletions tests/DurationDaysTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace MatthewDavis\Duration\Test;

use MatthewDavis\Duration\Duration;
use PHPUnit\Framework\TestCase;
use MatthewDavis\Duration\Duration;

class DurationDaysTest extends TestCase
{
Expand Down Expand Up @@ -36,7 +36,7 @@ public function it_returns_a_duration_created_in_days_in_hours()
/** @test */
public function it_returns_a_duration_created_in_days_in_days()
{
$oneDay = Duration::days(1)->inDays();
$oneDay = Duration::days(1)->inDays();
$threeDays = Duration::days(3)->inDays();

$this->assertEquals(1, $oneDay);
Expand All @@ -46,7 +46,7 @@ public function it_returns_a_duration_created_in_days_in_days()
/** @test */
public function it_returns_a_duration_created_in_days_in_weeks()
{
$oneWeek = Duration::days(7)->inWeeks();
$oneWeek = Duration::days(7)->inWeeks();
$threeWeeks = Duration::days(21)->inWeeks();

$this->assertEquals(1, $oneWeek);
Expand Down
8 changes: 4 additions & 4 deletions tests/DurationHoursTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace MatthewDavis\Duration\Test;

use MatthewDavis\Duration\Duration;
use PHPUnit\Framework\TestCase;
use MatthewDavis\Duration\Duration;

class DurationHoursTest extends TestCase
{
Expand All @@ -26,7 +26,7 @@ public function it_returns_a_duration_created_in_hours_in_minutes()
/** @test */
public function it_returns_a_duration_created_in_hours_in_hours()
{
$oneHour = Duration::hours(1)->inHours();
$oneHour = Duration::hours(1)->inHours();
$threeHours = Duration::hours(3)->inHours();

$this->assertEquals(1, $oneHour);
Expand All @@ -36,7 +36,7 @@ public function it_returns_a_duration_created_in_hours_in_hours()
/** @test */
public function it_returns_a_duration_created_in_hours_in_days()
{
$oneDay = Duration::hours(24)->inDays();
$oneDay = Duration::hours(24)->inDays();
$threeDays = Duration::hours(72)->inDays();

$this->assertEquals(1, $oneDay);
Expand All @@ -46,7 +46,7 @@ public function it_returns_a_duration_created_in_hours_in_days()
/** @test */
public function it_returns_a_duration_created_in_hours_in_weeks()
{
$oneWeek = Duration::hours(168)->inWeeks();
$oneWeek = Duration::hours(168)->inWeeks();
$threeWeeks = Duration::hours(504)->inWeeks();

$this->assertEquals(1, $oneWeek);
Expand Down
8 changes: 4 additions & 4 deletions tests/DurationMinutesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace MatthewDavis\Duration\Test;

use MatthewDavis\Duration\Duration;
use PHPUnit\Framework\TestCase;
use MatthewDavis\Duration\Duration;

class DurationMinutesTest extends TestCase
{
Expand All @@ -26,7 +26,7 @@ public function it_returns_a_duration_created_in_minutes_in_minutes()
/** @test */
public function it_returns_a_duration_created_in_minutes_in_hours()
{
$oneHour = Duration::minutes(60)->inHours();
$oneHour = Duration::minutes(60)->inHours();
$threeHours = Duration::minutes(180)->inHours();

$this->assertEquals(1, $oneHour);
Expand All @@ -36,7 +36,7 @@ public function it_returns_a_duration_created_in_minutes_in_hours()
/** @test */
public function it_returns_a_duration_created_in_minutes_in_days()
{
$oneDay = Duration::minutes(1440)->inDays();
$oneDay = Duration::minutes(1440)->inDays();
$threeDays = Duration::minutes(4320)->inDays();

$this->assertEquals(1, $oneDay);
Expand All @@ -46,7 +46,7 @@ public function it_returns_a_duration_created_in_minutes_in_days()
/** @test */
public function it_returns_a_duration_created_in_minutes_in_weeks()
{
$oneWeek = Duration::minutes(10080)->inWeeks();
$oneWeek = Duration::minutes(10080)->inWeeks();
$threeWeeks = Duration::minutes(30240)->inWeeks();

$this->assertEquals(1, $oneWeek);
Expand Down
10 changes: 5 additions & 5 deletions tests/DurationSecondsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace MatthewDavis\Duration\Test;

use MatthewDavis\Duration\Duration;
use PHPUnit\Framework\TestCase;
use MatthewDavis\Duration\Duration;

class DurationSecondsTest extends TestCase
{
Expand All @@ -18,7 +18,7 @@ public function it_returns_a_duration_created_in_seconds_in_seconds()
/** @test */
public function it_returns_a_duration_created_in_seconds_in_minutes()
{
$oneMinute = Duration::seconds(60)->inMinutes();
$oneMinute = Duration::seconds(60)->inMinutes();
$fiveMinutes = Duration::seconds(300)->inMinutes();

$this->assertEquals(1, $oneMinute);
Expand All @@ -28,7 +28,7 @@ public function it_returns_a_duration_created_in_seconds_in_minutes()
/** @test */
public function it_returns_a_duration_created_in_seconds_in_hours()
{
$oneHour = Duration::seconds(3600)->inHours();
$oneHour = Duration::seconds(3600)->inHours();
$threeHours = Duration::seconds(10800)->inHours();

$this->assertEquals(1, $oneHour);
Expand All @@ -38,7 +38,7 @@ public function it_returns_a_duration_created_in_seconds_in_hours()
/** @test */
public function it_returns_a_duration_created_in_seconds_in_days()
{
$oneDay = Duration::seconds(86400)->inDays();
$oneDay = Duration::seconds(86400)->inDays();
$threeDays = Duration::seconds(259200)->inDays();

$this->assertEquals(1, $oneDay);
Expand All @@ -48,7 +48,7 @@ public function it_returns_a_duration_created_in_seconds_in_days()
/** @test */
public function it_returns_a_duration_created_in_seconds_in_weeks()
{
$oneWeek = Duration::seconds(604800)->inWeeks();
$oneWeek = Duration::seconds(604800)->inWeeks();
$threeWeeks = Duration::seconds(1814400)->inWeeks();

$this->assertEquals(1, $oneWeek);
Expand Down
8 changes: 4 additions & 4 deletions tests/DurationWeeksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace MatthewDavis\Duration\Test;

use MatthewDavis\Duration\Duration;
use PHPUnit\Framework\TestCase;
use MatthewDavis\Duration\Duration;

class DurationWeeksTest extends TestCase
{
Expand All @@ -26,7 +26,7 @@ public function it_returns_a_duration_created_in_weeks_in_minutes()
/** @test */
public function it_returns_a_duration_created_in_weeks_in_hours()
{
$oneWeekInHours = Duration::weeks(1)->inHours();
$oneWeekInHours = Duration::weeks(1)->inHours();
$threeWeeksInHours = Duration::weeks(3)->inHours();

$this->assertEquals(168, $oneWeekInHours);
Expand All @@ -36,7 +36,7 @@ public function it_returns_a_duration_created_in_weeks_in_hours()
/** @test */
public function it_returns_a_duration_created_in_weeks_in_days()
{
$oneWeekInDays = Duration::weeks(1)->inDays();
$oneWeekInDays = Duration::weeks(1)->inDays();
$threeWeeksInDays = Duration::weeks(3)->inDays();

$this->assertEquals(7, $oneWeekInDays);
Expand All @@ -46,7 +46,7 @@ public function it_returns_a_duration_created_in_weeks_in_days()
/** @test */
public function it_returns_a_duration_created_in_weeks_in_weeks()
{
$oneWeek = Duration::weeks(1)->inWeeks();
$oneWeek = Duration::weeks(1)->inWeeks();
$threeWeeks = Duration::weeks(3)->inWeeks();

$this->assertEquals(1, $oneWeek);
Expand Down

0 comments on commit 52f771a

Please sign in to comment.