aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-09-27 20:31:13 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-09-27 20:31:13 +0200
commit71c2c412f7098050479f496292bc694095d9ec97 (patch)
tree6b935073599cfaff7155156957dcf56b9f14d804 /src
parent54fca64ff16d95d03588217dfaa21f4729c2f930 (diff)
downloadphorkie-71c2c412f7098050479f496292bc694095d9ec97.tar.gz
phorkie-71c2c412f7098050479f496292bc694095d9ec97.zip
CS fixes
Diffstat (limited to 'src')
-rw-r--r--src/phorkie/Database/Adapter/Null/Indexer.php17
-rw-r--r--src/phorkie/Database/Adapter/Null/Setup.php9
-rw-r--r--src/phorkie/File.php15
-rw-r--r--src/phorkie/Forker.php9
-rw-r--r--src/phorkie/Html/Pager.php5
-rw-r--r--src/phorkie/Renderer/ReStructuredText.php3
-rw-r--r--src/phorkie/Repositories.php7
-rw-r--r--src/phorkie/Repository.php16
-rw-r--r--src/phorkie/Repository/Commit.php4
-rw-r--r--src/phorkie/Repository/Post.php24
-rw-r--r--src/phorkie/SetupCheck.php7
11 files changed, 82 insertions, 34 deletions
diff --git a/src/phorkie/Database/Adapter/Null/Indexer.php b/src/phorkie/Database/Adapter/Null/Indexer.php
index afa9713..3b0c990 100644
--- a/src/phorkie/Database/Adapter/Null/Indexer.php
+++ b/src/phorkie/Database/Adapter/Null/Indexer.php
@@ -3,12 +3,21 @@ namespace phorkie;
class Database_Adapter_Null_Indexer
{
- public function addRepo(Repository $repo, $crdate = null) {}
+ public function addRepo(Repository $repo, $crdate = null)
+ {
+ }
- public function updateRepo(Repository $repo, $crdate = null) {}
+ public function updateRepo(Repository $repo, $crdate = null)
+ {
+ }
- public function deleteAllRepos() {}
- public function deleteRepo(Repository $repo) {}
+ public function deleteAllRepos()
+ {
+ }
+
+ public function deleteRepo(Repository $repo)
+ {
+ }
}
?>
diff --git a/src/phorkie/Database/Adapter/Null/Setup.php b/src/phorkie/Database/Adapter/Null/Setup.php
index 3850978..ba98fe4 100644
--- a/src/phorkie/Database/Adapter/Null/Setup.php
+++ b/src/phorkie/Database/Adapter/Null/Setup.php
@@ -3,8 +3,13 @@ namespace phorkie;
class Database_Adapter_Null_Setup
{
- public function setup() {}
- public function reset() {}
+ public function setup()
+ {
+ }
+
+ public function reset()
+ {
+ }
}
?>
diff --git a/src/phorkie/File.php b/src/phorkie/File.php
index 7f5b5b4..db773df 100644
--- a/src/phorkie/File.php
+++ b/src/phorkie/File.php
@@ -64,8 +64,7 @@ class File
//quick hack until https://pear.php.net/bugs/bug.php?id=19385 is fixed
$cmd = new GitCommandBinary($this->repo->getVc());
$cmd->setSubCommand('show');
- return //$this->repo->getVc()->getCommand('show')
- $cmd
+ return $cmd
->addArgument($this->repo->hash . ':' . $this->path)
->execute();
}
@@ -96,10 +95,10 @@ class File
/**
* Get a link to the file
*
- * @param string $type Link type. Supported are:
- * - "raw"
- * - "tool"
- * @param string $option
+ * @param string $type Link type. Supported are:
+ * - "raw"
+ * - "tool"
+ * @param string $option Additional option, e.g. tool name
*
* @return string
*/
@@ -113,7 +112,9 @@ class File
. '/' . $this->getFilename();
}
} else if ($type == 'tool') {
- return '/' . $this->repo->id . '/tool/' . $option . '/' . $this->getFilename();
+ return '/' . $this->repo->id
+ . '/tool/' . $option
+ . '/' . $this->getFilename();
}
throw new Exception('Unknown type');
}
diff --git a/src/phorkie/Forker.php b/src/phorkie/Forker.php
index c75cb39..f293455 100644
--- a/src/phorkie/Forker.php
+++ b/src/phorkie/Forker.php
@@ -28,11 +28,16 @@ class Forker
$rs = new Repositories();
$new = $rs->createNew();
$vc = $new->getVc();
- \rmdir($new->gitDir);//VersionControl_Git wants an existing dir, git clone not
+
+ //VersionControl_Git wants an existing dir, git clone not
+ \rmdir($new->gitDir);
+
$vc->getCommand('clone')
//this should be setOption, but it fails with a = between name and value
->addArgument('--separate-git-dir')
- ->addArgument($GLOBALS['phorkie']['cfg']['gitdir'] . '/' . $new->id . '.git')
+ ->addArgument(
+ $GLOBALS['phorkie']['cfg']['gitdir'] . '/' . $new->id . '.git'
+ )
->addArgument($pathOrUrl)
->addArgument($new->workDir)
->execute();
diff --git a/src/phorkie/Html/Pager.php b/src/phorkie/Html/Pager.php
index 57794a1..e58ccc6 100644
--- a/src/phorkie/Html/Pager.php
+++ b/src/phorkie/Html/Pager.php
@@ -6,7 +6,12 @@ class Html_Pager
protected $pager;
/**
+ * Create a new pager
+ *
+ * @param integer $itemCount Number of items in total
+ * @param integer $perPage Number of items on one page
* @param integer $currentPage Current page, beginning with 1
+ * @param string $filename URL the page number shall be appended
*/
public function __construct($itemCount, $perPage, $currentPage, $filename)
{
diff --git a/src/phorkie/Renderer/ReStructuredText.php b/src/phorkie/Renderer/ReStructuredText.php
index 7ecc2f7..d8d3183 100644
--- a/src/phorkie/Renderer/ReStructuredText.php
+++ b/src/phorkie/Renderer/ReStructuredText.php
@@ -44,7 +44,8 @@ class Renderer_ReStructuredText
if ($retval != 0) {
$html = '<div class="alert">'
- . 'rst2html encountered some error; return value ' . $retval . '<br/>'
+ . 'rst2html encountered some error; return value '
+ . $retval . '<br/>'
. 'Error message: ' . $errors
. '</div>'
. $html;
diff --git a/src/phorkie/Repositories.php b/src/phorkie/Repositories.php
index dc26a17..a75f2c2 100644
--- a/src/phorkie/Repositories.php
+++ b/src/phorkie/Repositories.php
@@ -16,7 +16,12 @@ class Repositories
{
chdir($this->gitDir);
$dirs = glob('*.git', GLOB_ONLYDIR);
- array_walk($dirs, function ($dir) { return substr($dir, 0, -4); });
+ array_walk(
+ $dirs,
+ function ($dir) {
+ return substr($dir, 0, -4);
+ }
+ );
sort($dirs, SORT_NUMERIC);
$n = end($dirs) + 1;
diff --git a/src/phorkie/Repository.php b/src/phorkie/Repository.php
index 25b049c..0cc279b 100644
--- a/src/phorkie/Repository.php
+++ b/src/phorkie/Repository.php
@@ -238,14 +238,14 @@ class Repository
/**
* Get a link to the repository
*
- * @param string $type Link type. Supported are:
- * - "edit"
- * - "delete"
- * - "delete-confirm"
- * - "display"
- * - "fork"
- * - "revision"
- * @param string $option
+ * @param string $type Link type. Supported are:
+ * - "edit"
+ * - "delete"
+ * - "delete-confirm"
+ * - "display"
+ * - "fork"
+ * - "revision"
+ * @param string $option Additional link option, e.g. revision number
*
* @return string
*/
diff --git a/src/phorkie/Repository/Commit.php b/src/phorkie/Repository/Commit.php
index 62f1d40..1ac8cc5 100644
--- a/src/phorkie/Repository/Commit.php
+++ b/src/phorkie/Repository/Commit.php
@@ -44,7 +44,9 @@ class Repository_Commit
$r = intval($r / $quot);
$g = intval($g / $quot);
}
- $string = str_repeat('g', $g) . str_repeat('r', $r) . str_repeat('n', 7 - $g - $r);
+ $string = str_repeat('g', $g)
+ . str_repeat('r', $r)
+ . str_repeat('n', 7 - $g - $r);
return str_split($string);
}
diff --git a/src/phorkie/Repository/Post.php b/src/phorkie/Repository/Post.php
index f94d9ab..90304bb 100644
--- a/src/phorkie/Repository/Post.php
+++ b/src/phorkie/Repository/Post.php
@@ -58,7 +58,9 @@ class Repository_Post
if ($name == '') {
if ($bUpload) {
- $name = Tools::sanitizeFilename($_FILES['files']['name'][$num]['upload']);
+ $name = Tools::sanitizeFilename(
+ $_FILES['files']['name'][$num]['upload']
+ );
} else {
$name = $this->getNextNumberedFile('phork')
. '.' . $arFile['type'];
@@ -102,13 +104,18 @@ class Repository_Post
$bCommit = true;
} else if ($bUpload) {
move_uploaded_file(
- $_FILES['files']['tmp_name'][$num]['upload'], $file->getFullPath()
+ $_FILES['files']['tmp_name'][$num]['upload'],
+ $file->getFullPath()
);
$command = $vc->getCommand('add')
->addArgument($file->getFilename())
->execute();
$bCommit = true;
- } else if ($bNew || (isset($arFile['content']) && $file->getContent() != $arFile['content'])) {
+ } else if ($bNew
+ || (isset($arFile['content'])
+ && $file->getContent() != $arFile['content']
+ )
+ ) {
file_put_contents($file->getFullPath(), $arFile['content']);
$command = $vc->getCommand('add')
->addArgument($file->getFilename())
@@ -127,12 +134,15 @@ class Repository_Post
$vc->getCommand('commit')
->setOption('message', '')
->setOption('allow-empty-message')
- ->setOption('author', $sessionData['name'].' <'.$sessionData['email'].'>')
+ ->setOption(
+ 'author',
+ $sessionData['name'] . ' <' . $sessionData['email'] . '>'
+ )
->execute();
//FIXME: git needs ref BEFORE add
//quick hack until http://pear.php.net/bugs/bug.php?id=19605 is fixed
$vc->getCommand('notes --ref=identity add')
- ->setOption('force')
+ ->setOption('force')
->setOption('message', "$notes")
->execute();
$bChanged = true;
@@ -173,7 +183,9 @@ class Repository_Post
$vc->getCommand('init')
//this should be setOption, but it fails with a = between name and value
->addArgument('--separate-git-dir')
- ->addArgument($GLOBALS['phorkie']['cfg']['gitdir'] . '/' . $repo->id . '.git')
+ ->addArgument(
+ $GLOBALS['phorkie']['cfg']['gitdir'] . '/' . $repo->id . '.git'
+ )
->addArgument($repo->workDir)
->execute();
diff --git a/src/phorkie/SetupCheck.php b/src/phorkie/SetupCheck.php
index 95fd759..8c09519 100644
--- a/src/phorkie/SetupCheck.php
+++ b/src/phorkie/SetupCheck.php
@@ -80,8 +80,11 @@ class SetupCheck
$es = parse_url($this->elasticsearch);
if (!preg_match("#/.+/#", $es['path'], $matches)) {
- $this->fail('Improper elasticsearch url. Elasticsearch requires a'
- . ' search domain to store your data. (e.g. http://localhost:9200/phorkie/)');
+ $this->fail(
+ 'Improper elasticsearch url. Elasticsearch requires a'
+ . ' search domain to store your data.'
+ . ' (e.g. http://localhost:9200/phorkie/)'
+ );
}
$dbs = new Database();
$dbs->getSetup()->setup();