@@ -54,7 +54,7 @@ public function asCreatingAShareWith($user, $body) {
5454 $ fd = $ body ->getRowsHash ();
5555 if (array_key_exists ('expireDate ' , $ fd )) {
5656 $ dateModification = $ fd ['expireDate ' ];
57- if ($ dateModification !== ' EMPTY_STRING ' ) {
57+ if (! empty ( $ dateModification) ) {
5858 $ fd ['expireDate ' ] = date ('Y-m-d ' , strtotime ($ dateModification ));
5959 }
6060 }
@@ -296,15 +296,16 @@ public function createShare($user,
296296 $ this ->lastShareData = simplexml_load_string ($ this ->response ->getBody ());
297297 } catch (\GuzzleHttp \Exception \ClientException $ ex ) {
298298 $ this ->response = $ ex ->getResponse ();
299- print (json_encode ($ this ->response ));
300299 throw new \Exception ($ this ->response ->getBody ());
301300 }
302301 }
303302
304303 public function isFieldInResponse ($ field , $ contentExpected ) {
305304 $ data = simplexml_load_string ($ this ->response ->getBody ())->data [0 ];
306305 if ((string )$ field == 'expiration ' ) {
307- $ contentExpected = date ('Y-m-d ' , strtotime ($ contentExpected )) . " 00:00:00 " ;
306+ if (!empty ($ contentExpected )) {
307+ $ contentExpected = date ('Y-m-d ' , strtotime ($ contentExpected )) . " 00:00:00 " ;
308+ }
308309 }
309310 if (count ($ data ->element ) > 0 ) {
310311 foreach ($ data as $ element ) {
@@ -314,8 +315,8 @@ public function isFieldInResponse($field, $contentExpected) {
314315 return is_numeric ((string )$ element ->$ field );
315316 } elseif ($ contentExpected == "AN_URL " ) {
316317 return $ this ->isExpectedUrl ((string )$ element ->$ field , "index.php/s/ " );
317- } elseif ($ contentExpected == "EMPTY_STRING " ) {
318- return ((string )$ element ->$ field === '' );
318+ } elseif ($ contentExpected == "EMPTY " ) {
319+ return empty ((string )$ element ->$ field );
319320 } elseif ((string )$ element ->$ field == $ contentExpected ) {
320321 return true ;
321322 } else {
@@ -331,6 +332,8 @@ public function isFieldInResponse($field, $contentExpected) {
331332 return is_numeric ((string )$ data ->$ field );
332333 } elseif ($ contentExpected == "AN_URL " ) {
333334 return $ this ->isExpectedUrl ((string )$ data ->$ field , "index.php/s/ " );
335+ } elseif ($ contentExpected == "EMPTY " ) {
336+ return empty ((string )$ data ->$ field );
334337 } elseif ($ contentExpected == $ data ->$ field ) {
335338 return true ;
336339 }
0 commit comments