original_string: private function detect()
    {
      $detect   = array();
      $defaults = $this->getDefaults();
      if( $this->isDetected() )
      {
        $detect = json_decode( $_COOKIE[ $this->cookieName ], true );
  
        if( !is_null( $detect ) )
        {
          // Convert Boolean values from strings
          foreach( $detect as $k => $v )
          {
            if( $v === "false" ) { $detect[ $k ] = $v = false; }
            if( $v === "true"  ) { $detect[ $k ] = $v = true;  }
  
            // Allow Server Overrides
            if ( $v === false && in_array( $k, DetectDefaults::SERVER ) ) {
              $detect[$k] = ( array_key_exists( $k, $defaults ) ) ? $defaults[ $k ] : $v;
            }
          }
        }
      }
      elseif( !$this->DetectByUserAgent instanceof DetectByUserAgent )
      {
        // Attempt to get from User Agent
        $this->DetectByUserAgent = new DetectByUserAgent();
        $detect                  = $this->DetectByUserAgent->detect();
      }
  
      // Append Defaults
      return ( !empty( $detect ) ) ? array_merge( $defaults, $detect ) : $defaults;
    }
code: private function detect()
    {
      $detect   = array();
      $defaults = $this->getDefaults();
      if( $this->isDetected() )
      {
        $detect = json_decode( $_COOKIE[ $this->cookieName ], true );
  
        if( !is_null( $detect ) )
        {
          // Convert Boolean values from strings
          foreach( $detect as $k => $v )
          {
            if( $v === "false" ) { $detect[ $k ] = $v = false; }
            if( $v === "true"  ) { $detect[ $k ] = $v = true;  }
  
            // Allow Server Overrides
            if ( $v === false && in_array( $k, DetectDefaults::SERVER ) ) {
              $detect[$k] = ( array_key_exists( $k, $defaults ) ) ? $defaults[ $k ] : $v;
            }
          }
        }
      }
      elseif( !$this->DetectByUserAgent instanceof DetectByUserAgent )
      {
        // Attempt to get from User Agent
        $this->DetectByUserAgent = new DetectByUserAgent();
        $detect                  = $this->DetectByUserAgent->detect();
      }
  
      // Append Defaults
      return ( !empty( $detect ) ) ? array_merge( $defaults, $detect ) : $defaults;
    }
code_tokens: private function detect ( ) { $ detect = array ( ) ; $ defaults = $ this -> getDefaults ( ) ; if ( $ this -> isDetected ( ) ) { $ detect = json_decode ( $ _COOKIE [ $ this -> cookieName ] , true ) ; if ( ! is_null ( $ detect ) ) { // Convert Boolean values from strings foreach ( $ detect as $ k => $ v ) { if ( $ v === "false" ) { $ detect [ $ k ] = $ v = false ; } if ( $ v === "true" ) { $ detect [ $ k ] = $ v = true ; } // Allow Server Overrides if ( $ v === false && in_array ( $ k , DetectDefaults :: SERVER ) ) { $ detect [ $ k ] = ( array_key_exists ( $ k , $ defaults ) ) ? $ defaults [ $ k ] : $ v ; } } } } elseif ( ! $ this -> DetectByUserAgent instanceof DetectByUserAgent ) { // Attempt to get from User Agent $ this -> DetectByUserAgent = new DetectByUserAgent ( ) ; $ detect = $ this -> DetectByUserAgent -> detect ( ) ; } // Append Defaults return ( ! empty ( $ detect ) ) ? array_merge ( $ defaults , $ detect ) : $ defaults ; }
docstring: Parses the cookie left by d.js.  If the cookie is not set due to Javascript being disabled, or cookies being
  being blocked, DetectByUserAgent is used to determine the values by the user agent.
  
  Using the user agent can be quite flawed. As we are limiting it to feature detection, it makes a good backup here.
  
  @return array
docstring_tokens: Parses the cookie left by d . js . If the cookie is not set due to Javascript being disabled or cookies being being blocked DetectByUserAgent is used to determine the values by the user agent .