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

IGNF / validator-api / 15188458321

22 May 2025 01:53PM UTC coverage: 53.006% (+19.6%) from 33.386%
15188458321

push

github

web-flow
fix: change storage location based on environmental variable

Storage adapter

11 of 28 new or added lines in 4 files covered. (39.29%)

335 of 632 relevant lines covered (53.01%)

2.78 hits per line

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

88.89
/src/Storage/ValidationsStorage.php
1
<?php
2

3
namespace App\Storage ;
4

5
use App\Entity\Validation;
6
use League\Flysystem\FilesystemOperator;
7

8
/**
9
 * Manage validation files
10
 */
11
class ValidationsStorage {
12

13
    /**
14
     * Root directory for validations.
15
     *
16
     * @var string
17
     */
18
    private $path;
19

20
    /**
21
     * Flysystem storage
22
     *
23
     * @var FilesystemOperator
24
     */
25
    private $storageSystem;
26

27
    public function __construct($validationsDir,
28
        FilesystemOperator $dataStorage,
29
        FilesystemOperator $defaultStorage)
30
    {
31
        $this->path = $validationsDir;
24✔
32
        // Assign storage based on env
33
        if (getenv("STORAGE_TYPE") === "S3"){
24✔
NEW
34
            $this->storageSystem = $dataStorage;
×
35
        } else {
36
            $this->storageSystem = $defaultStorage;
24✔
37
        }
38
    }
39

40
    /**
41
     * @return string
42
     */
43
    public function getPath(){
44
        return $this->path;
24✔
45
    }
46

47
    /**
48
     * @return FilesystemOperator
49
     */
50
    public function getStorage(){
51
        return $this->storageSystem;
3✔
52
    }
53

54
    /**
55
     * @param Validation $validation
56
     * @return string
57
     */
58
    public function getDirectory(Validation $validation){
59
        return $this->path.'/'.$validation->getUid();
23✔
60
    }
61

62
    /**
63
     * @param Validation $validation
64
     * @return string
65
     */
66
    public function getUploadDirectory(Validation $validation){
67
        return $validation->getUid() . "/upload/";
3✔
68
    }
69

70
    /**
71
     * @param Validation $validation
72
     * @return string
73
     */
74
    public function getOutputDirectory(Validation $validation){
75
        return $validation->getUid() . "/output/";
2✔
76
    }
77

78

79
}
80

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc