Completed
Push — version1.x ( 6e72a3...d4a6f6 )
by Sebastian
04:16
created
src/HierAttributes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
         if (empty(HierAttributes::$arr)) {
57 57
             $refClass = new \ReflectionClass('\AcademicPuma\CiteProc\HierAttributes');
58 58
             $constants = $refClass->getConstants();
59
-            array_walk($constants, function ($value) {
59
+            array_walk($constants, function($value) {
60 60
                 HierAttributes::$arr[$value] = $value;
61 61
             });
62 62
         }
Please login to merge, or discard this patch.
src/Date.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,9 +94,10 @@
 block discarded – undo
94 94
                 }
95 95
                 // now re-order the elements
96 96
                 foreach ($parts as $part) {
97
-                    foreach ($locale_elements as $key => $element)
98
-                        if ($element->name == $part) {
97
+                    foreach ($locale_elements as $key => $element) {
98
+                                            if ($element->name == $part) {
99 99
                             $this->elements[] = $element;
100
+                    }
100 101
                             unset($locale_elements[$key]);
101 102
                         }
102 103
                 }
Please login to merge, or discard this patch.
src/Names.php 1 patch
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -55,8 +55,9 @@  discard block
 block discarded – undo
55 55
         foreach ($domNode->childNodes as $node) {
56 56
             if ($node->nodeType == 1) {
57 57
                 $element = Factory::create($node, $citeProc);
58
-                if (($element instanceof Label))
59
-                    $element->variable = $var;
58
+                if (($element instanceof Label)) {
59
+                                    $element->variable = $var;
60
+                }
60 61
                 if (($element instanceof Name) && $etal) {
61 62
                     $element->etal = $etal;
62 63
                 }
@@ -79,8 +80,9 @@  discard block
 block discarded – undo
79 80
         $variables = explode(' ', $this->variable);
80 81
 
81 82
         foreach ($variables as $var) {
82
-            if (in_array($var, $this->citeProc->quash))
83
-                continue;
83
+            if (in_array($var, $this->citeProc->quash)) {
84
+                            continue;
85
+            }
84 86
             if (isset($data->{$var}) && (!empty($data->{$var}))) {
85 87
                 $matches[] = $var;
86 88
             }
@@ -100,18 +102,21 @@  discard block
 block discarded – undo
100 102
                     } else { // if it's not a "names" element, just render it
101 103
                         $text = $element->render($data, $mode);
102 104
                         $this->citeProc->quash[] = isset($element->variable) ? $element->variable : $element->var;
103
-                        if (!empty($text))
104
-                            $variable_parts[] = $text;
105
+                        if (!empty($text)) {
106
+                                                    $variable_parts[] = $text;
107
+                        }
108
+                    }
109
+                    if (!empty($matches)) {
110
+                                            break;
105 111
                     }
106
-                    if (!empty($matches))
107
-                        break;
108 112
                 }
109 113
             }
110 114
         }
111 115
 
112 116
         foreach ($matches as $var) {
113
-            if (in_array($var, $this->citeProc->quash) && in_array($var, $variables))
114
-                continue;
117
+            if (in_array($var, $this->citeProc->quash) && in_array($var, $variables)) {
118
+                            continue;
119
+            }
115 120
             $text = '';
116 121
             if (!empty($data->{$var})) {
117 122
                 foreach ($this->elements as $element) {
@@ -123,8 +128,9 @@  discard block
 block discarded – undo
123 128
                     }
124 129
                 }
125 130
             }
126
-            if (!empty($text))
127
-                $variable_parts[] = $text;
131
+            if (!empty($text)) {
132
+                            $variable_parts[] = $text;
133
+            }
128 134
         }
129 135
 
130 136
         if (!empty($variable_parts)) {
Please login to merge, or discard this patch.
src/Group.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
             $element_count++;
37 37
             if (($element instanceof Text) &&
38 38
                     ($element->source == 'term' ||
39
-                    $element->source == 'value' )) {
39
+                    $element->source == 'value')) {
40 40
                 $terms++;
41 41
             }
42 42
             if (($element instanceof Label)) {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                     }
63 63
                 }
64 64
                 //give the text parts a name
65
-                if($element instanceof Text) {
65
+                if ($element instanceof Text) {
66 66
                     $text_parts[$element->getVar()] = $text;
67 67
                 } else {
68 68
                     $text_parts[$element_count] = $text;
Please login to merge, or discard this patch.
Braces   +11 added lines, -6 removed lines patch added patch discarded remove patch
@@ -78,12 +78,17 @@
 block discarded – undo
78 78
                 }
79 79
             }
80 80
         }
81
-        if (empty($text_parts))
82
-            return;
83
-        if ($variables && !$have_variables)
84
-            return; // there has to be at least one other none empty value before the term is output
85
-        if (count($text_parts) == $terms)
86
-            return; // there has to be at least one other none empty value before the term is output
81
+        if (empty($text_parts)) {
82
+                    return;
83
+        }
84
+        if ($variables && !$have_variables) {
85
+                    return;
86
+        }
87
+        // there has to be at least one other none empty value before the term is output
88
+        if (count($text_parts) == $terms) {
89
+                    return;
90
+        }
91
+        // there has to be at least one other none empty value before the term is output
87 92
         $delimiter = $this->delimiter;
88 93
         //$text = implode($delimiter, $text_parts); // insert the delimiter if supplied.
89 94
         $text = $this->implodeGroup($delimiter, $text_parts);
Please login to merge, or discard this patch.
src/Locale.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
     private static function getLocalesFileName($lang) {
95 95
 
96
-        include_once __DIR__.'/../vendorPath.php';
96
+        include_once __DIR__ . '/../vendorPath.php';
97 97
 
98 98
         if (!($vendorPath = vendorPath())) {
99 99
             throw new \Exception('Error: vendor path not found. Use composer to initialize your project');
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
 
102 102
         $localeFile = null;
103 103
 
104
-        if(isset(self::$langBase[$lang])) {
105
-            $localeFile = file_get_contents($vendorPath.'/academicpuma/locales/locales-' . self::$langBase[$lang] . '.xml');
104
+        if (isset(self::$langBase[$lang])) {
105
+            $localeFile = file_get_contents($vendorPath . '/academicpuma/locales/locales-' . self::$langBase[$lang] . '.xml');
106 106
         } else {
107
-            $localeFile = file_get_contents($vendorPath.'/academicpuma/locales/locales-en-US.xml');
107
+            $localeFile = file_get_contents($vendorPath . '/academicpuma/locales/locales-en-US.xml');
108 108
         }
109 109
 
110 110
         return $localeFile;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -218,8 +218,9 @@
 block discarded – undo
218 218
                     $option = $this->locale->xpath("//cs:style-options[@$arg1]");
219 219
                 }
220 220
                 foreach ($option[0]->attributes() as $name => $value) {
221
-                    if ($name == $arg1)
222
-                        return (string) $value;
221
+                    if ($name == $arg1) {
222
+                                            return (string) $value;
223
+                    }
223 224
                 }
224 225
                 break;
225 226
         }
Please login to merge, or discard this patch.
src/PIf.php 1 patch
Braces   +45 added lines, -30 removed lines patch added patch discarded remove patch
@@ -36,35 +36,45 @@  discard block
 block discarded – undo
36 36
             $matches = 0;
37 37
             foreach ($types as $type) {
38 38
                 if (isset($data->type)) {
39
-                    if ($data->type == $type && $match == 'any')
40
-                        return true;
41
-                    if ($data->type != $type && $match == 'all')
42
-                        return false;
43
-                    if ($data->type == $type)
44
-                        $matches++;
39
+                    if ($data->type == $type && $match == 'any') {
40
+                                            return true;
41
+                    }
42
+                    if ($data->type != $type && $match == 'all') {
43
+                                            return false;
44
+                    }
45
+                    if ($data->type == $type) {
46
+                                            $matches++;
47
+                    }
45 48
                 }
46 49
             }
47
-            if ($match == 'all' && $matches == count($types))
48
-                return true;
49
-            if ($match == 'none' && $matches == 0)
50
-                return true;
50
+            if ($match == 'all' && $matches == count($types)) {
51
+                            return true;
52
+            }
53
+            if ($match == 'none' && $matches == 0) {
54
+                            return true;
55
+            }
51 56
             return false;
52 57
         }
53 58
         if (($variables = $this->variable)) {
54 59
             $variables = explode(' ', $variables);
55 60
             $matches = 0;
56 61
             foreach ($variables as $var) {
57
-                if (isset($data->$var) && !empty($data->$var) && $match == 'any')
58
-                    return true;
59
-                if ((!isset($data->$var) || empty($data->$var)) && $match == 'all')
60
-                    return false;
61
-                if (isset($data->$var) && !empty($data->$var))
62
-                    $matches++;
62
+                if (isset($data->$var) && !empty($data->$var) && $match == 'any') {
63
+                                    return true;
64
+                }
65
+                if ((!isset($data->$var) || empty($data->$var)) && $match == 'all') {
66
+                                    return false;
67
+                }
68
+                if (isset($data->$var) && !empty($data->$var)) {
69
+                                    $matches++;
70
+                }
71
+            }
72
+            if ($match == 'all' && $matches == count($variables)) {
73
+                            return true;
74
+            }
75
+            if ($match == 'none' && $matches == 0) {
76
+                            return true;
63 77
             }
64
-            if ($match == 'all' && $matches == count($variables))
65
-                return true;
66
-            if ($match == 'none' && $matches == 0)
67
-                return true;
68 78
             return false;
69 79
         }
70 80
         if (($is_numeric = $this->{'is-numeric'})) {
@@ -72,8 +82,9 @@  discard block
 block discarded – undo
72 82
             $matches = 0;
73 83
             foreach ($variables as $var) {
74 84
                 if (isset($data->$var)) {
75
-                    if (is_numeric($data->$var) && $match == 'any')
76
-                        return true;
85
+                    if (is_numeric($data->$var) && $match == 'any') {
86
+                                            return true;
87
+                    }
77 88
                     if (!is_numeric($data->$var)) {
78 89
                         if (preg_match('/(?:^\d+|\d+$)/', $data->$var)) {
79 90
                             $matches++;
@@ -81,18 +92,22 @@  discard block
 block discarded – undo
81 92
                             return false;
82 93
                         }
83 94
                     }
84
-                    if (is_numeric($data->$var))
85
-                        $matches++;
95
+                    if (is_numeric($data->$var)) {
96
+                                            $matches++;
97
+                    }
86 98
                 }
87 99
             }
88
-            if ($match == 'all' && $matches == count($variables))
89
-                return true;
90
-            if ($match == 'none' && $matches == 0)
91
-                return true;
100
+            if ($match == 'all' && $matches == count($variables)) {
101
+                            return true;
102
+            }
103
+            if ($match == 'none' && $matches == 0) {
104
+                            return true;
105
+            }
92 106
             return false;
93 107
         }
94
-        if (isset($this->locator))
95
-            $test = explode(' ', $this->type);
108
+        if (isset($this->locator)) {
109
+                    $test = explode(' ', $this->type);
110
+        }
96 111
 
97 112
         return false;
98 113
     }
Please login to merge, or discard this patch.
src/DatePart.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,8 +46,9 @@
 block discarded – undo
46 46
                 break;
47 47
             case 'month':
48 48
                 $text = (isset($date[1])) ? $date[1] : '';
49
-                if (empty($text) || $text < 1 || $text > 12)
50
-                    return;
49
+                if (empty($text) || $text < 1 || $text > 12) {
50
+                                    return;
51
+                }
51 52
                 // $form = $this->form;
52 53
                 switch ($this->form) {
53 54
                     case 'numeric': break;
Please login to merge, or discard this patch.
src/Number.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,8 +30,9 @@
 block discarded – undo
30 30
     public function render($data, $mode = NULL) {
31 31
         $var = $this->variable;
32 32
 
33
-        if (!$var || empty($data->$var))
34
-            return;
33
+        if (!$var || empty($data->$var)) {
34
+                    return;
35
+        }
35 36
 
36 37
         //   $form = $this->form;
37 38
 
Please login to merge, or discard this patch.
src/CiteProc.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,13 +92,13 @@
 block discarded – undo
92 92
      * @throws \Exception
93 93
      */
94 94
     public static function loadStyleSheet($name) {
95
-        include_once __DIR__.'/../vendorPath.php';
95
+        include_once __DIR__ . '/../vendorPath.php';
96 96
 
97 97
         if (!($vendorPath = vendorPath())) {
98 98
             throw new \Exception('Error: vendor path not found. Use composer to initialize your project');
99 99
         }
100 100
 
101
-        return file_get_contents($vendorPath.'/academicpuma/styles/'.$name.'.csl');
101
+        return file_get_contents($vendorPath . '/academicpuma/styles/' . $name . '.csl');
102 102
     }
103 103
 
104 104
     /**
Please login to merge, or discard this patch.