Code Duplication    Length = 31-31 lines in 2 locations

src/Admin/presenters/CompanyPresenter.php 2 locations

@@ 136-166 (lines=31) @@
133
        return $grid;
134
    }
135
136
    public function actionDeactivate($id, $idPage, $inDetail = false)
137
    {
138
139
        $this->company = $this->em->getRepository('\WebCMS\InvestformModule\Entity\Company')->find($id);
140
        $this->company->setActive(false);
141
142
        $this->businessmen = $this->em->getRepository('\WebCMS\InvestformModule\Entity\Businessman')->findBy(array(
143
            'company' => $this->company
144
        ));
145
146
        if ($this->businessmen) {
147
            foreach ($this->businessmen as $businessman) {
148
                $businessman->setActive(false);
149
            }
150
        }
151
152
        $this->em->flush();
153
154
        $this->flashMessage('Company has been deactivated', 'success');
155
156
        if ($inDetail) {
157
            $this->forward('detail', array(
158
                'id' => $id,
159
                'idPage' => $this->actualPage->getId()
160
            ));
161
        } else {
162
            $this->forward('activeCompanies', array(
163
                'idPage' => $this->actualPage->getId()
164
            ));
165
        }
166
    }
167
168
    public function actionActivate($id, $idPage, $inDetail = false)
169
    {
@@ 168-198 (lines=31) @@
165
        }
166
    }
167
168
    public function actionActivate($id, $idPage, $inDetail = false)
169
    {
170
171
        $this->company = $this->em->getRepository('\WebCMS\InvestformModule\Entity\Company')->find($id);
172
        $this->company->setActive(true);
173
174
        $this->businessmen = $this->em->getRepository('\WebCMS\InvestformModule\Entity\Businessman')->findBy(array(
175
            'company' => $this->company
176
        ));
177
178
        if ($this->businessmen) {
179
            foreach ($this->businessmen as $businessman) {
180
                $businessman->setActive(true);
181
            }
182
        }
183
184
        $this->em->flush();
185
186
        $this->flashMessage('Company has been activated', 'success');
187
188
        if ($inDetail) {
189
            $this->forward('detail', array(
190
                'id' => $id,
191
                'idPage' => $this->actualPage->getId()
192
            ));
193
        } else {
194
            $this->forward('inactiveCompanies', array(
195
                'idPage' => $this->actualPage->getId()
196
            ));
197
        }
198
    }
199
200
201
    public function actionUpdate($id, $idPage)