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

acdh-oeaw / arche-diss-cache / #20

14 Oct 2024 09:32PM UTC coverage: 81.529%. Remained the same
#20

push

php-coveralls

zozlak
ResponseCache::hashParams(): include resource id. Also phpstan fixes

9 of 13 new or added lines in 5 files covered. (69.23%)

128 of 157 relevant lines covered (81.53%)

3.41 hits per line

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

8.33
/src/acdhOeaw/arche/lib/dissCache/RepoWrapperRepoInterface.php
1
<?php
2

3
/*
4
 * The MIT License
5
 *
6
 * Copyright 2024 zozlak.
7
 *
8
 * Permission is hereby granted, free of charge, to any person obtaining a copy
9
 * of this software and associated documentation files (the "Software"), to deal
10
 * in the Software without restriction, including without limitation the rights
11
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
 * copies of the Software, and to permit persons to whom the Software is
13
 * furnished to do so, subject to the following conditions:
14
 *
15
 * The above copyright notice and this permission notice shall be included in
16
 * all copies or substantial portions of the Software.
17
 *
18
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
 * THE SOFTWARE.
25
 */
26

27
namespace acdhOeaw\arche\lib\dissCache;
28

29
use DateTimeImmutable;
30
use termTemplates\PredicateTemplate as PT;
31
use acdhOeaw\arche\lib\SearchConfig;
32
use acdhOeaw\arche\lib\RepoInterface;
33
use acdhOeaw\arche\lib\RepoResourceInterface;
34

35
/**
36
 * Description of RepoWrapperRepoInterface
37
 *
38
 * @author zozlak
39
 */
40
class RepoWrapperRepoInterface implements RepoWrapperInterface {
41

42
    private RepoInterface $repo;
43
    private bool $checkModDate;
44

45
    public function __construct(RepoInterface $repo,
46
                                bool $checkModificationDate = false) {
47
        $this->repo         = $repo;
×
48
        $this->checkModDate = $checkModificationDate;
×
49
    }
50

51
    public function getResourceById(string $id, ?SearchConfig $config = null): RepoResourceInterface {
52
        return $this->repo->getResourceById($id, $config);
1✔
53
    }
54

55
    public function getModificationTimestamp(string $id): int {
56
        if (!$this->checkModDate) {
×
57
            return PHP_INT_MAX;
×
58
        }
59

60
        $config                     = new SearchConfig();
×
NEW
61
        $config->metadataMode       = RepoResourceInterface::META_RESOURCE;
×
NEW
62
        $modDateProp                = $this->repo->getSchema()->modificationDate;
×
63
        $config->resourceProperties = [(string) $modDateProp];
×
NEW
64
        $res                        = $this->repo->getResourceById($id, $config);
×
65
        $modDate                    = $res->getGraph()->getObjectValue(new PT($modDateProp));
×
66
        return (new DateTimeImmutable($modDate))->getTimestamp();
×
67
    }
68
}
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

© 2025 Coveralls, Inc