Test Failed
Branch master (c6c4c1)
by Marcio
06:34 queued 03:15
created
src/Ballybran/Helpers/Time/Timestamp.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -111,45 +111,45 @@
 block discarded – undo
111 111
 
112 112
     public static function nicetime($date, array $translate = ["second", "minute", "hour", "day", "week", "month", "year", "decade"])
113 113
     {
114
-        if(empty($date)) {
114
+        if (empty($date)) {
115 115
             return "No date provided";
116 116
         }
117
-        if(!is_array($translate)) {
117
+        if (!is_array($translate)) {
118 118
             return "the expected value is not an array";
119 119
         }
120
-        if( 5 > count($translate)){
120
+        if (5 > count($translate)) {
121 121
             return "the matrix needs 5 to 8 values (second, minute, hour, day, week,month, year, decade)";
122 122
         }
123 123
 
124 124
         $periods         = $translate;
125
-        $lengths         = array("60","60","24","7","4.35","12","10");
125
+        $lengths         = array("60", "60", "24", "7", "4.35", "12", "10");
126 126
 
127 127
         $now             = time();
128
-        $unix_date         = strtotime($date);
128
+        $unix_date = strtotime($date);
129 129
 
130 130
         // check validity of date
131
-        if(empty($unix_date)) {   
131
+        if (empty($unix_date)) {   
132 132
             return "Bad date";
133 133
         }
134 134
 
135 135
     // is it future date or past date
136
-        if($now > $unix_date) {   
137
-            $difference     = $now - $unix_date;
138
-            $tense         = "ago";
136
+        if ($now > $unix_date) {   
137
+            $difference = $now - $unix_date;
138
+            $tense = "ago";
139 139
 
140 140
         } else {
141
-            $difference     = $unix_date - $now;
142
-            $tense         = "from now";
141
+            $difference = $unix_date - $now;
142
+            $tense = "from now";
143 143
         }
144 144
 
145
-        for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
145
+        for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths) - 1; $j++) {
146 146
             $difference /= $lengths[$j];
147 147
         }
148 148
 
149 149
         $difference = round($difference);
150 150
 
151
-        if($difference != 1) {
152
-            $periods[$j].= "s";
151
+        if ($difference != 1) {
152
+            $periods[$j] .= "s";
153 153
         }
154 154
 
155 155
         return "$difference $periods[$j] {$tense}";
Please login to merge, or discard this patch.
src/Ballybran/Helpers/Utility/Ucfirst.php 1 patch
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -69,17 +69,22 @@
 block discarded – undo
69 69
         $characterDeficit = 0; //Gets incremented when an uppercase letter is encountered before $targetCharsPerWord characters have been collected since the last UC char.
70 70
         $wordIndex = $targetWordLength; //HACK: keeps track of how many characters have been carried into the abbreviation since the last UC char
71 71
         while ($stringIndex < strlen($strString)) {  //Process the whole input string...
72
-            if ($abbrevLength >= $targetLength)              //...unless the abbreviation has hit the target length cap
72
+            if ($abbrevLength >= $targetLength) {
73
+                //...unless the abbreviation has hit the target length cap
73 74
                 break;
75
+            }
74 76
             $currentChar = $strString[$stringIndex++]; //Grab a character from the string, advance the string cursor
75 77
             if (in_array($currentChar, $ucLetters)) {           //If handling a UC char, consider it a new word
76 78
                 $characterDeficit += $targetWordLength - $wordIndex; //If UC chars are closer together than targetWordLength, keeps track of how many extra characters are required to fit the target length of the abbreviation
77 79
                 $wordIndex = 0; //Set the wordIndex to reflect a new word
78 80
             } else if ($wordIndex >= $targetWordLength) {
79
-                if ($characterDeficit == 0)                //If the word is full and we're not short any characters, ignore the character
81
+                if ($characterDeficit == 0) {
82
+                    //If the word is full and we're not short any characters, ignore the character
80 83
                     continue;
81
-                else
82
-                    $characterDefecit--; //If we are short some characters, decrement the defecit and carry on with adding the character to the abbreviation
84
+                } else {
85
+                                    $characterDefecit--;
86
+                }
87
+                //If we are short some characters, decrement the defecit and carry on with adding the character to the abbreviation
83 88
             }
84 89
             $abbreviation .= $currentChar; //Add the character to the abbreviation
85 90
             $abbrevLength++; //Increment abbreviation length
Please login to merge, or discard this patch.
src/Ballybran/Helpers/Http/Cookie.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -256,8 +256,8 @@
 block discarded – undo
256 256
         return $this->data['value'];
257 257
     }
258 258
 
259
-    public function setValue($value){
260
-            $this->data['value']= $value;
259
+    public function setValue($value) {
260
+            $this->data['value'] = $value;
261 261
 
262 262
     }
263 263
 
Please login to merge, or discard this patch.
src/Ballybran/Config/autoload.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,16 +38,22 @@
 block discarded – undo
38 38
     // Verifica se o diretório informado é válido
39 39
     if (is_dir($lib)) {
40 40
         // Verifica se o arquivo já existe neste primeiro diretório
41
-        if (file_exists($lib . $ds . $file)) return $lib . $ds . $file;
41
+        if (file_exists($lib . $ds . $file)) {
42
+            return $lib . $ds . $file;
43
+        }
42 44
         // Lista os subdiretórios e arquivos
43 45
         $dirs = array_diff(scandir($lib, 1), array('.', '..'));
44 46
         foreach ($dirs as $dir) {
45 47
             // Verifica se é um arquivo se for, pula para o próximo
46
-            if (!is_dir($lib . $ds . $dir)) continue;
48
+            if (!is_dir($lib . $ds . $dir)) {
49
+                continue;
50
+            }
47 51
             // Se for um diretório procura dentro dele
48 52
             $f = search_lib($lib . $ds . $dir, $file, $ds);
49 53
             // Caso não encontre retora false
50
-            if (false !== $f) return $f;
54
+            if (false !== $f) {
55
+                return $f;
56
+            }
51 57
         }
52 58
     }
53 59
     // Se o diretório informado não for válido ou se não tiver encontrado retorna false
Please login to merge, or discard this patch.
src/Ballybran/Library/CSSCache.php 1 patch
Braces   +17 added lines, -12 removed lines patch added patch discarded remove patch
@@ -18,16 +18,18 @@  discard block
 block discarded – undo
18 18
     private $cwd;
19 19
 
20 20
     public function __construct(array $i_filename_arr) {
21
-    if (!is_array($i_filename_arr))
22
-        $i_filename_arr = array($i_filename_arr);
21
+    if (!is_array($i_filename_arr)) {
22
+            $i_filename_arr = array($i_filename_arr);
23
+    }
23 24
 
24 25
     $this->filenames = $i_filename_arr;
25 26
     $this->cwd = getcwd() . DIRECTORY_SEPARATOR;
26 27
 
27
-    if ($this->style_changed())
28
-        $expire = -72000;
29
-    else
30
-        $expire = 3200;
28
+    if ($this->style_changed()) {
29
+            $expire = -72000;
30
+    } else {
31
+            $expire = 3200;
32
+    }
31 33
 
32 34
     header('Content-Type: text/css; charset: UTF-8');
33 35
     header('Cache-Control: must-revalidate');
@@ -37,8 +39,9 @@  discard block
 block discarded – undo
37 39
     public function dump_style() {
38 40
     ob_start('ob_gzhandler');
39 41
 
40
-    foreach ($this->filenames as $filename)
41
-        $this->dump_cache_contents($filename);
42
+    foreach ($this->filenames as $filename) {
43
+            $this->dump_cache_contents($filename);
44
+    }
42 45
 
43 46
     ob_end_flush();
44 47
     }
@@ -50,9 +53,10 @@  discard block
 block discarded – undo
50 53
     }
51 54
 
52 55
     private function style_changed() {
53
-    foreach ($this->filenames as $filename)
54
-        if (!is_file($this->get_cache_name($filename)))
56
+    foreach ($this->filenames as $filename) {
57
+            if (!is_file($this->get_cache_name($filename)))
55 58
         return TRUE;
59
+    }
56 60
     return FALSE;
57 61
     }
58 62
 
@@ -81,9 +85,10 @@  discard block
 block discarded – undo
81 85
     }
82 86
 
83 87
     // remove any old, lingering caches for this file
84
-    if ($dead_files = glob($this->get_cache_name($filename, TRUE), GLOB_NOESCAPE))
85
-        foreach ($dead_files as $dead_file)
88
+    if ($dead_files = glob($this->get_cache_name($filename, TRUE), GLOB_NOESCAPE)) {
89
+            foreach ($dead_files as $dead_file)
86 90
         unlink($dead_file);
91
+    }
87 92
 
88 93
     $compressed = $this->compress(file_get_contents($filename));
89 94
     file_put_contents($current_cache, $compressed);
Please login to merge, or discard this patch.
src/Ballybran/Library/fpdf/fpdf.php 1 patch
Braces   +29 added lines, -20 removed lines patch added patch discarded remove patch
@@ -507,37 +507,46 @@
 block discarded – undo
507 507
     function SetFont($family, $style = '', $size = 0)
508 508
     {
509 509
         // Select a font; size given in points
510
-        if ($family == '')
511
-            $family = $this->FontFamily;
512
-        else
513
-            $family = strtolower($family);
510
+        if ($family == '') {
511
+                    $family = $this->FontFamily;
512
+        } else {
513
+                    $family = strtolower($family);
514
+        }
514 515
         $style = strtoupper($style);
515 516
         if (false !== strpos($style, 'U')) {
516 517
             $this->underline = true;
517 518
             $style = str_replace('U', '', $style);
518
-        } else
519
-            $this->underline = false;
520
-        if ('IB' == $style)
521
-            $style = 'BI';
522
-        if (0 == $size)
523
-            $size = $this->FontSizePt;
519
+        } else {
520
+                    $this->underline = false;
521
+        }
522
+        if ('IB' == $style) {
523
+                    $style = 'BI';
524
+        }
525
+        if (0 == $size) {
526
+                    $size = $this->FontSizePt;
527
+        }
524 528
         // Test if font is already selected
525
-        if ($this->FontFamily == $family && $this->FontStyle == $style && $this->FontSizePt == $size)
526
-            return;
529
+        if ($this->FontFamily == $family && $this->FontStyle == $style && $this->FontSizePt == $size) {
530
+                    return;
531
+        }
527 532
         // Test if font is already loaded
528 533
         $fontkey = $family . $style;
529 534
         if (!isset($this->fonts[$fontkey])) {
530 535
             // Test if one of the core fonts
531
-            if ($family == 'arial')
532
-                $family = 'helvetica';
536
+            if ($family == 'arial') {
537
+                            $family = 'helvetica';
538
+            }
533 539
             if (in_array($family, $this->CoreFonts)) {
534
-                if ($family == 'symbol' || $family == 'zapfdingbats')
535
-                    $style = '';
540
+                if ($family == 'symbol' || $family == 'zapfdingbats') {
541
+                                    $style = '';
542
+                }
536 543
                 $fontkey = $family . $style;
537
-                if (!isset($this->fonts[$fontkey]))
538
-                    $this->AddFont($family, $style);
539
-            } else
540
-                $this->Error('Undefined font: ' . $family . ' ' . $style);
544
+                if (!isset($this->fonts[$fontkey])) {
545
+                                    $this->AddFont($family, $style);
546
+                }
547
+            } else {
548
+                            $this->Error('Undefined font: ' . $family . ' ' . $style);
549
+            }
541 550
         }
542 551
         // Select it
543 552
         $this->FontFamily = $family;
Please login to merge, or discard this patch.