Code Duplication    Length = 11-12 lines in 3 locations

src/AppBundle/Controller/NooliteController.php 3 locations

@@ 78-88 (lines=11) @@
75
                            break;
76
                        }
77
                    }
78
                } else {
79
                    // turning off
80
                    $changeSet = ['state'=>'off'];
81
                    /** @var Action $action */
82
                    foreach ($actions as $action) {
83
                        if ($action->getArguments()=='{"state":"off"}') {
84
                            $resultAction = $action;
85
                            break;
86
                        }
87
                    }
88
                }
89
            }
90
91
            if ($request->get('cmd')==0) {
@@ 91-102 (lines=12) @@
88
                }
89
            }
90
91
            if ($request->get('cmd')==0) {
92
                // turn off, only by pi
93
94
                $changeSet = ['state'=>'off'];
95
                /** @var Action $action */
96
                foreach ($actions as $action) {
97
                    if ($action->getArguments()=='{"state":"off"}') {
98
                        $resultAction = $action;
99
                        break;
100
                    }
101
                }
102
            }
103
104
            if ($request->get('cmd')==2) {
105
                // turn on, only by pi
@@ 104-115 (lines=12) @@
101
                }
102
            }
103
104
            if ($request->get('cmd')==2) {
105
                // turn on, only by pi
106
107
                $changeSet = ['state'=>'on'];
108
                /** @var Action $action */
109
                foreach ($actions as $action) {
110
                    if ($action->getArguments()=='{"state":"on"}') {
111
                        $resultAction = $action;
112
                        break;
113
                    }
114
                }
115
            }
116
117
118
            if (!$resultAction) {