private function validateCustomSnippet($customSnippet)
    {
        $snippetName = str_replace(' ', '', $customSnippet);
        $snippetNameData = explode('_', $snippetName, 3);
        $containsEmpty = in_array("", $snippetNameData, true);
        $types = ['init', 'recv', 'hit', 'miss', 'pass', 'fetch', 'error', 'log', 'deliver', 'hash', 'none'];
        $exception = 'Failed to upload VCL snippets. Please make sure the custom VCL snippets 
            follow this naming convention: [vcl_snippet_type]_[priority]_[short_name_description].vcl';

        if (count($snippetNameData) < 3) {
            throw new LocalizedException(__($exception));
        }

        $inArray = in_array($snippetNameData[0], $types);
        $isNumeric = is_numeric($snippetNameData[1]);
        $isAlphanumeric = preg_match('/^[\w]+$/', $snippetNameData[2]);

        if ($containsEmpty || !$inArray || !$isNumeric || !$isAlphanumeric) {
            throw new LocalizedException(__($exception));
        }
        return $snippetNameData;
    }
private function validateCustomSnippet($customSnippet)
    {
        $snippetName = str_replace(' ', '', $customSnippet);
        $snippetNameData = explode('_', $snippetName, 3);
        $containsEmpty = in_array("", $snippetNameData, true);
        $types = ['init', 'recv', 'hit', 'miss', 'pass', 'fetch', 'error', 'log', 'deliver', 'hash', 'none'];
        $exception = 'Failed to upload VCL snippets. Please make sure the custom VCL snippets 
            follow this naming convention: [vcl_snippet_type]_[priority]_[short_name_description].vcl';

        if (count($snippetNameData) < 3) {
            throw new LocalizedException(__($exception));
        }

        $inArray = in_array($snippetNameData[0], $types);
        $isNumeric = is_numeric($snippetNameData[1]);
        $isAlphanumeric = preg_match('/^[\w]+$/', $snippetNameData[2]);

        if ($containsEmpty || !$inArray || !$isNumeric || !$isAlphanumeric) {
            throw new LocalizedException(__($exception));
        }
        return $snippetNameData;
    }
private function validateCustomSnippet ( $ customSnippet ) { $ snippetName = str_replace ( ' ' , '' , $ customSnippet ) ; $ snippetNameData = explode ( '_' , $ snippetName , 3 ) ; $ containsEmpty = in_array ( "" , $ snippetNameData , true ) ; $ types = [ 'init' , 'recv' , 'hit' , 'miss' , 'pass' , 'fetch' , 'error' , 'log' , 'deliver' , 'hash' , 'none' ] ; $ exception = 'Failed to upload VCL snippets. Please make sure the custom VCL snippets 
            follow this naming convention: [vcl_snippet_type]_[priority]_[short_name_description].vcl' ; if ( count ( $ snippetNameData ) < 3 ) { throw new LocalizedException ( __ ( $ exception ) ) ; } $ inArray = in_array ( $ snippetNameData [ 0 ] , $ types ) ; $ isNumeric = is_numeric ( $ snippetNameData [ 1 ] ) ; $ isAlphanumeric = preg_match ( '/^[\w]+$/' , $ snippetNameData [ 2 ] ) ; if ( $ containsEmpty || ! $ inArray || ! $ isNumeric || ! $ isAlphanumeric ) { throw new LocalizedException ( __ ( $ exception ) ) ; } return $ snippetNameData ; }
Validate custom snippet naming convention
[vcl_snippet_type]_[priority]_[short_name_description].vcl

@param $customSnippet
@return array
@throws LocalizedException
Validate custom snippet naming convention [ vcl_snippet_type ] _ [ priority ] _ [ short_name_description ] . vcl