MediaWiki REL1_34
SimpleCallbacks.php
Go to the documentation of this file.
1<?php
2
4
6
16class SimpleCallbacks implements Callbacks {
17
19 private $params;
20
22 private $files;
23
25 private $conditions = [];
26
31 public function __construct( array $params, array $files = [] ) {
32 $this->params = $params;
33 $this->files = $files;
34 }
35
36 public function hasParam( $name, array $options ) {
37 return isset( $this->params[$name] );
38 }
39
40 public function getValue( $name, $default, array $options ) {
41 return $this->params[$name] ?? $default;
42 }
43
44 public function hasUpload( $name, array $options ) {
45 return isset( $this->files[$name] );
46 }
47
48 public function getUploadedFile( $name, array $options ) {
49 $file = $this->files[$name] ?? null;
50 if ( $file && !$file instanceof UploadedFile ) {
51 $file = new UploadedFile( $file );
52 $this->files[$name] = $file;
53 }
54 return $file;
55 }
56
57 public function recordCondition( ValidationException $condition, array $options ) {
58 $this->conditions[] = $condition;
59 }
60
65 public function getRecordedConditions() {
66 return $this->conditions;
67 }
68
72 public function clearRecordedConditions() {
73 $this->conditions = [];
74 }
75
76 public function useHighLimits( array $options ) {
77 return !empty( $options['useHighLimits'] );
78 }
79
80}
Simple Callbacks implementation for $_GET/$_POST/$_FILES data.
__construct(array $params, array $files=[])
string string[][] $params
$_GET/$_POST data
array UploadedFile[] $files
$_FILES data or UploadedFile instances
useHighLimits(array $options)
Indicate whether "high limits" should be used.
hasParam( $name, array $options)
Test if a parameter exists in the request.
getUploadedFile( $name, array $options)
Fetch data for a file upload.
getValue( $name, $default, array $options)
Fetch a value from the request.
array $conditions
Any recorded conditions.
clearRecordedConditions()
Clear any recorded conditions.
getRecordedConditions()
Fetch any recorded conditions.
hasUpload( $name, array $options)
Test if a parameter exists as an upload in the request.
recordCondition(ValidationException $condition, array $options)
Record non-fatal conditions.
A simple implementation of UploadedFileInterface.
Interface defining callbacks needed by ParamValidator.
Definition Callbacks.php:20
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
Definition router.php:42