Completed
Push — master ( ee5489...aa45e5 )
by Luka
03:39
created

src/Entity/Instance.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Baguette\Mastodon\Entity;
4
5
/**
6
 * Instance
7
 *
8
 * @author    USAMI Kenta <[email protected]>
9
 * @copyright 2017 Baguette HQ
10
 * @license   https://www.gnu.org/licenses/gpl-3.0.html GPL-3.0
11
 * @see https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#instance
12
 * @property-read string $uri         URI of the current instance
13
 * @property-read string $title       The instance's title
14
 * @property-read string $description A description for the instance
15
 * @property-read string $email       An email address which can be used to contact the instance administrator
16
 */
17 View Code Duplication
class Instance extends Entity
0 ignored issues
show
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...
18
{
19
    use \Teto\Object\TypedProperty;
20
21
    private static $property_types = [
22
        'uri'         => 'string',
23
        'title'       => 'string',
24
        'description' => 'string',
25
        'email'       => 'string',
26
    ];
27
28 2
    public function __construct(array $properties)
29
    {
30 2
        $this->setProperties($properties);
31 2
    }
32
33
    /**
34
     * Returns instance data as array
35
     *
36
     * @return array
37
     */
38 2
    public function toArray()
39
    {
40
        return [
41 2
            'uri'         => $this->uri,
42 2
            'title'       => $this->title,
43 2
            'description' => $this->description,
44 2
            'email'       => $this->email,
45
        ];
46
    }
47
}
48