for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @copyright Daniel Król <[email protected]>
* @license MIT
* @package Mleko\Alchemist
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Mleko\Alchemist\Normalizer;
use Mleko\Alchemist\Normalizer;
use Mleko\Alchemist\Type;
class ScalarNormalizer implements Normalizer
{
private const SUPPORTED_TYPES = ['integer', 'int', 'double', 'float', 'boolean', 'bool', 'string', 'null', 'NULL'];
* @inheritdoc
public function normalize($value, string $format, array $context = []) {
return $value;
}
public function denormalize($data, Type $type, string $format, array $context = []) {
return $data;
public function canProcess(Type $type, string $format): bool {
return \in_array($type->getName(), self::SUPPORTED_TYPES) && 0 === \count($type->getSubTypes());