Completed
Push — master ( 6a07a1...888a93 )
by
unknown
26:37
created
Behavior/ExtendedSluggableBehavior.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -143,6 +143,9 @@  discard block
 block discarded – undo
143 143
         return $script;
144 144
     }
145 145
 
146
+    /**
147
+     * @param string $script
148
+     */
146 149
     protected function addSlugSetter(&$script)
147 150
     {
148 151
         $script .= "
@@ -459,6 +462,9 @@  discard block
 block discarded – undo
459 462
         return $script;
460 463
     }
461 464
 
465
+    /**
466
+     * @param string $script
467
+     */
462 468
     protected function addFilterBySlug(&$script)
463 469
     {
464 470
         $script .= "
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
             ));
42 42
             // add a unique to column
43 43
             $unique = new \Unique($this->getColumnForParameter('slug_column'));
44
-            $unique->setName($this->getTable()->getCommonName() . '_slug');
44
+            $unique->setName($this->getTable()->getCommonName().'_slug');
45 45
             $unique->addColumn($this->getTable()->getColumn($this->getParameter('slug_column')));
46 46
             if ($this->getParameter('scope_column')) {
47 47
                 $unique->addColumn($this->getTable()->getColumn($this->getParameter('scope_column')));
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     protected function getColumnGetter()
59 59
     {
60
-        return 'get' . $this->getColumnForParameter('slug_column')->getPhpName();
60
+        return 'get'.$this->getColumnForParameter('slug_column')->getPhpName();
61 61
     }
62 62
 
63 63
     /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     protected function getColumnSetter()
69 69
     {
70
-        return 'set' . $this->getColumnForParameter('slug_column')->getPhpName();
70
+        return 'set'.$this->getColumnForParameter('slug_column')->getPhpName();
71 71
     }
72 72
 
73 73
     /**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
                     throw new \InvalidArgumentException(sprintf('The pattern %s is invalid  the column %s is not found', $pattern, $match));
100 100
                 }
101 101
                 $columnConst = $builder->getColumnConstant($column);
102
-                $script .= "\$this->isColumnModified($columnConst)" . ($key < $count - 1 ? " || " : "");
102
+                $script .= "\$this->isColumnModified($columnConst)".($key < $count - 1 ? " || " : "");
103 103
             }
104 104
 
105 105
             $script .= ") {
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
  * Wrap the setter for slug value
151 151
  *
152 152
  * @param   string
153
- * @return  " . $this->getTable()->getPhpName() . "
153
+ * @return  " . $this->getTable()->getPhpName()."
154 154
  */
155 155
 public function setSlug(\$v)
156 156
 {
157
-    return \$this->" . $this->getColumnSetter() . "(\$v);
157
+    return \$this->" . $this->getColumnSetter()."(\$v);
158 158
 }
159 159
 ";
160 160
     }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
  */
170 170
 public function getSlug()
171 171
 {
172
-    return \$this->" . $this->getColumnGetter() . "();
172
+    return \$this->" . $this->getColumnGetter()."();
173 173
 }
174 174
 ";
175 175
     }
@@ -204,10 +204,10 @@  discard block
 block discarded – undo
204 204
 
205 205
         $primary_string = $this->getParameter('primary_string');
206 206
         $i18n_languages = $this->getSlugLocales();
207
-        $primary_string_column =  count($i18n_languages) ? $primary_string : $this->getColumnForParameter('primary_string');
207
+        $primary_string_column = count($i18n_languages) ? $primary_string : $this->getColumnForParameter('primary_string');
208 208
         $get_primary_string = 'get'.(count($i18n_languages) ? $this->CamelCase($primary_string) : $primary_string_column->getPhpName());
209 209
 
210
-        if(!$primary_string_column) {
210
+        if (!$primary_string_column) {
211 211
             $this->exceptionError('Not found column "'.$primary_string.'" in table '.$this->getTable()->getName());
212 212
         }
213 213
 
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
         if (count($i18n_languages)) {
224 224
             $languages = 'array(';
225 225
             foreach ($i18n_languages as $lang) {
226
-                $languages.='"'.$lang.'",';
226
+                $languages .= '"'.$lang.'",';
227 227
             }
228
-            $languages.=')';
228
+            $languages .= ')';
229 229
 
230 230
             $toSlug .= '
231 231
         $to_string = $this->isNew() ? "Новая запись" : "";
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 {
261 261
     ";
262 262
         if ($pattern) {
263
-            $script .= "return '" . str_replace(array('{', '}'), array('\' . $this->cleanupSlugPart($this->get', '()) . \''), $pattern) . "';";
263
+            $script .= "return '".str_replace(array('{', '}'), array('\' . $this->cleanupSlugPart($this->get', '()) . \''), $pattern)."';";
264 264
         } else {
265 265
             $script .= "return \$this->cleanupSlugPart(\$this->toSlug());";
266 266
         }
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
  * @param     string \$replacement the separator used by slug
283 283
  * @return    string               the slugified text
284 284
  */
285
-protected static function cleanupSlugPart(\$slug, \$replacement = '" . $this->getParameter('replacement') . "')
285
+protected static function cleanupSlugPart(\$slug, \$replacement = '" . $this->getParameter('replacement')."')
286 286
 {
287 287
     \$slug = strtr(\$slug, array(
288 288
         'А' => 'A',  'Б' => 'B',  'В' => 'V',    'Г' => 'G',    'Д' => 'D', 'Е' => 'E', 'Ё' => 'E',  'Ж' => 'ZH',
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
     \$slug = str_replace(array('\'', '`', '^'), '', \$slug);
313 313
 
314 314
     // replace non letter or digits with separator
315
-    \$slug = preg_replace('" . $this->getParameter('replace_pattern') . "', \$replacement, \$slug);
315
+    \$slug = preg_replace('" . $this->getParameter('replace_pattern')."', \$replacement, \$slug);
316 316
 
317 317
     // trim
318 318
     \$slug = trim(\$slug, \$replacement);
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
  * @param    int    \$alreadyExists   false for the first try, true for the second, and take the high count + 1
364 364
  * @return   string                   the unique slug
365 365
  */
366
-protected function makeSlugUnique(\$slug, \$separator = '" . $this->getParameter('separator') . "', \$alreadyExists = false)
366
+protected function makeSlugUnique(\$slug, \$separator = '" . $this->getParameter('separator')."', \$alreadyExists = false)
367 367
 {";
368 368
         $getter = $this->getColumnGetter();
369 369
         $script .= "
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
         if (null == $this->getParameter('slug_pattern')) {
376 376
             $script .= "
377 377
 
378
-        \$count = " . $this->builder->getStubQueryBuilder()->getClassname() . "::create()
378
+        \$count = " . $this->builder->getStubQueryBuilder()->getClassname()."::create()
379 379
             ->filterBySlug(\$this->$getter())
380 380
             ->filterByPrimaryKey(\$this->getPrimaryKey())
381 381
         ->count();
@@ -388,23 +388,23 @@  discard block
 block discarded – undo
388 388
         $script .= "
389 389
     }
390 390
 
391
-     \$query = " . $this->builder->getStubQueryBuilder()->getClassname() . "::create('q')
391
+     \$query = " . $this->builder->getStubQueryBuilder()->getClassname()."::create('q')
392 392
     ";
393 393
         $platform = $this->getTable()->getDatabase()->getPlatform();
394 394
         if ($platform instanceof \PgsqlPlatform) {
395
-            $script .= "->where('q." . $this->getColumnForParameter('slug_column')->getPhpName() . " ' . (\$alreadyExists ? '~*' : '=') . ' ?', \$alreadyExists ? '^' . \$slug2 . '[0-9]+$' : \$slug2)";
395
+            $script .= "->where('q.".$this->getColumnForParameter('slug_column')->getPhpName()." ' . (\$alreadyExists ? '~*' : '=') . ' ?', \$alreadyExists ? '^' . \$slug2 . '[0-9]+$' : \$slug2)";
396 396
         } elseif ($platform instanceof \MssqlPlatform) {
397
-            $script .= "->where('q." . $this->getColumnForParameter('slug_column')->getPhpName() . " ' . (\$alreadyExists ? 'like' : '=') . ' ?', \$alreadyExists ? '^' . \$slug2 . '[0-9]+$' : \$slug2)";
397
+            $script .= "->where('q.".$this->getColumnForParameter('slug_column')->getPhpName()." ' . (\$alreadyExists ? 'like' : '=') . ' ?', \$alreadyExists ? '^' . \$slug2 . '[0-9]+$' : \$slug2)";
398 398
         } elseif ($platform instanceof \OraclePlatform) {
399
-            $script .= "->where((\$alreadyExists ? 'REGEXP_LIKE(' : '') . 'q." . $this->getColumnForParameter('slug_column')->getPhpName() . " ' . (\$alreadyExists ? ',' : '=') . ' ?' . (\$alreadyExists ? ')' : ''), \$alreadyExists ? '^' . \$slug2 . '[0-9]+$' : \$slug2)";
399
+            $script .= "->where((\$alreadyExists ? 'REGEXP_LIKE(' : '') . 'q.".$this->getColumnForParameter('slug_column')->getPhpName()." ' . (\$alreadyExists ? ',' : '=') . ' ?' . (\$alreadyExists ? ')' : ''), \$alreadyExists ? '^' . \$slug2 . '[0-9]+$' : \$slug2)";
400 400
         } else {
401
-            $script .= "->where('q." . $this->getColumnForParameter('slug_column')->getPhpName() . " ' . (\$alreadyExists ? 'REGEXP' : '=') . ' ?', \$alreadyExists ? '^' . \$slug2 . '[0-9]+$' : \$slug2)";
401
+            $script .= "->where('q.".$this->getColumnForParameter('slug_column')->getPhpName()." ' . (\$alreadyExists ? 'REGEXP' : '=') . ' ?', \$alreadyExists ? '^' . \$slug2 . '[0-9]+$' : \$slug2)";
402 402
         }
403 403
 
404
-        $script .="->prune(\$this)";
404
+        $script .= "->prune(\$this)";
405 405
 
406 406
         if ($this->getParameter('scope_column')) {
407
-            $scopeGetter = 'get' . $this->getColumnForParameter('scope_column')->getPhpName();
407
+            $scopeGetter = 'get'.$this->getColumnForParameter('scope_column')->getPhpName();
408 408
             $script .= "
409 409
             ->filterBy('{$this->getColumnForParameter('scope_column')->getPhpName()}', \$this->{$scopeGetter}())";
410 410
         }
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
 
428 428
     // Already exists
429 429
     \$object = \$query
430
-        ->addDescendingOrderByColumn('LENGTH(" . $this->getColumnForParameter('slug_column')->getName() . ")')
431
-        ->addDescendingOrderByColumn('" . $this->getColumnForParameter('slug_column')->getName() . "')
430
+        ->addDescendingOrderByColumn('LENGTH(" . $this->getColumnForParameter('slug_column')->getName().")')
431
+        ->addDescendingOrderByColumn('" . $this->getColumnForParameter('slug_column')->getName()."')
432 432
     ->findOne();
433 433
 
434 434
     // First duplicate slug
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
         return \$slug2 . '1';
437 437
     }
438 438
 
439
-    \$slugNum = substr(\$object->" . $getter . "(), strlen(\$slug) + 1);
439
+    \$slugNum = substr(\$object->" . $getter."(), strlen(\$slug) + 1);
440 440
     if ('0' === \$slugNum[0]) {
441 441
         \$slugNum[0] = 1;
442 442
     }
@@ -467,11 +467,11 @@  discard block
 block discarded – undo
467 467
  *
468 468
  * @param     string \$slug The value to use as filter.
469 469
  *
470
- * @return    " . $this->builder->getStubQueryBuilder()->getClassname() . " The current query, for fluid interface
470
+ * @return    " . $this->builder->getStubQueryBuilder()->getClassname()." The current query, for fluid interface
471 471
  */
472 472
 public function filterBySlug(\$slug)
473 473
 {
474
-    return \$this->addUsingAlias(" . $this->builder->getColumnConstant($this->getColumnForParameter('slug_column')) . ", \$slug, Criteria::EQUAL);
474
+    return \$this->addUsingAlias(" . $this->builder->getColumnConstant($this->getColumnForParameter('slug_column')).", \$slug, Criteria::EQUAL);
475 475
 }
476 476
 ";
477 477
     }
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
  * @param     string \$slug The value to use as filter.
486 486
  * @param     PropelPDO \$con The optional connection object
487 487
  *
488
- * @return    " . $this->builder->getStubObjectBuilder()->getClassname() . " the result, formatted by the current formatter
488
+ * @return    " . $this->builder->getStubObjectBuilder()->getClassname()." the result, formatted by the current formatter
489 489
  */
490 490
 public function findOneBySlug(\$slug, \$con = null)
491 491
 {
Please login to merge, or discard this patch.
Behavior/TranslationBehavior.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
      * Перевод из венгерского стиля в CamelCase
194 194
      *
195 195
      * @param $name
196
-     * @return mixed
196
+     * @return string
197 197
      */
198 198
     protected function CamelCase($name)
199 199
     {
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
     /**
280 280
      * Выкидываем эксепшн с ошибкой
281 281
      *
282
-     * @param $error
282
+     * @param string $error
283 283
      * @throws \Exception
284 284
      */
285 285
     protected function exceptionError($error)
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
         $locales = $this->getLocales();
28 28
         $langs = "array(";
29 29
         foreach ($locales as $locale) {
30
-            $langs.='"'.$locale.'",';
30
+            $langs .= '"'.$locale.'",';
31 31
         }
32
-        $langs.=')';
32
+        $langs .= ')';
33 33
 
34 34
         $script .= '
35 35
 /**
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $primary_string = $this->getParameter('primary_string');
66 66
         $i18n_languages = $this->getLocales();
67
-        $primary_string_column =  count($i18n_languages) ? $primary_string : $this->getColumnForParameter('primary_string');
67
+        $primary_string_column = count($i18n_languages) ? $primary_string : $this->getColumnForParameter('primary_string');
68 68
         $get_primary_string = 'get'.(count($i18n_languages) ? $this->CamelCase($primary_string) : $primary_string_column->getPhpName());
69 69
 
70
-        if(!$primary_string_column) {
70
+        if (!$primary_string_column) {
71 71
             $this->exceptionError('Not found column "'.$primary_string.'" in table '.$this->getTable()->getName());
72 72
         }
73 73
 
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
         if (count($i18n_languages)) {
85 85
             $languages = 'array(';
86 86
             foreach ($i18n_languages as $lang) {
87
-                $languages.='"'.$lang.'",';
87
+                $languages .= '"'.$lang.'",';
88 88
             }
89
-            $languages.=')';
89
+            $languages .= ')';
90 90
 
91 91
             $toString .= '
92 92
         $to_string = $this->isNew() ? "New object" : "";
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         $currentTable = $this->getTable();
244 244
         $db = $currentTable->getDatabase();
245 245
 
246
-        $i18nTableName = $currentTable->getName() . '_i18n';
246
+        $i18nTableName = $currentTable->getName().'_i18n';
247 247
         $i18nTable = $db->getTable($i18nTableName);
248 248
         if (!$i18nTable) {
249 249
             $this->exceptionError('Table '.$i18nTableName.' not found');
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
      * @param     string $relationAlias optional alias for the relation
266 266
      * @param     string $joinType Accepted values are null, \'left join\', \'right join\', \'inner join\'. Defaults to left join.
267 267
      *
268
-     * @return    \\' . $builder->getNewStubQueryBuilder($i18nTable)->getFullyQualifiedClassname() . ' A secondary query class using the current class as primary query
268
+     * @return    \\' . $builder->getNewStubQueryBuilder($i18nTable)->getFullyQualifiedClassname().' A secondary query class using the current class as primary query
269 269
      */
270 270
     public function useI18nQuery($locale = \'ru\', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
271 271
     {
272 272
         return $this
273 273
             ->joinI18n($locale, $relationAlias, $joinType)
274
-            ->useQuery($relationAlias ? $relationAlias : \''. $builder->getRefFKPhpNameAffix($foreignKey) .'\', \'\\'. $builder->getNewStubQueryBuilder($i18nTable)->getFullyQualifiedClassname() .'\');
274
+            ->useQuery($relationAlias ? $relationAlias : \''. $builder->getRefFKPhpNameAffix($foreignKey).'\', \'\\'.$builder->getNewStubQueryBuilder($i18nTable)->getFullyQualifiedClassname().'\');
275 275
     }';
276 276
         return $script;
277 277
     }
Please login to merge, or discard this patch.
Behavior/TranslationModelBehavior.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -37,6 +37,9 @@
 block discarded – undo
37 37
         return $script;
38 38
     }
39 39
 
40
+    /**
41
+     * @param string $script
42
+     */
40 43
     public function getFieldTranslation(&$script)
41 44
     {
42 45
         $locales = $this->getContainer()->getParameter("it_blaster_translation.locales");
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     {
33 33
         $this->builder = $builder;
34 34
         $script = '';
35
-        $this->getFieldTranslation($script);    //методы переводов указанного поля
35
+        $this->getFieldTranslation($script); //методы переводов указанного поля
36 36
 
37 37
         return $script;
38 38
     }
Please login to merge, or discard this patch.
Model/TranslationPeer.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@
 block discarded – undo
34 34
 
35 35
         foreach ($translation_list_en as $id => $translation_item) {
36 36
             $result[$translation_item['alias']] = isset($translation_list_locale[$id]) && $translation_list_locale[$id] ?
37
-                $translation_list_locale[$id] :
38
-                ($translation_item['title'] ? $translation_item['title'] : $translation_item['alias']);
37
+                $translation_list_locale[$id] : ($translation_item['title'] ? $translation_item['title'] : $translation_item['alias']);
39 38
         }
40 39
 
41 40
         return $result;
Please login to merge, or discard this patch.
Model/Translation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
     public function getAliasShort()
10 10
     {
11 11
         $alias = $this->getAlias();
12
-        if (mb_strlen($alias, "UTF-8")>26) {
12
+        if (mb_strlen($alias, "UTF-8") > 26) {
13 13
             $alias = mb_substr($alias, 0, 26, "utf-8")."...";
14 14
         }
15 15
         return $alias;
Please login to merge, or discard this patch.
Behavior/ExtendedI18nBehavior.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@
 block discarded – undo
12 12
         $table = $this->getTable();
13 13
         $primary_string = $this->getParameter('primary_string');
14 14
 
15
-        if(!$primary_string) {
15
+        if (!$primary_string) {
16 16
             $this->exceptionError('Need set parameter "primary_string" in table '.$table->getName());
17 17
         }
18 18
 
19
-        if(!$table->hasColumn($primary_string)) {
19
+        if (!$table->hasColumn($primary_string)) {
20 20
             $this->exceptionError('Not found column "'.$primary_string.'" in table '.$table->getName());
21 21
         }
22 22
     }
Please login to merge, or discard this patch.
Translation/Dumper/PhpDumper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         $this->writer
52 52
             ->reset()
53 53
             ->writeln('<?php')
54
-            ->writeln('return \ItBlaster\TranslationBundle\Model\TranslationPeer::getListForLocale("' . $this->locale . '");')
54
+            ->writeln('return \ItBlaster\TranslationBundle\Model\TranslationPeer::getListForLocale("'.$this->locale.'");')
55 55
             ->indent();
56 56
         $this->dumpStructureRecursively($structure);
57 57
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                     if (!isset($translation_strings[$locale][$k])) {
93 93
                         /** @var Translation $trans_obj */
94 94
                         $trans_obj = $translation_strings['en'][$k];
95
-                        $this->setParamsTransObj($trans_obj,$locale,$k);
95
+                        $this->setParamsTransObj($trans_obj, $locale, $k);
96 96
                     }
97 97
                 }
98 98
             }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      * @param $locale
110 110
      * @param string $title
111 111
      */
112
-    private function setParamsTransObj(&$trans_obj, $locale, $alias, $title='')
112
+    private function setParamsTransObj(&$trans_obj, $locale, $alias, $title = '')
113 113
     {
114 114
         $trans_obj
115 115
             ->setAlias($alias)
Please login to merge, or discard this patch.
Admin/TranslationAdmin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@
 block discarded – undo
122 122
             'dev' => $app_dir.'/cache/dev/translations/',
123 123
             'prod' => $app_dir.'/cache/prod/translations/',
124 124
         );
125
-        foreach($cache_dirs as $cache_dir) {
125
+        foreach ($cache_dirs as $cache_dir) {
126 126
             if (is_dir($cache_dir)) {
127 127
                 $files = glob($cache_dir."*.*");
128 128
                 if (count($files)) {
Please login to merge, or discard this patch.