Detect the correct tenside home dir and set the environment variable.

@param string $home The home directory.

@return void

@throws \InvalidArgumentException For empty value of $home.
335029
public static function setupHome($home)
    {
        if (empty($home)) {
            throw new \InvalidArgumentException('Empty home directory encountered.');
        }

        if (false === getenv('COMPOSER')) {
            putenv('COMPOSER=' . $home . DIRECTORY_SEPARATOR . 'composer.json');
        }
        chdir($home);

        // Ensure at least one of the environment variables is available.
        if (!getenv('COMPOSER_HOME') && !getenv('HOME')) {
            putenv('COMPOSER_HOME=' . $home);
        }
    }
266556
public function setPath(string $path): void
    {
        if (!file_exists($path) || !is_dir($path)) {
            throw new InvalidArgumentException(
                'Expected the template path to be an existing directory, received: ' . $path
            );
        }

        $this->path = $path;
    }
447611
public function setHost($host) {
        $this->host = (string) $host;
        if (empty($this->host)) {
            throw new InvalidArgumentException('empty host');
        }
        return $this;
    }
264595
public function setAddress(string $address = null) : void
    {
        if (!is_null($address) && !filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6)) {
            Utils::getContainer()->getLogger()->warning(sprintf('Provided argument (%s) is not a valid IP address.', $address));
        }
        $this->Address = $address;
    }
134408
public function setServerAddress($serverAddress)
    {
        $serverAddress = (string) $serverAddress;
        if ($serverAddress === '') {
            throw new \InvalidArgumentException('$serverAddress cannot be empty');
        }

        $this->serverAddress = $serverAddress;
    }
326481
protected function setPath($path)
    {
        if ($path !== '' && !$this->isValidPath($path)) {
            throw new \InvalidArgumentException("Invalid path '$path'");
        }
        
        $this->path = (string)$path;
    }
973917
private function setDroidIpToPrivateIp($host)
    {
        if ($host->droid_ip
            || ! $this->getEnvironment()
            || $this->getEnvironment()->droid_use_private_net !== true
        ) {
            return;
        }

        if (! $host->private_ip) {
            throw new RuntimeException(
                sprintf(
                    'I am unable to add "%s" to the Inventory because it is missing the "private_ip" required by the environment setting "droid_use_private_net".',
                    $host->getName()
                )
            );
        }

        $host->droid_ip = $host->private_ip;
    }
461114
public void setDataHome(String dir) {
        if (dir == null) {
            mDataHome = null;
        } else {
            setDataHomeFile(new File(dir));
        }
    }
437859
public function setRootDir(/*# string */ $rootDir)
    {
        $dir = realpath($rootDir);

        if (false === $dir) {
            throw new InvalidArgumentException(
                Message::get(Message::CONFIG_ROOT_INVALID, $rootDir),
                Message::CONFIG_ROOT_INVALID
            );
        }

        $this->root_dir = $dir . \DIRECTORY_SEPARATOR;

        return $this;
    }
1174681
public function setParent($parent)
    {
        if ($parent !== null &&  !$parent instanceof BaseEntry) {
            throw new \InvalidArgumentException('An entry may only have another entry as parent');
        }

        $this->parent = $parent;
    }
1349545
public static function setScanDir()
    {
        if (!getenv("BARTLETT_SCAN_DIR")) {
            $home = defined('PHP_WINDOWS_VERSION_BUILD') ? 'USERPROFILE' : 'HOME';
            $dirs = array(
                realpath('.'),
                getenv($home) . DIRECTORY_SEPARATOR . '.config',
                DIRECTORY_SEPARATOR . 'etc',
            );
            putenv("BARTLETT_SCAN_DIR=" . implode(PATH_SEPARATOR, $dirs));
        }
    }
333982
public static function SetDirectory($dir) {
    if (!is_dir($dir)) {
      if (!@\mkdir($dir, 0700, TRUE)) {
        throw new \InvalidArgumentException("dir $dir does not exist and could not be created");
      }
    }

    self::$DIR = realpath($dir);
  }
58921
public function setHost($url)
    {
        if (filter_var($url, FILTER_VALIDATE_URL) === false) {
            throw new \InvalidArgumentException('Invalid Host URL');
        }

        $this->host = $url;
    }
570294
public function setHost($host)
    {
        if (preg_match(self::PATTERN_MATCH_HOST, $host) !== 1) {
            throw new \InvalidArgumentException('"' . $host . '" is not valid host as part of a URI.', 1184071240);
        }

        $this->host = $host;
    }
40951
protected function verifyMigrationDirectory($path)
    {
        if (!is_dir($path)) {
            throw new \InvalidArgumentException(sprintf(
                'Migration directory "%s" does not exist',
                $path
            ));
        }

        if (!is_writable($path)) {
            throw new \InvalidArgumentException(sprintf(
                'Migration directory "%s" is not writable',
                $path
            ));
        }
    }
1175645
public function resetOpCacheFor(string $homepageUrl): self
    {
        if (!Str::startsWith($homepageUrl, 'http')) {
            throw new InvalidConfigurationException(sprintf('The value of %s option must be the valid URL of your homepage (it must start with http:// or https://).', Option::resetOpCacheFor));
        }

        $this->resetOpCacheFor = rtrim($homepageUrl, '/');

        return $this;
    }
528733
public function setAddress($address)
    {
        if (null === $address) {
            $this->address = null;
        } elseif ('' == $address) {
            $this->address = '';
        } else {
            $this->assertValidAddress($address);
            $this->address = $address;
        }
        $this->setCachedValue(null);
    }