/**
  * @return bool
  */
 public function isGoogleOrganic()
 {
     $this->isReady();
     if (!$this->isGoogleCampaign() && !$this->isGoogleAds() && StringHelper::convertCase($this->parsedUrl->getMedium(), StringHelper::CASE_LOWER) == 'search' && StringHelper::convertCase($this->parsedUrl->getSource(), StringHelper::CASE_LOWER) == 'google') {
         return true;
     }
     return false;
 }
예제 #2
0
 /**
  * @param string $cpf
  *
  * @return bool
  */
 public static function isCpfValid($cpf)
 {
     $cpf = StringHelper::justNumbers($cpf);
     if (strlen($cpf) !== 11 || in_array($cpf, ['00000000000', '11111111111', '22222222222', '33333333333', '44444444444', '55555555555', '66666666666', '77777777777', '88888888888', '99999999999'])) {
         return false;
     } else {
         for ($t = 9; $t < 11; $t++) {
             for ($d = 0, $c = 0; $c < $t; $c++) {
                 $d += $cpf[$c] * ($t + 1 - $c);
             }
             $d = 10 * $d % 11 % 10;
             if ($cpf[$c] != $d) {
                 return false;
             }
         }
     }
     return true;
 }
예제 #3
0
 /**
  * Validates a if a value is a valid CPF number.
  *
  * @param $cnpj string CNPJ Number
  *
  * @return bool
  */
 private function validateCnpj($cnpj)
 {
     $cnpj = StringHelper::justNumbers($cnpj);
     if ($this->skipOnEmpty && empty($cnpj)) {
         return true;
     }
     if (strlen($cnpj) != 14) {
         return false;
     }
     for ($i = 0, $j = 5, $sum = 0; $i < 12; $i++) {
         $sum += $cnpj[$i] * $j;
         $j = $j == 2 ? 9 : $j - 1;
     }
     $residual = $sum % 11;
     if ($cnpj[12] != ($residual < 2 ? 0 : 11 - $residual)) {
         return false;
     }
     for ($i = 0, $j = 6, $sum = 0; $i < 13; $i++) {
         $sum += $cnpj[$i] * $j;
         $j = $j == 2 ? 9 : $j - 1;
     }
     $residual = $sum % 11;
     return $cnpj[13] == ($residual < 2 ? 0 : 11 - $residual);
 }
예제 #4
0
 /**
  * @param string $robot
  *
  * @return string
  */
 public function getRobotId($robot)
 {
     if ($robot == '*') {
         $robot = 'all';
     }
     $robotId = StringHelper::asSlug($robot);
     return $robotId;
 }