-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a147afe
commit 6612311
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
use AdrienBrault\Instructrice\Instructrice; | ||
use AdrienBrault\Instructrice\InstructriceFactory; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Schema; | ||
use Symfony\Component\Console\Output\ConsoleOutputInterface; | ||
|
||
$demo = require __DIR__ . '/bootstrap.php'; | ||
$demo(function (Instructrice $instructrice, ?string $context, ConsoleOutputInterface $output) { | ||
$instructrice->get( | ||
Schema::object() | ||
->properties( | ||
Schema::string('name'), | ||
Schema::string('dateOfBirth')->format(Schema::FORMAT_DATE_TIME), | ||
Schema::boolean('isAlive'), | ||
Schema::array('significantContributions') | ||
->items(Schema::string()), | ||
) | ||
->toArray(), | ||
'Most impact scientists in history.', | ||
onChunk: InstructriceFactory::createOnChunkDump($output->section()), | ||
); | ||
}); | ||
|
||
/* | ||
1 array:4 [ | ||
"name" => "Marie Curie" | ||
"dateOfBirth" => "1867-11-07" | ||
"isAlive" => false | ||
"significantContributions" => array:3 [ | ||
0 => "Pioneered radioactivity research" | ||
1 => "First woman to win a Nobel Prize" | ||
2 => "First person to win two Nobel Prizes in different fields (Physics and Chemistry)" | ||
] | ||
] | ||
*/ |