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
in php storm, bring replace bar (ctrl + R) and check 'Regex' box and then enter these values: | |
in firt input (for find): | |
'([^ ']*)\\([^ ']*)@([^ ']*)' | |
in second input (for replace): | |
[Controllers\\$1\\$2::class, '$3'] |
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
public static function isHourBeforeNow($hour) | |
{ | |
$now = date('H:i'); | |
$nowArray = explode(':', $now); | |
$hourArray = explode(':', $hour); | |
if ($nowArray[ 0 ] < $hourArray[ 0 ]) { | |
return false; | |
} else if ($nowArray[ 0 ] > $hourArray[ 0 ]) { |
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
public static function verifyNatCode($code) | |
{ | |
if (!is_numeric($code) || strlen($code) > 10) | |
return false; | |
$tempInt = intval($code); | |
if ($tempInt == 0) | |
return false; | |
while (strlen($code) < 10) { |
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
public static function formatCurrencyString($currency) | |
{ | |
$currencySubStr1 = $currency; | |
$currencySubStr2 = ''; | |
$dotPos = strpos($currency, '.'); | |
if ($dotPos) { | |
$currencySubStr1 = substr($currency, 0, $dotPos); | |
$currencySubStr2 = substr($currency, $dotPos + 1, strlen($currency) - 1); | |
} |
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
public static function generateRandomPassword($length) | |
{ | |
$signs = '_-!#@'; | |
$signsLength = strlen($signs); | |
$numbers = '0123456789'; | |
$numbersLength = strlen($numbers); | |
$alphs = 'abcdefghijklmnopqrstuvwxyx'; | |
$alphsLength = strlen($alphs); | |
$signsCount = 1; |
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
public static function isFloat($numberString) | |
{ | |
$regString = '/(^\d+\.\d+$|^\d+$)/'; | |
return (bool)preg_match($regString, $numberString); | |
} |
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
public static function makePaginationPageNumbers($count, $perPage, $current, $offset) | |
{ | |
$start = 1; | |
$hasPrevious = false; | |
$hasFirst = false; | |
$hasNext = false; | |
$hasLast = false; | |
$end = intval(floor($count / $perPage) + ($count % $perPage > 0 ? 1 : 0)); |