Completed
Push — master ( c79919...bcbfd5 )
by Yaro
14:20
created
src/Commands/CreateDefinitionArtisanCommand.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -50,6 +50,9 @@
 block discarded – undo
50 50
         echo $showMethod;
51 51
     } // end doGenerateMethods
52 52
     
53
+    /**
54
+     * @param string $uri
55
+     */
53 56
     private function trimAdminPrefix($uri)
54 57
     {
55 58
         $segments = array_filter(explode('/', $uri));
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
         $methodPostfix = camel_case('show_'. preg_replace('~2~', '_to_', $this->table));
37 37
         $this->info('Routes:');
38 38
         $route = "Route::any('". $this->trimAdminPrefix($this->getRequestUri) 
39
-                  . "', 'TableAdminController@". $methodPostfix ."');";
39
+                    . "', 'TableAdminController@". $methodPostfix ."');";
40 40
         $this->line($route);
41 41
         
42 42
         $this->info('Methods:');
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 use Symfony\Component\Console\Input\InputArgument;
7 7
 
8 8
 
9
-class CreateDefinitionArtisanCommand extends Command 
9
+class CreateDefinitionArtisanCommand extends Command
10 10
 {
11 11
 
12 12
     protected $name = 'jarboe:definition';
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
     public function fire()
22 22
     {
23 23
         $this->table = $this->argument('table');
24
-        $this->stub  = file_get_contents(__DIR__ .'/../../stubs/definition.stub');
24
+        $this->stub  = file_get_contents(__DIR__.'/../../stubs/definition.stub');
25 25
         
26
-        $fields = \DB::select(\DB::raw('SHOW FULL COLUMNS FROM '. $this->table));
26
+        $fields = \DB::select(\DB::raw('SHOW FULL COLUMNS FROM '.$this->table));
27 27
         $this->doFillStub($fields);
28 28
         
29 29
         $this->doSaveStub();
@@ -33,20 +33,20 @@  discard block
 block discarded – undo
33 33
     
34 34
     private function doGenerateMethods()
35 35
     {
36
-        $methodPostfix = camel_case('show_'. preg_replace('~2~', '_to_', $this->table));
36
+        $methodPostfix = camel_case('show_'.preg_replace('~2~', '_to_', $this->table));
37 37
         $this->info('Routes:');
38
-        $route = "Route::any('". $this->trimAdminPrefix($this->getRequestUri) 
39
-                  . "', 'TableAdminController@". $methodPostfix ."');";
38
+        $route = "Route::any('".$this->trimAdminPrefix($this->getRequestUri) 
39
+                  . "', 'TableAdminController@".$methodPostfix."');";
40 40
         $this->line($route);
41 41
         
42 42
         $this->info('Methods:');
43
-        $showMethod = 'public function show'. $methodPostfix .'()'. PHP_EOL;
44
-        $showMethod .= '{' . PHP_EOL;
45
-        $showMethod .= '    $options = array(' . PHP_EOL;
46
-        $showMethod .= "        'def_name' => '". $this->definition ."'," . PHP_EOL;
47
-        $showMethod .= '    );' . PHP_EOL;
48
-        $showMethod .= '    return Jarboe::table($options);' . PHP_EOL . PHP_EOL;
49
-        $showMethod .= '} // end show'. $methodPostfix . PHP_EOL . PHP_EOL;
43
+        $showMethod = 'public function show'.$methodPostfix.'()'.PHP_EOL;
44
+        $showMethod .= '{'.PHP_EOL;
45
+        $showMethod .= '    $options = array('.PHP_EOL;
46
+        $showMethod .= "        'def_name' => '".$this->definition."',".PHP_EOL;
47
+        $showMethod .= '    );'.PHP_EOL;
48
+        $showMethod .= '    return Jarboe::table($options);'.PHP_EOL.PHP_EOL;
49
+        $showMethod .= '} // end show'.$methodPostfix.PHP_EOL.PHP_EOL;
50 50
         echo $showMethod;
51 51
     } // end doGenerateMethods
52 52
     
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
                 continue;
100 100
             }
101 101
             
102
-            $this->comment($field['Field'] .':');
102
+            $this->comment($field['Field'].':');
103 103
             if (!$this->confirm('Add field to definition? [y|n]')) {
104 104
                 continue;
105 105
             }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             return $template;
125 125
         }
126 126
         
127
-        $template .= sprintf("        '%s' => array(\n", 'many2many_'. str_random(6));
127
+        $template .= sprintf("        '%s' => array(\n", 'many2many_'.str_random(6));
128 128
         $template .= sprintf("            'caption' => '%s',\n", 'Связи');
129 129
         $template .= "            'type' => 'many_to_many',\n";
130 130
         $template .= $this->getManyToManyFieldType($field);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
     
168 168
     private function getFieldCaption($field)
169 169
     {
170
-        $caption = $field['Comment'] ? : $field['Field'];
170
+        $caption = $field['Comment'] ?: $field['Field'];
171 171
         return sprintf("            'caption' => '%s',\n", $caption);
172 172
     } // end getFieldCaption
173 173
     
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
             
203 203
             $references = \DB::select(
204 204
                 \DB::raw("select concat(table_name, '.', column_name) as 'fk', concat(referenced_table_name, '.', referenced_column_name) as 'ref' from information_schema.key_column_usage where referenced_table_name is not null HAVING fk = ?"), 
205
-                array($this->table .'.'. $field['Field'])
205
+                array($this->table.'.'.$field['Field'])
206 206
             );
207 207
             
208 208
             // cuz one2many
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             $additional .= sprintf("            'foreign_table' => '%s',\n", $foreignTable);
216 216
             $additional .= sprintf("            'foreign_key_field' => '%s',\n", $foreignKey);
217 217
             $additional .= sprintf("            'foreign_value_field' => '%s', //change me\n", $foreignKey);
218
-            $additional .= sprintf("            'alias' => '%s',\n", $this->table . $foreignTable);
218
+            $additional .= sprintf("            'alias' => '%s',\n", $this->table.$foreignTable);
219 219
         } elseif ($field['Field'] == 'datetime') {
220 220
             $type = 'datetime';
221 221
         } elseif ($field['Field'] == 'timestamp') {
@@ -246,13 +246,13 @@  discard block
 block discarded – undo
246 246
     private function doSaveStub()
247 247
     {
248 248
         $postfix = '';
249
-        if (file_exists(base_path() .'/resources/definitions/'. $this->table .'.php')) {
250
-            $postfix = '_'. time();
249
+        if (file_exists(base_path().'/resources/definitions/'.$this->table.'.php')) {
250
+            $postfix = '_'.time();
251 251
         }
252 252
         
253
-        $this->definition = $this->table . $postfix;
253
+        $this->definition = $this->table.$postfix;
254 254
         
255
-        $path = base_path() .'/resources/definitions/'. $this->definition .'.php';
255
+        $path = base_path().'/resources/definitions/'.$this->definition.'.php';
256 256
         file_put_contents($path, $this->stub);
257 257
     } // end doSaveStub
258 258
     
Please login to merge, or discard this patch.
src/Fields/AbstractField.php 3 patches
Doc Comments   +15 added lines patch added patch discarded remove patch
@@ -33,6 +33,9 @@  discard block
 block discarded – undo
33 33
     
34 34
     protected function onAssets() {} // end onAssets
35 35
     
36
+    /**
37
+     * @param string $ident
38
+     */
36 39
     public function getDefinitionOption($ident, $default = null)
37 40
     {
38 41
         $value = array_get($this->definition, $ident);
@@ -74,16 +77,25 @@  discard block
 block discarded – undo
74 77
         return $attributes;
75 78
     } // end _prepareAttributes
76 79
 
80
+    /**
81
+     * @param string $ident
82
+     */
77 83
     protected function getOption($ident)
78 84
     {
79 85
         return $this->options[$ident];
80 86
     } // end getOption
81 87
 
88
+    /**
89
+     * @param string $ident
90
+     */
82 91
     public function getAttribute($ident, $default = false)
83 92
     {
84 93
         return array_key_exists($ident, $this->attributes) ? $this->attributes[$ident] : $default;
85 94
     } // end getAttribute
86 95
     
96
+    /**
97
+     * @param string $ident
98
+     */
87 99
     public function getRequiredAttribute($ident)
88 100
     {
89 101
         if (!array_key_exists($ident, $this->attributes)) {
@@ -238,6 +250,9 @@  discard block
 block discarded – undo
238 250
         return $input->render();
239 251
     } // end getFilterInput
240 252
 
253
+    /**
254
+     * @param string $methodName
255
+     */
241 256
     protected function hasCustomHandlerMethod($methodName)
242 257
     {
243 258
         return $this->handler && is_callable(array($this->handler, $methodName));
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 use Illuminate\Support\Facades\Validator;
9 9
 
10 10
 
11
-abstract class AbstractField 
11
+abstract class AbstractField
12 12
 {
13 13
 
14 14
     protected $fieldName;
@@ -31,7 +31,9 @@  discard block
 block discarded – undo
31 31
         $this->onAssets();
32 32
     } // end __construct
33 33
     
34
-    protected function onAssets() {} // end onAssets
34
+    protected function onAssets()
35
+    {
36
+} // end onAssets
35 37
     
36 38
     public function getDefinitionOption($ident, $default = null)
37 39
     {
@@ -358,9 +360,13 @@  discard block
 block discarded – undo
358 360
         return '';
359 361
     } // end getRowColor
360 362
     
361
-    public function afterInsert($id, $values) {} // end afterInsert
363
+    public function afterInsert($id, $values)
364
+    {
365
+} // end afterInsert
362 366
     
363
-    public function afterUpdate($id, $values) {} // end afterUpdate
367
+    public function afterUpdate($id, $values)
368
+    {
369
+} // end afterUpdate
364 370
 
365 371
     abstract public function onSearchFilter(&$db, $value);
366 372
     
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     public function getRequiredAttribute($ident)
88 88
     {
89 89
         if (!array_key_exists($ident, $this->attributes)) {
90
-            throw new \RuntimeException('Field ['. $this->getFieldName() .'] requires ['. $ident .'] attribute');
90
+            throw new \RuntimeException('Field ['.$this->getFieldName().'] requires ['.$ident.'] attribute');
91 91
         }
92 92
         
93 93
         return $this->attributes[$ident];
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     public function getValue($row, $postfix = '')
102 102
     {
103 103
         if (!is_object($row)) {
104
-            $row = (object) $row;
104
+            $row = (object)$row;
105 105
         }
106 106
         
107 107
         if ($this->hasCustomHandlerMethod('onGetValue')) {
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
             }
112 112
         }
113 113
         
114
-        $fieldName = $this->getFieldName() . $postfix;
114
+        $fieldName = $this->getFieldName().$postfix;
115 115
         // postfix used for getting values for form - tabs loop
116 116
         // so there is no need to force appending postfix
117 117
         if ($this->getAttribute('tabs') && !$postfix) {
118 118
             $tabs = $this->getAttribute('tabs');
119
-            $fieldName = $fieldName . $tabs[0]['postfix'];
119
+            $fieldName = $fieldName.$tabs[0]['postfix'];
120 120
         }
121 121
         $value = isset($row->$fieldName) ? $row->$fieldName : '';
122 122
         
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
         $type = $this->getAttribute('type');
164 164
 
165
-        $input = view('admin::tb.input.'. $type);
165
+        $input = view('admin::tb.input.'.$type);
166 166
         $input->value = $this->getValue($row);
167 167
         $input->name  = $this->getFieldName();
168 168
         $input->rows  = $this->getAttribute('rows');
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         
189 189
         $type = $this->getAttribute('type');
190 190
         
191
-        $input = view('admin::tb.input.tab.'. $type);
191
+        $input = view('admin::tb.input.tab.'.$type);
192 192
         $input->value = $this->getValue($row);
193 193
         $input->name  = $this->getFieldName();
194 194
         $input->rows  = $this->getAttribute('rows');
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
         $type = $this->getAttribute('filter');
238 238
 
239
-        $input = view('admin::tb.filter.'. $type);
239
+        $input = view('admin::tb.filter.'.$type);
240 240
         $input->name = $this->getFieldName();
241 241
         $input->value = $filter;
242 242
 
@@ -271,11 +271,11 @@  discard block
 block discarded – undo
271 271
         $tabs = $this->getAttribute('tabs');
272 272
         if ($tabs) {
273 273
             foreach ($tabs as $tab) {
274
-                $name = $this->definition['db']['table'] .'.'. $this->getFieldName() . $tab['postfix'];
274
+                $name = $this->definition['db']['table'].'.'.$this->getFieldName().$tab['postfix'];
275 275
                 $db->addSelect($name);
276 276
             }
277 277
         } else {
278
-            $db->addSelect($this->definition->getDatabaseOption('table') .'.'. $this->getFieldName());
278
+            $db->addSelect($this->definition->getDatabaseOption('table').'.'.$this->getFieldName());
279 279
         }
280 280
     } // end onSelectValue
281 281
     
Please login to merge, or discard this patch.
src/Fields/ManyToManyField.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -177,6 +177,9 @@
 block discarded – undo
177 177
         return $input->render();
178 178
     } // end getEditInputWithExtra
179 179
     
180
+    /**
181
+     * @param boolean $segmentCount
182
+     */
180 183
     private function doDivideOnParts($array, $segmentCount)
181 184
     {
182 185
         $dataCount = count($array);
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@
 block discarded – undo
33 33
         $values = is_array($values) ? $values : explode(',', $values);
34 34
         
35 35
         DB::table($this->getAttribute('mtm_table'))
36
-          ->where($this->getAttribute('mtm_key_field'), $id)
37
-          ->delete();
36
+            ->where($this->getAttribute('mtm_key_field'), $id)
37
+            ->delete();
38 38
         
39 39
         $data = array();
40 40
         if ($this->getAttribute('show_type') == 'extra') {
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 use Jarboe;
8 8
 
9 9
 
10
-class ManyToManyField extends AbstractField 
10
+class ManyToManyField extends AbstractField
11 11
 {
12 12
 
13 13
     protected function onAssets()
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             return $this->getEditInputSelectWithAjaxSearch($row);
120 120
         }
121 121
 
122
-        $input = View::make('admin::tb.input.many2many_'. $showType);
122
+        $input = View::make('admin::tb.input.many2many_'.$showType);
123 123
         $input->selected = array();
124 124
         if ($row) {
125 125
             $input->selected = $this->getRelatedExternalFieldOptions($row);
@@ -193,15 +193,15 @@  discard block
 block discarded – undo
193 193
 
194 194
     protected function getRelatedExternalFieldOptions($row, $isGetAll = false)
195 195
     {
196
-        $keyField = $this->getAttribute('mtm_table') .'.'. $this->getAttribute('mtm_external_key_field');
197
-        $valueField = $this->getAttribute('mtm_external_table') .'.'. $this->getAttribute('mtm_external_value_field');
196
+        $keyField = $this->getAttribute('mtm_table').'.'.$this->getAttribute('mtm_external_key_field');
197
+        $valueField = $this->getAttribute('mtm_external_table').'.'.$this->getAttribute('mtm_external_value_field');
198 198
         $externalTable = $this->getAttribute('mtm_external_table');
199
-        $externalForeignKey = $externalTable .'.'. $this->getAttribute('mtm_external_foreign_key_field');
199
+        $externalForeignKey = $externalTable.'.'.$this->getAttribute('mtm_external_foreign_key_field');
200 200
         
201
-        $options = DB::table($this->getAttribute('mtm_table'))->orderBy($externalTable .'.id', 'desc');
201
+        $options = DB::table($this->getAttribute('mtm_table'))->orderBy($externalTable.'.id', 'desc');
202 202
         $options->select($keyField, $valueField);
203 203
         if ($isGetAll) {
204
-            $options->addSelect($this->getAttribute('mtm_table') .'.*');
204
+            $options->addSelect($this->getAttribute('mtm_table').'.*');
205 205
         }
206 206
 
207 207
         $options->join($externalTable, $keyField, '=', $externalForeignKey);
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
     
237 237
     protected function getAllExternalFieldOptions($isGetAll = false)
238 238
     {
239
-        $valueField = $this->getAttribute('mtm_external_table') .'.'. $this->getAttribute('mtm_external_value_field');
239
+        $valueField = $this->getAttribute('mtm_external_table').'.'.$this->getAttribute('mtm_external_value_field');
240 240
         $externalTable = $this->getAttribute('mtm_external_table');
241
-        $externalForeignKey = $externalTable .'.'. $this->getAttribute('mtm_external_foreign_key_field');
241
+        $externalForeignKey = $externalTable.'.'.$this->getAttribute('mtm_external_foreign_key_field');
242 242
         
243 243
         $options = DB::table($externalTable);
244 244
         if (!$isGetAll) {
@@ -274,13 +274,13 @@  discard block
 block discarded – undo
274 274
     public function getAjaxSearchResult($query, $limit, $page)
275 275
     {
276 276
         // TODO: create handler callback & lambda callback
277
-        $results = DB::table($this->getAttribute('mtm_external_table'))->orderBy($this->getAttribute('mtm_external_table') .'.id', 'desc')
277
+        $results = DB::table($this->getAttribute('mtm_external_table'))->orderBy($this->getAttribute('mtm_external_table').'.id', 'desc')
278 278
                     ->select('id', $this->getAttribute('mtm_external_value_field'))
279
-                    ->where($this->getAttribute('mtm_external_value_field'), 'LIKE', '%'. $query .'%')
279
+                    ->where($this->getAttribute('mtm_external_value_field'), 'LIKE', '%'.$query.'%')
280 280
                     ->take($limit)
281 281
                     ->skip(($limit * $page) - $limit)
282 282
                     ->get();
283
-        $results = $results ? : array();
283
+        $results = $results ?: array();
284 284
         
285 285
         $res = array();
286 286
         foreach ($results as $result) {
Please login to merge, or discard this patch.
src/Handlers/ActionsHandler.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -8,6 +8,9 @@  discard block
 block discarded – undo
8 8
     protected $def;
9 9
     protected $controller;
10 10
 
11
+    /**
12
+     * @param \Yaro\Jarboe\JarboeController $controller
13
+     */
11 14
     public function __construct(array $actionsDefinition, &$controller)
12 15
     {
13 16
         $this->def = $actionsDefinition;
@@ -134,6 +137,9 @@  discard block
 block discarded – undo
134 137
         return $action;
135 138
     } // end onRestoreButton
136 139
     
140
+    /**
141
+     * @param string $type
142
+     */
137 143
     public function isAllowed($type, $buttonDefinition = array())
138 144
     {
139 145
         $def = isset($this->def[$type]) ? $this->def[$type] : false;
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 namespace Yaro\Jarboe\Handlers;
4 4
 
5
-class ActionsHandler 
5
+class ActionsHandler
6 6
 {
7 7
     
8 8
     protected $def;
Please login to merge, or discard this patch.
src/helpers.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -76,6 +76,10 @@
 block discarded – undo
76 76
 
77 77
 if (!function_exists('cartesianRecurseIt'))
78 78
 {
79
+    /**
80
+     * @param integer $level
81
+     * @param boolean $isElementsDuplicated
82
+     */
79 83
     function cartesianRecurseIt($arr, $variant, $level, $result, $arrayCount, $isElementsDuplicated)
80 84
     {
81 85
         $level++;
Please login to merge, or discard this patch.
Braces   +22 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,15 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!function_exists('urlify'))
4
-{
3
+if (!function_exists('urlify')) {
5 4
     function urlify($string)
6 5
     {
7 6
         return Jarboe::urlify($string);
8 7
     } // end urlify
9 8
 }
10 9
 
11
-if (!function_exists('__'))
12
-{
10
+if (!function_exists('__')) {
13 11
     function __()
14 12
     {
15 13
         /*
@@ -52,8 +50,7 @@  discard block
 block discarded – undo
52 50
     } // end __
53 51
 }
54 52
 
55
-if (!function_exists('dr'))
56
-{
53
+if (!function_exists('dr')) {
57 54
     function dr($array)
58 55
     {
59 56
         echo '<pre>';
@@ -62,8 +59,7 @@  discard block
 block discarded – undo
62 59
     } // end dr
63 60
 }
64 61
 
65
-if (!function_exists('cartesian'))
66
-{
62
+if (!function_exists('cartesian')) {
67 63
     function cartesian($arr, $isElementsDuplicated = false)
68 64
     {
69 65
         $variant = array();
@@ -74,8 +70,7 @@  discard block
 block discarded – undo
74 70
     } // end cartesian
75 71
 }
76 72
 
77
-if (!function_exists('cartesianRecurseIt'))
78
-{
73
+if (!function_exists('cartesianRecurseIt')) {
79 74
     function cartesianRecurseIt($arr, $variant, $level, $result, $arrayCount, $isElementsDuplicated)
80 75
     {
81 76
         $level++;
@@ -97,8 +92,7 @@  discard block
 block discarded – undo
97 92
     } // end cartesianRecurseIt
98 93
 }
99 94
 
100
-if (!function_exists('remove_bom'))
101
-{
95
+if (!function_exists('remove_bom')) {
102 96
     function remove_bom($val)
103 97
     {
104 98
         if (substr($val, 0, 3) == pack('CCC', 0xef, 0xbb, 0xbf)) {
@@ -108,8 +102,7 @@  discard block
 block discarded – undo
108 102
     } // end remove_bom
109 103
 }
110 104
 
111
-if (!function_exists('xml2array'))
112
-{
105
+if (!function_exists('xml2array')) {
113 106
     function xml2array(SimpleXMLElement $xml, $options = array())
114 107
     {
115 108
         $defaults = array(
@@ -131,8 +124,10 @@  discard block
 block discarded – undo
131 124
         foreach ($namespaces as $prefix => $namespace) {
132 125
             foreach ($xml->attributes($namespace) as $attributeName => $attribute) {
133 126
                 //replace characters in attribute name
134
-                if ($options['keySearch']) $attributeName =
127
+                if ($options['keySearch']) {
128
+                    $attributeName =
135 129
                         str_replace($options['keySearch'], $options['keyReplace'], $attributeName);
130
+                }
136 131
                 $attributeKey = $options['attributePrefix']
137 132
                         . ($prefix ? $prefix . $options['namespaceSeparator'] : '')
138 133
                         . $attributeName;
@@ -149,10 +144,14 @@  discard block
 block discarded – undo
149 144
                 list($childTagName, $childProperties) = each($childArray);
150 145
      
151 146
                 //replace characters in tag name
152
-                if ($options['keySearch']) $childTagName =
147
+                if ($options['keySearch']) {
148
+                    $childTagName =
153 149
                         str_replace($options['keySearch'], $options['keyReplace'], $childTagName);
150
+                }
154 151
                 //add namespace prefix, if any
155
-                if ($prefix) $childTagName = $prefix . $options['namespaceSeparator'] . $childTagName;
152
+                if ($prefix) {
153
+                    $childTagName = $prefix . $options['namespaceSeparator'] . $childTagName;
154
+                }
156 155
      
157 156
                 if (!isset($tagsArray[$childTagName])) {
158 157
                     //only entry with this key
@@ -176,7 +175,9 @@  discard block
 block discarded – undo
176 175
         //get text content of node
177 176
         $textContentArray = array();
178 177
         $plainText = trim((string)$xml);
179
-        if ($plainText !== '') $textContentArray[$options['textContent']] = $plainText;
178
+        if ($plainText !== '') {
179
+            $textContentArray[$options['textContent']] = $plainText;
180
+        }
180 181
      
181 182
         //stick it all together
182 183
         $propertiesArray = !$options['autoText'] || $attributesArray || $tagsArray || ($plainText === '')
@@ -189,9 +190,8 @@  discard block
 block discarded – undo
189 190
     } // end xml2array    
190 191
 }
191 192
 
192
-if (!function_exists('filesize_format'))
193
-{
194
-    function filesize_format($bytes) 
193
+if (!function_exists('filesize_format')) {
194
+    function filesize_format($bytes)
195 195
     {
196 196
         if ($bytes >= 1073741824) {
197 197
             $bytes = number_format($bytes / 1073741824, 1, '.', '') . ' Gb';
@@ -212,8 +212,7 @@  discard block
 block discarded – undo
212 212
 }
213 213
 
214 214
 
215
-if (!function_exists('get_path_by_id'))
216
-{
215
+if (!function_exists('get_path_by_id')) {
217 216
     function get_path_by_id($id, $pad = 6)
218 217
     {
219 218
         $id = str_pad($id, $pad, '0', STR_PAD_LEFT);
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         }
35 35
  
36 36
         $namespace = 'messages';
37
-        if (Request::is(ltrim(config('jarboe.admin.uri') .'/*', '/')) || Request::is(ltrim(config('jarboe.admin.uri'), '/'))) {
37
+        if (Request::is(ltrim(config('jarboe.admin.uri').'/*', '/')) || Request::is(ltrim(config('jarboe.admin.uri'), '/'))) {
38 38
             $namespace = 'admin';
39 39
         }
40 40
         
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
         $defaults = array(
116 116
             'namespaceSeparator' => ':', // you may want this to be something other than a colon
117 117
             'attributePrefix'    => '@', // to distinguish between attributes and nodes with the same name
118
-            'alwaysArray' => array(),    // array of xml tag names which should always become arrays
119
-            'autoArray'   => true,       // only create arrays for tags which appear more than once
120
-            'textContent' => '$',        // key used for the text content of elements
121
-            'autoText'    => true,       // skip textContent key if node has no attributes or child nodes
122
-            'keySearch'   => false,      // optional search and replace on tag and attribute names
118
+            'alwaysArray' => array(), // array of xml tag names which should always become arrays
119
+            'autoArray'   => true, // only create arrays for tags which appear more than once
120
+            'textContent' => '$', // key used for the text content of elements
121
+            'autoText'    => true, // skip textContent key if node has no attributes or child nodes
122
+            'keySearch'   => false, // optional search and replace on tag and attribute names
123 123
             'keyReplace'  => false       // replace values for above search values (as passed to str_replace())
124 124
         );
125 125
         $options = array_merge($defaults, $options);
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
                 if ($options['keySearch']) $attributeName =
135 135
                         str_replace($options['keySearch'], $options['keyReplace'], $attributeName);
136 136
                 $attributeKey = $options['attributePrefix']
137
-                        . ($prefix ? $prefix . $options['namespaceSeparator'] : '')
137
+                        . ($prefix ? $prefix.$options['namespaceSeparator'] : '')
138 138
                         . $attributeName;
139 139
                 $attributesArray[$attributeKey] = (string)$attribute;
140 140
             }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
                 if ($options['keySearch']) $childTagName =
153 153
                         str_replace($options['keySearch'], $options['keyReplace'], $childTagName);
154 154
                 //add namespace prefix, if any
155
-                if ($prefix) $childTagName = $prefix . $options['namespaceSeparator'] . $childTagName;
155
+                if ($prefix) $childTagName = $prefix.$options['namespaceSeparator'].$childTagName;
156 156
      
157 157
                 if (!isset($tagsArray[$childTagName])) {
158 158
                     //only entry with this key
@@ -194,15 +194,15 @@  discard block
 block discarded – undo
194 194
     function filesize_format($bytes) 
195 195
     {
196 196
         if ($bytes >= 1073741824) {
197
-            $bytes = number_format($bytes / 1073741824, 1, '.', '') . ' Gb';
197
+            $bytes = number_format($bytes / 1073741824, 1, '.', '').' Gb';
198 198
         } elseif ($bytes >= 1048576) {
199
-            $bytes = number_format($bytes / 1048576, 1, '.', '') . ' Mb';
199
+            $bytes = number_format($bytes / 1048576, 1, '.', '').' Mb';
200 200
         } elseif ($bytes >= 1024) {
201
-            $bytes = number_format($bytes / 1024, 1, '.', '') . ' Kb';
201
+            $bytes = number_format($bytes / 1024, 1, '.', '').' Kb';
202 202
         } elseif ($bytes > 1) {
203
-            $bytes = $bytes . ' bytes';
203
+            $bytes = $bytes.' bytes';
204 204
         } elseif ($bytes == 1) {
205
-            $bytes = $bytes . ' byte';
205
+            $bytes = $bytes.' byte';
206 206
         } else {
207 207
             $bytes = '0 bytes';
208 208
         }
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
         $id = str_pad($id, $pad, '0', STR_PAD_LEFT);
220 220
         $chunks = str_split($id, 2);
221 221
     
222
-        return implode('/', $chunks) .'/';
222
+        return implode('/', $chunks).'/';
223 223
     } // end get_path_by_id
224 224
 }
225 225
 
Please login to merge, or discard this patch.
src/JarboeController.php 4 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -115,6 +115,9 @@  discard block
 block discarded – undo
115 115
         return false;
116 116
     } // end createCustomHandlerInstance
117 117
 
118
+    /**
119
+     * @param string $methodName
120
+     */
118 121
     public function hasCustomHandlerMethod($methodName)
119 122
     {
120 123
         return $this->getCustomHandler() && is_callable(array($this->getCustomHandler(), $methodName));
@@ -170,6 +173,9 @@  discard block
 block discarded – undo
170 173
         return $this->definition;
171 174
     } // end getDefinition
172 175
     
176
+    /**
177
+     * @param string $ident
178
+     */
173 179
     public function getDefinitionOption($ident, $default = null)
174 180
     {
175 181
         $value = array_get($this->getDefinition(), $ident);
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 use Yaro\Jarboe\Handlers\ImportHandler;
13 13
 use Yaro\Jarboe\Handlers\CustomClosureHandler;
14 14
 use Yaro\Jarboe\Storage\Image as ImageStorage;
15
-use Yaro\Jarboe\Storage\File  as FileStorage;
15
+use Yaro\Jarboe\Storage\File as FileStorage;
16 16
 
17 17
 
18 18
 class JarboeController 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
         
85 85
         //
86 86
         if (!isset($this->definition['options']['action_url'])) {
87
-            $this->definition['options']['action_url'] = '/'. Request::path();
87
+            $this->definition['options']['action_url'] = '/'.Request::path();
88 88
             // for structure current node resolver
89 89
             $requestValues = Request::only('node');
90 90
             if ($requestValues['node']) {
91
-                $this->definition['options']['action_url'] .'?node='. $requestValues['node'];
91
+                $this->definition['options']['action_url'].'?node='.$requestValues['node'];
92 92
             }
93 93
         }
94 94
     } // end doPrepareDefinition
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     protected function createCustomHandlerInstance()
114 114
     {
115 115
         if (isset($this->definition['options']['handler'])) {
116
-            $handler = '\\'. $this->definition['options']['handler'];
116
+            $handler = '\\'.$this->definition['options']['handler'];
117 117
             return new $handler($this);
118 118
         }
119 119
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
     public function getCustomHandler()
134 134
     {
135
-        return $this->handler ? : $this->callbacks;
135
+        return $this->handler ?: $this->callbacks;
136 136
     } // end getCustomHandler
137 137
 
138 138
     public function getField($ident)
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
     
223 223
     protected function createFieldInstance($name, $info)
224 224
     {
225
-        $className = 'Yaro\\Jarboe\\Fields\\'. ucfirst(camel_case($info['type'])) ."Field";
225
+        $className = 'Yaro\\Jarboe\\Fields\\'.ucfirst(camel_case($info['type']))."Field";
226 226
 
227 227
         return new $className(
228 228
             $name, 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
     protected function getTableDefinition($table)
237 237
     {
238 238
         $table = preg_replace('~\.~', '/', $table);
239
-        $path = base_path('resources/definitions/'. $table .'.php');
239
+        $path = base_path('resources/definitions/'.$table.'.php');
240 240
 
241 241
         if (!file_exists($path)) {
242 242
             throw new \RuntimeException("Definition \n[{$path}]\n does not exist.");
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 use Yaro\Jarboe\Storage\File  as FileStorage;
16 16
 
17 17
 
18
-class JarboeController 
18
+class JarboeController
19 19
 {
20 20
 
21 21
     protected $options;
Please login to merge, or discard this patch.
resources/lang/en/login.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-return array (
3
+return array(
4 4
     'email_required'    => 'Please enter your email address',
5 5
     'email_valid'       => 'Please enter a VALID email address',
6 6
     'password_required' => 'Please enter your password',
Please login to merge, or discard this patch.
resources/lang/ru/login.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-return array (
3
+return array(
4 4
     'email_required'    => 'Введите адрес эл.почты',
5 5
     'email_valid'       => 'Введите валидный адрес эл.почты',
6 6
     'password_required' => 'Введите пароль',
Please login to merge, or discard this patch.
resources/lang/ua/login.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-return array (
3
+return array(
4 4
     'email_required'    => 'Введiть адресу ел.пошти',
5 5
     'email_valid'       => 'Введiть дiйсну адресу ел.пошти',
6 6
     'password_required' => 'Введiть пароль',
Please login to merge, or discard this patch.