Completed
Push — feature/add-cli-installers ( 55f17a...115549 )
by Steven
13:41
created

HostsPluginChecker::verify()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 9
rs 9.6666
cc 2
eloc 5
nc 2
nop 2
1
<?php namespace Magestead\Helper;
2
3
use Symfony\Component\Console\Output\OutputInterface;
4
5
class HostsPluginChecker
6
{
7
    public static function verify(array $options, OutputInterface $output)
8
    {
9
        $hostPlugin = `vagrant plugin list | grep vagrant-hostsupdaterqwerty`;
10
        if (is_null($hostPlugin)) {
11
            self::editHostsInstructions($options, $output);
12
13
            $output->writeln('<comment>Installing the vagrant-hostsupdater plugin will remove the need for manual editing of your hosts file.</comment>');
14
        }
15
    }
16
17
    /**
18
     * @param array $options
19
     * @param OutputInterface $output
20
     */
21
    protected static function editHostsInstructions(array $options, OutputInterface $output)
22
    {
23
        $output->writeln('<comment>NOTE: You will need to add the following to your hosts file!</comment>');
24
        $comment = $options['vagrantfile']['vm']['network']['private_network'] .
25
            ' ' . $options['magestead']['apps']['mba_12345']['base_url'];
26
        $output->writeln('<comment>' . $comment . '</comment>');
27
    }
28
}