Completed
Pull Request — 1.0 (#6)
by
unknown
62:28
created
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.
src/Converters/FileItemConverter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,13 +44,13 @@
 block discarded – undo
44 44
         $node = null;
45 45
         $values = $value->getValue();
46 46
         $type = str_replace('default:', '', $value->getParent()->getSettings()['handler']);
47
-        if(isset($values['target_id'])) {
47
+        if (isset($values['target_id'])) {
48 48
             $node = $this->entityManager->getStorage($type)->load($values['target_id']);
49 49
         }
50
-        elseif(isset($value->getValue()['fids'][0])) {
50
+        elseif (isset($value->getValue()['fids'][0])) {
51 51
             $node = $this->entityManager->getStorage($type)->load($value->getValue()['fids'][0]);
52 52
         }
53
-        if($node !== null) {
53
+        if ($node !== null) {
54 54
             return $this->entityWrapper->wrap($node);
55 55
         }
56 56
         else {
Please login to merge, or discard this patch.