Completed
Push — master ( c2ba48...1fd225 )
by Markus
14s queued 12s
created

ProcessSymfonyServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 3 1
A createProcessFactory() 0 9 1
1
<?php
2
3
namespace Jellyfish\ProcessSymfony;
4
5
use Pimple\Container;
6
use Pimple\ServiceProviderInterface;
7
8
class ProcessSymfonyServiceProvider implements ServiceProviderInterface
9
{
10
    /**
11
     * @param \Pimple\Container $pimple
12
     *
13
     * @return void
14
     */
15
    public function register(Container $pimple): void
16
    {
17
        $this->createProcessFactory($pimple);
18
    }
19
20
    /**
21
     * @param \Pimple\Container $container
22
     *
23
     * @return \Jellyfish\ProcessSymfony\ProcessSymfonyServiceProvider
24
     */
25
    protected function createProcessFactory(Container $container): ProcessSymfonyServiceProvider
26
    {
27
        $container->offsetSet('process_factory', function (Container $container) {
28
            $rootDir = $container->offsetGet('root_dir');
29
30
            return new ProcessFactory($rootDir . 'tmp' . DIRECTORY_SEPARATOR);
31
        });
32
33
        return $this;
34
    }
35
}
36