%PDF- %PDF-
Direktori : /var/www/html/bbw/farmaci/kritik-portale/module/ReviewBase/src/ReviewBase/View/Helper/ |
Current File : /var/www/html/bbw/farmaci/kritik-portale/module/ReviewBase/src/ReviewBase/View/Helper/HintEmail.php |
<?php namespace ReviewBase\View\Helper; use Zend\Filter\PregReplace; use Zend\I18n\Validator\PhoneNumber; use Zend\Validator\Regex; use Zend\View\Helper\AbstractHelper; /** * Description of HintEmail * * @author Florian Koller ( conlabz GmbH ) <florian.koller at conlabz.de> */ class HintEmail extends AbstractHelper { protected $hintCount; public function __construct() { $this->hintCount = 3; } /** * * @param string $emailAddress * @return string */ public function __invoke($emailAddress) { $parts = explode('@', $emailAddress); $preAt = $parts[0]; $afterAt = $parts[1]; $domainPart = strstr($afterAt, '.'); $afterAt = str_replace($domainPart, '', $afterAt); $identifierPart = $preAt;//str_replace($domainPart, '', $emailAddress); $countPreAt = strlen($preAt); $countAfterAt = strlen($afterAt); $preAt = $this->hintCount >= $countPreAt ? $preAt : substr($preAt, 0, $this->hintCount).'...'; $afterAt = $this->hintCount >= $countAfterAt ? $afterAt : '...'.substr($afterAt, -$this->hintCount); $hintEmail = $preAt.'@'.$afterAt.$domainPart; return $hintEmail; } }