Permalink
Browse files

* various cs fixes (idention, tabs/spaces, doc blocks, etc.)

 * fixed a typo'd exception name
  • Loading branch information...
1 parent 592f691 commit 1f41da8d3f42052c7019c7a918b3bc4a2f3895f0 @till committed Jun 25, 2012
@@ -32,7 +32,7 @@
/**
* @var array
*/
- static $keys = array(
+ protected static $keys = array(
'binaries' => 'bin',
'scripts',
'type',
@@ -70,7 +70,6 @@
* @param mixed $path
* @param \Composer\Util\ProcessExecutor|null $process
*
- * @return \Composer\Package\Dumper\BaseDumper
* @throws \InvalidArgumentException
*/
public function __construct($path = null, ProcessExecutor $process = null)
@@ -79,7 +78,7 @@ public function __construct($path = null, ProcessExecutor $process = null)
if (!is_writable($path)) {
throw new \InvalidArgumentException("Not authorized to write to '{$path}'");
}
- $this->path = $path;
+ $this->path = $path;
}
$this->process = ($process !== null)?$process:new ProcessExecutor;
$this->temp = sys_get_temp_dir();
@@ -95,10 +94,7 @@ public function __construct($path = null, ProcessExecutor $process = null)
public function getFilename(PackageInterface $package, $extension)
{
$name = $package->getPrettyVersion();
- $fileName = sprintf('%s.%s',
- $name,
- $extension
- );
+ $fileName = sprintf('%s.%s', $name, $extension);
return $fileName;
}
@@ -17,5 +17,13 @@
*/
interface DumperInterface
{
+ /**
+ * Return value depends on implementation - e.g. generating a tar or zip the
+ * method currently returns void, the ArrayDumper returns an array.
+ *
+ * @param PackageInterface $package
+ *
+ * @return mixed
+ */
public function dump(PackageInterface $package);
-}
+}
@@ -32,21 +32,22 @@ public function dump(PackageInterface $package)
$sourceRef = $package->getSourceReference();
switch ($sourceType) {
- case 'git':
- $this->downloadGit($package, $workDir);
- $this->packageGit($fileName, $sourceRef, $workDir);
- break;
- case 'hg':
- $this->downloadHg($package, $workDir);
- $this->packageHg($fileName, $sourceRef, $workDir);
- break;
- case 'svn':
- $dir = $workDir . (substr($sourceRef, 0, 1) !== '/')?'/':'' . $sourceRef;
- $this->downloadSvn($package, $workDir);
- $this->package($fileName, $dir, \Phar::TAR);
- break;
- default:
- throw new \InvalidArgumentException("Unable to handle repositories of type '{$sourceType}'.");
+ case 'git':
+ $this->downloadGit($package, $workDir);
+ $this->packageGit($fileName, $sourceRef, $workDir);
+ break;
+ case 'hg':
+ $this->downloadHg($package, $workDir);
+ $this->packageHg($fileName, $sourceRef, $workDir);
+ break;
+ case 'svn':
+ $dir = $workDir . (substr($sourceRef, 0, 1) !== '/')?'/':'' . $sourceRef;
+ $this->downloadSvn($package, $workDir);
+ $this->package($fileName, $dir, \Phar::TAR);
+ break;
+ default:
+ throw new \InvalidArgumentException(
+ "Unable to handle repositories of type '{$sourceType}'.");
}
}
}
@@ -32,21 +32,21 @@ public function dump(PackageInterface $package)
$sourceRef = $package->getSourceReference();
switch ($sourceType) {
- case 'git':
- $this->downloadGit($package, $workDir);
- $this->packageGit($fileName, $sourceRef, $workDir);
- break;
- case 'hg':
- $this->downloadHg($package, $workDir);
- $this->packageHg($fileName, $sourceRef, $workDir);
- break;
- case 'svn':
- $dir = $workDir . (substr($sourceRef, 0, 1) !== '/')?'/':'' . $sourceRef;
- $this->downloadSvn($package, $workDir);
- $this->package($fileName, $dir, \Phar::ZIP);
- break;
- default:
- throw new \InvalidArgumentException("Unable to handle repositories of type '{$sourceType}'.");
+ case 'git':
+ $this->downloadGit($package, $workDir);
+ $this->packageGit($fileName, $sourceRef, $workDir);
+ break;
+ case 'hg':
+ $this->downloadHg($package, $workDir);
+ $this->packageHg($fileName, $sourceRef, $workDir);
+ break;
+ case 'svn':
+ $dir = $workDir . (substr($sourceRef, 0, 1) !== '/')?'/':'' . $sourceRef;
+ $this->downloadSvn($package, $workDir);
+ $this->package($fileName, $dir, \Phar::ZIP);
+ break;
+ default:
+ throw new \InvalidArgumentException("Unable to handle repositories of type '{$sourceType}'.");
}
}
}
@@ -35,7 +35,7 @@
public function setUp()
{
$this->fs = new Filesystem;
- $this->process = new ProcessExecutor;
+ $this->process = new ProcessExecutor;
$this->testdir = sys_get_temp_dir() . '/composer_dumpertest_git_repository' . mt_rand();
}
@@ -58,20 +58,20 @@ protected function setupGitRepo()
chdir($td);
$result = $this->process->execute("git init -q");
- if ($result > 0) {
+ if ($result > 0) {
throw new \RuntimeException(
"Could not init: " . $this->process->getErrorOutput());
}
$result = file_put_contents('b', 'a');
if (false === $result) {
- throw new \RuntimeExcepton("Could not save file.");
+ throw new \RuntimeException("Could not save file.");
}
$result = $this->process->execute("git add b && git commit -m 'commit b' -q");
if ($result > 0) {
throw new \RuntimeException(
"Could not init: " . $this->process->getErrorOutput());
}
- chdir($currentWorkDir);
+ chdir($currentWorkDir);
}
protected function removeGitRepo()

0 comments on commit 1f41da8

Please sign in to comment.