OnlyofficeAppRequests::getFileUrlForConvert()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
c 1
b 0
f 1
dl 0
loc 11
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * (c) Copyright Ascensio System SIA 2025.
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 *     http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
use Onlyoffice\DocsIntegrationSdk\Service\Request\RequestService;
18
19
class OnlyofficeAppRequests extends RequestService
20
{
21
    /**
22
     * File url to test convert service.
23
     *
24
     * @var string
25
     */
26
    private $convertFileUrl;
0 ignored issues
show
introduced by
The private property $convertFileUrl is not used, and could be removed.
Loading history...
27
    private $convertFilePath;
0 ignored issues
show
introduced by
The private property $convertFilePath is not used, and could be removed.
Loading history...
28
29
    public function __construct($settingsManager, $httpClient, $jwtManager)
30
    {
31
        parent::__construct($settingsManager, $httpClient, $jwtManager);
32
    }
33
34
    public function getFileUrlForConvert()
35
    {
36
        $data = [
37
            'type' => 'empty',
38
            'courseId' => api_get_course_int_id(),
39
            'userId' => api_get_user_id(),
40
            'sessionId' => api_get_session_id(),
41
        ];
42
        $hashUrl = $this->jwtManager->getHash($data);
0 ignored issues
show
Bug introduced by
The method getHash() does not exist on Onlyoffice\DocsIntegrati...ger\Security\JwtManager. Since it exists in all sub-types, consider adding an abstract or default implementation to Onlyoffice\DocsIntegrati...ger\Security\JwtManager. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

42
        /** @scrutinizer ignore-call */ 
43
        $hashUrl = $this->jwtManager->getHash($data);
Loading history...
43
44
        return api_get_path(WEB_PLUGIN_PATH).'onlyoffice/callback.php?hash='.$hashUrl;
45
    }
46
}
47