Update samples for ze-ph. (#5823)

This commit is contained in:
Paŭlo Ebermann 2017-06-13 18:42:24 +02:00 committed by wing328
parent b288991c6c
commit ceff3762cc
11 changed files with 214 additions and 1 deletions

View File

@ -0,0 +1 @@
2.2.3-SNAPSHOT

View File

@ -7,6 +7,37 @@ path_handler:
route: /fake
defaults:
handler: Fake
may_terminate: true
child_routes:
'outer':
type: Literal
options:
route: /outer
child_routes:
'boolean':
type: Literal
options:
route: /boolean
defaults:
handler: FakeOuterBoolean
'composite':
type: Literal
options:
route: /composite
defaults:
handler: FakeOuterComposite
'number':
type: Literal
options:
route: /number
defaults:
handler: FakeOuterNumber
'string':
type: Literal
options:
route: /string
defaults:
handler: FakeOuterString
'pet':
type: Literal
options:
@ -119,6 +150,10 @@ path_handler:
handlers:
invokables:
Fake: App\Handler\Fake
FakeOuterBoolean: App\Handler\FakeOuterBoolean
FakeOuterComposite: App\Handler\FakeOuterComposite
FakeOuterNumber: App\Handler\FakeOuterNumber
FakeOuterString: App\Handler\FakeOuterString
Pet: App\Handler\Pet
PetFindByStatus: App\Handler\PetFindByStatus
PetFindByTags: App\Handler\PetFindByTags

View File

@ -57,7 +57,7 @@ class FormatTest
/**
* @DTA\Data(field="string", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @DTA\Validator(name="Regex", options={"pattern":"/[a-z]/i})
* @DTA\Validator(name="Regex", options={"pattern":"/[a-z]/i"})
* @var string
*/
public $string;

View File

@ -0,0 +1,12 @@
<?php
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class OuterBoolean
{
}

View File

@ -0,0 +1,33 @@
<?php
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class OuterComposite
{
/**
* @DTA\Data(field="my_number", nullable=true)
* @DTA\Strategy(name="Object", options={"type":\App\DTO\OuterNumber::class})
* @DTA\Validator(name="Dictionary", options={"type":\App\DTO\OuterNumber::class})
* @var \App\DTO\OuterNumber
*/
public $my_number;
/**
* @DTA\Data(field="my_string", nullable=true)
* @DTA\Strategy(name="Object", options={"type":\App\DTO\OuterString::class})
* @DTA\Validator(name="Dictionary", options={"type":\App\DTO\OuterString::class})
* @var \App\DTO\OuterString
*/
public $my_string;
/**
* @DTA\Data(field="my_boolean", nullable=true)
* @DTA\Strategy(name="Object", options={"type":\App\DTO\OuterBoolean::class})
* @DTA\Validator(name="Dictionary", options={"type":\App\DTO\OuterBoolean::class})
* @var \App\DTO\OuterBoolean
*/
public $my_boolean;
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class OuterNumber
{
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class OuterString
{
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Handler;
use Articus\PathHandler\Operation;
use Articus\PathHandler\Annotation as PHA;
use Articus\PathHandler\Consumer as PHConsumer;
use Articus\PathHandler\Producer as PHProducer;
use Articus\PathHandler\Attribute as PHAttribute;
use Articus\PathHandler\Exception as PHException;
use Psr\Http\Message\ServerRequestInterface;
class FakeOuterBoolean implements Operation\PostInterface
{
/**
* @PHA\Attribute(name=PHAttribute\Transfer::class, options={"type":\App\DTO\OuterBoolean::class,"objectAttr":"body"})
* @return \App\DTO\OuterBoolean
*/
public function handlePost(ServerRequestInterface $request)
{
//TODO implement method
/** @var \App\DTO\OuterBoolean $body */
$body = $request->getAttribute("body");
throw new PHException\HttpCode(500, "Not implemented");
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Handler;
use Articus\PathHandler\Operation;
use Articus\PathHandler\Annotation as PHA;
use Articus\PathHandler\Consumer as PHConsumer;
use Articus\PathHandler\Producer as PHProducer;
use Articus\PathHandler\Attribute as PHAttribute;
use Articus\PathHandler\Exception as PHException;
use Psr\Http\Message\ServerRequestInterface;
class FakeOuterComposite implements Operation\PostInterface
{
/**
* @PHA\Attribute(name=PHAttribute\Transfer::class, options={"type":\App\DTO\OuterComposite::class,"objectAttr":"body"})
* @return \App\DTO\OuterComposite
*/
public function handlePost(ServerRequestInterface $request)
{
//TODO implement method
/** @var \App\DTO\OuterComposite $body */
$body = $request->getAttribute("body");
throw new PHException\HttpCode(500, "Not implemented");
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Handler;
use Articus\PathHandler\Operation;
use Articus\PathHandler\Annotation as PHA;
use Articus\PathHandler\Consumer as PHConsumer;
use Articus\PathHandler\Producer as PHProducer;
use Articus\PathHandler\Attribute as PHAttribute;
use Articus\PathHandler\Exception as PHException;
use Psr\Http\Message\ServerRequestInterface;
class FakeOuterNumber implements Operation\PostInterface
{
/**
* @PHA\Attribute(name=PHAttribute\Transfer::class, options={"type":\App\DTO\OuterNumber::class,"objectAttr":"body"})
* @return \App\DTO\OuterNumber
*/
public function handlePost(ServerRequestInterface $request)
{
//TODO implement method
/** @var \App\DTO\OuterNumber $body */
$body = $request->getAttribute("body");
throw new PHException\HttpCode(500, "Not implemented");
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Handler;
use Articus\PathHandler\Operation;
use Articus\PathHandler\Annotation as PHA;
use Articus\PathHandler\Consumer as PHConsumer;
use Articus\PathHandler\Producer as PHProducer;
use Articus\PathHandler\Attribute as PHAttribute;
use Articus\PathHandler\Exception as PHException;
use Psr\Http\Message\ServerRequestInterface;
class FakeOuterString implements Operation\PostInterface
{
/**
* @PHA\Attribute(name=PHAttribute\Transfer::class, options={"type":\App\DTO\OuterString::class,"objectAttr":"body"})
* @return \App\DTO\OuterString
*/
public function handlePost(ServerRequestInterface $request)
{
//TODO implement method
/** @var \App\DTO\OuterString $body */
$body = $request->getAttribute("body");
throw new PHException\HttpCode(500, "Not implemented");
}
}