Skip to content
This repository was archived by the owner on Jan 17, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: php

php:
- 7.1
- 7.2
- 7.3

env:
matrix:
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@
}
],
"require": {
"laravel/framework": "~5.5"
"laravel/framework": "~5.5|^6.0"
},
"require-dev": {
"phpunit/phpunit": "^6.2|^7.0",
"orchestra/testbench": "~3.5.0|~3.6.0"
"phpunit/phpunit": "^6.2|^7.0|^8.0",
"orchestra/testbench": "~3.5.0|~3.6.0|~4.0.0",
"orchestra/database": "~3.5.0|~3.6.0|~4.0.0"
},
"autoload": {
"psr-4": {
Expand Down
9 changes: 6 additions & 3 deletions database/factories/UserFactory.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

use Illuminate\Support\Str;

/*
|--------------------------------------------------------------------------
| Model Factories
Expand All @@ -12,9 +15,9 @@

$factory->define(\Rennokki\Schedule\Test\Models\User::class, function () {
return [
'name' => 'Name'.str_random(5),
'email' => str_random(5).'@gmail.com',
'name' => 'Name'.Str::random(5),
'email' => Str::random(5).'@gmail.com',
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
'remember_token' => str_random(10),
'remember_token' => Str::random(10),
];
});
4 changes: 2 additions & 2 deletions database/migrations/2018_05_19_135648_schedules.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class Schedules extends Migration
{
Expand Down
2 changes: 1 addition & 1 deletion src/TimeRange.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function isInTimeRange($hourMinute): bool
return false;
}

list($hour, $minute) = explode(':', $hourMinute);
[$hour, $minute] = explode(':', $hourMinute);
$hour = (int) $hour;
$minute = (int) $minute;

Expand Down
12 changes: 6 additions & 6 deletions src/Traits/HasSchedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function deleteExclusions()
*/
public function isAvailableOn($dateOrDay): bool
{
if (in_array($dateOrDay, Self::$availableDays)) {
if (in_array($dateOrDay, self::$availableDays)) {
return (bool) (count($this->getSchedule()[$dateOrDay]) > 0);
}

Expand Down Expand Up @@ -209,7 +209,7 @@ public function isAvailableOnAt($dateOrDay, $time): bool
{
$timeRanges = null;

if (in_array($dateOrDay, Self::$availableDays)) {
if (in_array($dateOrDay, self::$availableDays)) {
$timeRanges = $this->getSchedule()[$dateOrDay];
}

Expand Down Expand Up @@ -267,7 +267,7 @@ public function getHoursOn($dateOrDay): int
$totalHours = 0;
$timeRanges = null;

if (in_array($dateOrDay, Self::$availableDays)) {
if (in_array($dateOrDay, self::$availableDays)) {
$timeRanges = $this->getSchedule()[$dateOrDay];
}

Expand Down Expand Up @@ -311,7 +311,7 @@ public function getMinutesOn($dateOrDay): int
$totalMinutes = 0;
$timeRanges = null;

if (in_array($dateOrDay, Self::$availableDays)) {
if (in_array($dateOrDay, self::$availableDays)) {
$timeRanges = $this->getSchedule()[$dateOrDay];
}

Expand Down Expand Up @@ -415,12 +415,12 @@ protected function normalizeScheduleArray(array $scheduleArray): array
{
$finalScheduleArray = [];

foreach (Self::$availableDays as $availableDay) {
foreach (self::$availableDays as $availableDay) {
$finalScheduleArray[$availableDay] = [];
}

foreach ($scheduleArray as $day => $timeArray) {
if (! in_array($day, Self::$availableDays)) {
if (! in_array($day, self::$availableDays)) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/ScheduleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ScheduleTest extends TestCase
'saturday', 'sunday',
];

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down
6 changes: 3 additions & 3 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Rennokki\Schedule\Test;

use Rennokki\Schedule\Test\Models\User;
use Rennokki\Schedule\Models\ScheduleModel;
use Orchestra\Testbench\TestCase as Orchestra;
use Rennokki\Schedule\Models\ScheduleModel;
use Rennokki\Schedule\Test\Models\User;

abstract class TestCase extends Orchestra
{
public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down