@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | if (!is_array($data)) return null; |
| 19 | 19 | |
| 20 | 20 | $index = array_search($object, $data); |
| 21 | - return $index === false ? null : (string) self::keyToCursor($index); |
|
| 21 | + return $index === false ? null : (string)self::keyToCursor($index); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public static function keyToCursor($key) |
| 36 | 36 | { |
| 37 | - return base64_encode(self::PREFIX . $key); |
|
| 37 | + return base64_encode(self::PREFIX.$key); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $offset = array_search($key, array_keys($array)); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - return is_null($offset) ? $default : (int) $offset; |
|
| 89 | + return is_null($offset) ? $default : (int)$offset; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | public static function connectionFromArray(array $data, array $args = []) |
@@ -15,7 +15,9 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | public static function cursorForObjectInConnection($data, $object) |
| 17 | 17 | { |
| 18 | - if (!is_array($data)) return null; |
|
| 18 | + if (!is_array($data)) { |
|
| 19 | + return null; |
|
| 20 | + } |
|
| 19 | 21 | |
| 20 | 22 | $index = array_search($object, $data); |
| 21 | 23 | return $index === false ? null : (string) self::keyToCursor($index); |
@@ -81,8 +83,7 @@ discard block |
||
| 81 | 83 | $key = self::cursorToKey($cursor); |
| 82 | 84 | if (empty($array)) { |
| 83 | 85 | $offset = $key; |
| 84 | - } |
|
| 85 | - else { |
|
| 86 | + } else { |
|
| 86 | 87 | $offset = array_search($key, array_keys($array)); |
| 87 | 88 | } |
| 88 | 89 | |