Get Z score for confidence interval

@param  string $cl confidence level

@return float Z score

@throws Exception\BadDataException
431318
public static function getZScoreForConfidenceInterval(string $cl): float
    {
        if (!array_key_exists($cl, self::Z_SCORES_FOR_CONFIDENCE_INTERVALS)) {
            throw new Exception\BadDataException('Not a valid confidence level');
        }
        return self::Z_SCORES_FOR_CONFIDENCE_INTERVALS[$cl];
    }
940703
public function getCrlUrl() {
    if ($this->crlUrl === self::AUTOLOAD) {
      $this->crlUrl = NULL; // Default if we can't find something else.
      $caCertObj = X509Util::loadCACert($this->getCaCert());
      // There can be multiple DPs, but in practice CiviRootCA only has one.
      $crlDPs = $caCertObj->getExtension('id-ce-cRLDistributionPoints');
      if (is_array($crlDPs)) {
        foreach ($crlDPs as $crlDP) {
          foreach ($crlDP['distributionPoint']['fullName'] as $fullName) {
            if (isset($fullName['uniformResourceIdentifier'])) {
              $this->crlUrl = $fullName['uniformResourceIdentifier'];
              break 2;
            }
          }
        }
      }
    }
    return $this->crlUrl;
  }
969614
private function getMeanScore($a_stat_score)
    {
        $mean_score = $a_stat_score->find('div', 1);
        $temp_score = $mean_score->find('span', 0)->plaintext;

        return str_replace($temp_score, '', $mean_score->plaintext);
    }
257345
private function getScore()
    {
        $score = $this->_parser->find('div[class="fl-l score"]', 0)->plaintext;
        $score = trim($score);

        return $score != 'N/A' ? $score : null;
    }
14851
function getShardID(int $shardCount) {
        if(\PHP_INT_SIZE === 4) {
            $time = \base_convert(\substr($this->binary, 0, 42), 2, 10);
            $shard = (int) \bcmod($time, ((string) $shardCount));
            
            return $shard;
        } else {
            $time = $this->value >> 22;
            return ($time % $shardCount);
        }
    }
357740
public static function getHourTimestamp($now = null) {
        $now = $now === null ? time() : $now;
        $diff = $now % 3600; // 1 * 60 * 60;
        return $now - $diff;
    }
900403
public function getRatio()
    {
        $total = $this->score->getValid() +
            $this->score->getPartial() +
            $this->score->getNotValid();

        return $this->score->getValid() == 0 ? 0 : (float) number_format($this->score->getValid()/$total, 2);
    }
1367975
function get_error_level() {
		// calculate level in case global errors have been cleared
		$e = 0;
		foreach( $this->err_stack as $t => $ids ) {
			foreach( $ids as $id ){
				$Err = PLUGError::get_reference( $t, $id );
				if( is_object($Err) ){
					$e |= $t;
					break;
				}
			}
		}
		return $e;
	}
1110019
public function getZ() : ?float 
    {
        if ( ! $this->hasZ()) {
            $this->setZ($this->getDefaultZ());
        }
        return $this->z;
    }
1045120
public static function getMozRankRaw($url = false)
    {
        $data = static::getCols('16384', $url);
        return (parent::noDataDefaultValue() == $data) ? $data :
            number_format($data['umrr'], 16);
    }
731412
private ResultSet read(ConsistencyLevel cl, int retryCount) {

    System.out.printf("Reading at %s (retry count: %d)%n", cl, retryCount);

    Statement stmt =
        SimpleStatement.newInstance(
                "SELECT sensor_id, date, timestamp, value "
                    + "FROM downgrading.sensor_data "
                    + "WHERE "
                    + "sensor_id = 756716f7-2e54-4715-9f00-91dcbea6cf50 AND "
                    + "date = '2018-02-26' AND "
                    + "timestamp > '2018-02-26+01:00'")
            .setConsistencyLevel(cl);

    try {

      ResultSet rows = session.execute(stmt);
      System.out.println("Read succeeded at " + cl);
      return rows;

    } catch (DriverException e) {

      if (retryCount == maxRetries) {
        throw e;
      }

      e = unwrapAllNodesFailedException(e);

      System.out.println("Read failed: " + e);

      // General intent: downgrade and retry at the highest consistency level
      // that is likely to succeed.

      if (e instanceof UnavailableException) {

        // Downgrade to the number of replicas reported alive and retry.
        int aliveReplicas = ((UnavailableException) e).getAlive();

        ConsistencyLevel downgraded = downgrade(cl, aliveReplicas, e);
        return read(downgraded, retryCount + 1);

      } else if (e instanceof ReadTimeoutException) {

        ReadTimeoutException readTimeout = (ReadTimeoutException) e;
        int received = readTimeout.getReceived();
        int required = readTimeout.getBlockFor();

        // If fewer replicas responded than required by the consistency level
        // (but at least one replica did respond), retry with a consistency level
        // equal to the number of received acknowledgements.
        if (received < required) {

          ConsistencyLevel downgraded = downgrade(cl, received, e);
          return read(downgraded, retryCount + 1);
        }

        // If we received enough replies to meet the consistency level,
        // but the actual data was not present among the received responses,
        // then retry with the initial consistency level, we might be luckier next time
        // and get the data back.
        if (!readTimeout.wasDataPresent()) {

          return read(cl, retryCount + 1);
        }

        // Otherwise, abort since the read timeout is unlikely to be solved by a retry.
        throw e;

      } else {

        // Unexpected error: just retry with same consistency level
        // and hope to talk to a healthier coordinator.
        return read(cl, retryCount + 1);
      }
    }
  }
976197
public static function getScore( $password )
	{
		$score	= 0;

		//  --  LENGTH  --  //
		$length	= strlen( $password );
		$min	= self::$minLength;
		if( $length < $min )															// Password too short
			$score	-= 100;
		else if( $length >= $min && $length <= $min + 2 ) 								// Password Short
			$score += 6;
		else if( $length >= $min + 3 && $length <= $min + 4 )							// Password Medium
			$score += 12;
		else if( $length >= $min + 5 )													// Password Large
			$score += 18;

		//  --  CASE SENSE  --  //
		if( preg_match( "/[a-z]/", $password ) )										// at least one lower case letter
			$score	+= 1;
		if( preg_match( "/[A-Z]/", $password ) )										// at least one upper case letter
			$score	+= 5;

		//  --  NUMBERS  --  //
		if( preg_match( "/\d+/", $password ) )											// at least one number
			$score	+= 5;
		if( preg_match( "/(.*[0-9].*[0-9].*[0-9])/", $password ) )						// at least three numbers
			$score	+= 7;

		//  --  SPECIAL CHARACTERS  --  //
		if( preg_match( "/.[!,@,#,$,%,^,&,*,?,_,~]/", $password ) )						// at least one special character
			$score	+= 5;
		if( preg_match( "/(.*[!@#$%^&*?_~].*[!@#$%^&*?_~])/", $password ) )				// at least two special characters
			$score	+= 7;

		//  --  COMBINATION  --  //
		if( preg_match( "/([a-z].*[A-Z])|([A-Z].*[a-z])/", $password ) )				// both upper and lower case
			$score	+= 2;
		if( preg_match( "/[a-z]/i", $password ) && preg_match( "/\d/", $password ) )	// both letters and numbers
			$score	+= 3;
		$regEx	= "/([a-z0-9].*[!@#$%^&*?_~])|([!@#$%^&*?_~].*[a-z0-9])/i";
		if( preg_match( $regEx, $password ) )											// letters, numbers, and special characters
			$score	+= 3;

		//  --  BAD WORDS  --  //
		if( in_array( strtolower( $password ), self::$badWords ) ) 
			$score -= 200;
		return $score;
	}
23416
protected function _calculateConsecutiveTokenScore($class)
    {
        $score = 0;
        $pattern = '/[^a-zA-Z0-9]{2,}/';

        if ($class == self::CLASS_LETTER) {
            $pattern = '/[a-zA-Z]{2,}/';
        }

        if ($class == self::CLASS_UPPER) {
            $pattern = '/[A-Z]{2,}/';
        }

        if ($class == self::CLASS_LOWER) {
            $pattern = '/[a-z]{2,}/';
        }

        if ($class == self::CLASS_NUMBER) {
            $pattern = '/[0-9]{2,}/';
        }

        $matches = array ();
        preg_match_all($pattern, $this->_password, $matches);
        foreach ($matches[0] as $match) {
            $score -= (strlen($match) - 1) * 2;
        }

        return $score;
    }
682116
public static function calcDepthScore($reference)
    {
        if (!self::isReferenceNumeric($reference)) {
            return null;
        }
        $reference = self::trimReference($reference);
        $sectionParts = explode('.', $reference);
        $score = 0;
        foreach ($sectionParts as $level => $part) {
            $score += $part * (1 / pow(10, $level));
        }
        return $score;
    }
353222
private function getIconvAlias($cs)
    {
        $normalized = $this->getNormalizedCharset($cs);
        if (array_key_exists($normalized, self::$iconvAliases)) {
            return static::$iconvAliases[$normalized];
        }
        return $cs;
    }
772095
public function spacheReadabilityScore($strText = false)
    {
        $strText = $this->setText($strText);

        $score = Maths::bcCalc(
            Maths::bcCalc(
                Maths::bcCalc(
                    0.121,
                    '*',
                    Maths::bcCalc(
                        Text::wordCount($strText, $this->strEncoding),
                        '/',
                        Text::sentenceCount($strText, $this->strEncoding)
                    )
                ),
                '+',
                Maths::bcCalc(
                    0.082,
                    '*',
                    $this->spacheDifficultWordCount($strText)
                )
            ),
            '+',
            0.659
        );

        if ($this->normalise) {
            return Maths::normaliseScore($score, 0, 5, $this->dps); // Not really suitable for measuring readability above grade 4
        } else {
            return Maths::bcCalc($score, '+', 0, true, $this->dps);
        }
    }
1095219
public function guess() : float
    {
        if ($this->percentile === null or $this->mad === null) {
            throw new RuntimeException('Strategy has not been fitted.');
        }

        return $this->percentile
            + $this->blur
            * $this->gaussian()
            * $this->mad;
    }