Task/Collect/CodeAnalyser.php
protected function setupScript() {
    // The PHP that proc_open() will find may not be the same one as run by
    // the webserver, and indeed, on some systems may be an out-of-date version,
    // so detect the PHP that we're currently running and ensure we use that.
    $php = PHP_BINDIR . '/php';

    $script_name = __DIR__ . '/../../class_safety_checker.php';
    $drupal_root = $this->environment->getRoot();
    $autoloader_filepath = $drupal_root . '/autoload.php';

    // We need to pass all the dynamic namespaces to the script, as Composer's
    // generated autoloader knows only about /vendor and /core/lib, but not
    // modules.
    // This code is taken from DrupalKernel::attachSynthetic().
    $container = $this->environment->getContainer();
    $namespaces = $container->getParameter('container.namespaces');
    $psr4 = [];
    foreach ($namespaces as $prefix => $paths) {
      if (is_array($paths)) {
        foreach ($paths as $key => $value) {
          $paths[$key] = $drupal_root . '/' . $value;
        }
      }
      elseif (is_string($paths)) {
        $paths = $drupal_root . '/' . $paths;
      }

      // Build a list of data to pass to the script on STDIN.
      // $paths is never an array, AFAICT.
      $psr4[] = $prefix . '\\' . '::' . $paths;
    }

    // Debug option for the script.
    $debug_int = (int) $this->debug;

    $command = "{$php} {$script_name} '{$autoloader_filepath}' {$debug_int}";

    // Open pipes for both input and output.
    $descriptorspec = array(
       0 => array("pipe", "r"),
       1 => array("pipe", "w")
    );
    $this->checking_script_resource = proc_open($command, $descriptorspec, $this->pipes);

    if (!is_resource($this->checking_script_resource)) {
      throw new \Exception("Could not create process for classIsUsable().");
    }

    foreach ($psr4 as $line) {
      $this->sendCommand('PSR4', $line);
    }
  }
protected function setupScript() {
    // The PHP that proc_open() will find may not be the same one as run by
    // the webserver, and indeed, on some systems may be an out-of-date version,
    // so detect the PHP that we're currently running and ensure we use that.
    $php = PHP_BINDIR . '/php';

    $script_name = __DIR__ . '/../../class_safety_checker.php';
    $drupal_root = $this->environment->getRoot();
    $autoloader_filepath = $drupal_root . '/autoload.php';

    // We need to pass all the dynamic namespaces to the script, as Composer's
    // generated autoloader knows only about /vendor and /core/lib, but not
    // modules.
    // This code is taken from DrupalKernel::attachSynthetic().
    $container = $this->environment->getContainer();
    $namespaces = $container->getParameter('container.namespaces');
    $psr4 = [];
    foreach ($namespaces as $prefix => $paths) {
      if (is_array($paths)) {
        foreach ($paths as $key => $value) {
          $paths[$key] = $drupal_root . '/' . $value;
        }
      }
      elseif (is_string($paths)) {
        $paths = $drupal_root . '/' . $paths;
      }

      // Build a list of data to pass to the script on STDIN.
      // $paths is never an array, AFAICT.
      $psr4[] = $prefix . '\\' . '::' . $paths;
    }

    // Debug option for the script.
    $debug_int = (int) $this->debug;

    $command = "{$php} {$script_name} '{$autoloader_filepath}' {$debug_int}";

    // Open pipes for both input and output.
    $descriptorspec = array(
       0 => array("pipe", "r"),
       1 => array("pipe", "w")
    );
    $this->checking_script_resource = proc_open($command, $descriptorspec, $this->pipes);

    if (!is_resource($this->checking_script_resource)) {
      throw new \Exception("Could not create process for classIsUsable().");
    }

    foreach ($psr4 as $line) {
      $this->sendCommand('PSR4', $line);
    }
  }
protected function setupScript ( ) { // The PHP that proc_open() will find may not be the same one as run by // the webserver, and indeed, on some systems may be an out-of-date version, // so detect the PHP that we're currently running and ensure we use that. $ php = PHP_BINDIR . '/php' ; $ script_name = __DIR__ . '/../../class_safety_checker.php' ; $ drupal_root = $ this -> environment -> getRoot ( ) ; $ autoloader_filepath = $ drupal_root . '/autoload.php' ; // We need to pass all the dynamic namespaces to the script, as Composer's // generated autoloader knows only about /vendor and /core/lib, but not // modules. // This code is taken from DrupalKernel::attachSynthetic(). $ container = $ this -> environment -> getContainer ( ) ; $ namespaces = $ container -> getParameter ( 'container.namespaces' ) ; $ psr4 = [ ] ; foreach ( $ namespaces as $ prefix => $ paths ) { if ( is_array ( $ paths ) ) { foreach ( $ paths as $ key => $ value ) { $ paths [ $ key ] = $ drupal_root . '/' . $ value ; } } elseif ( is_string ( $ paths ) ) { $ paths = $ drupal_root . '/' . $ paths ; } // Build a list of data to pass to the script on STDIN. // $paths is never an array, AFAICT. $ psr4 [ ] = $ prefix . '\\' . '::' . $ paths ; } // Debug option for the script. $ debug_int = ( int ) $ this -> debug ; $ command = "{$php} {$script_name} '{$autoloader_filepath}' {$debug_int}" ; // Open pipes for both input and output. $ descriptorspec = array ( 0 => array ( "pipe" , "r" ) , 1 => array ( "pipe" , "w" ) ) ; $ this -> checking_script_resource = proc_open ( $ command , $ descriptorspec , $ this -> pipes ) ; if ( ! is_resource ( $ this -> checking_script_resource ) ) { throw new \ Exception ( "Could not create process for classIsUsable()." ) ; } foreach ( $ psr4 as $ line ) { $ this -> sendCommand ( 'PSR4' , $ line ) ; } }
Starts a process running the class safety script.
Starts a process running the class safety script .