本文整理匯總了PHP中PHPCI\Builder::interpolate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Builder::interpolate方法的具體用法?PHP Builder::interpolate怎麽用?PHP Builder::interpolate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PHPCI\Builder
的用法示例。
在下文中一共展示了Builder::interpolate方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* Set up the plugin, configure options, etc.
* @param Builder $phpci
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
{
$path = $phpci->buildPath;
$this->phpci = $phpci;
$this->build = $build;
$this->directory = isset($options['directory']) ? $this->phpci->interpolate($options['directory']) : $path;
}
示例2: execute
/**
* Connects to PgSQL and runs a specified set of queries.
* @return boolean
*/
public function execute()
{
try {
$opts = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
$pdo = new PDO('pgsql:host=' . $this->host, $this->user, $this->pass, $opts);
foreach ($this->queries as $query) {
$pdo->query($this->phpci->interpolate($query));
}
} catch (\Exception $ex) {
$this->phpci->logFailure($ex->getMessage());
return false;
}
return true;
}
示例3: execute
/**
* Runs the shell command.
*/
public function execute()
{
if (!defined('ENABLE_SHELL_PLUGIN') || !ENABLE_SHELL_PLUGIN) {
throw new \Exception('The shell plugin is not enabled.');
}
$success = true;
foreach ($this->commands as $command) {
$command = $this->phpci->interpolate($command);
if (!$this->phpci->executeCommand($command)) {
$success = false;
}
}
return $success;
}
示例4: executeFile
/**
* @param string $query
* @return boolean
* @throws \Exception
*/
protected function executeFile($query)
{
if (!isset($query['file'])) {
throw new \Exception(Lang::get('import_file_key'));
}
$import_file = $this->phpci->buildPath . $this->phpci->interpolate($query['file']);
if (!is_readable($import_file)) {
throw new \Exception(Lang::get('cannot_open_import', $import_file));
}
$database = isset($query['database']) ? $this->phpci->interpolate($query['database']) : null;
$import_command = $this->getImportCommand($import_file, $database);
if (!$this->phpci->executeCommand($import_command)) {
throw new \Exception(Lang::get('unable_to_execute'));
}
return true;
}
示例5: executeFile
/**
* @param string $query
* @return boolean
* @throws \Exception
*/
protected function executeFile($query)
{
if (!isset($query['file'])) {
throw new \Exception("Import statement must contain a 'file' key");
}
$import_file = $this->phpci->buildPath . $this->phpci->interpolate($query['file']);
if (!is_readable($import_file)) {
throw new \Exception("Cannot open SQL import file: {$import_file}");
}
$database = isset($query['database']) ? $this->phpci->interpolate($query['database']) : null;
$import_command = $this->getImportCommand($import_file, $database);
if (!$this->phpci->executeCommand($import_command)) {
throw new \Exception("Unable to execute SQL file");
}
return true;
}