Completed
Push — master ( 0c70fa...a4aba1 )
by Tobias
22:26
created

Attachment::show()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * Copyright (C) 2013 Mailgun
5
 *
6
 * This software may be modified and distributed under the terms
7
 * of the MIT license. See the LICENSE file for details.
8
 */
9
10
namespace Mailgun\Api;
11
12
use Mailgun\Assert;
13
use Mailgun\Model\Attachment\Attachment as Model;
14
15
/**
16
 * @author Tobias Nyholm <[email protected]>
17
 */
18 View Code Duplication
class Attachment extends HttpApi
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
{
20
    /**
21
     * @param string $url
22
     *
23
     * @return Model
24
     */
25
    public function show($url)
26
    {
27
        Assert::stringNotEmpty($url);
28
        Assert::regex($url, '@https://.*mailgun\.(net|org)/v.+@');
29
        Assert::regex($url, '|/attachments/[0-9]+|');
30
31
        $response = $this->httpGet($url);
32
33
        return $this->hydrateResponse($response, Model::class);
34
    }
35
}
36