DaitoGoogleChat.php
1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace Daito\Lib;
use Daito\Lib\DaitoGoogleChat\DaitoGoogleChatManager;
use RuntimeException;
class DaitoGoogleChat
{
public static function sendText($text, array $arrContext = array(), $webhookUrl = null): array
{
return self::manager()->sendText($text, $arrContext, $webhookUrl);
}
public static function sendPayload(array $arrPayload, $webhookUrl = null): array
{
return self::manager()->sendPayload($arrPayload, $webhookUrl);
}
public static function sendCardV2(array $arrCardV2, $webhookUrl = null): array
{
return self::manager()->sendCardV2($arrCardV2, $webhookUrl);
}
public static function queueText($text, array $arrContext = array(), $webhookUrl = null): void
{
self::manager()->queueText($text, $arrContext, $webhookUrl);
}
public static function queuePayload(array $arrPayload, $webhookUrl = null): void
{
self::manager()->queuePayload($arrPayload, $webhookUrl);
}
public static function queueCardV2(array $arrCardV2, $webhookUrl = null): void
{
self::manager()->queueCardV2($arrCardV2, $webhookUrl);
}
private static function manager(): DaitoGoogleChatManager
{
if (!function_exists('app')) {
throw new RuntimeException('Laravel app container is required for DaitoGoogleChat.');
}
$manager = app(DaitoGoogleChatManager::class);
if (!$manager instanceof DaitoGoogleChatManager) {
throw new RuntimeException('Can not resolve DaitoGoogleChatManager from container.');
}
return $manager;
}
}