for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Trait CharsetTrait
*
* @filesource CharsetTrait.php
* @created 05.06.2017
* @package chillerlan\Database\Query\Traits
* @author Smiley <[email protected]>
* @copyright 2017 Smiley
* @license MIT
*/
namespace chillerlan\Database\Query\Traits;
trait CharsetTrait{
protected $collate;
protected function _charset(string $collation):string {
list($charset) = explode('_', $collation);
$collate = 'CHARACTER SET '.$charset;
if($charset !== $collation){
$collate .= ' COLLATE '.$collation;
}
return $collate;
protected function _collate(string $collation){
$collation = trim($collation);
if(!empty($collation)){
$this->collate = $collation;
return $this;