This repository has been archived by the owner on Jan 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Showing
9 changed files
with
103 additions
and
6 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
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,54 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of the KleijnWeb\SwaggerBundle package. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace KleijnWeb\SwaggerBundle\Hydrator; | ||
|
||
use KleijnWeb\PhpApi\Descriptions\Description\Schema\Schema; | ||
use KleijnWeb\PhpApi\Hydrator\ProcessorBuilder; | ||
|
||
/** | ||
* Wrapper around ProcessorBuilder for compatibility | ||
* | ||
* @author John Kleijn <john@kleijnweb.nl> | ||
*/ | ||
class ObjectHydrator | ||
{ | ||
/** | ||
* @var ProcessorBuilder | ||
*/ | ||
private $builder; | ||
|
||
/** | ||
* ObjectHydrator constructor. | ||
* @param ProcessorBuilder $builder | ||
*/ | ||
public function __construct(ProcessorBuilder $builder) | ||
{ | ||
$this->builder = $builder; | ||
} | ||
|
||
/** | ||
* @param mixed $value | ||
* @param Schema $schema | ||
* @return mixed | ||
*/ | ||
public function hydrate($value, Schema $schema) | ||
{ | ||
return $this->builder->build($schema)->hydrate($value); | ||
} | ||
|
||
/** | ||
* @param mixed $value | ||
* @param Schema $schema | ||
* @return mixed | ||
*/ | ||
public function dehydrate($value, Schema $schema) | ||
{ | ||
return $this->builder->build($schema)->dehydrate($value); | ||
} | ||
} |
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