1 | <?php |
||
15 | class FileUploader { |
||
16 | |||
17 | /** |
||
18 | * @var MediawikiApi |
||
19 | */ |
||
20 | private $api; |
||
21 | |||
22 | /** @var int */ |
||
23 | protected $chunkSize; |
||
24 | |||
25 | /** |
||
26 | * @param MediawikiApi $api |
||
27 | */ |
||
28 | public function __construct( MediawikiApi $api ) { |
||
31 | |||
32 | /** |
||
33 | * Set the chunk size used for chunked uploading. |
||
34 | * |
||
35 | * Chunked uploading is available in MediaWiki 1.20 and above, although prior to version 1.25, |
||
36 | * SVGs could not be uploaded via chunked uploading. |
||
37 | * |
||
38 | * @link https://www.mediawiki.org/wiki/API:Upload#Chunked_uploading |
||
39 | * |
||
40 | * @param int $chunkSize In bytes. |
||
41 | */ |
||
42 | public function setChunkSize( $chunkSize ) { |
||
45 | |||
46 | /** |
||
47 | * Upload a file. |
||
48 | * |
||
49 | * @param string $targetName The name to give the file on the wiki (no 'File:' prefix required). |
||
50 | * @param string $location Can be local path or remote URL. |
||
51 | * @param string $text Initial page text for new files. |
||
52 | * @param string $comment Upload comment. Also used as the initial page text for new files if |
||
53 | * text parameter not provided. |
||
54 | * @param string $watchlist Unconditionally add or remove the page from your watchlist, use |
||
55 | * preferences or do not change watch. Possible values: 'watch', 'preferences', 'nochange'. |
||
56 | * @param bool $ignoreWarnings Ignore any warnings. This must be set to upload a new version of |
||
57 | * an existing image. |
||
58 | * |
||
59 | * @return bool |
||
60 | */ |
||
61 | public function upload( |
||
106 | |||
107 | /** |
||
108 | * Upload a file by chunks and get the parameters for the final upload call. |
||
109 | * @param mixed[] $params The request parameters. |
||
110 | * @return mixed[] |
||
111 | * @throws Exception |
||
112 | */ |
||
113 | protected function uploadByChunks( $params ) { |
||
152 | } |
||
153 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.