Page Menu
Home
GitPull.it
Search
Configure Global Search
Log In
Files
F15178369
Answers.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
Unknown
Size
771 B
Referenced Files
None
Subscribers
None
Answers.php
View Options
<?php
namespace
Wikicaptcha
\
Backend
;
use
Psr
\
Http
\
Message
\
ResponseInterface
;
use
Psr
\
Http
\
Message
\
ServerRequestInterface
;
use
Psr
\
Http
\
Server
\
RequestHandlerInterface
;
use
Zend
\
Diactoros
\
Response
\
JsonResponse
;
class
Answers
implements
RequestHandlerInterface
{
public
function
handle
(
ServerRequestInterface
$request
)
:
ResponseInterface
{
$payload
=
$request
->
getAttribute
(
'ParsedBody'
,
[
]
)
;
$questions
=
WikiApiDto
::
fromArray
(
$payload
)
;
// TODO: check that user is a human or a bot
//return new JsonResponse($questions);
// A real system would probably not give this information to the user, but to the server
if
(
(bool)
mt_rand
(
0
,
1
)
)
{
return
new
JsonResponse
(
[
'human'
=>
true
]
)
;
}
else
{
return
new
JsonResponse
(
[
'human'
=>
false
]
)
;
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Nov 19, 04:25 (19 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2264728
Default Alt Text
Answers.php (771 B)
Attached To
Mode
R20 WikiCAPTCHA API RESTful
Attached
Detach File
Event Timeline