mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-24 23:14:16 +00:00
54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\General;
|
|
|
|
|
|
use Illuminate\Support\Str;
|
|
|
|
class Helper
|
|
{
|
|
|
|
/**
|
|
* @param string $methodName
|
|
* @return string
|
|
*/
|
|
static function getPropertyName(string $methodName){
|
|
return Str::snake(str_replace('get', '', $methodName));
|
|
}
|
|
|
|
/**
|
|
* @param string $className
|
|
* @return array
|
|
*/
|
|
static function getClassMethodsArray(string $className){
|
|
return array_slice(get_class_methods($className), 1);
|
|
}
|
|
|
|
/**
|
|
* @param object $segmentConstantObject
|
|
* @param string $key
|
|
* @return integer
|
|
*/
|
|
static function getConstantByKey($segmentConstantObject, $key) {
|
|
if ($segmentConstantObject) {
|
|
$base_rate = (array) $segmentConstantObject->value;
|
|
$base_rate = array_key_exists($key, $base_rate) === true ? $base_rate[$key] : 0;
|
|
return $base_rate;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param object $segmentConstantObject
|
|
* @param string $postcode
|
|
* @return boolean
|
|
*/
|
|
static function checkPostcodeExistInConstant($segmentConstantObject, $postcode) {
|
|
$segmentConstantObject = $segmentConstantObject->value;
|
|
if (!empty($segmentConstantObject)) {
|
|
return in_array($postcode, $segmentConstantObject);
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
} |