Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
PathParts
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toString
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 __toString
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace PeServer\Core\IO;
6
7use Stringable;
8
9/**
10 * パスの各要素。
11 */
12readonly class PathParts implements Stringable
13{
14    /**
15     * 生成。
16     *
17     * @param string $directory ディレクトリパス(終端 ディレクトリセパレータなし)。
18     * @param string $fileName ファイル名。
19     * @param string $fileNameWithoutExtension 拡張子なしファイル名。
20     * @param string $extension 拡張子(.なし)。
21     */
22    public function __construct(
23        public string $directory,
24        public string $fileName,
25        public string $fileNameWithoutExtension,
26        public string $extension,
27    ) {
28    }
29
30    #region function
31
32    public function toString(): string
33    {
34        return $this->directory . DIRECTORY_SEPARATOR . $this->fileName;
35    }
36
37    #endregion
38
39    #region Stringable
40
41    public function __toString(): string
42    {
43        return $this->toString();
44    }
45
46    #endregion
47}