本文整理汇总了PHP中Robo\Result::errorMissingPackage方法的典型用法代码示例。如果您正苦于以下问题:PHP Result::errorMissingPackage方法的具体用法?PHP Result::errorMissingPackage怎么用?PHP Result::errorMissingPackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Robo\Result
的用法示例。
在下文中一共展示了Result::errorMissingPackage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scssphp
/**
* scssphp compiler
* @link https://github.com/leafo/scssphp
*
* @param string $file
* @return string
*/
protected function scssphp($file)
{
if (!class_exists('\\Leafo\\ScssPhp\\Compiler')) {
return Result::errorMissingPackage($this, 'scssphp', 'leafo/scssphp');
}
$scssCode = file_get_contents($file);
$scss = new \Leafo\ScssPhp\Compiler();
// set options for the scssphp compiler
if (isset($this->compilerOptions['importDirs'])) {
$scss->setImportPaths($this->compilerOptions['importDirs']);
}
if (isset($this->compilerOptions['formatter'])) {
$scss->setFormatter($this->compilerOptions['formatter']);
}
return $scss->compile($scssCode);
}
示例2: less
/**
* less compiler
* @link https://github.com/oyejorge/less.php
*
* @param string $file
*
* @return string
*/
protected function less($file)
{
if (!class_exists('\\Less_Parser')) {
return Result::errorMissingPackage($this, 'Less_Parser', 'oyejorge/less.php');
}
$lessCode = file_get_contents($file);
$parser = new \Less_Parser();
$parser->SetOptions($this->compilerOptions);
if (isset($this->compilerOptions['importDirs'])) {
$importDirs = [];
foreach ($this->compilerOptions['importDirs'] as $dir) {
$importDirs[$dir] = $dir;
}
$parser->SetImportDirs($importDirs);
}
$parser->parse($lessCode);
return $parser->getCss();
}
示例3: run
public function run()
{
if (!class_exists('Lurker\\ResourceWatcher')) {
return Result::errorMissingPackage($this, 'ResourceWatcher', 'henrikbjorn/lurker');
}
$watcher = new ResourceWatcher();
foreach ($this->monitor as $k => $monitor) {
$closure = $monitor[1];
$closure->bindTo($this->bindTo);
foreach ($monitor[0] as $i => $dir) {
$watcher->track("fs.{$k}.{$i}", $dir, FilesystemEvent::MODIFY);
$this->printTaskInfo('Watching {dir} for changes...', ['dir' => $dir]);
$watcher->addListener("fs.{$k}.{$i}", $closure);
}
}
$watcher->start();
return Result::success($this);
}
示例4: extractTar
protected function extractTar($extractLocation)
{
if (!class_exists('Archive_Tar')) {
return Result::errorMissingPackage($this, 'Archive_Tar', 'pear/archive_tar');
}
$tar_object = new \Archive_Tar($this->filename);
if (!$tar_object->extract($extractLocation)) {
return Result::error($this, "Could not extract tar archive {$this->filename}");
}
return Result::success($this);
}
示例5: getMinifiedText
/**
* Minifies and returns text.
*
* @return string|bool
*/
protected function getMinifiedText()
{
switch ($this->type) {
case 'css':
if (!class_exists('\\CssMin')) {
return Result::errorMissingPackage($this, 'CssMin', 'natxet/CssMin');
}
return \CssMin::minify($this->text);
break;
case 'js':
if (!class_exists('\\JSqueeze') && !class_exists('\\Patchwork\\JSqueeze')) {
return Result::errorMissingPackage($this, 'Patchwork\\JSqueeze', 'patchwork/jsqueeze');
}
if (class_exists('\\JSqueeze')) {
$jsqueeze = new \JSqueeze();
} else {
$jsqueeze = new \Patchwork\JSqueeze();
}
return $jsqueeze->squeeze($this->text, $this->squeezeOptions['singleLine'], $this->squeezeOptions['keepImportantComments'], $this->squeezeOptions['specialVarRx']);
break;
}
return false;
}
示例6: archiveTar
protected function archiveTar($archiveFile, $items)
{
if (!class_exists('Archive_Tar')) {
return Result::errorMissingPackage($this, 'Archive_Tar', 'pear/archive_tar');
}
$tar_object = new \Archive_Tar($archiveFile);
foreach ($items as $placementLocation => $filesystemLocation) {
$p_remove_dir = $filesystemLocation;
$p_add_dir = $placementLocation;
if (is_file($filesystemLocation)) {
$p_remove_dir = dirname($filesystemLocation);
$p_add_dir = dirname($placementLocation);
if (basename($filesystemLocation) != basename($placementLocation)) {
return Result::error($this, "Tar archiver does not support renaming files during extraction; could not add {$filesystemLocation} as {$placementLocation}.");
}
}
if (!$tar_object->addModify([$filesystemLocation], $p_add_dir, $p_remove_dir)) {
return Result::error($this, "Could not add {$filesystemLocation} to the archive.");
}
}
return Result::success($this);
}
示例7: less
/**
* less compiler
*
* @link https://github.com/oyejorge/less.php
* @return string
*/
protected function less($file)
{
if (!class_exists('\\Less_Parser')) {
return Result::errorMissingPackage($this, 'Less_Parser', 'oyejorge/less.php');
}
$lessCode = file_get_contents($file);
$parser = new \Less_Parser();
$parser->parse($lessCode);
return $parser->getCss();
}