Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| Assets | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| image | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Cosray\Assets; |
| 6 | |
| 7 | use Cosray\Config; |
| 8 | use Cosray\Util\Path; |
| 9 | |
| 10 | class Assets |
| 11 | { |
| 12 | public readonly string $publicDir; |
| 13 | public readonly string $assetsDir; |
| 14 | public readonly string $cacheDir; |
| 15 | |
| 16 | public function __construct( |
| 17 | protected readonly Config $config, |
| 18 | ) { |
| 19 | $this->publicDir = rtrim(realpath($config->path->public), '\\/'); |
| 20 | |
| 21 | $this->assetsDir = Path::inside($this->publicDir, $config->path->assets); |
| 22 | $this->cacheDir = Path::inside($this->publicDir, $config->path->cache); |
| 23 | } |
| 24 | |
| 25 | public function image(string $path): Image |
| 26 | { |
| 27 | return new Image($this, $path); |
| 28 | } |
| 29 | } |