Completed
Pull Request — master (#41)
by Vladimir
02:31
created
src/allejo/stakx/Manager/CollectionManager.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @return JailObject[][]
59 59
      */
60
-    public function getJailedCollections()
60
+    public function getJailedCollections ()
61 61
     {
62 62
         $jailItems = array();
63 63
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      *
78 78
      * @param string[][] $collections An array of definitions for collections
79 79
      */
80
-    public function parseCollections($collections)
80
+    public function parseCollections ($collections)
81 81
     {
82 82
         if ($collections === null)
83 83
         {
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     /**
119 119
      * {@inheritdoc}
120 120
      */
121
-    public function createNewItem($filePath)
121
+    public function createNewItem ($filePath)
122 122
     {
123 123
         $collection = $this->getTentativeCollectionName($filePath);
124 124
 
@@ -130,14 +130,14 @@  discard block
 block discarded – undo
130 130
     /**
131 131
      * {@inheritdoc}
132 132
      */
133
-    public function refreshItem($filePath)
133
+    public function refreshItem ($filePath)
134 134
     {
135 135
     }
136 136
 
137 137
     /**
138 138
      * {@inheritdoc}
139 139
      */
140
-    protected function handleTrackableItem($filePath, $options = array())
140
+    protected function handleTrackableItem ($filePath, $options = array())
141 141
     {
142 142
         $collectionName = $options['namespace'];
143 143
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      *
163 163
      * @return string
164 164
      */
165
-    private function getTentativeCollectionName($filePath)
165
+    private function getTentativeCollectionName ($filePath)
166 166
     {
167 167
         foreach ($this->collectionDefinitions as $collection)
168 168
         {
Please login to merge, or discard this patch.
src/allejo/stakx/Object/ContentItem.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -31,19 +31,19 @@  discard block
 block discarded – undo
31 31
     /**
32 32
      * {@inheritdoc}
33 33
      */
34
-    public function createJail()
34
+    public function createJail ()
35 35
     {
36 36
         return new JailObject($this, array_merge(self::$whiteListFunctions, array(
37 37
             'getCollection',
38 38
         )), array('getPageView' => 'getJailedPageView'));
39 39
     }
40 40
 
41
-    public function getCollection()
41
+    public function getCollection ()
42 42
     {
43 43
         return $this->parentCollection;
44 44
     }
45 45
 
46
-    public function setCollection($collection)
46
+    public function setCollection ($collection)
47 47
     {
48 48
         $this->parentCollection = $collection;
49 49
     }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      *
54 54
      * @return string
55 55
      */
56
-    public function getContent()
56
+    public function getContent ()
57 57
     {
58 58
         if (!$this->bodyContentEvaluated)
59 59
         {
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
             $this->bodyContentEvaluated = true;
64 64
         }
65 65
 
66
-        return (string)$this->bodyContent;
66
+        return (string) $this->bodyContent;
67 67
     }
68 68
 
69 69
     /**
70 70
      * Parse the Twig that is embedded inside a ContentItem's body.
71 71
      */
72
-    private function parseTwig()
72
+    private function parseTwig ()
73 73
     {
74 74
         $twig = TwigManager::getInstance();
75 75
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     /**
84 84
      * Parse the ContentItem's body based on the extension of the file.
85 85
      */
86
-    private function parseEngines()
86
+    private function parseEngines ()
87 87
     {
88 88
         switch ($this->getExtension())
89 89
         {
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         return $this->parentPageView;
114 114
     }
115 115
 
116
-    public function getJailedPageView()
116
+    public function getJailedPageView ()
117 117
     {
118 118
         return $this->parentPageView->createJail();
119 119
     }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      *
124 124
      * @param PageView $pageView
125 125
      */
126
-    public function setPageView(&$pageView)
126
+    public function setPageView (&$pageView)
127 127
     {
128 128
         $this->parentPageView = &$pageView;
129 129
     }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     /**
132 132
      * {@inheritdoc}
133 133
      */
134
-    public function jsonSerialize()
134
+    public function jsonSerialize ()
135 135
     {
136 136
         return array_merge($this->getFrontMatter(), array(
137 137
             'content'   => $this->getContent(),
Please login to merge, or discard this patch.
src/allejo/stakx/Object/FrontMatterable.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      *
15 15
      * @param array|null $variables An array of YAML variables to use in evaluating the `$permalink` value
16 16
      */
17
-    public function evaluateFrontMatter($variables = null);
17
+    public function evaluateFrontMatter ($variables = null);
18 18
 
19 19
     /**
20 20
      * Get the Front Matter of a ContentItem as an array.
@@ -23,21 +23,21 @@  discard block
 block discarded – undo
23 23
      *
24 24
      * @return array
25 25
      */
26
-    public function getFrontMatter($evaluateYaml = true);
26
+    public function getFrontMatter ($evaluateYaml = true);
27 27
 
28 28
     /**
29 29
      * Returns true when the evaluated Front Matter has expanded values embeded.
30 30
      *
31 31
      * @return bool
32 32
      */
33
-    public function hasExpandedFrontMatter();
33
+    public function hasExpandedFrontMatter ();
34 34
 
35 35
     /**
36 36
      * Append a custom FrontMatter value.
37 37
      *
38 38
      * @param array $frontMatter
39 39
      */
40
-    public function appendFrontMatter(array $frontMatter);
40
+    public function appendFrontMatter (array $frontMatter);
41 41
 
42 42
     /**
43 43
      * Delete a custom FrontMatter value.
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      *
47 47
      * @param string $key
48 48
      */
49
-    public function deleteFrontMatter($key);
49
+    public function deleteFrontMatter ($key);
50 50
 
51 51
     /**
52 52
      * Set custom FrontMatter values.
@@ -56,5 +56,5 @@  discard block
 block discarded – undo
56 56
      *
57 57
      * @param array $frontMatter
58 58
      */
59
-    public function setFrontMatter(array $frontMatter);
59
+    public function setFrontMatter (array $frontMatter);
60 60
 }
Please login to merge, or discard this patch.
src/allejo/stakx/Object/RepeaterPageView.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     /**
36 36
      * {@inheritdoc}
37 37
      */
38
-    public function __construct($filePath)
38
+    public function __construct ($filePath)
39 39
     {
40 40
         parent::__construct($filePath);
41 41
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      *
50 50
      * @return ExpandedValue[]
51 51
      */
52
-    public function getRepeaterPermalinks()
52
+    public function getRepeaterPermalinks ()
53 53
     {
54 54
         return $this->permalinks;
55 55
     }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      *
60 60
      * @return ExpandedValue[][]
61 61
      */
62
-    public function getRepeaterRedirects()
62
+    public function getRepeaterRedirects ()
63 63
     {
64 64
         return $this->redirectLinks;
65 65
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      * When looping through permalinks in a RepeaterPageView, the permalink needs to be updated each time so that it may
69 69
      * behave as a static PageView.
70 70
      */
71
-    public function bumpPermalink()
71
+    public function bumpPermalink ()
72 72
     {
73 73
         $this->permalink = $this->permalinksIterator->current()->getEvaluated();
74 74
         $this->permalinksIterator->next();
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     /**
78 78
      * Rewind the permalink iterator to the beginning.
79 79
      */
80
-    public function rewindPermalink()
80
+    public function rewindPermalink ()
81 81
     {
82 82
         $this->permalinksIterator->rewind();
83 83
     }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     /**
86 86
      * Setup this object.
87 87
      */
88
-    private function configureValues()
88
+    private function configureValues ()
89 89
     {
90 90
         // Cause the Front Matter to be evaluated
91 91
         $this->getFrontMatter();
Please login to merge, or discard this patch.
src/allejo/stakx/Object/JailObject.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      * @param array    $whiteListFunctions A list of function names that can be called
38 38
      * @param array    $jailedFunctions
39 39
      */
40
-    public function __construct(&$object, array $whiteListFunctions, array $jailedFunctions = array())
40
+    public function __construct (&$object, array $whiteListFunctions, array $jailedFunctions = array())
41 41
     {
42 42
         if (!($object instanceof Jailable) && !($object instanceof \ArrayAccess))
43 43
         {
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $this->jailedFunctions = $jailedFunctions;
50 50
     }
51 51
 
52
-    public function __call($name, $arguments)
52
+    public function __call ($name, $arguments)
53 53
     {
54 54
         // White listed functions will always be getter functions, so somehow get the name of a possible getter function
55 55
         // name.
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         throw new \BadMethodCallException();
73 73
     }
74 74
 
75
-    public function coreInstanceOf($class)
75
+    public function coreInstanceOf ($class)
76 76
     {
77 77
         return is_subclass_of($this->object, $class);
78 78
     }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     /**
85 85
      * {@inheritdoc}
86 86
      */
87
-    public function offsetExists($offset)
87
+    public function offsetExists ($offset)
88 88
     {
89 89
         return $this->object->offsetExists($offset);
90 90
     }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     /**
93 93
      * {@inheritdoc}
94 94
      */
95
-    public function offsetGet($offset)
95
+    public function offsetGet ($offset)
96 96
     {
97 97
         return $this->object->offsetGet($offset);
98 98
     }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     /**
101 101
      * {@inheritdoc}
102 102
      */
103
-    public function offsetSet($offset, $value)
103
+    public function offsetSet ($offset, $value)
104 104
     {
105 105
         return $this->object->offsetSet($offset, $value);
106 106
     }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     /**
109 109
      * {@inheritdoc}
110 110
      */
111
-    public function offsetUnset($offset)
111
+    public function offsetUnset ($offset)
112 112
     {
113 113
         return $this->object->offsetUnset($offset);
114 114
     }
Please login to merge, or discard this patch.
src/allejo/stakx/Object/Jailable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,5 +19,5 @@
 block discarded – undo
19 19
      *
20 20
      * @return JailObject
21 21
      */
22
-    public function createJail();
22
+    public function createJail ();
23 23
 }
Please login to merge, or discard this patch.
src/allejo/stakx/Object/DynamicPageView.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     /**
20 20
      * {@inheritdoc}
21 21
      */
22
-    public function __construct($filePath)
22
+    public function __construct ($filePath)
23 23
     {
24 24
         parent::__construct($filePath);
25 25
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      *
33 33
      * @param ContentItem $contentItem
34 34
      */
35
-    public function addContentItem(&$contentItem)
35
+    public function addContentItem (&$contentItem)
36 36
     {
37 37
         $filename = $this->fs->getBaseName($contentItem->getFilePath());
38 38
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      *
46 46
      * @return ContentItem[]
47 47
      */
48
-    public function getContentItems()
48
+    public function getContentItems ()
49 49
     {
50 50
         return $this->contentItems;
51 51
     }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      *
56 56
      * @return string
57 57
      */
58
-    public function getCollection()
58
+    public function getCollection ()
59 59
     {
60 60
         return $this->getFrontMatter(false)['collection'];
61 61
     }
Please login to merge, or discard this patch.
tests/allejo/stakx/Test/StreamInterceptor.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 {
17 17
     public static $output = '';
18 18
 
19
-    public function filter($in, $out, &$consumed, $closing)
19
+    public function filter ($in, $out, &$consumed, $closing)
20 20
     {
21 21
         while ($bucket = stream_bucket_make_writeable($in)) {
22 22
             self::$output .= $bucket->data;
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@
 block discarded – undo
18 18
 
19 19
     public function filter($in, $out, &$consumed, $closing)
20 20
     {
21
-        while ($bucket = stream_bucket_make_writeable($in)) {
21
+        while ($bucket = stream_bucket_make_writeable($in))
22
+        {
22 23
             self::$output .= $bucket->data;
23 24
             $consumed += $bucket->datalen;
24 25
         }
Please login to merge, or discard this patch.
tests/allejo/stakx/Test/PHPUnit_Stakx_TestCase.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,8 @@
 block discarded – undo
84 84
     {
85 85
         $results = array();
86 86
 
87
-        foreach ($elements as $element) {
87
+        foreach ($elements as $element)
88
+        {
88 89
             $filename = (isset($element['filename'])) ? $element['filename'] : hash('sha256', uniqid(mt_rand(), true), false);
89 90
             $frontMatter = (empty($element['frontmatter'])) ? '' : Yaml::dump($element['frontmatter'], 2);
90 91
             $body = (isset($element['body'])) ? $element['body'] : 'Body Text';
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -50,6 +50,9 @@
 block discarded – undo
50 50
     // Assertion functions
51 51
     ///
52 52
 
53
+    /**
54
+     * @param string $haystack
55
+     */
53 56
     protected function assertStringContains($needle, $haystack, $message = '')
54 57
     {
55 58
         $this->assertNotFalse(strpos($haystack, $needle), $message);
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      */
37 37
     protected $fs;
38 38
 
39
-    public function setUp()
39
+    public function setUp ()
40 40
     {
41 41
         $this->dummyFile = vfsStream::newFile('stakx.html.twig');
42 42
         $this->rootDir = vfsStream::setup();
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
     // Assertion functions
51 51
     ///
52 52
 
53
-    protected function assertStringContains($needle, $haystack, $message = '')
53
+    protected function assertStringContains ($needle, $haystack, $message = '')
54 54
     {
55 55
         $this->assertNotFalse(strpos($haystack, $needle), $message);
56 56
     }
57 57
 
58
-    protected function assertFileContains($fileContent, $filePath, $message = '')
58
+    protected function assertFileContains ($fileContent, $filePath, $message = '')
59 59
     {
60 60
         (substr($filePath, -1, 1) == '/') && $filePath .= 'index.html';
61 61
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     // Utility Functions
69 69
     //
70 70
 
71
-    protected function bookCollectionProvider($jailed = false)
71
+    protected function bookCollectionProvider ($jailed = false)
72 72
     {
73 73
         $cm = new CollectionManager();
74 74
         $cm->setLogger($this->getMockLogger());
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      *
90 90
      * @return mixed
91 91
      */
92
-    protected function createVirtualFile($classType, $frontMatter = array(), $body = 'Body Text')
92
+    protected function createVirtualFile ($classType, $frontMatter = array(), $body = 'Body Text')
93 93
     {
94 94
         $this->dummyFile
95 95
             ->setContent($this->generateFM($frontMatter, $body))
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         return new $classType($this->dummyFile->url());
99 99
     }
100 100
 
101
-    protected function createMultipleVirtualFiles($classType, $elements)
101
+    protected function createMultipleVirtualFiles ($classType, $elements)
102 102
     {
103 103
         $results = array();
104 104
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      *
124 124
      * @return LoggerInterface
125 125
      */
126
-    protected function getMockLogger()
126
+    protected function getMockLogger ()
127 127
     {
128 128
         return $this->getMock(LoggerInterface::class);
129 129
     }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      *
134 134
      * @return StakxLogger
135 135
      */
136
-    protected function getReadableLogger()
136
+    protected function getReadableLogger ()
137 137
     {
138 138
         stream_filter_register('intercept', StreamInterceptor::class);
139 139
         $stakxLogger = new StakxLogger(new ConsoleOutput());
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      *
151 151
      * @return string
152 152
      */
153
-    protected function generateFM(array $frontMatter = array(), $body = 'Body text')
153
+    protected function generateFM (array $frontMatter = array(), $body = 'Body text')
154 154
     {
155 155
         $fm = (empty($frontMatter)) ? '' : Yaml::dump($frontMatter, 2);
156 156
 
Please login to merge, or discard this patch.