for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PhpSchool\LearnYouPhp\Exercise;
use PhpSchool\PhpWorkshop\Exercise\AbstractExercise;
use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface;
use PhpSchool\PhpWorkshop\ExerciseCheck\CgiOutputExerciseCheck;
use Psr\Http\Message\RequestInterface;
use Zend\Diactoros\Request;
/**
* Class HttpJsonApi
* @package PhpSchool\LearnYouPhp\Exercise
* @author Aydin Hassan <[email protected]>
*/
class HttpJsonApi extends AbstractExercise implements ExerciseInterface, CgiOutputExerciseCheck
{
* @return string
public function getName()
return 'HTTP JSON API';
}
public function getDescription()
return 'HTTP JSON API - Servers JSON when it receives a GET request';
* @return RequestInterface[]
public function getRequests()
$url = 'http://www.time.com/api/%s?iso=%s';
return [
(new Request(sprintf($url, 'parsetime', (new \DateTime)->format(DATE_ISO8601))))
->withMethod('GET'),
(new Request(sprintf($url, 'unixtime', (new \DateTime)->format(DATE_ISO8601))))
];