Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
Reader
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 read
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
5/**
6 * Fast Forward Development Tools for PHP projects.
7 *
8 * This file is part of fast-forward/dev-tools project.
9 *
10 * @author   Felipe SayĆ£o Lobato Abreu <github@mentordosnerds.com>
11 * @license  https://opensource.org/licenses/MIT MIT License
12 *
13 * @see      https://github.com/php-fast-forward/
14 * @see      https://github.com/php-fast-forward/dev-tools
15 * @see      https://github.com/php-fast-forward/dev-tools/issues
16 * @see      https://php-fast-forward.github.io/dev-tools/
17 * @see      https://datatracker.ietf.org/doc/html/rfc2119
18 */
19
20namespace FastForward\DevTools\GitIgnore;
21
22/**
23 * Reads .gitignore files and returns domain representations for them.
24 *
25 * This reader SHALL provide a minimal abstraction for loading a .gitignore file
26 * from a filesystem path. The implementation MUST delegate file parsing to the
27 * GitIgnore value object and MUST return a GitIgnoreInterface-compatible result.
28 */
29 class Reader implements ReaderInterface
30{
31    /**
32     * Reads a .gitignore file from the specified filesystem path.
33     *
34     * The provided path MUST reference a readable .gitignore file. This method
35     * SHALL delegate object creation to GitIgnore::fromFile() and MUST return
36     * the resulting GitIgnoreInterface implementation.
37     *
38     * @param string $gitignorePath The filesystem path to the .gitignore file.
39     *
40     * @return GitIgnoreInterface The loaded .gitignore representation.
41     */
42    public function read(string $gitignorePath): GitIgnoreInterface
43    {
44        return GitIgnore::fromFile($gitignorePath);
45    }
46}