Completed
Push — master ( c524ca...754537 )
by Petrus
06:40
created
vendor/mos/ctextfilter/src/TextFilter/CTextFilter.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -194,11 +194,11 @@
 block discarded – undo
194 194
      * Call each filter and return array with details of the formatted content.
195 195
      *
196 196
      * @param string $text   the text to filter.
197
-     * @param array  $filter array of filters to use.
197
+     * @param string[]  $filter array of filters to use.
198 198
      *
199 199
      * @throws mos/TextFilter/Exception  when filterd does not exists.
200 200
      *
201
-     * @return array with the formatted text and additional details.
201
+     * @return \stdClass with the formatted text and additional details.
202 202
      */
203 203
     public function parse($text, $filter)
204 204
     {
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@
 block discarded – undo
21 21
         "nl2br",
22 22
         "purify",
23 23
         "titlefromh1",
24
-     ];
24
+        ];
25 25
 
26 26
 
27 27
 
28
-     /**
29
-      * Current document parsed.
30
-      */
28
+        /**
29
+         * Current document parsed.
30
+         */
31 31
     private $current;
32 32
 
33 33
 
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
         // For each filter, call its function with the $text as parameter.
67 67
         foreach ($filter as $key) {
68 68
 
69
-            if (!isset($callbacks[$key])) {
69
+            if (!isset($callbacks[ $key ])) {
70 70
                 throw new Exception("The filter '$filters' is not a valid filter string due to '$key'.");
71 71
             }
72
-            $text = call_user_func_array([$this, $callbacks[$key]], [$text]);
72
+            $text = call_user_func_array([ $this, $callbacks[ $key ] ], [ $text ]);
73 73
         }
74 74
 
75 75
         return $text;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         }
121 121
 
122 122
         if (is_null($this->current->frontmatter)) {
123
-            $this->current->frontmatter = [];
123
+            $this->current->frontmatter = [ ];
124 124
         }
125 125
 
126 126
         $this->current->frontmatter = array_merge_recursive($this->current->frontmatter, $matter);
@@ -155,20 +155,20 @@  discard block
 block discarded – undo
155 155
         switch ($filter) {
156 156
             case "jsonfrontmatter":
157 157
                 $res = $this->jsonFrontMatter($text);
158
-                $this->current->text = $res["text"];
159
-                $this->addToFrontmatter($res["frontmatter"]);
158
+                $this->current->text = $res[ "text" ];
159
+                $this->addToFrontmatter($res[ "frontmatter" ]);
160 160
                 break;
161 161
 
162 162
             case "yamlfrontmatter":
163 163
                 $res = $this->yamlFrontMatter($text);
164
-                $this->current->text = $res["text"];
165
-                $this->addToFrontmatter($res["frontmatter"]);
164
+                $this->current->text = $res[ "text" ];
165
+                $this->addToFrontmatter($res[ "frontmatter" ]);
166 166
                 break;
167 167
 
168 168
             case "titlefromh1":
169 169
                 $title = $this->getTitleFromFirstH1($text);
170 170
                 $this->current->text = $text;
171
-                $this->addToFrontmatter(["title" => $title]);
171
+                $this->addToFrontmatter([ "title" => $title ]);
172 172
                 break;
173 173
 
174 174
             case "bbcode":
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
             case "nl2br":
179 179
             case "purify":
180 180
                 $this->current->text = call_user_func_array(
181
-                    [$this, $callbacks[$filter]],
182
-                    [$text]
181
+                    [ $this, $callbacks[ $filter ] ],
182
+                    [ $text ]
183 183
                 );
184 184
                 break;
185 185
 
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
 
240 240
                 $frontmatter = substr($text, $start + $tokenLength, $length);
241 241
                 $textStart = substr($text, 0, $start);
242
-                $text = $textStart . substr($text, $stop + $tokenLength);
242
+                $text = $textStart.substr($text, $stop + $tokenLength);
243 243
             }
244 244
         }
245 245
 
246
-        return [$text, $frontmatter];
246
+        return [ $text, $frontmatter ];
247 247
     }
248 248
 
249 249
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         list($text, $frontmatter) = $this->extractFrontMatter($text, $needle, $needle);
289 289
 
290 290
         if (function_exists("yaml_parse") && !empty($frontmatter)) {
291
-            $frontmatter = yaml_parse($needle . $frontmatter);
291
+            $frontmatter = yaml_parse($needle.$frontmatter);
292 292
 
293 293
             if ($frontmatter === false) {
294 294
                 throw new Exception("Failed parsing YAML frontmatter.");
@@ -312,11 +312,11 @@  discard block
 block discarded – undo
312 312
      */
313 313
     public function getTitleFromFirstH1($text)
314 314
     {
315
-        $matches = [];
315
+        $matches = [ ];
316 316
         $title = null;
317 317
 
318 318
         if (preg_match("#<h1.*?>(.*)</h1>#", $text, $matches)) {
319
-            $title = strip_tags($matches[1]);
319
+            $title = strip_tags($matches[ 1 ]);
320 320
         }
321 321
 
322 322
         return $title;
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
     {
372 372
         return preg_replace_callback(
373 373
             '#\b(?<![href|src]=[\'"])https?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#',
374
-            function ($matches) {
375
-                return "<a href='{$matches[0]}'>{$matches[0]}</a>";
374
+            function($matches) {
375
+                return "<a href='{$matches[ 0 ]}'>{$matches[ 0 ]}</a>";
376 376
             },
377 377
             $text
378 378
         );
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
      */
390 390
     public function purify($text)
391 391
     {
392
-        $config   = \HTMLPurifier_Config::createDefault();
392
+        $config = \HTMLPurifier_Config::createDefault();
393 393
         $config->set("Cache.DefinitionImpl", null);
394 394
         //$config->set('Cache.SerializerPath', '/home/user/absolute/path');
395 395
 
@@ -443,15 +443,15 @@  discard block
 block discarded – undo
443 443
 
444 444
         return preg_replace_callback(
445 445
             $patterns,
446
-            function ($matches) {
447
-                switch ($matches[1]) {
446
+            function($matches) {
447
+                switch ($matches[ 1 ]) {
448 448
 
449 449
                     case 'FIGURE':
450
-                        return self::ShortCodeFigure($matches[2]);
450
+                        return self::ShortCodeFigure($matches[ 2 ]);
451 451
                         break;
452 452
 
453 453
                     default:
454
-                        return "{$matches[1]} is unknown shortcode.";
454
+                        return "{$matches[ 1 ]} is unknown shortcode.";
455 455
                 }
456 456
             },
457 457
             $text
@@ -472,14 +472,14 @@  discard block
 block discarded – undo
472 472
         preg_match_all('/[a-zA-Z0-9]+="[^"]+"|\S+/', $options, $matches);
473 473
 
474 474
         $res = array();
475
-        foreach ($matches[0] as $match) {
475
+        foreach ($matches[ 0 ] as $match) {
476 476
             $pos = strpos($match, '=');
477 477
             if ($pos === false) {
478
-                $res[$match] = true;
478
+                $res[ $match ] = true;
479 479
             } else {
480 480
                 $key = substr($match, 0, $pos);
481
-                $val = trim(substr($match, $pos+1), '"');
482
-                $res[$key] = $val;
481
+                $val = trim(substr($match, $pos + 1), '"');
482
+                $res[ $key ] = $val;
483 483
             }
484 484
         }
485 485
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
     public static function shortCodeFigure($options)
501 501
     {
502 502
         // Merge incoming options with default and expose as variables
503
-        $options= array_merge(
503
+        $options = array_merge(
504 504
             [
505 505
                 'id' => null,
506 506
                 'class' => null,
Please login to merge, or discard this patch.
vendor/composer/autoload_real.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     public static function loadClassLoader($class)
10 10
     {
11 11
         if ('Composer\Autoload\ClassLoader' === $class) {
12
-            require __DIR__ . '/ClassLoader.php';
12
+            require __DIR__.'/ClassLoader.php';
13 13
         }
14 14
     }
15 15
 
@@ -23,24 +23,24 @@  discard block
 block discarded – undo
23 23
         self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24 24
         spl_autoload_unregister(array('ComposerAutoloaderInit62f39d7a932289837b43d6101406a178', 'loadClassLoader'));
25 25
 
26
-        $map = require __DIR__ . '/autoload_namespaces.php';
26
+        $map = require __DIR__.'/autoload_namespaces.php';
27 27
         foreach ($map as $namespace => $path) {
28 28
             $loader->set($namespace, $path);
29 29
         }
30 30
 
31
-        $map = require __DIR__ . '/autoload_psr4.php';
31
+        $map = require __DIR__.'/autoload_psr4.php';
32 32
         foreach ($map as $namespace => $path) {
33 33
             $loader->setPsr4($namespace, $path);
34 34
         }
35 35
 
36
-        $classMap = require __DIR__ . '/autoload_classmap.php';
36
+        $classMap = require __DIR__.'/autoload_classmap.php';
37 37
         if ($classMap) {
38 38
             $loader->addClassMap($classMap);
39 39
         }
40 40
 
41 41
         $loader->register(true);
42 42
 
43
-        $includeFiles = require __DIR__ . '/autoload_files.php';
43
+        $includeFiles = require __DIR__.'/autoload_files.php';
44 44
         foreach ($includeFiles as $fileIdentifier => $file) {
45 45
             composerRequire62f39d7a932289837b43d6101406a178($fileIdentifier, $file);
46 46
         }
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 
52 52
 function composerRequire62f39d7a932289837b43d6101406a178($fileIdentifier, $file)
53 53
 {
54
-    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
54
+    if (empty($GLOBALS[ '__composer_autoload_files' ][ $fileIdentifier ])) {
55 55
         require $file;
56 56
 
57
-        $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
57
+        $GLOBALS[ '__composer_autoload_files' ][ $fileIdentifier ] = true;
58 58
     }
59 59
 }
Please login to merge, or discard this patch.
vendor/composer/autoload_psr4.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 $baseDir = dirname($vendorDir);
7 7
 
8 8
 return array(
9
-    'petlid\\' => array($baseDir . '/src'),
10
-    'Mos\\TextFilter\\' => array($vendorDir . '/mos/ctextfilter/src/TextFilter'),
11
-    'Mos\\' => array($vendorDir . '/mos/cform/src'),
12
-    'Anax\\' => array($vendorDir . '/anax/mvc/src'),
9
+    'petlid\\' => array($baseDir.'/src'),
10
+    'Mos\\TextFilter\\' => array($vendorDir.'/mos/ctextfilter/src/TextFilter'),
11
+    'Mos\\' => array($vendorDir.'/mos/cform/src'),
12
+    'Anax\\' => array($vendorDir.'/anax/mvc/src'),
13 13
 );
Please login to merge, or discard this patch.
vendor/composer/autoload_namespaces.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 $baseDir = dirname($vendorDir);
7 7
 
8 8
 return array(
9
-    'SimplePie' => array($vendorDir . '/simplepie/simplepie/library'),
10
-    'Michelf' => array($vendorDir . '/michelf/php-markdown'),
11
-    'HTMLPurifier' => array($vendorDir . '/ezyang/htmlpurifier/library'),
9
+    'SimplePie' => array($vendorDir.'/simplepie/simplepie/library'),
10
+    'Michelf' => array($vendorDir.'/michelf/php-markdown'),
11
+    'HTMLPurifier' => array($vendorDir.'/ezyang/htmlpurifier/library'),
12 12
 );
Please login to merge, or discard this patch.
vendor/composer/autoload_files.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 $baseDir = dirname($vendorDir);
7 7
 
8 8
 return array(
9
-    '2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
9
+    '2cffec82183ee1cea088009cef9a6fc3' => $vendorDir.'/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
10 10
 );
Please login to merge, or discard this patch.
vendor/ezyang/htmlpurifier/extras/HTMLPurifierExtras.auto.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
  * This is a stub include that automatically configures the include path.
5 5
  */
6 6
 
7
-set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path() );
7
+set_include_path(dirname(__FILE__).PATH_SEPARATOR.get_include_path());
8 8
 require_once 'HTMLPurifierExtras.php';
9 9
 require_once 'HTMLPurifierExtras.autoload.php';
10 10
 
Please login to merge, or discard this patch.
vendor/ezyang/htmlpurifier/extras/ConfigDoc/HTMLXSLTProcessor.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,9 @@
 block discarded – undo
13 13
 
14 14
     public function __construct($proc = false)
15 15
     {
16
-        if ($proc === false) $proc = new XSLTProcessor();
16
+        if ($proc === false) {
17
+            $proc = new XSLTProcessor();
18
+        }
17 19
         $this->xsltProcessor = $proc;
18 20
     }
19 21
 
Please login to merge, or discard this patch.
vendor/ezyang/htmlpurifier/extras/HTMLPurifierExtras.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
         ) return false;
24 24
         // Custom implementations can go here
25 25
         // Standard implementation:
26
-        return str_replace('_', '/', $class) . '.php';
26
+        return str_replace('_', '/', $class).'.php';
27 27
     }
28 28
 
29 29
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
     public static function autoload($class)
11 11
     {
12 12
         $path = HTMLPurifierExtras::getPath($class);
13
-        if (!$path) return false;
13
+        if (!$path) {
14
+            return false;
15
+        }
14 16
         require $path;
15 17
         return true;
16 18
     }
@@ -20,7 +22,9 @@  discard block
 block discarded – undo
20 22
         if (
21 23
             strncmp('FSTools', $class, 7) !== 0 &&
22 24
             strncmp('ConfigDoc', $class, 9) !== 0
23
-        ) return false;
25
+        ) {
26
+            return false;
27
+        }
24 28
         // Custom implementations can go here
25 29
         // Standard implementation:
26 30
         return str_replace('_', '/', $class) . '.php';
Please login to merge, or discard this patch.
vendor/ezyang/htmlpurifier/extras/FSTools/File.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@
 block discarded – undo
30 30
     }
31 31
 
32 32
     /** Returns the filename of the file. */
33
-    public function getName() {return $this->name;}
33
+    public function getName() {return $this->name; }
34 34
 
35 35
     /** Returns directory of the file without trailing slash */
36
-    public function getDirectory() {return $this->fs->dirname($this->name);}
36
+    public function getDirectory() {return $this->fs->dirname($this->name); }
37 37
 
38 38
     /**
39 39
      * Retrieves the contents of a file
Please login to merge, or discard this patch.
Braces   +29 added lines, -10 removed lines patch added patch discarded remove patch
@@ -81,7 +81,9 @@  discard block
 block discarded – undo
81 81
     /** Opens file's handle */
82 82
     public function open($mode)
83 83
     {
84
-        if ($this->handle) $this->close();
84
+        if ($this->handle) {
85
+            $this->close();
86
+        }
85 87
         $this->handle = $this->fs->fopen($this->name, $mode);
86 88
         return true;
87 89
     }
@@ -89,7 +91,9 @@  discard block
 block discarded – undo
89 91
     /** Closes file's handle */
90 92
     public function close()
91 93
     {
92
-        if (!$this->handle) return false;
94
+        if (!$this->handle) {
95
+            return false;
96
+        }
93 97
         $status = $this->fs->fclose($this->handle);
94 98
         $this->handle = false;
95 99
         return $status;
@@ -98,42 +102,57 @@  discard block
 block discarded – undo
98 102
     /** Retrieves a line from an open file, with optional max length $length */
99 103
     public function getLine($length = null)
100 104
     {
101
-        if (!$this->handle) $this->open('r');
102
-        if ($length === null) return $this->fs->fgets($this->handle);
103
-        else return $this->fs->fgets($this->handle, $length);
105
+        if (!$this->handle) {
106
+            $this->open('r');
107
+        }
108
+        if ($length === null) {
109
+            return $this->fs->fgets($this->handle);
110
+        } else {
111
+            return $this->fs->fgets($this->handle, $length);
112
+        }
104 113
     }
105 114
 
106 115
     /** Retrieves a character from an open file */
107 116
     public function getChar()
108 117
     {
109
-        if (!$this->handle) $this->open('r');
118
+        if (!$this->handle) {
119
+            $this->open('r');
120
+        }
110 121
         return $this->fs->fgetc($this->handle);
111 122
     }
112 123
 
113 124
     /** Retrieves an $length bytes of data from an open data */
114 125
     public function read($length)
115 126
     {
116
-        if (!$this->handle) $this->open('r');
127
+        if (!$this->handle) {
128
+            $this->open('r');
129
+        }
117 130
         return $this->fs->fread($this->handle, $length);
118 131
     }
119 132
 
120 133
     /** Writes to an open file */
121 134
     public function put($string)
122 135
     {
123
-        if (!$this->handle) $this->open('a');
136
+        if (!$this->handle) {
137
+            $this->open('a');
138
+        }
124 139
         return $this->fs->fwrite($this->handle, $string);
125 140
     }
126 141
 
127 142
     /** Returns TRUE if the end of the file has been reached */
128 143
     public function eof()
129 144
     {
130
-        if (!$this->handle) return true;
145
+        if (!$this->handle) {
146
+            return true;
147
+        }
131 148
         return $this->fs->feof($this->handle);
132 149
     }
133 150
 
134 151
     public function __destruct()
135 152
     {
136
-        if ($this->handle) $this->close();
153
+        if ($this->handle) {
154
+            $this->close();
155
+        }
137 156
     }
138 157
 
139 158
 }
Please login to merge, or discard this patch.