Completed
Pull Request — 1.0 (#4)
by Marc
47:44
created
src/Converters/FileItemConverter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@
 block discarded – undo
43 43
     {
44 44
         $node = null;
45 45
         $type = str_replace('default:', '', $value->getParent()->getSettings()['handler']);
46
-        if(isset($value->getValue()['fids'][0])) {
46
+        if (isset($value->getValue()['fids'][0])) {
47 47
             $node = $this->entityManager->getStorage($type)->load($value->getValue()['fids'][0]);
48 48
         }
49
-        if($node !== null) {
49
+        if ($node !== null) {
50 50
             return $this->entityWrapper->wrap($node);
51 51
         }
52 52
         else {
Please login to merge, or discard this patch.
src/Converters/CollectionConverter.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     public function convert(FieldItemInterface $value)
44 44
     {
45 45
         $values = $value->getValue();
46
-        if(isset($values['value'])) {
46
+        if (isset($values['value'])) {
47 47
             $node = $this->entityManager->getStorage('field_collection_item')->load($values['value']);
48 48
         }
49 49
         else {
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
              * a field collection in another. This remove the language default
53 53
              */
54 54
 
55
-            if(isset($values[LanguageInterface::LANGCODE_DEFAULT])) {
55
+            if (isset($values[LanguageInterface::LANGCODE_DEFAULT])) {
56 56
                 $values = $values[LanguageInterface::LANGCODE_DEFAULT];
57 57
             }
58 58
             $valuesFormat = [];
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
             $node = new FieldCollectionItem($valuesFormat, 'field_collection_item', $values['field_collection_item']->bundle());
64 64
         }
65 65
         
66
-        if($node) {
66
+        if ($node) {
67 67
             return $this->entityWrapper->wrap($node);
68 68
         }
69 69
         else {
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
     
74 74
     private function convertArrayToValues($toConvert, &$convert) {
75 75
         foreach ($toConvert as $k => $v) {
76
-            if(is_array($v) && isset($v[0]) && count($v) == 1) {
76
+            if (is_array($v) && isset($v[0]) && count($v) == 1) {
77 77
                 $convert[$k][LanguageInterface::LANGCODE_DEFAULT] = $v[0];
78 78
             }
79
-            elseif(count($v) > 1) {
79
+            elseif (count($v) > 1) {
80 80
                 $convert[$k][LanguageInterface::LANGCODE_DEFAULT] = [];
81 81
                 $this->convertArrayToValues($v, $convert[$k][LanguageInterface::LANGCODE_DEFAULT]);
82 82
             }
Please login to merge, or discard this patch.