The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
- 3.1. Metadata
| a = None | |
| a is not None # False | |
| t = (1, 2, 3) | |
| 2 in t # True | |
| a = 10 | |
| 7 < a <= 10 # True | |
| def is_float_equal(a, b): |
| <?php | |
| use Phprest\Util\Controller; | |
| use Symfony\Component\HttpFoundation\Request; | |
| use Phprest\Response; | |
| use League\Fractal\Manager; | |
| use League\Fractal\Resource\Item; | |
| class Temperature extends Controller | |
| { | |
| public function get(Request $request, $version, $id) |
| <?php | |
| require 'vendor/autoload.php'; | |
| use League\BooBoo\Runner; | |
| use League\BooBoo\Formatter\JsonFormatter; | |
| $booboo = new Runner(); | |
| $formatter = new JsonFormatter(); | |
| $booboo->pushFormatter($formatter); |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <phpunit backupGlobals="false" | |
| backupStaticAttributes="false" | |
| bootstrap="tests/bootstrap.php" | |
| colors="true" | |
| convertErrorsToExceptions="true" | |
| convertNoticesToExceptions="true" | |
| convertWarningsToExceptions="true" | |
| processIsolation="false" | |
| stopOnFailure="false" |
| # business logic file | |
| module DataStructure | |
| class Array | |
| def initialize(array) | |
| @array = array | |
| end | |
| def flatten | |
| _flatten @array | |
| end |
| <?php | |
| class Project | |
| { | |
| /** @var null|int */ | |
| protected $id; | |
| /** @var string */ | |
| protected $name; | |
| <?php | |
| class Task | |
| { | |
| /** @var null|int */ | |
| protected $id; | |
| /** @var string */ | |
| protected $name; | |
| <?php | |
| final class TaskCollection implements IteratorAggregate | |
| { | |
| /** @var Task[] */ | |
| private $tasks; | |
| /** | |
| * @param Task[] $tasks | |
| */ |
| <?php | |
| class DbProject extends Project | |
| { | |
| /** | |
| * @param int $id | |
| * @param string $name | |
| * @param Task[] $tasks | |
| */ | |
| public function __construct($id, $name, $tasks) |