-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathadmin.php
More file actions
14217 lines (12681 loc) · 530 KB
/
admin.php
File metadata and controls
14217 lines (12681 loc) · 530 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* PHP-CRUD-ADMIN v2 License: MIT
* Maurits van der Schee: maurits@vdschee.nl
* https://github.com/mevdschee/php-crud-admin
*
* Dependencies:
* - vendor/psr/*: PHP-FIG
* https://github.com/php-fig
* - vendor/nyholm/*: Tobias Nyholm
* https://github.com/Nyholm
**/
namespace {
global $_HTML;
$_HTML = array();
}
// file: templates/column/create.html
namespace {
$_HTML['column/create'] = <<<'END_OF_HTML'
<ul class="breadcrumb">
<li><a href="{{base}}/admin/table/list">home</a></li>
<li><a href="{{base}}/admin/column/{{table}}/list">{{table}}</a></li>
</ul>
<h2>create column</h2>
<form class="form-horizontal" method="post">
{{for:field:key:form}}
<div class="form-group">
<label class="control-label col-sm-2" for="{{key}}">{{key}}{{if:field.required}}*{{endif}}</label>
<div class="col-sm-7">
{{if:field.type|eq("select")}}
<select id="{{key}}" name="{{key}}" class="form-control"{{if:field.required}} required{{endif}}>
<option value=""></option>
{{for:v:k:field.values}}
<option value="{{k}}"{{if:k|eq(field.value)}} selected{{endif}}>{{v}}</option>
{{endfor}}
</select>
{{else}}
<input class="form-control" id="{{key}}" name="{{key}}" type="{{field.type}}" value="{{field.value}}"{{if:field.required}} required{{endif}}>
{{endif}}
</div>
</div>
{{endfor}}
<button type="submit" class="btn btn-primary">Save</button>
</form>
END_OF_HTML;
}
// file: templates/column/created.html
namespace {
$_HTML['column/created'] = <<<'END_OF_HTML'
<ul class="breadcrumb">
<li><a href="{{base}}/admin/table/list">home</a></li>
<li><a href="{{base}}/admin/column/{{table}}/list">{{table}}</a></li>
</ul>
<h2>create column</h2>
<p>Created {{name}}: {{success}}</p>
<p><a href="{{base}}/admin/column/{{table}}/list" class="btn btn-primary">Ok</a></p>
END_OF_HTML;
}
// file: templates/column/delete.html
namespace {
$_HTML['column/delete'] = <<<'END_OF_HTML'
<ul class="breadcrumb">
<li><a href="{{base}}/admin/table/list">home</a></li>
<li><a href="{{base}}/admin/column/{{table}}/list">{{table}}</a></li>
</ul>
<h2>delete column</h2>
<p>You are about to delete the column named "{{name}}"</p>
<p>The action cannot be undone.</p>
<form method="post">
<input type="hidden" name="name" value="{{name}}"/>
<button type="submit" class="btn btn-danger">Delete</button>
<a href="{{base}}/admin/column/{{table}}/update/{{name}}" class="btn btn-default">Cancel</a>
</form>
END_OF_HTML;
}
// file: templates/column/deleted.html
namespace {
$_HTML['column/deleted'] = <<<'END_OF_HTML'
<ul class="breadcrumb">
<li><a href="{{base}}/admin/table/list">home</a></li>
<li><a href="{{base}}/admin/column/{{table}}/list">{{table}}</a></li>
</ul>
<h2>delete column</h2>
<p>Deleted {{name}}: {{success}}</p>
<p><a href="{{base}}/admin/column/{{table}}/list" class="btn btn-primary">Ok</a></p>
END_OF_HTML;
}
// file: templates/column/list.html
namespace {
$_HTML['column/list'] = <<<'END_OF_HTML'
<ul class="breadcrumb">
<li><a href="{{base}}/admin/table/list">home</a></li>
<li><a href="{{base}}/admin/column/{{table}}/list">{{table}}</a></li>
</ul>
<h2>list columns</h2>
<table class="table"><thead>
<tr>
<th></th>
<th>name</th>
<th>type</th>
<th>length</th>
<th>precision</th>
<th>scale</th>
<th>nullable</th>
<th>pk</th>
<th>fk</th>
</tr>
</thead><tbody>
{{for:column:columns}}
<tr>
<td><a href="{{base}}/admin/column/{{table}}/update/{{column.name}}">edit</a></td>
<td>{{column.name}}</td>
<td>{{column.type}}</td>
<td>{{column.length|or("-")}}</td>
<td>{{column.precision|or("-")}}</td>
<td>{{column.scale|or("-")}}</td>
<td>{{column.nullable|bool("yes","-")}}</td>
<td>{{column.pk|bool("yes","-")}}</td>
<td>
{{if:column.fk}}
<a href="{{base}}/admin/column/{{column.fk}}/list">{{column.fk}}</a>
{{else}}
-
{{endif}}
</td>
</tr>
{{endfor}}
</tbody></table>
<p>
<a class="btn btn-primary" href="{{base}}/admin/column/{{table}}/create">Add column</a>
<a class="btn btn-danger" href="{{base}}/admin/table/delete/{{table}}">Delete table</a>
</p>
END_OF_HTML;
}
// file: templates/column/update.html
namespace {
$_HTML['column/update'] = <<<'END_OF_HTML'
<ul class="breadcrumb">
<li><a href="{{base}}/admin/table/list">home</a></li>
<li><a href="{{base}}/admin/column/{{table}}/list">{{table}}</a></li>
</ul>
<h2>update column</h2>
<form class="form-horizontal" method="post">
{{for:field:key:form}}
<div class="form-group">
<label class="control-label col-sm-2" for="{{key}}">{{key}}{{if:field.required}}*{{endif}}</label>
<div class="col-sm-7">
{{if:field.type|eq("select")}}
<select id="{{key}}" name="{{key}}" class="form-control"{{if:field.required}} required{{endif}}>
<option value=""></option>
{{for:v:k:field.values}}
<option value="{{k}}"{{if:k|eq(field.value)}} selected{{endif}}>{{v}}</option>
{{endfor}}
</select>
{{else}}
<input class="form-control" id="{{key}}" name="{{key}}" type="{{field.type}}" value="{{field.value}}"{{if:field.required}} required{{endif}}>
{{endif}}
</div>
</div>
{{endfor}}
<p>
<button type="submit" class="btn btn-primary">Save</button>
<a class="btn btn-danger" href="{{base}}/admin/column/{{table}}/delete/{{name}}">Delete</a>
</p>
</form>
END_OF_HTML;
}
// file: templates/column/updated.html
namespace {
$_HTML['column/updated'] = <<<'END_OF_HTML'
<ul class="breadcrumb">
<li><a href="{{base}}/admin/table/list">home</a></li>
<li><a href="{{base}}/admin/column/{{table}}/list">{{table}}</a></li>
</ul>
<h2>update column</h2>
<p>Updated {{name}}: {{success}}</p>
<p><a href="{{base}}/admin/column/{{table}}/list" class="btn btn-primary">Ok</a></p>
END_OF_HTML;
}
// file: templates/error/show.html
namespace {
$_HTML['error/show'] = <<<'END_OF_HTML'
<ul class="breadcrumb">
<li><a href="{{base}}/admin/table/list">home</a></li>
</ul>
<h2>error</h2>
<strong>code:</strong><br/>
<p>{{code}}</p>
<strong>message:</strong><br/>
<p>{{message}}</p>
<strong>details:</strong><br/>
<pre>{{details}}</pre>
END_OF_HTML;
}
// file: templates/layouts/default.html
namespace {
$_HTML['layouts/default'] = <<<'END_OF_HTML'
<!DOCTYPE html>
<html lang="en">
<head>
<title>PHP-CRUD-ADMIN</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap-theme.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="{{base}}/admin/table/list">PHP-CRUD-ADMIN</a>
</div>
</div>
</nav>
<div class="row">
<div class="col-md-3">
<ul class="nav nav-pills nav-stacked">
{{for:item:menu}}
<li{{if:item|eq(table)}} class="active"{{endif}}>
<a href="{{base}}/admin/column/{{item}}/list">{{item}}</a>
</li>
{{endfor}}
</ul>
</div>
<div class="col-md-9">
{{content}}
</div>
</div>
</div>
</body>
</html>
END_OF_HTML;
}
// file: templates/layouts/error.html
namespace {
$_HTML['layouts/error'] = <<<'END_OF_HTML'
<!DOCTYPE html>
<html lang="en">
<head>
<title>PHP-CRUD-ADMIN</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap-theme.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="{{base}}/admin/table/list">PHP-CRUD-ADMIN</a>
</div>
</div>
</nav>
<div class="row">
<div class="col-md-3">
<ul class="nav nav-pills nav-stacked">
{{for:item:menu}}
<li{{if:item|eq(table)}} class="active"{{endif}}>
<a href="{{base}}/admin/column/{{item}}/list">{{item}}</a>
</li>
{{endfor}}
</ul>
</div>
<div class="col-md-9">
{{content}}
</div>
</div>
</div>
</body>
</html>
END_OF_HTML;
}
// file: templates/table/create.html
namespace {
$_HTML['table/create'] = <<<'END_OF_HTML'
<ul class="breadcrumb">
<li><a href="{{base}}/admin/table/list">home</a></li>
</ul>
<h2>create table</h2>
<form class="form-horizontal" method="post">
{{for:field:key:form}}
<div class="form-group">
<label class="control-label col-sm-2" for="{{key}}">{{key}}{{if:field.required}}*{{endif}}</label>
<div class="col-sm-7">
{{if:field.type|eq("select")}}
<select id="{{key}}" name="{{key}}" class="form-control"{{if:field.required}} required{{endif}}>
<option value=""></option>
{{for:v:k:field.values}}
<option value="{{k}}"{{if:k|eq(field.value)}} selected{{endif}}>{{v}}</option>
{{endfor}}
</select>
{{else}}
<input class="form-control" id="{{key}}" name="{{key}}" type="{{field.type}}" value="{{field.value}}"{{if:field.required}} required{{endif}}>
{{endif}}
</div>
</div>
{{endfor}}
<button type="submit" class="btn btn-primary">Save</button>
</form>
END_OF_HTML;
}
// file: templates/table/created.html
namespace {
$_HTML['table/created'] = <<<'END_OF_HTML'
<ul class="breadcrumb">
<li><a href="{{base}}/admin/table/list">home</a></li>
</ul>
<h2>create table</h2>
<p>Created {{name}}: {{success}}</p>
<p><a href="{{base}}/admin/table/list" class="btn btn-primary">Ok</a></p>
END_OF_HTML;
}
// file: templates/table/delete.html
namespace {
$_HTML['table/delete'] = <<<'END_OF_HTML'
<ul class="breadcrumb">
<li><a href="{{base}}/admin/table/list">home</a></li>
<li><a href="{{base}}/admin/column/{{table}}/list">{{table}}</a></li>
</ul>
<h2>delete table</h2>
<p>The action cannot be undone.</p>
<form method="post">
<input type="hidden" name="name" value="{{table}}"/>
<button type="submit" class="btn btn-danger">Delete</button>
<a href="{{base}}/admin/column/{{table}}/list" class="btn btn-default">Cancel</a>
</form>
END_OF_HTML;
}
// file: templates/table/deleted.html
namespace {
$_HTML['table/deleted'] = <<<'END_OF_HTML'
<ul class="breadcrumb">
<li><a href="{{base}}/admin/table/list">home</a></li>
<li><a href="{{base}}/admin/column/{{table}}/list">{{table}}</a></li>
</ul>
<h2>delete table</h2>
<p>Deleted {{table}}: {{success}}</p>
<p><a href="{{base}}/admin/table/list" class="btn btn-primary">Ok</a></p>
END_OF_HTML;
}
// file: templates/table/list.html
namespace {
$_HTML['table/list'] = <<<'END_OF_HTML'
<ul class="breadcrumb">
<li><a href="{{base}}/admin/table/list">home</a></li>
</ul>
<h2>list tables</h2>
<table class="table"><thead>
<tr>
<th>name</th>
</tr>
</thead><tbody>
{{for:table:tables}}
<tr>
<td><a href="{{base}}/admin/column/{{table}}/list">{{table}}</a></td>
</tr>
{{endfor}}
</tbody></table>
<p><a href="{{base}}/admin/table/create" class="btn btn-primary">Add table</a></p>
END_OF_HTML;
}
// file: vendor/psr/http-factory/src/RequestFactoryInterface.php
namespace Psr\Http\Message {
interface RequestFactoryInterface
{
/**
* Create a new request.
*
* @param string $method The HTTP method associated with the request.
* @param UriInterface|string $uri The URI associated with the request. If
* the value is a string, the factory MUST create a UriInterface
* instance based on it.
*
* @return RequestInterface
*/
public function createRequest(string $method, $uri): RequestInterface;
}
}
// file: vendor/psr/http-factory/src/ResponseFactoryInterface.php
namespace Psr\Http\Message {
interface ResponseFactoryInterface
{
/**
* Create a new response.
*
* @param int $code HTTP status code; defaults to 200
* @param string $reasonPhrase Reason phrase to associate with status code
* in generated response; if none is provided implementations MAY use
* the defaults as suggested in the HTTP specification.
*
* @return ResponseInterface
*/
public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface;
}
}
// file: vendor/psr/http-factory/src/ServerRequestFactoryInterface.php
namespace Psr\Http\Message {
interface ServerRequestFactoryInterface
{
/**
* Create a new server request.
*
* Note that server-params are taken precisely as given - no parsing/processing
* of the given values is performed, and, in particular, no attempt is made to
* determine the HTTP method or URI, which must be provided explicitly.
*
* @param string $method The HTTP method associated with the request.
* @param UriInterface|string $uri The URI associated with the request. If
* the value is a string, the factory MUST create a UriInterface
* instance based on it.
* @param array $serverParams Array of SAPI parameters with which to seed
* the generated request instance.
*
* @return ServerRequestInterface
*/
public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface;
}
}
// file: vendor/psr/http-factory/src/StreamFactoryInterface.php
namespace Psr\Http\Message {
interface StreamFactoryInterface
{
/**
* Create a new stream from a string.
*
* The stream SHOULD be created with a temporary resource.
*
* @param string $content String content with which to populate the stream.
*
* @return StreamInterface
*/
public function createStream(string $content = ''): StreamInterface;
/**
* Create a stream from an existing file.
*
* The file MUST be opened using the given mode, which may be any mode
* supported by the `fopen` function.
*
* The `$filename` MAY be any string supported by `fopen()`.
*
* @param string $filename Filename or stream URI to use as basis of stream.
* @param string $mode Mode with which to open the underlying filename/stream.
*
* @return StreamInterface
* @throws \RuntimeException If the file cannot be opened.
* @throws \InvalidArgumentException If the mode is invalid.
*/
public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface;
/**
* Create a new stream from an existing resource.
*
* The stream MUST be readable and may be writable.
*
* @param resource $resource PHP resource to use as basis of stream.
*
* @return StreamInterface
*/
public function createStreamFromResource($resource): StreamInterface;
}
}
// file: vendor/psr/http-factory/src/UploadedFileFactoryInterface.php
namespace Psr\Http\Message {
interface UploadedFileFactoryInterface
{
/**
* Create a new uploaded file.
*
* If a size is not provided it will be determined by checking the size of
* the file.
*
* @see http://php.net/manual/features.file-upload.post-method.php
* @see http://php.net/manual/features.file-upload.errors.php
*
* @param StreamInterface $stream Underlying stream representing the
* uploaded file content.
* @param int $size in bytes
* @param int $error PHP file upload error
* @param string $clientFilename Filename as provided by the client, if any.
* @param string $clientMediaType Media type as provided by the client, if any.
*
* @return UploadedFileInterface
*
* @throws \InvalidArgumentException If the file resource is not readable.
*/
public function createUploadedFile(
StreamInterface $stream,
int $size = null,
int $error = \UPLOAD_ERR_OK,
string $clientFilename = null,
string $clientMediaType = null
): UploadedFileInterface;
}
}
// file: vendor/psr/http-factory/src/UriFactoryInterface.php
namespace Psr\Http\Message {
interface UriFactoryInterface
{
/**
* Create a new URI.
*
* @param string $uri
*
* @return UriInterface
*
* @throws \InvalidArgumentException If the given URI cannot be parsed.
*/
public function createUri(string $uri = ''): UriInterface;
}
}
// file: vendor/psr/http-message/src/MessageInterface.php
namespace Psr\Http\Message {
/**
* HTTP messages consist of requests from a client to a server and responses
* from a server to a client. This interface defines the methods common to
* each.
*
* Messages are considered immutable; all methods that might change state MUST
* be implemented such that they retain the internal state of the current
* message and return an instance that contains the changed state.
*
* @link http://www.ietf.org/rfc/rfc7230.txt
* @link http://www.ietf.org/rfc/rfc7231.txt
*/
interface MessageInterface
{
/**
* Retrieves the HTTP protocol version as a string.
*
* The string MUST contain only the HTTP version number (e.g., "1.1", "1.0").
*
* @return string HTTP protocol version.
*/
public function getProtocolVersion();
/**
* Return an instance with the specified HTTP protocol version.
*
* The version string MUST contain only the HTTP version number (e.g.,
* "1.1", "1.0").
*
* This method MUST be implemented in such a way as to retain the
* immutability of the message, and MUST return an instance that has the
* new protocol version.
*
* @param string $version HTTP protocol version
* @return static
*/
public function withProtocolVersion($version);
/**
* Retrieves all message header values.
*
* The keys represent the header name as it will be sent over the wire, and
* each value is an array of strings associated with the header.
*
* // Represent the headers as a string
* foreach ($message->getHeaders() as $name => $values) {
* echo $name . ": " . implode(", ", $values);
* }
*
* // Emit headers iteratively:
* foreach ($message->getHeaders() as $name => $values) {
* foreach ($values as $value) {
* header(sprintf('%s: %s', $name, $value), false);
* }
* }
*
* While header names are not case-sensitive, getHeaders() will preserve the
* exact case in which headers were originally specified.
*
* @return string[][] Returns an associative array of the message's headers. Each
* key MUST be a header name, and each value MUST be an array of strings
* for that header.
*/
public function getHeaders();
/**
* Checks if a header exists by the given case-insensitive name.
*
* @param string $name Case-insensitive header field name.
* @return bool Returns true if any header names match the given header
* name using a case-insensitive string comparison. Returns false if
* no matching header name is found in the message.
*/
public function hasHeader($name);
/**
* Retrieves a message header value by the given case-insensitive name.
*
* This method returns an array of all the header values of the given
* case-insensitive header name.
*
* If the header does not appear in the message, this method MUST return an
* empty array.
*
* @param string $name Case-insensitive header field name.
* @return string[] An array of string values as provided for the given
* header. If the header does not appear in the message, this method MUST
* return an empty array.
*/
public function getHeader($name);
/**
* Retrieves a comma-separated string of the values for a single header.
*
* This method returns all of the header values of the given
* case-insensitive header name as a string concatenated together using
* a comma.
*
* NOTE: Not all header values may be appropriately represented using
* comma concatenation. For such headers, use getHeader() instead
* and supply your own delimiter when concatenating.
*
* If the header does not appear in the message, this method MUST return
* an empty string.
*
* @param string $name Case-insensitive header field name.
* @return string A string of values as provided for the given header
* concatenated together using a comma. If the header does not appear in
* the message, this method MUST return an empty string.
*/
public function getHeaderLine($name);
/**
* Return an instance with the provided value replacing the specified header.
*
* While header names are case-insensitive, the casing of the header will
* be preserved by this function, and returned from getHeaders().
*
* This method MUST be implemented in such a way as to retain the
* immutability of the message, and MUST return an instance that has the
* new and/or updated header and value.
*
* @param string $name Case-insensitive header field name.
* @param string|string[] $value Header value(s).
* @return static
* @throws \InvalidArgumentException for invalid header names or values.
*/
public function withHeader($name, $value);
/**
* Return an instance with the specified header appended with the given value.
*
* Existing values for the specified header will be maintained. The new
* value(s) will be appended to the existing list. If the header did not
* exist previously, it will be added.
*
* This method MUST be implemented in such a way as to retain the
* immutability of the message, and MUST return an instance that has the
* new header and/or value.
*
* @param string $name Case-insensitive header field name to add.
* @param string|string[] $value Header value(s).
* @return static
* @throws \InvalidArgumentException for invalid header names or values.
*/
public function withAddedHeader($name, $value);
/**
* Return an instance without the specified header.
*
* Header resolution MUST be done without case-sensitivity.
*
* This method MUST be implemented in such a way as to retain the
* immutability of the message, and MUST return an instance that removes
* the named header.
*
* @param string $name Case-insensitive header field name to remove.
* @return static
*/
public function withoutHeader($name);
/**
* Gets the body of the message.
*
* @return StreamInterface Returns the body as a stream.
*/
public function getBody();
/**
* Return an instance with the specified message body.
*
* The body MUST be a StreamInterface object.
*
* This method MUST be implemented in such a way as to retain the
* immutability of the message, and MUST return a new instance that has the
* new body stream.
*
* @param StreamInterface $body Body.
* @return static
* @throws \InvalidArgumentException When the body is not valid.
*/
public function withBody(StreamInterface $body);
}
}
// file: vendor/psr/http-message/src/RequestInterface.php
namespace Psr\Http\Message {
/**
* Representation of an outgoing, client-side request.
*
* Per the HTTP specification, this interface includes properties for
* each of the following:
*
* - Protocol version
* - HTTP method
* - URI
* - Headers
* - Message body
*
* During construction, implementations MUST attempt to set the Host header from
* a provided URI if no Host header is provided.
*
* Requests are considered immutable; all methods that might change state MUST
* be implemented such that they retain the internal state of the current
* message and return an instance that contains the changed state.
*/
interface RequestInterface extends MessageInterface
{
/**
* Retrieves the message's request target.
*
* Retrieves the message's request-target either as it will appear (for
* clients), as it appeared at request (for servers), or as it was
* specified for the instance (see withRequestTarget()).
*
* In most cases, this will be the origin-form of the composed URI,
* unless a value was provided to the concrete implementation (see
* withRequestTarget() below).
*
* If no URI is available, and no request-target has been specifically
* provided, this method MUST return the string "/".
*
* @return string
*/
public function getRequestTarget();
/**
* Return an instance with the specific request-target.
*
* If the request needs a non-origin-form request-target — e.g., for
* specifying an absolute-form, authority-form, or asterisk-form —
* this method may be used to create an instance with the specified
* request-target, verbatim.
*
* This method MUST be implemented in such a way as to retain the
* immutability of the message, and MUST return an instance that has the
* changed request target.
*
* @link http://tools.ietf.org/html/rfc7230#section-5.3 (for the various
* request-target forms allowed in request messages)
* @param mixed $requestTarget
* @return static
*/
public function withRequestTarget($requestTarget);
/**
* Retrieves the HTTP method of the request.
*
* @return string Returns the request method.
*/
public function getMethod();
/**
* Return an instance with the provided HTTP method.
*
* While HTTP method names are typically all uppercase characters, HTTP
* method names are case-sensitive and thus implementations SHOULD NOT
* modify the given string.
*
* This method MUST be implemented in such a way as to retain the
* immutability of the message, and MUST return an instance that has the
* changed request method.
*
* @param string $method Case-sensitive method.
* @return static
* @throws \InvalidArgumentException for invalid HTTP methods.
*/
public function withMethod($method);
/**
* Retrieves the URI instance.
*
* This method MUST return a UriInterface instance.
*
* @link http://tools.ietf.org/html/rfc3986#section-4.3
* @return UriInterface Returns a UriInterface instance
* representing the URI of the request.
*/
public function getUri();
/**
* Returns an instance with the provided URI.
*
* This method MUST update the Host header of the returned request by
* default if the URI contains a host component. If the URI does not
* contain a host component, any pre-existing Host header MUST be carried
* over to the returned request.
*
* You can opt-in to preserving the original state of the Host header by
* setting `$preserveHost` to `true`. When `$preserveHost` is set to
* `true`, this method interacts with the Host header in the following ways:
*
* - If the Host header is missing or empty, and the new URI contains
* a host component, this method MUST update the Host header in the returned
* request.
* - If the Host header is missing or empty, and the new URI does not contain a
* host component, this method MUST NOT update the Host header in the returned
* request.
* - If a Host header is present and non-empty, this method MUST NOT update
* the Host header in the returned request.
*
* This method MUST be implemented in such a way as to retain the
* immutability of the message, and MUST return an instance that has the
* new UriInterface instance.
*
* @link http://tools.ietf.org/html/rfc3986#section-4.3
* @param UriInterface $uri New request URI to use.
* @param bool $preserveHost Preserve the original state of the Host header.
* @return static
*/
public function withUri(UriInterface $uri, $preserveHost = false);
}
}
// file: vendor/psr/http-message/src/ResponseInterface.php
namespace Psr\Http\Message {
/**
* Representation of an outgoing, server-side response.
*
* Per the HTTP specification, this interface includes properties for
* each of the following:
*
* - Protocol version
* - Status code and reason phrase
* - Headers
* - Message body
*
* Responses are considered immutable; all methods that might change state MUST
* be implemented such that they retain the internal state of the current
* message and return an instance that contains the changed state.
*/
interface ResponseInterface extends MessageInterface
{
/**
* Gets the response status code.
*
* The status code is a 3-digit integer result code of the server's attempt
* to understand and satisfy the request.
*
* @return int Status code.
*/
public function getStatusCode();
/**
* Return an instance with the specified status code and, optionally, reason phrase.
*
* If no reason phrase is specified, implementations MAY choose to default
* to the RFC 7231 or IANA recommended reason phrase for the response's
* status code.
*
* This method MUST be implemented in such a way as to retain the
* immutability of the message, and MUST return an instance that has the
* updated status and reason phrase.
*
* @link http://tools.ietf.org/html/rfc7231#section-6
* @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
* @param int $code The 3-digit integer result code to set.
* @param string $reasonPhrase The reason phrase to use with the
* provided status code; if none is provided, implementations MAY
* use the defaults as suggested in the HTTP specification.
* @return static
* @throws \InvalidArgumentException For invalid status code arguments.
*/
public function withStatus($code, $reasonPhrase = '');
/**
* Gets the response reason phrase associated with the status code.
*
* Because a reason phrase is not a required element in a response
* status line, the reason phrase value MAY be null. Implementations MAY
* choose to return the default RFC 7231 recommended reason phrase (or those
* listed in the IANA HTTP Status Code Registry) for the response's
* status code.
*
* @link http://tools.ietf.org/html/rfc7231#section-6
* @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
* @return string Reason phrase; must return an empty string if none present.
*/
public function getReasonPhrase();
}
}
// file: vendor/psr/http-message/src/ServerRequestInterface.php
namespace Psr\Http\Message {
/**
* Representation of an incoming, server-side HTTP request.
*
* Per the HTTP specification, this interface includes properties for
* each of the following:
*
* - Protocol version
* - HTTP method
* - URI
* - Headers
* - Message body
*
* Additionally, it encapsulates all data as it has arrived to the
* application from the CGI and/or PHP environment, including:
*
* - The values represented in $_SERVER.
* - Any cookies provided (generally via $_COOKIE)
* - Query string arguments (generally via $_GET, or as parsed via parse_str())
* - Upload files, if any (as represented by $_FILES)
* - Deserialized body parameters (generally from $_POST)
*
* $_SERVER values MUST be treated as immutable, as they represent application
* state at the time of request; as such, no methods are provided to allow
* modification of those values. The other values provide such methods, as they
* can be restored from $_SERVER or the request body, and may need treatment
* during the application (e.g., body parameters may be deserialized based on
* content type).
*