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

valksor / php-bundle / 19634156412

24 Nov 2025 12:21PM UTC coverage: 65.046% (-13.4%) from 78.447%
19634156412

push

github

k0d3r1s
add valksor-dev snapshot

0 of 130 new or added lines in 2 files covered. (0.0%)

495 of 761 relevant lines covered (65.05%)

1.61 hits per line

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

0.0
/Service/PathFilterHelper.php
1
<?php declare(strict_types = 1);
2

3
/*
4
 * This file is part of the Valksor package.
5
 *
6
 * (c) Davis Zalitis (k0d3r1s)
7
 * (c) SIA Valksor <packages@valksor.com>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12

13
namespace Valksor\Bundle\Service;
14

15
use ReflectionClass;
16

17
use function array_merge;
18

19
/**
20
 * PathFilter Helper - Shared filtering utilities.
21
 *
22
 * This service provides reusable PathFilter creation and pattern categorization
23
 * methods used by hot reload, snapshot, and other services that need file filtering.
24
 * It follows the exact same pattern as HotReloadService for consistency.
25
 */
26
class PathFilterHelper
27
{
28
    /**
29
     * Create PathFilter with custom exclusion patterns.
30
     * Merges default PathFilter exclusions with user-defined patterns.
31
     */
32
    public static function createPathFilterWithExclusions(
33
        array $excludePatterns,
34
        string $projectDir,
35
    ): PathFilter {
36
        // Get default patterns from PathFilter
NEW
37
        $defaultFilter = PathFilter::createDefault($projectDir);
×
NEW
38
        $defaultExclusions = self::extractDefaultExclusions($defaultFilter);
×
39

40
        // Combine all patterns into a unified list (no categorization needed)
NEW
41
        $allPatterns = array_merge(
×
NEW
42
            $defaultExclusions['all'],
×
NEW
43
            $excludePatterns,
×
NEW
44
        );
×
45

NEW
46
        return new PathFilter($allPatterns, $projectDir);
×
47
    }
48

49
    /**
50
     * Extract default exclusions from PathFilter using reflection.
51
     */
52
    public static function extractDefaultExclusions(
53
        PathFilter $filter,
54
    ): array {
NEW
55
        $reflection = new ReflectionClass($filter);
×
NEW
56
        $excludePatterns = $reflection->getProperty('excludePatterns')->getValue($filter);
×
57

NEW
58
        return [
×
NEW
59
            'directories' => [],
×
NEW
60
            'globs' => [],
×
NEW
61
            'filenames' => [],
×
NEW
62
            'extensions' => [],
×
NEW
63
            'all' => $excludePatterns,
×
NEW
64
        ];
×
65
    }
66
}
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

© 2026 Coveralls, Inc