Completed
Push — pull-request/7609 ( 4ccf63...393b85 )
by Kamil
146:59 queued 125:08
created

FilesystemRequirements::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 9.0856
c 0
b 0
f 0
cc 1
eloc 16
nc 1
nop 4
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Bundle\CoreBundle\Installer\Requirement;
13
14
use Symfony\Component\Translation\TranslatorInterface;
15
16
final class FilesystemRequirements extends RequirementCollection
17
{
18
    public function __construct(TranslatorInterface $translator, $root, $cacheDir, $logDir)
19
    {
20
        parent::__construct($translator->trans('sylius.installer.filesystem.header', []));
21
22
        $this
23
            ->add(new Requirement(
24
                $translator->trans('sylius.installer.filesystem.vendors', []),
25
                is_dir($root.'/../vendor')
26
            ))
27
            ->add(new Requirement(
28
                $translator->trans('sylius.installer.filesystem.cache.header', []),
29
                is_writable($cacheDir),
30
                true,
31
                $translator->trans('sylius.installer.filesystem.cache.help', ['%path%' => $cacheDir])
32
            ))
33
            ->add(new Requirement(
34
                $translator->trans('sylius.installer.filesystem.logs.header', []),
35
                is_writable($logDir),
36
                true,
37
                $translator->trans('sylius.installer.filesystem.logs.help', ['%path%' => $logDir])
38
            ))
39
        ;
40
    }
41
}
42