Code Coverage  | 
      ||||||||||
Lines  | 
       Functions and Methods  | 
       Classes and Traits  | 
      ||||||||
| Total |         | 
       100.00%  | 
       10 / 10  | 
               | 
       100.00%  | 
       3 / 3  | 
       CRAP |         | 
       100.00%  | 
       1 / 1  | 
      
| Path |         | 
       100.00%  | 
       10 / 10  | 
               | 
       100.00%  | 
       3 / 3  | 
       5 |         | 
       100.00%  | 
       1 / 1  | 
      
| canonizeUnix |         | 
       100.00%  | 
       3 / 3  | 
               | 
       100.00%  | 
       1 / 1  | 
       1 | |||
| normalizeUnix |         | 
       100.00%  | 
       1 / 1  | 
               | 
       100.00%  | 
       1 / 1  | 
       1 | |||
| absolute |         | 
       100.00%  | 
       6 / 6  | 
               | 
       100.00%  | 
       1 / 1  | 
       3 | |||
| 1 | <?php | 
| 2 | |
| 3 | declare(strict_types=1); | 
| 4 | |
| 5 | namespace Projom\Util; | 
| 6 | |
| 7 | use Projom\Util\File; | 
| 8 | |
| 9 | class Path | 
| 10 | { | 
| 11 | public static function canonizeUnix(string $fullPath): string | 
| 12 | { | 
| 13 | $fullPath = static::normalizeUnix($fullPath); | 
| 14 | $fullPath = File::removeExtension($fullPath); | 
| 15 | return $fullPath; | 
| 16 | } | 
| 17 | |
| 18 | public static function normalizeUnix(string $fullPath) | 
| 19 | { | 
| 20 | return str_replace('\\', '/', $fullPath); | 
| 21 | } | 
| 22 | |
| 23 | public static function absolute(string $fullFilePath): null|string | 
| 24 | { | 
| 25 | if (!$fullFilePath) | 
| 26 | return null; | 
| 27 | |
| 28 | $absolutePath = realpath($fullFilePath); | 
| 29 | if ($absolutePath === false) | 
| 30 | return null; | 
| 31 | |
| 32 | return $absolutePath; | 
| 33 | } | 
| 34 | } |