PagerStrategy::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 3
1
<?php
2
namespace Nubs\Sensible\Strategy;
3
4
use Habitat\Environment\Environment;
5
use Nubs\Which\Locator as CommandLocator;
6
7
/**
8
 * Uses the EnvironmentVariableStrategy (PAGER) and CommandLocatorStrategy to
9
 * create a Pager.
10
 */
11 View Code Duplication
class PagerStrategy extends ListStrategy implements StrategyInterface
12
{
13
    /**
14
     * Initialize the pager strategy.
15
     *
16
     * @param string[] $pagers The names of the potential pagers.  The first
17
     *     command in the list that can be located will be used.
18
     * @param \Nubs\Which\Locator $commandLocator The command locator.  This
19
     *     helps locate commands using PATH.
20
     * @param \Habitat\Environment\Environment $environment The environment
21
     *     variable wrapper.  Defaults to null, which just uses the built-in
22
     *     getenv.
23
     */
24
    public function __construct(array $pagers, CommandLocator $commandLocator, Environment $environment = null)
25
    {
26
        parent::__construct([new EnvironmentVariableStrategy('PAGER', $environment), new CommandLocatorStrategy($pagers, $commandLocator)]);
27
    }
28
}
29