Completed
Push — master ( 579b25...02b205 )
by Vitaly
02:52
created
application/Application.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,6 @@
 block discarded – undo
8 8
 
9 9
 namespace samsoncms\seo\application;
10 10
 
11
-use samsonphp\event\Event;
12
-
13 11
 if (class_exists('\samsoncms\Application', false)) {
14 12
 
15 13
     class Application extends \samsoncms\Application
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: molodyko
5
- * Date: 29.09.2015
6
- * Time: 11:32
7
- */
3
+     * Created by PhpStorm.
4
+     * User: molodyko
5
+     * Date: 29.09.2015
6
+     * Time: 11:32
7
+     */
8 8
 
9 9
 namespace samsoncms\seo\application;
10 10
 
Please login to merge, or discard this patch.
src/Core.php 2 patches
Unused Use Statements   -5 removed lines patch added patch discarded remove patch
@@ -2,19 +2,14 @@
 block discarded – undo
2 2
 
3 3
 namespace samsoncms\seo;
4 4
 
5
-use samson\activerecord\dbRecord;
6 5
 use samson\activerecord\structure;
7 6
 use samson\activerecord\structurematerial;
8
-use samson\cms\CMSMaterial;
9 7
 use samsoncms\seo\Migrate;
10 8
 use samsoncms\seo\render\Element;
11 9
 use samsoncms\seo\schema\control\seo\Dynamic;
12
-use samsoncms\seo\schema\material\Facebook;
13
-use samsoncms\seo\schema\Main;
14 10
 use samsoncms\seo\schema\Schema;
15 11
 use samson\core\CompressableService;
16 12
 use samsoncms\seo\sitemap\SiteMap;
17
-use samsoncms\seo\sitemap\Xml;
18 13
 use samsoncms\seo\tab\InfoTab;
19 14
 use samsonphp\event\Event;
20 15
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             if ($schema->getStructureId() == $structureId) {
73 73
 
74 74
                 // Render elements if exists
75
-                $isElements = isset($schema->elements)&&(!empty($schema->elements));
75
+                $isElements = isset($schema->elements) && (!empty($schema->elements));
76 76
 
77 77
                 // If exists elements on the tab then show their
78 78
                 if ($isElements) {
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                     // Insert element as first child of table
87 87
                     $content = preg_replace(
88 88
                         '/\<div class=\"material_table_tab\"\>/',
89
-                        '<div class="material_table_tab">' . $contentNestedElement,
89
+                        '<div class="material_table_tab">'.$contentNestedElement,
90 90
                         $content,
91 91
                         1
92 92
                     );
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
      * @param $query
154 154
      * @param $entity
155 155
      */
156
-    public function renderMaterialTab(\samsoncms\app\material\form\Form &$form, $renderer, $query, $entity)
156
+    public function renderMaterialTab(\samsoncms\app\material\form\Form&$form, $renderer, $query, $entity)
157 157
     {
158 158
 
159 159
         $migrate = new \samsoncms\seo\Migrate($this->query);
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
                 // If content not empty render field(meta tag)
250 250
                 if (isset($content{0})) {
251 251
                     // Save html view
252
-                    $html .= $this->view($schema->view)->name($alias)->content($content)->output() . "\n";
252
+                    $html .= $this->view($schema->view)->name($alias)->content($content)->output()."\n";
253 253
                 }
254 254
             }
255 255
         }
@@ -300,9 +300,9 @@  discard block
 block discarded – undo
300 300
     public function templateRenderer(&$html, $parameters, $module)
301 301
     {
302 302
         // TODO: Change this to normal dependency
303
-        if($module->id() != 'compressor') {
303
+        if ($module->id() != 'compressor') {
304 304
             $content = $this->show();
305
-            $html = str_ireplace('</head>', $content . '</head>', $html);
305
+            $html = str_ireplace('</head>', $content.'</head>', $html);
306 306
         }
307 307
     }
308 308
 }
Please login to merge, or discard this patch.
src/Display.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
     /**
22 22
      * Init query
23
-     * @param $query
23
+     * @param \samson\activerecord\dbQuery $query
24 24
      */
25 25
     public function __construct($query)
26 26
     {
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
     /**
31 31
      * Get data from passed material
32
-     * @param $fieldName
32
+     * @param string $fieldName
33 33
      * @param $material
34 34
      * @return null
35 35
      * @throws \Exception
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      * @param $schema
109 109
      * @param $fieldName
110 110
      * @param $material
111
-     * @return null
111
+     * @return string|null
112 112
      */
113 113
     public function findField($schema, $fieldName, $material)
114 114
     {
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
     /**
140 140
      * Get material by url
141
-     * @param $url
141
+     * @param string $url
142 142
      * @return mixed
143 143
      */
144 144
     public function getMaterialByUrl($url)
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
     /**
189 189
      * Get all views which not assign to any material
190
-     * @param $renderer
190
+     * @param Core $renderer
191 191
      * @return String
192 192
      */
193 193
     public function getCommonViews($renderer)
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,6 @@
 block discarded – undo
8 8
 
9 9
 namespace samsoncms\seo;
10 10
 
11
-use samsoncms\seo\schema\control\seo\Dynamic;
12 11
 use samsoncms\seo\schema\material\Publisher;
13 12
 use samsoncms\seo\schema\Schema;
14 13
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     {
66 66
 
67 67
         // Set field name with prefix of schema
68
-        $fieldNameFull = $fieldName . '_' . $schema->id;
68
+        $fieldNameFull = $fieldName.'_'.$schema->id;
69 69
         $fieldValue = $this->getDataField($fieldNameFull, $material);
70 70
 
71 71
         // If in the current schema need value wasn't found then find in sibling schemas
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
                 }
81 81
 
82 82
                 // Set field name with prefix of schema
83
-                $fieldNameFull = $fieldName . '_' . $schemaFind->id;
83
+                $fieldNameFull = $fieldName.'_'.$schemaFind->id;
84 84
 
85 85
                 // If it is deep search i.e search in parent structures then change current material to parent
86 86
                 if ($deep == true) {
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
             foreach ($schema->relations as $fieldName => $alias) {
205 205
 
206 206
                 // Get value
207
-                $content = trim($material[$fieldName . '_' . $schema->id]);
207
+                $content = trim($material[$fieldName.'_'.$schema->id]);
208 208
 
209 209
                 if (isset($content{0})) {
210 210
                     // Render
211
-                    $html .= $renderer->view($schema->view)->name($alias)->content($content)->output() . "\n";
211
+                    $html .= $renderer->view($schema->view)->name($alias)->content($content)->output()."\n";
212 212
                 }
213 213
             }
214 214
         }
Please login to merge, or discard this patch.
src/sitemap/SiteMap.php 3 patches
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
     /**
115 115
      * @param $params
116
-     * @param $xml
116
+     * @param Xml $xml
117 117
      * @return int
118 118
      * @throws \Exception
119 119
      */
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
     /**
150 150
      * @param $params
151
-     * @param $xml
151
+     * @param Xml $xml
152 152
      * @return int
153 153
      * @throws \Exception
154 154
      */
@@ -276,6 +276,9 @@  discard block
 block discarded – undo
276 276
         }
277 277
     }
278 278
 
279
+    /**
280
+     * @param ControlSchema $controlSchema
281
+     */
279 282
     public function getRelatedStructuresInMaterial($controlSchema, $mainMaterial)
280 283
     {
281 284
 
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: molodyko
5
- * Date: 24.09.2015
6
- * Time: 18:31
7
- */
3
+     * Created by PhpStorm.
4
+     * User: molodyko
5
+     * Date: 24.09.2015
6
+     * Time: 18:31
7
+     */
8 8
 
9 9
 namespace samsoncms\seo\sitemap;
10 10
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             $mainSiteMapContent = $xml->generateIndexSiteMap($mainParams, $this->filePrefix);
102 102
 
103 103
             // Save
104
-            $xml->saveXmlToFile($this->mainMapName . '.xml', $mainSiteMapContent);
104
+            $xml->saveXmlToFile($this->mainMapName.'.xml', $mainSiteMapContent);
105 105
         }
106 106
 
107 107
         $time_elapsed_secs = microtime(true) - $start;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $fileName = 'static.xml';
142 142
 
143 143
         // Create site map file for current category
144
-        $xml->saveXmlToFile($this->filePrefix . $fileName, $result);
144
+        $xml->saveXmlToFile($this->filePrefix.$fileName, $result);
145 145
 
146 146
         return $count;
147 147
     }
@@ -178,16 +178,16 @@  discard block
 block discarded – undo
178 178
                 $fileName = preg_replace('/^\//', '', $link);
179 179
 
180 180
                 // Exchange all slash to dash
181
-                $fileName = preg_replace('/\//', '-', $fileName) . '.xml';
181
+                $fileName = preg_replace('/\//', '-', $fileName).'.xml';
182 182
 
183 183
                 // Create site map file for current category
184
-                $xml->saveXmlToFile($this->filePrefix . $fileName, $result);
184
+                $xml->saveXmlToFile($this->filePrefix.$fileName, $result);
185 185
 
186 186
                 $links[] = $param;
187 187
             }
188 188
 
189 189
             // If need recursively execute structures
190
-            if ((isset($param['__SEO_IsRecursive']))&&($param['__SEO_IsRecursive'] == true)||$recursive) {
190
+            if ((isset($param['__SEO_IsRecursive'])) && ($param['__SEO_IsRecursive'] == true) || $recursive) {
191 191
 
192 192
                 $structures = null;
193 193
                 $this->query->className('structure')
Please login to merge, or discard this patch.
src/tab/InfoTab.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -18,6 +18,9 @@
 block discarded – undo
18 18
     /** @var string Path to main view */
19 19
     public $indexView = 'info/index';
20 20
 
21
+    /**
22
+     * @param \samsoncms\seo\Core $renderer
23
+     */
21 24
     public function __construct($renderer, $data = null)
22 25
     {
23 26
         // Save renderer
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: molodyko
5
- * Date: 29.09.2015
6
- * Time: 13:21
7
- */
3
+     * Created by PhpStorm.
4
+     * User: molodyko
5
+     * Date: 29.09.2015
6
+     * Time: 13:21
7
+     */
8 8
 
9 9
 namespace samsoncms\seo\tab;
10 10
 
Please login to merge, or discard this patch.
src/tab/Tab.php 4 patches
Doc Comments   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
 
85 85
         /**
86 86
          * Render default tab with fields
87
-         * @param $renderer
88
-         * @param $query
89
-         * @param $entity
90
-         * @param $schema
87
+         * @param RenderInterface $renderer
88
+         * @param QueryInterface $query
89
+         * @param Record $entity
90
+         * @param MaterialSchema $schema
91 91
          */
92 92
         public function renderDefaultStructure($renderer, $query, $entity, $schema)
93 93
         {
@@ -105,6 +105,10 @@  discard block
 block discarded – undo
105 105
 
106 106
         /**
107 107
          * Render control schemas
108
+         * @param RenderInterface $renderer
109
+         * @param QueryInterface $query
110
+         * @param Record $entity
111
+         * @param ControlSchema $schema
108 112
          */
109 113
         public function renderControlStructure($renderer, $query, $entity, $schema)
110 114
         {
@@ -170,6 +174,9 @@  discard block
 block discarded – undo
170 174
             return $this->renderer->view($this->contentView)->content($content)->output();
171 175
         }
172 176
 
177
+        /**
178
+         * @param string $name
179
+         */
173 180
         public function setName($name)
174 181
         {
175 182
             $this->name = $name;
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -8,12 +8,10 @@
 block discarded – undo
8 8
 
9 9
 namespace samsoncms\seo\tab;
10 10
 
11
-use samson\activerecord\dbRelation;
12 11
 use samsoncms\seo\render\Element;
13 12
 use samsoncms\seo\schema\control\ControlSchema;
14 13
 use samsoncms\seo\schema\material\MaterialSchema;
15 14
 use samsoncms\seo\schema\Schema;
16
-use samson\core\SamsonLocale;
17 15
 use samsonframework\core\RenderInterface;
18 16
 use samsonframework\orm\QueryInterface;
19 17
 use samsonframework\orm\Record;
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: molodyko
5
- * Date: 20.09.2015
6
- * Time: 14:39
7
- */
3
+     * Created by PhpStorm.
4
+     * User: molodyko
5
+     * Date: 20.09.2015
6
+     * Time: 14:39
7
+     */
8 8
 
9 9
 namespace samsoncms\seo\tab;
10 10
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                 $html = $subTab->content();
140 140
 
141 141
                 // Render elements if exists
142
-                $isElements = isset($subTab->schema->elements)&&(!empty($subTab->schema->elements));
142
+                $isElements = isset($subTab->schema->elements) && (!empty($subTab->schema->elements));
143 143
                 if ($isElements) {
144 144
 
145 145
                     // Create element instance
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
                     $contentNestedElement = $elements->renderNestedElements($subTab->schema->elements);
150 150
 
151 151
                     // Insert element as first child of table
152
-                    $html = preg_replace('/>/', '>' . $contentNestedElement, $html, 1);
152
+                    $html = preg_replace('/>/', '>'.$contentNestedElement, $html, 1);
153 153
 
154 154
                     // Get all not nested element
155 155
                     $contentNotNestedElement = $elements->renderNotNestedElements($subTab->schema->elements);
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                 if ($isElements) {
163 163
 
164 164
                     // Concatenate element to main view
165
-                    $content = $contentNotNestedElement . $content;
165
+                    $content = $contentNotNestedElement.$content;
166 166
                 }
167 167
             }
168 168
 
@@ -177,5 +177,5 @@  discard block
 block discarded – undo
177 177
     }
178 178
 
179 179
 } else {
180
-    class Tab{}
180
+    class Tab {}
181 181
 }
Please login to merge, or discard this patch.
src/Migrate.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: molodyko
5
- * Date: 18.09.2015
6
- * Time: 16:13
7
- */
3
+     * Created by PhpStorm.
4
+     * User: molodyko
5
+     * Date: 18.09.2015
6
+     * Time: 16:13
7
+     */
8 8
 
9 9
 namespace samsoncms\seo;
10 10
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -169,13 +169,13 @@  discard block
 block discarded – undo
169 169
         // Iterate and create all fields
170 170
         foreach ($fields as $field) {
171 171
 
172
-            $fieldInstance = $this->isFieldExists($field['Name'] . '_' . $prefix);
172
+            $fieldInstance = $this->isFieldExists($field['Name'].'_'.$prefix);
173 173
 
174 174
             // If field not exists then create it
175 175
             if (!$fieldInstance) {
176 176
                 // Create and add field to structure
177 177
                 $fieldInstance = $this->createField(
178
-                    $field['Name'] . '_' . $prefix,
178
+                    $field['Name'].'_'.$prefix,
179 179
                     $field['Description'],
180 180
                     $field['Type'],
181 181
                     // If it is the select type then add value
@@ -361,8 +361,8 @@  discard block
 block discarded – undo
361 361
             // Set prefix of material
362 362
             $prefix = 'Material of ';
363 363
             $material = $this->createNestedMaterial(
364
-                $prefix . $structure->Name,
365
-                $prefix . $structure->Url
364
+                $prefix.$structure->Name,
365
+                $prefix.$structure->Url
366 366
             );
367 367
 
368 368
             $this->assignNestedMaterial($material, $structure);
Please login to merge, or discard this patch.
Doc Comments   +12 added lines, -9 removed lines patch added patch discarded remove patch
@@ -28,6 +28,9 @@  discard block
 block discarded – undo
28 28
 
29 29
     const MAIN_PREFIX_NAME = 'main';
30 30
 
31
+    /**
32
+     * @param \samson\activerecord\dbQuery $query
33
+     */
31 34
     public function __construct($query)
32 35
     {
33 36
         $this->query = $query;
@@ -99,7 +102,7 @@  discard block
 block discarded – undo
99 102
 
100 103
     /**
101 104
      * Assign structure to passed material
102
-     * @param $material
105
+     * @param \samson\activerecord\Material $material
103 106
      * @param $structure
104 107
      * @return mixed|structurematerial
105 108
      */
@@ -203,7 +206,7 @@  discard block
 block discarded – undo
203 206
 
204 207
     /**
205 208
      * Create field
206
-     * @param $name
209
+     * @param string $name
207 210
      * @param $description
208 211
      * @param $type
209 212
      * @param $value
@@ -272,8 +275,8 @@  discard block
 block discarded – undo
272 275
 
273 276
     /**
274 277
      * Get structure if exists
275
-     * @param $name
276
-     * @param $url
278
+     * @param string $name
279
+     * @param string $url
277 280
      * @return mixed
278 281
      */
279 282
     public function isStructureExists($name, $url)
@@ -286,7 +289,7 @@  discard block
 block discarded – undo
286 289
 
287 290
     /**
288 291
      * Get field if exists
289
-     * @param $name
292
+     * @param string $name
290 293
      * @return mixed
291 294
      */
292 295
     public function isFieldExists($name)
@@ -312,7 +315,7 @@  discard block
 block discarded – undo
312 315
 
313 316
     /**
314 317
      * Assign nested material to the structure
315
-     * @param $material
318
+     * @param \samson\activerecord\Material $material
316 319
      * @param $structure
317 320
      */
318 321
     public function assignNestedMaterial($material, $structure)
@@ -331,8 +334,8 @@  discard block
 block discarded – undo
331 334
 
332 335
     /**
333 336
      * Create nested material of structure
334
-     * @param $name
335
-     * @param $url
337
+     * @param string $name
338
+     * @param string $url
336 339
      * @return \samson\activerecord\material
337 340
      */
338 341
     public function createNestedMaterial($name, $url)
@@ -349,7 +352,7 @@  discard block
 block discarded – undo
349 352
     /**
350 353
      * Create nested material on the structure if it don't exists and assign it to the passed structure
351 354
      * @param $structure
352
-     * @return null|\samson\activerecord\material
355
+     * @return \samson\activerecord\Material
353 356
      */
354 357
     public function buildNestedMaterial($structure)
355 358
     {
Please login to merge, or discard this patch.
src/render/Button.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: molodyko
5
- * Date: 24.09.2015
6
- * Time: 16:17
7
- */
3
+     * Created by PhpStorm.
4
+     * User: molodyko
5
+     * Date: 24.09.2015
6
+     * Time: 16:17
7
+     */
8 8
 
9 9
 namespace samsoncms\seo\render;
10 10
 
Please login to merge, or discard this patch.
src/render/Element.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: molodyko
5
- * Date: 24.09.2015
6
- * Time: 16:21
7
- */
3
+     * Created by PhpStorm.
4
+     * User: molodyko
5
+     * Date: 24.09.2015
6
+     * Time: 16:21
7
+     */
8 8
 
9 9
 namespace samsoncms\seo\render;
10 10
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         foreach ($elements as $element) {
64 64
 
65 65
             // Check if this element is nested
66
-            $isNested = (isset($element['Nested'])&&$element['Nested'] == true);
66
+            $isNested = (isset($element['Nested']) && $element['Nested'] == true);
67 67
 
68 68
             if (isset($element['Field']) && ($field == false)) {
69 69
                 continue;
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
 
79 79
             // Check if this element is need to be hide
80
-            $isHide = (isset($element['Hide'])&&$element['Hide'] == true);
80
+            $isHide = (isset($element['Hide']) && $element['Hide'] == true);
81 81
 
82 82
             // If not right go further
83 83
             if ($isHide) {
Please login to merge, or discard this patch.