src/Config.php
public function exceptionSampleRate(\Exception $toLog)
    {
        $sampleRate = 1.0;
        if (count($this->exceptionSampleRates) == 0) {
            return $sampleRate;
        }
        
        $exceptionClasses = array();
        
        $class = get_class($toLog);
        while ($class) {
            $exceptionClasses []= $class;
            $class = get_parent_class($class);
        }
        $exceptionClasses = array_reverse($exceptionClasses);
        
        foreach ($exceptionClasses as $exceptionClass) {
            if (isset($this->exceptionSampleRates["$exceptionClass"])) {
                $sampleRate = $this->exceptionSampleRates["$exceptionClass"];
            }
        }
        
        return $sampleRate;
    }
public function exceptionSampleRate(\Exception $toLog)
    {
        $sampleRate = 1.0;
        if (count($this->exceptionSampleRates) == 0) {
            return $sampleRate;
        }
        
        $exceptionClasses = array();
        
        $class = get_class($toLog);
        while ($class) {
            $exceptionClasses []= $class;
            $class = get_parent_class($class);
        }
        $exceptionClasses = array_reverse($exceptionClasses);
        
        foreach ($exceptionClasses as $exceptionClass) {
            if (isset($this->exceptionSampleRates["$exceptionClass"])) {
                $sampleRate = $this->exceptionSampleRates["$exceptionClass"];
            }
        }
        
        return $sampleRate;
    }
public function exceptionSampleRate ( \ Exception $ toLog ) { $ sampleRate = 1.0 ; if ( count ( $ this -> exceptionSampleRates ) == 0 ) { return $ sampleRate ; } $ exceptionClasses = array ( ) ; $ class = get_class ( $ toLog ) ; while ( $ class ) { $ exceptionClasses [ ] = $ class ; $ class = get_parent_class ( $ class ) ; } $ exceptionClasses = array_reverse ( $ exceptionClasses ) ; foreach ( $ exceptionClasses as $ exceptionClass ) { if ( isset ( $ this -> exceptionSampleRates [ "$exceptionClass" ] ) ) { $ sampleRate = $ this -> exceptionSampleRates [ "$exceptionClass" ] ; } } return $ sampleRate ; }
Calculate what's the chance of logging this exception according to
exception sampling.

@param \Exception $toLog

@return float
Calculate what s the chance of logging this exception according to exception sampling .