aboutsummaryrefslogtreecommitdiffhomepage
path: root/Digitigrade/RemoteFetchable.php
blob: 4b4262d5ba9fcb3930860b27bae7c30ea9999627 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
namespace Digitigrade;

interface RemoteFetchable {
    /**
     * Fetches the object by its URI from the remote server.
     * @param string $uri the URI of the remote object
     * @param bool $autoSave whether to automatically save the fetched object to the database
     * @return static
     */
    //public static function fetchFromRemote(string $uri, bool $autoSave);

    /**
     * Finds the object locally by its URI or fetches it remotely if not found.
     * @param string $uri the URI identifier of the object
     * @param bool $autoSave whether to automatically save the object (if fetched) to the database
     * @param bool $forceRefetch whether to forcibly refetch the object even if it's in the database
     * @return static
     */
    public static function findByUri(string $uri, bool $autoSave = true, bool $forceRefetch = false);
}