Skip to content

Commit

Permalink
Add method to produce a hydrator
Browse files Browse the repository at this point in the history
  • Loading branch information
Stratadox committed Jan 21, 2018
1 parent fc60f70 commit 1cc941b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/Mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Stratadox\Hydration\Mapper;

use Stratadox\Hydration\Hydrates;
use Stratadox\Hydration\Hydrator\MappedHydrator;
use Stratadox\Hydration\Mapper\Instruction\Is;
use Stratadox\Hydration\Mapping\Mapping;
use Stratadox\Hydration\MapsObject;
Expand Down Expand Up @@ -38,6 +40,11 @@ public function property(
return new self($this->name, $this->add($property, $instruction));
}

public function hydrator() : Hydrates
{
return MappedHydrator::fromThis($this->map());
}

public function map() : MapsObject
{
$class = $this->name;
Expand Down

0 comments on commit 1cc941b

Please sign in to comment.