for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of Pomm's Foundation package.
*
* (c) 2014 - 2017 Grégoire HUBERT <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PommProject\Foundation\Converter;
use PommProject\Foundation\Session\Session;
/**
* PgString
* Converter for strings types.
* @package Foundation
* @copyright 2014 - 2017 Grégoire HUBERT
* @author Grégoire HUBERT
* @license X11 {@link http://opensource.org/licenses/mit-license.php}
* @see ConverterInterface
class PgString implements ConverterInterface
{
* toPg
public function toPg($data, $type, Session $session)
return $data !== null
? sprintf("%s %s", $type, $session->getConnection()->escapeLiteral($data))
: sprintf("NULL::%s", $type);
}
* toPgStandardFormat
public function toPgStandardFormat($data, $type, Session $session)
return $data;
public function fromPg($data, $type, Session $session)
return $data !== null ? (string) $data : null;