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

HostsPluginChecker   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A verify() 0 9 2
A editHostsInstructions() 0 7 1
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
}