generated from spatie/package-skeleton-php
-
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.
Rename CarbonNormalizer to denormalizer as only denormalization happe…
…ns (#5)
- Loading branch information
Showing
3 changed files
with
28 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Morrislaptop\PopoFactory\Normalizer; | ||
|
||
use Carbon\Carbon; | ||
use Carbon\CarbonInterface; | ||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; | ||
|
||
class CarbonDenormalizer implements DenormalizerInterface | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public function denormalize($data, string $type, string $format = null, array $context = []) | ||
{ | ||
return new Carbon($data); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function supportsDenormalization($data, string $type, string $format = null) | ||
{ | ||
return is_a($type, CarbonInterface::class, true); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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