@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function __construct($path) |
24 | 24 | { |
25 | - $this->path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
|
25 | + $this->path = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function getValue($chatId, $value, $default) |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | private function getFileName($chatId) |
46 | 46 | { |
47 | - return $this->path . 'c' . $chatId; |
|
47 | + return $this->path.'c'.$chatId; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | public function setValue($chatId, $key, $value) |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $map = $this->map; |
50 | 50 | |
51 | 51 | return collect($attributes) |
52 | - ->mapWithKeys(function ($item, $key) use ($map) { |
|
52 | + ->mapWithKeys(function($item, $key) use ($map) { |
|
53 | 53 | $keyData = array_get($map, $key); |
54 | 54 | if (is_callable($keyData)) { |
55 | 55 | return [$key => call_user_func($keyData, $item)]; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | public function toArray() |
82 | 82 | { |
83 | 83 | return $this->attributes |
84 | - ->mapWithKeys(function ($item, $key) { |
|
84 | + ->mapWithKeys(function($item, $key) { |
|
85 | 85 | if (is_subclass_of($item, BaseType::class)) { |
86 | 86 | /** @var BaseType $item */ |
87 | 87 | return [$key => $item->toArray()]; |
@@ -39,7 +39,7 @@ |
||
39 | 39 | return $keyboard; |
40 | 40 | } |
41 | 41 | |
42 | - public function toArray(){ |
|
42 | + public function toArray() { |
|
43 | 43 | return $this->rows->toArray(); |
44 | 44 | } |
45 | 45 | } |
46 | 46 | \ No newline at end of file |
@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | $baseType = $this->baseType; |
30 | 30 | $this->array = collect($array) |
31 | - ->map(function ($item) use ($baseType) { |
|
31 | + ->map(function($item) use ($baseType) { |
|
32 | 32 | return new BaseType($item); |
33 | 33 | }); |
34 | 34 | } |
@@ -38,10 +38,9 @@ |
||
38 | 38 | public function toArray() |
39 | 39 | { |
40 | 40 | return $this->attributes |
41 | - ->mapWithKeys(function ($item, $key) { |
|
42 | - return $item instanceof Collection || get_parent_class($item) === BaseEntry::class? |
|
43 | - [$key => $item->toArray()] : |
|
44 | - [$key => $item]; |
|
41 | + ->mapWithKeys(function($item, $key) { |
|
42 | + return $item instanceof Collection || get_parent_class($item) === BaseEntry::class ? |
|
43 | + [$key => $item->toArray()] : [$key => $item]; |
|
45 | 44 | }) |
46 | 45 | ->toArray(); |
47 | 46 | } |
@@ -12,9 +12,13 @@ |
||
12 | 12 | */ |
13 | 13 | function array_get($array, $key, $default = null) |
14 | 14 | { |
15 | - if (is_null($key)) return $array; |
|
15 | + if (is_null($key)) { |
|
16 | + return $array; |
|
17 | + } |
|
16 | 18 | |
17 | - if (isset($array[$key])) return $array[$key]; |
|
19 | + if (isset($array[$key])) { |
|
20 | + return $array[$key]; |
|
21 | + } |
|
18 | 22 | |
19 | 23 | foreach (explode('.', $key) as $segment) |
20 | 24 | { |
@@ -35,7 +35,7 @@ |
||
35 | 35 | { |
36 | 36 | function snake_case($value, $delimiter = '_') |
37 | 37 | { |
38 | - $replace = '$1'.$delimiter.'$2'; |
|
39 | - return ctype_lower($value) ? $value : strtolower(preg_replace('/(.)([A-Z])/', $replace, $value)); |
|
38 | + $replace = '$1'.$delimiter.'$2'; |
|
39 | + return ctype_lower($value) ? $value : strtolower(preg_replace('/(.)([A-Z])/', $replace, $value)); |
|
40 | 40 | } |
41 | 41 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! function_exists('array_get')) |
|
3 | +if (!function_exists('array_get')) |
|
4 | 4 | { |
5 | 5 | /** |
6 | 6 | * Get an item from an array using "dot" notation. |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | foreach (explode('.', $key) as $segment) |
20 | 20 | { |
21 | - if ( ! is_array($array) || ! array_key_exists($segment, $array)) |
|
21 | + if (!is_array($array) || !array_key_exists($segment, $array)) |
|
22 | 22 | { |
23 | 23 | return value($default); |
24 | 24 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | -if ( ! function_exists('snake_case')) |
|
34 | +if (!function_exists('snake_case')) |
|
35 | 35 | { |
36 | 36 | function snake_case($value, $delimiter = '_') |
37 | 37 | { |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * @param bool $requestLocation |
50 | 50 | * @return $this |
51 | 51 | */ |
52 | - public function setRequestLocation($requestLocation){ |
|
52 | + public function setRequestLocation($requestLocation) { |
|
53 | 53 | return $this->set('request_contact', $requestLocation); |
54 | 54 | } |
55 | 55 | } |
56 | 56 | \ No newline at end of file |
@@ -77,10 +77,10 @@ |
||
77 | 77 | $clone = clone $this; |
78 | 78 | $rows = $clone |
79 | 79 | ->get(self::KEYBOARD_KEY, collect()) |
80 | - ->mapWithKeys(function ($item, $key) { |
|
80 | + ->mapWithKeys(function($item, $key) { |
|
81 | 81 | return [ |
82 | 82 | $key => collect($item) |
83 | - ->mapWithKeys(function ($item, $key) { |
|
83 | + ->mapWithKeys(function($item, $key) { |
|
84 | 84 | /** @var $item Collection */ |
85 | 85 | return [$key => $item->toArray()]; |
86 | 86 | }), |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | if (!$this->token) { |
47 | 47 | throw new TelegramCoreException('Token must be defined'); |
48 | 48 | } |
49 | - $baseOptions = [ |
|
49 | + $baseOptions = [ |
|
50 | 50 | 'base_uri' => sprintf('https://api.telegram.org/bot%s/', $token), |
51 | 51 | 'verify' => false, |
52 | 52 | 'http_errors' => false, |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | $json = \GuzzleHttp\json_decode($response->getBody()->getContents(), true); |
81 | 81 | if (array_get($json, 'ok') === false) { |
82 | - throw new TelegramCoreException(array_get($json, 'description', 'error') . array_get($json, 'error_code'), |
|
82 | + throw new TelegramCoreException(array_get($json, 'description', 'error').array_get($json, 'error_code'), |
|
83 | 83 | array_get($json, 'error_code')); |
84 | 84 | } |
85 | 85 |