Code Duplication    Length = 24-24 lines in 2 locations

examples/Disk/api/copy.php 1 location

@@ 15-38 (lines=24) @@
12
13
$client = new OAuthClient($settings['global']['clientId']);
14
15
if (isset($_COOKIE['yaAccessToken'])) {
16
17
    $target = $_POST['target'];
18
    $destination = $_POST['destination'];
19
20
    $client->setAccessToken($_COOKIE['yaAccessToken']);
21
22
    // XXX: how it should be (using user access token)
23
    //$diskClient = new \Yandex\Disk\DiskClient($client->getAccessToken());
24
25
    // XXX: how it is now (using magic access token)
26
    $diskClient = new \Yandex\Disk\DiskClient($client->getAccessToken());
27
28
    $diskClient->setServiceScheme(\Yandex\Disk\DiskClient::HTTPS_SCHEME);
29
30
    header('Content-type: application/json');
31
    $response = [];
32
33
    if ($diskClient->copy($target, $destination)) {
34
        $response['status'] = 'OK';
35
    }
36
37
    echo json_encode($response);
38
}

examples/Disk/api/move.php 1 location

@@ 15-38 (lines=24) @@
12
13
$client = new OAuthClient($settings['global']['clientId']);
14
15
if (isset($_COOKIE['yaAccessToken'])) {
16
17
    $target = $_POST['target'];
18
    $destination = $_POST['destination'];
19
20
    $client->setAccessToken($_COOKIE['yaAccessToken']);
21
22
    // XXX: how it should be (using user access token)
23
    //$diskClient = new \Yandex\Disk\DiskClient($client->getAccessToken());
24
25
    // XXX: how it is now (using magic access token)
26
    $diskClient = new \Yandex\Disk\DiskClient($client->getAccessToken());
27
28
    $diskClient->setServiceScheme(\Yandex\Disk\DiskClient::HTTPS_SCHEME);
29
30
    header('Content-type: application/json');
31
    $response = [];
32
33
    if ($diskClient->move($target, $destination)) {
34
        $response['status'] = 'OK';
35
    }
36
37
    echo json_encode($response);
38
}