Code Duplication    Length = 8-8 lines in 3 locations

src/Cli/HubphCommands.php 1 location

@@ 197-204 (lines=8) @@
194
        return $this->getProjectWithOrfFromUrl($remote);
195
    }
196
197
    protected function getProjectWithOrfFromUrl($remote)
198
    {
199
        $remote = preg_replace('#^git@[^:]*:#', '', $remote);
200
        $remote = preg_replace('#^[^:]*://[^/]/#', '', $remote);
201
        $remote = preg_replace('#\.git$#', '', $remote);
202
203
        return $remote;
204
    }
205
206
    protected function getRemote($remote = 'origin', $cwd = '')
207
    {

src/Git/Remote.php 1 location

@@ 55-62 (lines=8) @@
52
53
    // https://{$token}:[email protected]/{$projectWithOrg}.git";
54
    // [email protected]:{$projectWithOrg}.git
55
    public static function projectWithOrgFromUrl($remote)
56
    {
57
        $remote = preg_replace('#^git@[^:]*:#', '', $remote);
58
        $remote = preg_replace('#^[^:]*://[^/]*/#', '', $remote);
59
        $remote = preg_replace('#\.git$#', '', $remote);
60
61
        return $remote;
62
    }
63
64
    public function url()
65
    {

src/HubphAPI.php 1 location

@@ 181-188 (lines=8) @@
178
        return "https://{$token}:[email protected]/{$projectAndOrg}.git";
179
    }
180
181
    protected function projectAndOrgFromUrl($remote)
182
    {
183
        $remote = preg_replace('#^git@[^:]*:#', '', $remote);
184
        $remote = preg_replace('#^[^:]*://[^/]*/#', '', $remote);
185
        $remote = preg_replace('#\.git$#', '', $remote);
186
187
        return $remote;
188
    }
189
190
    protected function existingPRs($projectWithOrg, VersionIdentifiers $vids)
191
    {