GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (66)

src/Client/Commands/ScoUpload.php (6 issues)

1
<?php
2
3
namespace Soheilrt\AdobeConnectClient\Client\Commands;
4
5
use InvalidArgumentException;
6
use Soheilrt\AdobeConnectClient\Client\Abstracts\Command;
7
use Soheilrt\AdobeConnectClient\Client\Converter\Converter;
8
use Soheilrt\AdobeConnectClient\Client\Entities\SCO;
9
use Soheilrt\AdobeConnectClient\Client\Filter;
10
use Soheilrt\AdobeConnectClient\Client\Helpers\StatusValidate;
11
use SplFileInfo;
12
13
/**
14
 * Uploads a file to the server and then builds the file, if necessary.
15
 *
16
 * Create a new File SCO or update if exists in the folder (a SCO Meeting) and upload the file.
17
 *
18
 * More info see {@link https://helpx.adobe.com/adobe-connect/webservices/sco-upload.html}
19
 *
20
 * The filename (filePath) needs the extension for Adobe Connect purpose.
21
 *
22
 * The Adobe Connect API Documentation says to call the sco-info and analyse the status info
23
 * to determine if upload is ready, but the sco-info does not inform the status attribute.
24
 *
25
 * So we analyse the files array wich is returned by the sco-upload, but this info is deprecated.
26
 */
27
class ScoUpload extends Command
28
{
29
    /**
30
     * @var int
31
     */
32
    protected $folderId;
33
34
    /**
35
     * @var string
36
     */
37
    protected $resourceName;
38
39
    /**
40
     * @var SplFileInfo|resource
41
     */
42
    protected $file;
43
44
    /**
45
     * @var SCO|mixed
46
     */
47
    protected $sco;
48
49
    /**
50
     * @param int                  $folderId The Folder (SCO ID) owned the file
51
     * @param string               $resourceName
52
     * @param SplFileInfo|resource $file
53
     *
54
     * @throws InvalidArgumentException
55
     */
56
    public function __construct($folderId, $resourceName, $file)
57
    {
58
        if (!is_resource($file) && !($file instanceof SplFileInfo)) {
0 ignored issues
show
$file is always a sub-type of SplFileInfo.
Loading history...
59
            throw new InvalidArgumentException('File need be a valid resource or a SplFileInfo object');
60
        }
61
        $this->folderId = (int) $folderId;
62
        $this->resourceName = (string) $resourceName;
63
        $this->file = $file;
64
        $this->sco = $this->getEntity('sco');
65
    }
66
67
    /**
68
     * {@inheritdoc}
69
     *
70
     * @return int|null The Content SCO ID or null if fail
71
     */
72
    protected function process()
73
    {
74
        $sco = $this->getSco();
75
76
        $response = Converter::convert(
77
            $this->client->doPost(
0 ignored issues
show
The method doPost() does not exist on Soheilrt\AdobeConnectCli...lient\Abstracts\Command. ( Ignorable by Annotation )

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

77
            $this->client->/** @scrutinizer ignore-call */ 
78
                           doPost(

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
78
                [
79
                    'file' => $this->file,
80
                ],
81
                [
82
                    'action'  => 'sco-upload',
83
                    'sco-id'  => $sco->getScoId(),
84
                    'session' => $this->client->getSession(),
0 ignored issues
show
The method getSession() does not exist on Soheilrt\AdobeConnectCli...lient\Abstracts\Command. ( Ignorable by Annotation )

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

84
                    'session' => $this->client->/** @scrutinizer ignore-call */ getSession(),

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
85
                ]
86
            )
87
        );
88
        StatusValidate::validate($response['status']);
89
90
        return empty($response['files']) ? null : $sco->getScoId();
0 ignored issues
show
Bug Best Practice introduced by
The expression return empty($response['...null : $sco->getScoId() also could return the type string which is incompatible with the documented return type integer|null.
Loading history...
91
    }
92
93
    /**
94
     * Get the SCO content if exists or create one.
95
     *
96
     * @return SCO
97
     */
98
    protected function getSco()
99
    {
100
        $scos = $this->client->scoContents(
0 ignored issues
show
The method scoContents() does not exist on Soheilrt\AdobeConnectCli...lient\Abstracts\Command. ( Ignorable by Annotation )

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

100
        /** @scrutinizer ignore-call */ 
101
        $scos = $this->client->scoContents(

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
101
            $this->folderId,
102
            Filter::instance()
103
                ->equals('folderId', $this->folderId)
104
                ->equals('name', $this->resourceName)
105
                ->equals('type', SCO::TYPE_CONTENT)
106
        );
107
108
        return empty($scos) ? $this->createSco() : reset($scos);
109
    }
110
111
    /**
112
     * Create a SCO content.
113
     *
114
     * @return SCO
115
     */
116
    protected function createSco()
117
    {
118
        return $this->client->scoCreate(
0 ignored issues
show
The method scoCreate() does not exist on Soheilrt\AdobeConnectCli...lient\Abstracts\Command. ( Ignorable by Annotation )

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

118
        return $this->client->/** @scrutinizer ignore-call */ scoCreate(

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
119
            SCO::instance()
120
                ->setType(SCO::TYPE_CONTENT)
121
                ->setFolderId($this->folderId)
122
                ->setName($this->resourceName)
123
        );
124
    }
125
}
126