CS fixes
authorChristian Weiske <cweiske@cweiske.de>
Thu, 27 Sep 2012 18:31:13 +0000 (20:31 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Thu, 27 Sep 2012 18:31:13 +0000 (20:31 +0200)
src/phorkie/Database/Adapter/Null/Indexer.php
src/phorkie/Database/Adapter/Null/Setup.php
src/phorkie/File.php
src/phorkie/Forker.php
src/phorkie/Html/Pager.php
src/phorkie/Renderer/ReStructuredText.php
src/phorkie/Repositories.php
src/phorkie/Repository.php
src/phorkie/Repository/Commit.php
src/phorkie/Repository/Post.php
src/phorkie/SetupCheck.php

index afa9713c04f76aeb7553dd19f7a73241e1af30f7..3b0c9906b2e13648ef9798c1432eebf66a8653b1 100644 (file)
@@ -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)
+    {
+    }
 }
 
 ?>
index 385097877efc2c11cb8424a34a26f6ac57da48ee..ba98fe4373eaf3c310726284bc26a8b7e4a03bc9 100644 (file)
@@ -3,8 +3,13 @@ namespace phorkie;
 
 class Database_Adapter_Null_Setup
 {
-    public function setup() {}
-    public function reset() {}
+    public function setup()
+    {
+    }
+
+    public function reset()
+    {
+    }
 }
 
 ?>
index 7f5b5b407df44747c9d67f6f34f6f1eff7b025e9..db773df070a936ad793f49fc1fdb3c341549c08c 100644 (file)
@@ -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');
     }
index c75cb393a1dc6dea2e524d3b4758454215bf765b..f293455a54010187c2c8b667f23d17c204aa5106 100644 (file)
@@ -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();
index 57794a16df6d862daa6b0ebc58a2098080d6c531..e58ccc6d6f6831e18658f5affdcd8c930bb6f4d1 100644 (file)
@@ -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)
     {
index 7ecc2f70aa13d3658b2fda1452c114fbe5431b08..d8d318397eba80b6920baf711d95d16a4bd0f583 100644 (file)
@@ -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;
index dc26a171eebecafc575d0325bc8c78e353726f4c..a75f2c23a62d23ca93f6e57ee340592317ce9f2d 100644 (file)
@@ -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;
 
index 25b049cb1d91a4280ec1def1f770717907612ed6..0cc279b7472f0b66442a47d2ad77633c6f4394c6 100644 (file)
@@ -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
      */
index 62f1d408cb8f09373d2b3709479af07881f510c2..1ac8cc5cce40788a526446f40578ecf9b51112cd 100644 (file)
@@ -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);
     }
index f94d9ab755d4ddc492451b19f54cdef8fb7a3d4a..90304bb602af8340df1fd0f4f205cae9e357cbfc 100644 (file)
@@ -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();
 
index 95fd75993d2c3b88076573e75059915da39cd2c3..8c09519f8cf6fee0c9d4081a936ecde9d348c076 100644 (file)
@@ -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();