public static function _($value, $filters = 'raw')
    {
        if (is_string($filters)) {
            $filters = Str::trim($filters);
            $filters = explode(',', $filters);

            if (count($filters) > 0) {
                foreach ($filters as $filter) {
                    $filterName = self::cmd($filter);

                    if ($filterName) {
                        if (method_exists(__CLASS__, $filterName)) {
                            $value = self::$filterName($value);
                        } else {
                            throw new Exception('Undefined filter method: ' . $filter);
                        }
                    }
                }
            }
        } elseif ($filters instanceof \Closure) {
            $value = $filters($value);
        }

        return $value;
    }
public static function _($value, $filters = 'raw')
    {
        if (is_string($filters)) {
            $filters = Str::trim($filters);
            $filters = explode(',', $filters);

            if (count($filters) > 0) {
                foreach ($filters as $filter) {
                    $filterName = self::cmd($filter);

                    if ($filterName) {
                        if (method_exists(__CLASS__, $filterName)) {
                            $value = self::$filterName($value);
                        } else {
                            throw new Exception('Undefined filter method: ' . $filter);
                        }
                    }
                }
            }
        } elseif ($filters instanceof \Closure) {
            $value = $filters($value);
        }

        return $value;
    }
public static function _ ( $ value , $ filters = 'raw' ) { if ( is_string ( $ filters ) ) { $ filters = Str :: trim ( $ filters ) ; $ filters = explode ( ',' , $ filters ) ; if ( count ( $ filters ) > 0 ) { foreach ( $ filters as $ filter ) { $ filterName = self :: cmd ( $ filter ) ; if ( $ filterName ) { if ( method_exists ( __CLASS__ , $ filterName ) ) { $ value = self :: $ filterName ( $ value ) ; } else { throw new Exception ( 'Undefined filter method: ' . $ filter ) ; } } } } } elseif ( $ filters instanceof \ Closure ) { $ value = $ filters ( $ value ) ; } return $ value ; }
Apply custom filter to variable

@param mixed           $value
@param string|\Closure $filters
@return mixed
@throws Exception
@SuppressWarnings(PHPMD.CamelCaseMethodName)
@SuppressWarnings(PHPMD.ShortMethodName)
Apply custom filter to variable