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

createProcessFactory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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