Completed
Pull Request — master (#41)
by Vladimir
02:29
created
src/allejo/stakx/FrontMatter/FrontMatterParser.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@
 block discarded – undo
194 194
      *
195 195
      * @param  string $frontMatterKey     The current hierarchy of the Front Matter keys being used
196 196
      * @param  string $expandableValue    The Front Matter value that will be expanded
197
-     * @param  array  $arrayVariableNames The Front Matter variable names that reference arrays
197
+     * @param  string[]  $arrayVariableNames The Front Matter variable names that reference arrays
198 198
      *
199 199
      * @return array
200 200
      *
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
      *
62 62
      * @param array $rawFrontMatter
63 63
      */
64
-    public function __construct(&$rawFrontMatter)
64
+    public function __construct (&$rawFrontMatter)
65 65
     {
66 66
         $this->expansionUsed = false;
67 67
         $this->nestingLevel = 0;
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -100,7 +100,9 @@  discard block
 block discarded – undo
100 100
      */
101 101
     private function handleDateField ()
102 102
     {
103
-        if (!isset($this->frontMatter['date'])) { return; }
103
+        if (!isset($this->frontMatter['date']))
104
+        {
105
+return; }
104 106
 
105 107
         $date = &$this->frontMatter['date'];
106 108
         $itemDate = $this->guessDateTime($date);
@@ -258,7 +260,9 @@  discard block
 block discarded – undo
258 260
 
259 261
             if (is_array($value) || is_bool($value))
260 262
             {
261
-                if ($ignoreArrays) { continue; }
263
+                if ($ignoreArrays)
264
+                {
265
+continue; }
262 266
 
263 267
                 throw new YamlUnsupportedVariableException("Yaml variable `$variable` for `$key` is not a supported data type.");
264 268
             }
@@ -348,6 +352,8 @@  discard block
 block discarded – undo
348 352
         {
349 353
             return (new \DateTime($guess));
350 354
         }
351
-        catch (\Exception $e) { return false; }
355
+        catch (\Exception $e)
356
+        {
357
+return false; }
352 358
     }
353 359
 }
354 360
\ No newline at end of file
Please login to merge, or discard this patch.
src/allejo/stakx/Manager/DataManager.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     /**
33 33
      * Get all of the DataItems and DataSets in this manager
34 34
      *
35
-     * @return array
35
+     * @return string
36 36
      */
37 37
     public function getDataItems ()
38 38
     {
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,9 @@  discard block
 block discarded – undo
64 64
      */
65 65
     public function parseDataItems ($folders)
66 66
     {
67
-        if ($folders === null) { return; }
67
+        if ($folders === null)
68
+        {
69
+return; }
68 70
 
69 71
         foreach ($folders as $folder)
70 72
         {
@@ -84,7 +86,9 @@  discard block
 block discarded – undo
84 86
      */
85 87
     public function parseDataSets ($dataSets)
86 88
     {
87
-        if ($dataSets === null) { return; }
89
+        if ($dataSets === null)
90
+        {
91
+return; }
88 92
 
89 93
         /**
90 94
          * The information which each DataSet has from the configuration file
Please login to merge, or discard this patch.
src/allejo/stakx/Manager/PageManager.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -90,6 +90,9 @@
 block discarded – undo
90 90
         $this->targetDir = &$folder;
91 91
     }
92 92
 
93
+    /**
94
+     * @param \allejo\stakx\Object\Configuration $configuration
95
+     */
93 96
     public function configureTwig ($configuration, $options)
94 97
     {
95 98
         $this->twigOpts['configuration'] = $configuration;
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     /**
59 59
      * PageManager constructor
60 60
      */
61
-    public function __construct()
61
+    public function __construct ()
62 62
     {
63 63
         parent::__construct();
64 64
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
     /**
229 229
      * {@inheritdoc}
230 230
      */
231
-    public function isTracked($filePath)
231
+    public function isTracked ($filePath)
232 232
     {
233 233
         return (parent::isTracked($filePath) || isset($this->twigExtendsDeps[$filePath]));
234 234
     }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
     /**
237 237
      * {@inheritdoc}
238 238
      */
239
-    public function refreshItem($filePath)
239
+    public function refreshItem ($filePath)
240 240
     {
241 241
         if (parent::isTracked($filePath))
242 242
         {
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     /**
257 257
      * {@inheritdoc}
258 258
      */
259
-    protected function handleTrackableItem($filePath, $options = array())
259
+    protected function handleTrackableItem ($filePath, $options = array())
260 260
     {
261 261
         $pageView  = PageView::create($filePath);
262 262
         $namespace = $pageView->getType();
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
         {
535 535
             $filePath = $this->fs->getRelativePath($parent->getSourceContext()->getPath());
536 536
 
537
-            $this->twigExtendsDeps[$filePath][(string)$pageView->getFilePath()] = &$pageView;
537
+            $this->twigExtendsDeps[$filePath][(string) $pageView->getFilePath()] = &$pageView;
538 538
             $parent = $parent->getParent(array());
539 539
         }
540 540
     }
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,6 @@
 block discarded – undo
12 12
 use allejo\stakx\FrontMatter\ExpandedValue;
13 13
 use allejo\stakx\Object\ContentItem;
14 14
 use allejo\stakx\Object\DynamicPageView;
15
-use allejo\stakx\Object\JailObject;
16 15
 use allejo\stakx\Object\PageView;
17 16
 use allejo\stakx\Object\RepeaterPageView;
18 17
 use allejo\stakx\System\FileExplorer;
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -150,7 +150,9 @@  discard block
 block discarded – undo
150 150
      */
151 151
     public function parsePageViews ($pageViewFolders)
152 152
     {
153
-        if (empty($pageViewFolders)) { return; }
153
+        if (empty($pageViewFolders))
154
+        {
155
+return; }
154 156
 
155 157
         /**
156 158
          * The name of the folder where PageViews are located
@@ -332,7 +334,9 @@  discard block
 block discarded – undo
332 334
      */
333 335
     private function handleTrackableStaticPageView ($pageView)
334 336
     {
335
-        if (empty($pageView['title'])) { return; }
337
+        if (empty($pageView['title']))
338
+        {
339
+return; }
336 340
 
337 341
         $this->flatPages[$pageView['title']] = $pageView;
338 342
     }
@@ -548,7 +552,9 @@  discard block
 block discarded – undo
548 552
      */
549 553
     private function trackParentTwigTemplate ($template, &$pageView)
550 554
     {
551
-        if (!$this->tracking) { return; }
555
+        if (!$this->tracking)
556
+        {
557
+return; }
552 558
 
553 559
         /** @var Twig_Template $parent */
554 560
         $parent = $template->getParent(array());
Please login to merge, or discard this patch.
src/allejo/stakx/Object/Configuration.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -163,6 +163,9 @@
 block discarded – undo
163 163
         return $this->configuration['twig']['autoescape'];
164 164
     }
165 165
 
166
+    /**
167
+     * @return false|string
168
+     */
166 169
     public function getRedirectTemplate ()
167 170
     {
168 171
         return $this->configuration['templates']['redirect'];
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     /**
35 35
      * Configuration constructor.
36 36
      */
37
-    public function __construct()
37
+    public function __construct ()
38 38
     {
39 39
         $this->configuration = array();
40 40
         $this->fs            = new Filesystem();
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     /**
65 65
      * {@inheritdoc}
66 66
      */
67
-    public function setLogger(LoggerInterface $logger)
67
+    public function setLogger (LoggerInterface $logger)
68 68
     {
69 69
         $this->output = $logger;
70 70
     }
Please login to merge, or discard this patch.
src/allejo/stakx/Object/FrontMatterObject.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -318,7 +318,7 @@
 block discarded – undo
318 318
     /**
319 319
      * Get the original file path
320 320
      *
321
-     * @return string
321
+     * @return SplFileInfo
322 322
      */
323 323
     final public function getFilePath ()
324 324
     {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -392,7 +392,9 @@
 block discarded – undo
392 392
      */
393 393
     final public function deleteFrontMatter ($key)
394 394
     {
395
-        if (!isset($this->writableFrontMatter[$key])) { return; }
395
+        if (!isset($this->writableFrontMatter[$key]))
396
+        {
397
+return; }
396 398
 
397 399
         unset($this->writableFrontMatter[$key]);
398 400
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
 
85 85
         if (!$this->fs->exists($filePath))
86 86
         {
87
-            throw new FileNotFoundException("The following file could not be found: ${filePath}");
87
+            throw new FileNotFoundException("The following file could not be found: ${filepath}");
88 88
         }
89 89
 
90 90
         $this->extension = strtolower($this->fs->getExtension($filePath));
Please login to merge, or discard this patch.
src/allejo/stakx/Object/Website.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -322,6 +322,9 @@  discard block
 block discarded – undo
322 322
         $this->noClean = $noClean;
323 323
     }
324 324
 
325
+    /**
326
+     * @param string $filePath
327
+     */
325 328
     private function creationWatcher ($filePath)
326 329
     {
327 330
         $this->output->writeln(sprintf("File creation detected: %s", $filePath));
@@ -363,6 +366,9 @@  discard block
 block discarded – undo
363 366
         }
364 367
     }
365 368
 
369
+    /**
370
+     * @param string $filePath
371
+     */
366 372
     private function modificationWatcher ($filePath)
367 373
     {
368 374
         $this->output->writeln(sprintf("File change detected: %s", $filePath));
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
         $this->pm->configureTwig($this->getConfiguration(), array(
149 149
             'safe'    => $this->safeMode,
150 150
             'globals' => array(
151
-                array('name' => 'site',        'value' => $this->getConfiguration()->getConfiguration()),
151
+                array('name' => 'site', 'value' => $this->getConfiguration()->getConfiguration()),
152 152
                 array('name' => 'collections', 'value' => $this->cm->getJailedCollections()),
153
-                array('name' => 'menu',        'value' => $this->mm->getSiteMenu()),
154
-                array('name' => 'pages',       'value' => $this->pm->getJailedStaticPages()),
155
-                array('name' => 'data',        'value' => $this->dm->getDataItems())
153
+                array('name' => 'menu', 'value' => $this->mm->getSiteMenu()),
154
+                array('name' => 'pages', 'value' => $this->pm->getJailedStaticPages()),
155
+                array('name' => 'data', 'value' => $this->dm->getDataItems())
156 156
             )
157 157
         ));
158 158
         $this->pm->compileAll();
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     /**
319 319
      * @return boolean
320 320
      */
321
-    public function isNoClean()
321
+    public function isNoClean ()
322 322
     {
323 323
         return $this->noClean;
324 324
     }
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
     /**
327 327
      * @param boolean $noClean
328 328
      */
329
-    public function setNoClean($noClean)
329
+    public function setNoClean ($noClean)
330 330
     {
331 331
         $this->noClean = $noClean;
332 332
     }
Please login to merge, or discard this patch.
src/allejo/stakx/System/FileExplorer.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@
 block discarded – undo
63 63
      * FileExplorer constructor.
64 64
      *
65 65
      * @param \RecursiveIterator $iterator
66
-     * @param array              $excludes
67
-     * @param array              $includes
66
+     * @param string[]              $excludes
67
+     * @param string[]              $includes
68 68
      * @param int|null           $flags
69 69
      */
70 70
     public function __construct(\RecursiveIterator $iterator, array $excludes = array(), array $includes = array(), $flags = null)
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     /**
21 21
      * A bitwise flag to have FileExplorer search files starting with a period as well
22 22
      */
23
-    const ALLOW_DOT_FILES    = 0x2;
23
+    const ALLOW_DOT_FILES = 0x2;
24 24
 
25 25
     /**
26 26
      * A list of common version control folders to ignore.
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      *
37 37
      * @var string[]
38 38
      */
39
-    public static $vcsPatterns =  array('.git', '.hg', '.svn', '_svn');
39
+    public static $vcsPatterns = array('.git', '.hg', '.svn', '_svn');
40 40
 
41 41
     /**
42 42
      * A list of phrases to exclude from the search
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      * @param array              $includes
68 68
      * @param int|null           $flags
69 69
      */
70
-    public function __construct(\RecursiveIterator $iterator, array $excludes = array(), array $includes = array(), $flags = null)
70
+    public function __construct (\RecursiveIterator $iterator, array $excludes = array(), array $includes = array(), $flags = null)
71 71
     {
72 72
         parent::__construct($iterator);
73 73
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     /**
80 80
      * @return string
81 81
      */
82
-    public function __toString()
82
+    public function __toString ()
83 83
     {
84 84
         return $this->current()->getFilename();
85 85
     }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      *
106 106
      * @return SplFileInfo
107 107
      */
108
-    public function current()
108
+    public function current ()
109 109
     {
110 110
         /** @var \SplFileInfo $current */
111 111
         $current = parent::current();
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     /**
121 121
      * {@inheritdoc}
122 122
      */
123
-    public function getChildren()
123
+    public function getChildren ()
124 124
     {
125 125
         return (new self(
126 126
             $this->getInnerIterator()->getChildren(),
Please login to merge, or discard this patch.
Braces   +13 added lines, -4 removed lines patch added patch discarded remove patch
@@ -143,11 +143,17 @@  discard block
 block discarded – undo
143 143
      */
144 144
     public function matchesPattern ($filePath)
145 145
     {
146
-        if ($this->strpos_array($filePath, $this->includes)) { return true; }
147
-        if (($this->flags & self::INCLUDE_ONLY_FILES) && !$this->current()->isDir()) { return false; }
146
+        if ($this->strpos_array($filePath, $this->includes))
147
+        {
148
+return true; }
149
+        if (($this->flags & self::INCLUDE_ONLY_FILES) && !$this->current()->isDir())
150
+        {
151
+return false; }
148 152
 
149 153
         if (!($this->flags & self::ALLOW_DOT_FILES) &&
150
-            preg_match('#(^|\\\\|\/)\..+(\\\\|\/|$)#', $filePath) === 1) { return false; }
154
+            preg_match('#(^|\\\\|\/)\..+(\\\\|\/|$)#', $filePath) === 1)
155
+        {
156
+return false; }
151 157
 
152 158
         return ($this->strpos_array($filePath, $this->excludes) === false);
153 159
     }
@@ -192,10 +198,13 @@  discard block
 block discarded – undo
192 198
                 return true;
193 199
             }
194 200
 
195
-            if (strpos($haystack, $query, $offset) !== false) // stop on first true result
201
+            if (strpos($haystack, $query, $offset) !== false)
202
+            {
203
+                // stop on first true result
196 204
             {
197 205
                 return true;
198 206
             }
207
+            }
199 208
         }
200 209
 
201 210
         return false;
Please login to merge, or discard this patch.
src/allejo/stakx/Twig/TextExtension.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     /**
16 16
      * Returns a list of filters.
17 17
      *
18
-     * @return array
18
+     * @return Twig_SimpleFilter[]
19 19
      */
20 20
     public function getFilters ()
21 21
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     public function getFilters ()
21 21
     {
22 22
         return array(
23
-            new Twig_SimpleFilter('summary',  'twig_summary_filter'),
23
+            new Twig_SimpleFilter('summary', 'twig_summary_filter'),
24 24
             new Twig_SimpleFilter('truncate', 'twig_truncate_filter', array('needs_environment' => true)),
25 25
             new Twig_SimpleFilter('wordwrap', 'twig_wordwrap_filter', array('needs_environment' => true)),
26 26
         );
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             $length = $breakpoint;
74 74
         }
75 75
 
76
-        return rtrim(mb_substr($value, 0, $length, $env->getCharset())).$separator;
76
+        return rtrim(mb_substr($value, 0, $length, $env->getCharset())) . $separator;
77 77
     }
78 78
 
79 79
     return $value;
Please login to merge, or discard this patch.
src/allejo/stakx/Object/JailObject.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     /**
104 104
      * {@inheritdoc}
105 105
      */
106
-    public function offsetExists($offset)
106
+    public function offsetExists ($offset)
107 107
     {
108 108
         return $this->object->offsetExists($offset);
109 109
     }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     /**
112 112
      * {@inheritdoc}
113 113
      */
114
-    public function offsetGet($offset)
114
+    public function offsetGet ($offset)
115 115
     {
116 116
         return $this->object->offsetGet($offset);
117 117
     }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     /**
120 120
      * {@inheritdoc}
121 121
      */
122
-    public function offsetSet($offset, $value)
122
+    public function offsetSet ($offset, $value)
123 123
     {
124 124
         return $this->object->offsetSet($offset, $value);
125 125
     }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     /**
128 128
      * {@inheritdoc}
129 129
      */
130
-    public function offsetUnset($offset)
130
+    public function offsetUnset ($offset)
131 131
     {
132 132
         return $this->object->offsetUnset($offset);
133 133
     }
Please login to merge, or discard this patch.