for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the 2amigos/yii2-usuario project.
*
* (c) 2amigOS! <http://2amigos.us/>
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Da\User\Helper;
use RuntimeException;
class MigrationHelper
{
/**
* @param string $driverName
* @throws RuntimeException
* @return null|string
public static function resolveTableOptions($driverName)
switch ($driverName) {
case 'mysql':
return 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
case 'pgsql':
case 'dblib':
case 'mssql':
case 'sqlsrv':
return null;
default:
throw new RuntimeException('Your database is not supported!');
}
* @param $driverName
* @return string
public static function resolveDbType($driverName)
return $driverName;
return 'sqlsrv';
* @return bool
public static function isMicrosoftSQLServer($driverName)
return self::resolveDbType($driverName) === 'sqlsrv';
public static function getBooleanValue($driverName,$value=false)
switch (self::resolveDbType($driverName)) {
return $value?1:0;
break;
break
The break statement is not necessary if it is preceded for example by a return statement:
switch ($x) { case 1: return 'foo'; break; // This break is not necessary and can be left off. }
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.
return $value?true:false;
return $value;
The break statement is not necessary if it is preceded for example by a return statement:
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.