@@ -86,10 +86,10 @@ |
||
| 86 | 86 | |
| 87 | 87 | if (isset($response['contacts']['add'])) { |
| 88 | 88 | $result = array_map(function($item) { |
| 89 | - if(!empty($item['id'])) |
|
| 89 | + if (!empty($item['id'])) |
|
| 90 | 90 | return $item['id']; |
| 91 | - elseif(!empty($item['error'])) |
|
| 92 | - throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 91 | + elseif (!empty($item['error'])) |
|
| 92 | + throw new Exception($item['error'], filter_var(mb_strstr($item['error'], ".", true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 93 | 93 | else |
| 94 | 94 | return []; |
| 95 | 95 | }, $response['contacts']['add']); |
@@ -86,12 +86,13 @@ |
||
| 86 | 86 | |
| 87 | 87 | if (isset($response['contacts']['add'])) { |
| 88 | 88 | $result = array_map(function($item) { |
| 89 | - if(!empty($item['id'])) |
|
| 90 | - return $item['id']; |
|
| 91 | - elseif(!empty($item['error'])) |
|
| 92 | - throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 93 | - else |
|
| 94 | - return []; |
|
| 89 | + if(!empty($item['id'])) { |
|
| 90 | + return $item['id']; |
|
| 91 | + } elseif(!empty($item['error'])) { |
|
| 92 | + throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 93 | + } else { |
|
| 94 | + return []; |
|
| 95 | + } |
|
| 95 | 96 | }, $response['contacts']['add']); |
| 96 | 97 | } else { |
| 97 | 98 | return []; |
@@ -112,10 +112,10 @@ |
||
| 112 | 112 | |
| 113 | 113 | if (isset($response['tasks']['add'])) { |
| 114 | 114 | $result = array_map(function($item) { |
| 115 | - if(!empty($item['id'])) |
|
| 115 | + if (!empty($item['id'])) |
|
| 116 | 116 | return $item['id']; |
| 117 | - elseif(!empty($item['error'])) |
|
| 118 | - throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 117 | + elseif (!empty($item['error'])) |
|
| 118 | + throw new Exception($item['error'], filter_var(mb_strstr($item['error'], ".", true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 119 | 119 | else |
| 120 | 120 | return []; |
| 121 | 121 | }, $response['tasks']['add']); |
@@ -112,12 +112,13 @@ |
||
| 112 | 112 | |
| 113 | 113 | if (isset($response['tasks']['add'])) { |
| 114 | 114 | $result = array_map(function($item) { |
| 115 | - if(!empty($item['id'])) |
|
| 116 | - return $item['id']; |
|
| 117 | - elseif(!empty($item['error'])) |
|
| 118 | - throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 119 | - else |
|
| 120 | - return []; |
|
| 115 | + if(!empty($item['id'])) { |
|
| 116 | + return $item['id']; |
|
| 117 | + } elseif(!empty($item['error'])) { |
|
| 118 | + throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 119 | + } else { |
|
| 120 | + return []; |
|
| 121 | + } |
|
| 121 | 122 | }, $response['tasks']['add']); |
| 122 | 123 | } else { |
| 123 | 124 | return []; |
@@ -80,11 +80,11 @@ |
||
| 80 | 80 | $response = $this->postRequest('/private/api/v2/json/customers/set', $parameters); |
| 81 | 81 | |
| 82 | 82 | if (isset($response['customers']['add'])) { |
| 83 | - $result = array_map(function ($item) { |
|
| 84 | - if(!empty($item['id'])) |
|
| 83 | + $result = array_map(function($item) { |
|
| 84 | + if (!empty($item['id'])) |
|
| 85 | 85 | return $item['id']; |
| 86 | - elseif(!empty($item['error'])) |
|
| 87 | - throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 86 | + elseif (!empty($item['error'])) |
|
| 87 | + throw new Exception($item['error'], filter_var(mb_strstr($item['error'], ".", true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 88 | 88 | else |
| 89 | 89 | return []; |
| 90 | 90 | }, $response['customers']['add']['customers']); |
@@ -81,12 +81,13 @@ |
||
| 81 | 81 | |
| 82 | 82 | if (isset($response['customers']['add'])) { |
| 83 | 83 | $result = array_map(function ($item) { |
| 84 | - if(!empty($item['id'])) |
|
| 85 | - return $item['id']; |
|
| 86 | - elseif(!empty($item['error'])) |
|
| 87 | - throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 88 | - else |
|
| 89 | - return []; |
|
| 84 | + if(!empty($item['id'])) { |
|
| 85 | + return $item['id']; |
|
| 86 | + } elseif(!empty($item['error'])) { |
|
| 87 | + throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 88 | + } else { |
|
| 89 | + return []; |
|
| 90 | + } |
|
| 90 | 91 | }, $response['customers']['add']['customers']); |
| 91 | 92 | } else { |
| 92 | 93 | return []; |
@@ -75,11 +75,11 @@ |
||
| 75 | 75 | $response = $this->postRequest('/private/api/v2/json/catalogs/set', $parameters); |
| 76 | 76 | |
| 77 | 77 | if (isset($response['catalogs']['add']['catalogs'])) { |
| 78 | - $result = array_map(function ($item) { |
|
| 79 | - if(!empty($item['id'])) |
|
| 78 | + $result = array_map(function($item) { |
|
| 79 | + if (!empty($item['id'])) |
|
| 80 | 80 | return $item['id']; |
| 81 | - elseif(!empty($item['error'])) |
|
| 82 | - throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 81 | + elseif (!empty($item['error'])) |
|
| 82 | + throw new Exception($item['error'], filter_var(mb_strstr($item['error'], ".", true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 83 | 83 | else |
| 84 | 84 | return []; |
| 85 | 85 | }, $response['catalogs']['add']['catalogs']); |
@@ -76,12 +76,13 @@ |
||
| 76 | 76 | |
| 77 | 77 | if (isset($response['catalogs']['add']['catalogs'])) { |
| 78 | 78 | $result = array_map(function ($item) { |
| 79 | - if(!empty($item['id'])) |
|
| 80 | - return $item['id']; |
|
| 81 | - elseif(!empty($item['error'])) |
|
| 82 | - throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 83 | - else |
|
| 84 | - return []; |
|
| 79 | + if(!empty($item['id'])) { |
|
| 80 | + return $item['id']; |
|
| 81 | + } elseif(!empty($item['error'])) { |
|
| 82 | + throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 83 | + } else { |
|
| 84 | + return []; |
|
| 85 | + } |
|
| 85 | 86 | }, $response['catalogs']['add']['catalogs']); |
| 86 | 87 | } else { |
| 87 | 88 | return []; |
@@ -141,10 +141,10 @@ |
||
| 141 | 141 | |
| 142 | 142 | if (isset($response['notes']['add'])) { |
| 143 | 143 | $result = array_map(function($item) { |
| 144 | - if(!empty($item['id'])) |
|
| 144 | + if (!empty($item['id'])) |
|
| 145 | 145 | return $item['id']; |
| 146 | - elseif(!empty($item['error'])) |
|
| 147 | - throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 146 | + elseif (!empty($item['error'])) |
|
| 147 | + throw new Exception($item['error'], filter_var(mb_strstr($item['error'], ".", true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 148 | 148 | else |
| 149 | 149 | return []; |
| 150 | 150 | }, $response['notes']['add']); |
@@ -141,12 +141,13 @@ |
||
| 141 | 141 | |
| 142 | 142 | if (isset($response['notes']['add'])) { |
| 143 | 143 | $result = array_map(function($item) { |
| 144 | - if(!empty($item['id'])) |
|
| 145 | - return $item['id']; |
|
| 146 | - elseif(!empty($item['error'])) |
|
| 147 | - throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 148 | - else |
|
| 149 | - return []; |
|
| 144 | + if(!empty($item['id'])) { |
|
| 145 | + return $item['id']; |
|
| 146 | + } elseif(!empty($item['error'])) { |
|
| 147 | + throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 148 | + } else { |
|
| 149 | + return []; |
|
| 150 | + } |
|
| 150 | 151 | }, $response['notes']['add']); |
| 151 | 152 | } else { |
| 152 | 153 | return []; |
@@ -79,11 +79,11 @@ |
||
| 79 | 79 | $response = $this->postRequest('/private/api/v2/json/transactions/set', $parameters); |
| 80 | 80 | |
| 81 | 81 | if (isset($response['transactions']['add']['transactions'])) { |
| 82 | - $result = array_map(function ($item) { |
|
| 83 | - if(!empty($item['id'])) |
|
| 82 | + $result = array_map(function($item) { |
|
| 83 | + if (!empty($item['id'])) |
|
| 84 | 84 | return $item['id']; |
| 85 | - elseif(!empty($item['error'])) |
|
| 86 | - throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 85 | + elseif (!empty($item['error'])) |
|
| 86 | + throw new Exception($item['error'], filter_var(mb_strstr($item['error'], ".", true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 87 | 87 | else |
| 88 | 88 | return []; |
| 89 | 89 | }, $response['transactions']['add']['transactions']); |
@@ -80,12 +80,13 @@ |
||
| 80 | 80 | |
| 81 | 81 | if (isset($response['transactions']['add']['transactions'])) { |
| 82 | 82 | $result = array_map(function ($item) { |
| 83 | - if(!empty($item['id'])) |
|
| 84 | - return $item['id']; |
|
| 85 | - elseif(!empty($item['error'])) |
|
| 86 | - throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 87 | - else |
|
| 88 | - return []; |
|
| 83 | + if(!empty($item['id'])) { |
|
| 84 | + return $item['id']; |
|
| 85 | + } elseif(!empty($item['error'])) { |
|
| 86 | + throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 87 | + } else { |
|
| 88 | + return []; |
|
| 89 | + } |
|
| 89 | 90 | }, $response['transactions']['add']['transactions']); |
| 90 | 91 | } else { |
| 91 | 92 | return []; |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | $response = $this->postRequest('/private/api/v2/json/catalog_elements/set', $parameters); |
| 72 | 72 | |
| 73 | 73 | if (isset($response['catalog_elements']['add']['catalog_elements'])) { |
| 74 | - $result = array_map(function ($item) { |
|
| 75 | - if(!empty($item['id'])) |
|
| 74 | + $result = array_map(function($item) { |
|
| 75 | + if (!empty($item['id'])) |
|
| 76 | 76 | return $item['id']; |
| 77 | - elseif(!empty($item['error'])) |
|
| 78 | - throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 77 | + elseif (!empty($item['error'])) |
|
| 78 | + throw new Exception($item['error'], filter_var(mb_strstr($item['error'], ".", true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 79 | 79 | else |
| 80 | 80 | return []; |
| 81 | 81 | }, $response['catalog_elements']['add']['catalog_elements']); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | public function apiDeleteBatch(array $ids) |
| 163 | 163 | { |
| 164 | - array_walk($ids, function($id){ |
|
| 164 | + array_walk($ids, function($id) { |
|
| 165 | 165 | $this->checkId($id); |
| 166 | 166 | }); |
| 167 | 167 | |
@@ -72,12 +72,13 @@ |
||
| 72 | 72 | |
| 73 | 73 | if (isset($response['catalog_elements']['add']['catalog_elements'])) { |
| 74 | 74 | $result = array_map(function ($item) { |
| 75 | - if(!empty($item['id'])) |
|
| 76 | - return $item['id']; |
|
| 77 | - elseif(!empty($item['error'])) |
|
| 78 | - throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 79 | - else |
|
| 80 | - return []; |
|
| 75 | + if(!empty($item['id'])) { |
|
| 76 | + return $item['id']; |
|
| 77 | + } elseif(!empty($item['error'])) { |
|
| 78 | + throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 79 | + } else { |
|
| 80 | + return []; |
|
| 81 | + } |
|
| 81 | 82 | }, $response['catalog_elements']['add']['catalog_elements']); |
| 82 | 83 | } else { |
| 83 | 84 | return []; |
@@ -91,10 +91,10 @@ |
||
| 91 | 91 | |
| 92 | 92 | if (isset($response['leads']['add'])) { |
| 93 | 93 | $result = array_map(function($item) { |
| 94 | - if(!empty($item['id'])) |
|
| 94 | + if (!empty($item['id'])) |
|
| 95 | 95 | return $item['id']; |
| 96 | - elseif(!empty($item['error'])) |
|
| 97 | - throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 96 | + elseif (!empty($item['error'])) |
|
| 97 | + throw new Exception($item['error'], filter_var(mb_strstr($item['error'], ".", true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 98 | 98 | else |
| 99 | 99 | return []; |
| 100 | 100 | }, $response['leads']['add']); |
@@ -91,12 +91,13 @@ |
||
| 91 | 91 | |
| 92 | 92 | if (isset($response['leads']['add'])) { |
| 93 | 93 | $result = array_map(function($item) { |
| 94 | - if(!empty($item['id'])) |
|
| 95 | - return $item['id']; |
|
| 96 | - elseif(!empty($item['error'])) |
|
| 97 | - throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 98 | - else |
|
| 99 | - return []; |
|
| 94 | + if(!empty($item['id'])) { |
|
| 95 | + return $item['id']; |
|
| 96 | + } elseif(!empty($item['error'])) { |
|
| 97 | + throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 98 | + } else { |
|
| 99 | + return []; |
|
| 100 | + } |
|
| 100 | 101 | }, $response['leads']['add']); |
| 101 | 102 | } else { |
| 102 | 103 | return []; |
@@ -89,11 +89,11 @@ |
||
| 89 | 89 | $response = $this->postRequest('/private/api/v2/json/contacts/set', $parameters); |
| 90 | 90 | |
| 91 | 91 | if (isset($response['contacts']['add'])) { |
| 92 | - $result = array_map(function ($item) { |
|
| 93 | - if(!empty($item['id'])) |
|
| 92 | + $result = array_map(function($item) { |
|
| 93 | + if (!empty($item['id'])) |
|
| 94 | 94 | return $item['id']; |
| 95 | - elseif(!empty($item['error'])) |
|
| 96 | - throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 95 | + elseif (!empty($item['error'])) |
|
| 96 | + throw new Exception($item['error'], filter_var(mb_strstr($item['error'], ".", true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 97 | 97 | else |
| 98 | 98 | return []; |
| 99 | 99 | }, $response['contacts']['add']); |
@@ -90,12 +90,13 @@ |
||
| 90 | 90 | |
| 91 | 91 | if (isset($response['contacts']['add'])) { |
| 92 | 92 | $result = array_map(function ($item) { |
| 93 | - if(!empty($item['id'])) |
|
| 94 | - return $item['id']; |
|
| 95 | - elseif(!empty($item['error'])) |
|
| 96 | - throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 97 | - else |
|
| 98 | - return []; |
|
| 93 | + if(!empty($item['id'])) { |
|
| 94 | + return $item['id']; |
|
| 95 | + } elseif(!empty($item['error'])) { |
|
| 96 | + throw new Exception($item['error'],filter_var(mb_strstr($item['error'],".",true), FILTER_SANITIZE_NUMBER_INT)); |
|
| 97 | + } else { |
|
| 98 | + return []; |
|
| 99 | + } |
|
| 99 | 100 | }, $response['contacts']['add']); |
| 100 | 101 | } else { |
| 101 | 102 | return []; |