/** * Checks to see if the variable exists * * @param string $variable The variable to check * @param string $type The variable type * * @throws \InvalidArgumentException If the variable does not exist * * @return bool Does the variable exist */ private function checkVariableExists($variable, $type) { if ($type === 'env' && !getenv($variable) || $type === 'replacement' && !$this->rstore->arrayKeyExists($variable) || $type === 'variable' && !$this->vstore->arrayKeyExists($variable)) { throw new \InvalidArgumentException(sprintf('Variable has not been defined as a `%s`: %s', $variable, $type)); } return true; }