Sha256: 76dedff54613d11092272f5329e159ac0e5ce8be663cea7212093a2748da1a3f

Contents?: true

Size: 1.55 KB

Versions: 42

Compression:

Stored size: 1.55 KB

Contents

<?php

/*
 * This file is part of composer/xdebug-handler.
 *
 * (c) Composer <https://github.com/composer>
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 */

namespace Composer\XdebugHandler;

/**
 * @author John Stevenson <john-stevenson@blueyonder.co.uk>
 */
class PhpConfig
{
    /**
     * Use the original PHP configuration
     *
     * @return array PHP cli options
     */
    public function useOriginal()
    {
        $this->getDataAndReset();
        return array();
    }

    /**
     * Use standard restart settings
     *
     * @return array PHP cli options
     */
    public function useStandard()
    {
        if ($data = $this->getDataAndReset()) {
            return array('-n', '-c', $data['tmpIni']);
        }

        return array();
    }

    /**
     * Use environment variables to persist settings
     *
     * @return array PHP cli options
     */
    public function usePersistent()
    {
        if ($data = $this->getDataAndReset()) {
            Process::setEnv('PHPRC', $data['tmpIni']);
            Process::setEnv('PHP_INI_SCAN_DIR', '');
        }

        return array();
    }

    /**
     * Returns restart data if available and resets the environment
     *
     * @return array|null
     */
    private function getDataAndReset()
    {
        if ($data = XdebugHandler::getRestartSettings()) {
            Process::setEnv('PHPRC', $data['phprc']);
            Process::setEnv('PHP_INI_SCAN_DIR', $data['scanDir']);
        }

        return $data;
    }
}

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
dependabot-composer-0.119.0.beta1 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.113.19 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.112.1 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.111.57 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.111.56 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.111.52 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.111.50 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.111.25 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.111.17 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.111.15 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.110.13 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.108.11 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.108.8 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.107.47 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.107.39 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.107.36 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.107.28 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.107.14 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.106.12 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php
dependabot-composer-0.106.11 helpers/vendor/composer/xdebug-handler/src/PhpConfig.php