ajout TelephoneType::isMobile()
This commit is contained in:
		
							parent
							
								
									26edd874df
								
							
						
					
					
						commit
						743c4b9961
					
				@ -351,4 +351,17 @@ class TelephoneType extends RegexpType {
 | 
			
		||||
    elseif (substr($tel, 0, 4) == "+33 ") return "0".substr($tel, 4);
 | 
			
		||||
    else return $tel;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * vérifier si $tel est un numéro de portable.
 | 
			
		||||
   *
 | 
			
		||||
   * le numéro doit avoir été formatté, que ce soit au format international ou
 | 
			
		||||
   * local. si ce n'est pas un numéro français, la réponse est toujours false
 | 
			
		||||
   */
 | 
			
		||||
  function isMobile(?string $tel): bool {
 | 
			
		||||
    if ($tel === null) return false;
 | 
			
		||||
    if (preg_match('/^\+(262|33) [67]/', $tel)) return true;
 | 
			
		||||
    if (preg_match('/^0[67]/', $tel)) return true;
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user