summaryrefslogtreecommitdiff
path: root/server/vendor/php-opencloud/common/src/Common/Resource/ResourceInterface.php
blob: ffe3d20b8a7902c709417ae7f62eb5ea7577a200 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php declare(strict_types=1);

namespace OpenCloud\Common\Resource;

use Psr\Http\Message\ResponseInterface;

/**
 * Represents an API resource.
 *
 * @package OpenCloud\Common\Resource
 */
interface ResourceInterface
{
    /**
     * All models which represent an API resource should be able to be populated
     * from a {@see ResponseInterface} object.
     *
     * @param ResponseInterface $response
     *
     * @return self
     */
    public function populateFromResponse(ResponseInterface $response);

    /**
     * @param array $data
     * @return mixed
     */
    public function populateFromArray(array $data);
}