You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					22 lines
				
				399 B
			
		
		
			
		
	
	
					22 lines
				
				399 B
			| 
								 
											7 years ago
										 
									 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * Created by Error202
							 | 
						||
| 
								 | 
							
								 * Date: 23.09.2018
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace core\helpers;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class PhoneHelper
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    public static function normalizePhone(string $phone): string
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        return preg_replace('/[^0-9]/', '', $phone);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    public static function isCorrect(string $phone): bool
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        $string = PhoneHelper::normalizePhone($phone);
							 | 
						||
| 
								 | 
							
								        return strlen($string) == 11;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 |