• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

RonasIT / laravel-helpers / 8971211749

06 May 2024 02:57PM UTC coverage: 72.518% (-1.1%) from 73.658%
8971211749

Pull #116

github

web-flow
Merge 572ea95cd into 194095dc5
Pull Request #116: Added code that allows user to work with different versions.

12 of 33 new or added lines in 4 files covered. (36.36%)

9 existing lines in 1 file now uncovered.

884 of 1219 relevant lines covered (72.52%)

7.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Support/Version.php
1
<?php
2

3
namespace RonasIT\Support\Support;
4

5
use Illuminate\Support\Arr;
6
use Illuminate\Support\Facades\Route;
7
use RonasIT\Support\Contracts\VersionEnumContract;
8

9
class Version
10
{
11
    public static function current($pathParamName = 'version'): string
12
    {
NEW
13
        $route = Route::getRoutes()->match(request());
×
14

NEW
15
        return Arr::get($route->parameters(), $pathParamName, str_replace('/v', '', $route->getPrefix()));
×
16
    }
17

18
    public static function is(VersionEnumContract $expectedVersion): bool
19
    {
NEW
20
        return version_compare($expectedVersion->value, self::current(), '=');
×
21
    }
22

23
    public static function between(VersionEnumContract $from, VersionEnumContract $to): bool
24
    {
NEW
25
        $version = self::current();
×
26

NEW
27
        return version_compare($version, $from->value, '>=') && version_compare($version, $to->value, '<=');
×
28
    }
29

30
    public static function gte(VersionEnumContract $from): bool
31
    {
NEW
32
        return version_compare(self::current(), $from->value, '>=');
×
33
    }
34

35
    public static function lte(VersionEnumContract $to): bool
36
    {
NEW
37
        return version_compare(self::current(), $to->value, '<=');
×
38
    }
39
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc