Task/Collect/CodeAnalyser.php
public function classIsUsable($qualified_classname) {
    // Set up the script with its autoloader if not already done so. We keep the
    // resource to the process open between calls to this method.
    // This means we only need to start a new process at the start of a request
    // to DCB and after a bad class has caused the script to crash.
    if (!is_resource($this->checking_script_resource)) {
      $this->setupScript();
    }

    // Write the class to check to the script's STDIN.
    $status = $this->sendCommand('CLASS', $qualified_classname);

    if (!$status) {
      // The process has crashed.
      // Clean up so the script is reinitialized the next time this method is
      // called.
      $this->closeScript();
    }

    // Return the status of the class check: TRUE means the class is usable,
    // FALSE means it is broken and a class_exists() causes a crash.
    return $status;
  }
public function classIsUsable($qualified_classname) {
    // Set up the script with its autoloader if not already done so. We keep the
    // resource to the process open between calls to this method.
    // This means we only need to start a new process at the start of a request
    // to DCB and after a bad class has caused the script to crash.
    if (!is_resource($this->checking_script_resource)) {
      $this->setupScript();
    }

    // Write the class to check to the script's STDIN.
    $status = $this->sendCommand('CLASS', $qualified_classname);

    if (!$status) {
      // The process has crashed.
      // Clean up so the script is reinitialized the next time this method is
      // called.
      $this->closeScript();
    }

    // Return the status of the class check: TRUE means the class is usable,
    // FALSE means it is broken and a class_exists() causes a crash.
    return $status;
  }
public function classIsUsable ( $ qualified_classname ) { // Set up the script with its autoloader if not already done so. We keep the // resource to the process open between calls to this method. // This means we only need to start a new process at the start of a request // to DCB and after a bad class has caused the script to crash. if ( ! is_resource ( $ this -> checking_script_resource ) ) { $ this -> setupScript ( ) ; } // Write the class to check to the script's STDIN. $ status = $ this -> sendCommand ( 'CLASS' , $ qualified_classname ) ; if ( ! $ status ) { // The process has crashed. // Clean up so the script is reinitialized the next time this method is // called. $ this -> closeScript ( ) ; } // Return the status of the class check: TRUE means the class is usable, // FALSE means it is broken and a class_exists() causes a crash. return $ status ; }
Determines whether a class may be instantiated safely.

This is needed because:
- lots of contrib modules have plugins that simply crash on class load,
typically because they fail the interface implementation.
- modules can have services which are meant for another non-dependent
module's use, and which can thus implement interfaces or inherit from
classes which are not present. For example, in the case of a tagged
service, if the collecting module is not enabled, we have no way of
detecting that the service's tag is a service collector tag.

@param string $qualified_classname
The fully-qualified class name, without the initial \.

@return boolean
TRUE if the class may be used (but note this does not say whether it
actually exists); FALSE if the class should not be used as attempting to
will cause a PHP fatal error.
Determines whether a class may be instantiated safely .