@@ -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()]; |
@@ -73,6 +73,9 @@ |
||
73 | 73 | return new static(is_array($json) ? $json : json_decode($json, true)); |
74 | 74 | } |
75 | 75 | |
76 | + /** |
|
77 | + * @param string $key |
|
78 | + */ |
|
76 | 79 | public function get($key) |
77 | 80 | { |
78 | 81 | return $this->attributes->get($key); |
@@ -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 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if (!$this->token) { |
48 | 48 | throw new TelegramCoreException('Token must be defined'); |
49 | 49 | } |
50 | - $baseOptions = [ |
|
50 | + $baseOptions = [ |
|
51 | 51 | 'base_uri' => sprintf('https://api.telegram.org/bot%s/', $token), |
52 | 52 | 'verify' => false, |
53 | 53 | 'http_errors' => false, |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | { |
81 | 81 | $json = \GuzzleHttp\json_decode($response->getBody()->getContents(), true); |
82 | 82 | if (array_get($json, 'ok') == false) { |
83 | - throw new TelegramCoreException(array_get($json, 'description', 'error') . array_get($json, 'error_code'), |
|
83 | + throw new TelegramCoreException(array_get($json, 'description', 'error').array_get($json, 'error_code'), |
|
84 | 84 | array_get($json, 'error_code')); |
85 | 85 | } |
86 | 86 |
@@ -41,7 +41,7 @@ |
||
41 | 41 | return $this->set('request_contact', $requestContact); |
42 | 42 | } |
43 | 43 | |
44 | - public function setRequestLocation(bool $requestLocation){ |
|
44 | + public function setRequestLocation(bool $requestLocation) { |
|
45 | 45 | return $this->set('request_contact', $requestLocation); |
46 | 46 | } |
47 | 47 | } |
48 | 48 | \ 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 | return [$key => $item->toArray()]; |
85 | 85 | }), |
86 | 86 | ]; |
@@ -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 | } |