Code Duplication    Length = 35-35 lines in 2 locations

src/Actions/Authentication.php 1 location

@@ 46-80 (lines=35) @@
43
44
    }
45
46
    public function update($package_name, $initial_extra, $target_extra) {
47
48
        $io = $this->getIO();
49
50
        $io->write("<info>>>> Updating authentication providers from ".$package_name."</info>");
51
52
        $old_providers = array_keys($initial_extra);
53
        
54
        $new_providers = array_keys($target_extra);
55
        
56
        $uninstall = array_diff($old_providers, $new_providers);
57
58
        $install = array_diff($new_providers, $old_providers);
59
60
        $update = array_intersect($old_providers, $new_providers);
61
        
62
        foreach ( $uninstall as $provider ) {
63
            
64
            $this->removeAuthProvider($io, $package_name, $provider, $initial_extra[$provider]);
65
            
66
        }
67
        
68
        foreach ( $install as $provider ) {
69
            
70
            $this->addAuthProvider($io, $package_name, $provider, $target_extra[$provider]);
71
            
72
        }
73
        
74
        foreach ( $update as $provider ) {
75
            
76
            $this->updateAuthProvider($io, $package_name, $provider, $target_extra[$provider]);
77
            
78
        }
79
80
    }
81
82
    public function uninstall($package_name, $package_extra) {
83

src/Actions/Setting.php 1 location

@@ 46-80 (lines=35) @@
43
44
    }
45
46
    public function update($package_name, $initial_extra, $target_extra) {
47
48
        $io = $this->getIO();
49
50
        $io->write("<info>>>> Updating setting from package ".$package_name."</info>");
51
52
        $old_settings = array_keys($initial_extra);
53
        
54
        $new_settings = array_keys($target_extra);
55
        
56
        $uninstall = array_diff($old_settings, $new_settings);
57
58
        $install = array_diff($new_settings, $old_settings);
59
60
        $update = array_intersect($old_settings, $new_settings);
61
        
62
        foreach ( $uninstall as $setting ) {
63
            
64
            $this->removeSetting($io, $package_name, $setting, $initial_extra[$setting]);
65
            
66
        }
67
        
68
        foreach ( $install as $setting ) {
69
            
70
            $this->addSetting($io, $package_name, $setting, $target_extra[$setting]);
71
            
72
        }
73
        
74
        foreach ( $update as $setting ) {
75
            
76
            $this->updateSetting($io, $package_name, $setting, $initial_extra[$setting], $target_extra[$setting]);
77
            
78
        }
79
80
    }
81
82
    public function uninstall($package_name, $package_extra) {
83