Commit d15fb1b9 by HanSon

修改了大部分collection

1 parent 288f7b2a
{
"name": "hanson/wx-bot",
"name": "hanson/vbot",
"type": "library",
"license": "mit",
"authors": [
......@@ -15,7 +15,8 @@
"endroid/qrcode": "^1.7",
"symfony/css-selector": "^3.2",
"pimple/pimple": "^3.0",
"illuminate/support": "^5.3"
"illuminate/support": "^5.3",
"nesbot/carbon": "^1.21"
},
"autoload": {
"files": [
......
......@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "6af130a3acc2b00f4ce8782188ada4cf",
"content-hash": "a8ac3a77959b316bf6ef9568195ba937",
"hash": "37f52ae2334d2a7d5f4435c7d835c45a",
"content-hash": "45acbc8560c0df766dc94338616aefe5",
"packages": [
{
"name": "doctrine/inflector",
......@@ -461,6 +461,53 @@
"time": "2016-09-22 11:01:11"
},
{
"name": "nesbot/carbon",
"version": "1.21.0",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
"reference": "7b08ec6f75791e130012f206e3f7b0e76e18e3d7"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/briannesbitt/Carbon/7b08ec6f75791e130012f206e3f7b0e76e18e3d7.zip",
"reference": "7b08ec6f75791e130012f206e3f7b0e76e18e3d7",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"symfony/translation": "~2.6|~3.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0|~5.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Carbon\\": "src/Carbon/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Brian Nesbitt",
"email": "brian@nesbot.com",
"homepage": "http://nesbot.com"
}
],
"description": "A simple API extension for DateTime.",
"homepage": "http://carbon.nesbot.com",
"keywords": [
"date",
"datetime",
"time"
],
"time": "2015-11-04 20:07:17"
},
{
"name": "paragonie/random_compat",
"version": "v2.0.4",
"source": {
......@@ -867,6 +914,70 @@
"shim"
],
"time": "2016-11-14 01:06:16"
},
{
"name": "symfony/translation",
"version": "v3.2.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "5fd18eca88f4d187807a1eba083bc99feaa8635b"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/symfony/translation/5fd18eca88f4d187807a1eba083bc99feaa8635b.zip",
"reference": "5fd18eca88f4d187807a1eba083bc99feaa8635b",
"shasum": ""
},
"require": {
"php": ">=5.5.9",
"symfony/polyfill-mbstring": "~1.0"
},
"conflict": {
"symfony/config": "<2.8"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~2.8|~3.0",
"symfony/intl": "~2.8|~3.0",
"symfony/yaml": "~2.8|~3.0"
},
"suggest": {
"psr/log": "To use logging capability in translator",
"symfony/config": "",
"symfony/yaml": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Translation\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2016-11-30 14:40:17"
}
],
"packages-dev": [
......
<?php
/**
* Created by PhpStorm.
* User: HanSon
* Date: 2016/12/7
* Time: 16:33
*/
require_once __DIR__ . './../vendor/autoload.php';
use Hanson\Robot\Foundation\Robot;
use Hanson\Robot\Message\Message;
$robot = new Robot([
'tmp' => __DIR__ . './../tmp/',
]);
$flag = false;
$robot->server->setCustomerHandler(function() use (&$flag){
/** @var $message Message */
if(!$flag){
Message::send('custom', contact()->getUsernameById('L907159127'));
$flag = true;
}
Message::send('测试' . \Carbon\Carbon::now()->toDateTimeString(), contact()->getUsernameById('L907159127'));
});
$robot->server->run();
......@@ -8,18 +8,19 @@
require_once __DIR__ . './../vendor/autoload.php';
$robot = new \Hanson\Robot\Foundation\Robot([
'tmp' => realpath('./tmp') . '/',
'debug' => true,
]);
use Hanson\Robot\Foundation\Robot;
use Hanson\Robot\Message\Message;
$client = new \GuzzleHttp\Client();
$robot = new Robot([
'tmp' => __DIR__ . './../tmp/',
'debug' => true
]);
$robot->server->setMessageHandler(function($message) use ($client, $robot){
$robot->server->setMessageHandler(function($message){
if($message->type === 'Text'){
$contact = \Hanson\Robot\Collections\Account::getInstance()->getUsernameById('hanson1994');
\Hanson\Robot\Message\Message::send('hi', $message->rawMsg['FromUserName']);
\Hanson\Robot\Message\Message::send($message->content, $contact);
/** @var $message Message */
$contact = contact()->getUsernameById('L907159127');
Message::send($message->content, $contact);
}
});
$robot->server->setCustomerHandler(function(){
......
......@@ -8,17 +8,17 @@
require_once __DIR__ . './../vendor/autoload.php';
$robot = new \Hanson\Robot\Foundation\Robot([
'tmp' => realpath('./tmp') . '/',
'debug' => true,
]);
use Hanson\Robot\Foundation\Robot;
use Hanson\Robot\Message\Message;
$client = new \GuzzleHttp\Client();
$robot = new Robot([
'tmp' => __DIR__ . './../tmp/',
]);
$robot->server->setMessageHandler(function($message) use ($client, $robot){
/** @var $message \Hanson\Robot\Message\Message */
$robot->server->setMessageHandler(function($message){
/** @var $message Message */
if($message->type === 'Text'){
\Hanson\Robot\Message\Message::send($message->fromType, $message->username);
Message::send($message->fromType, $message->username);
}
});
$robot->server->run();
<?php
/**
* Created by PhpStorm.
* User: HanSon
* Date: 2016/12/7
* Time: 16:33
*/
require_once __DIR__ . './../vendor/autoload.php';
use Hanson\Robot\Foundation\Robot;
use Hanson\Robot\Message\Message;
$robot = new Robot([
'tmp' => __DIR__ . './../tmp/',
'debug' => true
]);
$flag = false;
$robot->server->setCustomerHandler(function() use (&$flag){
/** @var $message Message */
Message::send('测试' . \Carbon\Carbon::now()->toDateTimeString(), contact()->getUsernameById('L907159127'));
});
$robot->server->run();
......@@ -8,23 +8,23 @@
require_once __DIR__ . './../vendor/autoload.php';
$robot = new \Hanson\Robot\Foundation\Robot([
'tmp' => realpath('./tmp') . '/',
'debug' => true,
]);
use Hanson\Robot\Foundation\Robot;
use Hanson\Robot\Message\Message;
$client = new \GuzzleHttp\Client();
$robot = new Robot([
'tmp' => __DIR__ . './../tmp/',
]);
$robot->server->setMessageHandler(function($message) use ($client, $robot){
$robot->server->setMessageHandler(function($message){
/** @var $message Message */
if($message->type === 'Text'){
$url = 'http://www.tuling123.com/openapi/api';
$result = $robot->server->http->post($url, [
$result = http()->post($url, [
'key' => '1dce02aef026258eff69635a06b0ab7d',
'info' => $message->content
], true);
print_r($message);
print_r($result);
return $result['text'];
}
});
......
<?php
/**
* Created by PhpStorm.
* User: Hanson
* Date: 2016/12/13
* Time: 20:56
*/
namespace Hanson\Robot\Collections;
use Illuminate\Support\Collection;
class Contact extends Collection
{
/**
* @var Contact
*/
static $instance = null;
/**
* create a single instance
*
* @return Contact
*/
public static function getInstance()
{
if(static::$instance === null){
static::$instance = new Contact();
}
return static::$instance;
}
public function isContact($id)
{
return static::$instance->get($id, false);
}
/**
* 根据username获取联系人
*
* @param $id
* @return array
*/
public function getContactByUsername($id)
{
$contact = $this->get($id);
return $contact ?? null;
}
/**
* 根据微信号获取联系人
*
* @param $id
* @return mixed
*/
public function getContactById($id)
{
$contact = $this->filter(function($item, $key) use ($id){
if($item['Alias'] === $id){
return true;
}
})->first();
return $contact;
}
/**
* 根据微信号获取联系username
*
* @param $id
* @return mixed
*/
public function getUsernameById($id)
{
$contact = $this->search(function($item, $key) use ($id){
if($item['Alias'] === $id){
return true;
}
});
return $contact;
}
}
\ No newline at end of file
......@@ -14,7 +14,6 @@ use Hanson\Robot\Support\Console;
class ContactFactory
{
// protected $server;
const SPECIAL_USERS = ['newsapp', 'fmessage', 'filehelper', 'weibo', 'qqmail',
'fmessage', 'tmessage', 'qmessage', 'qqsync', 'floatbottle',
......@@ -37,7 +36,6 @@ class ContactFactory
$content = http()->json($url, [
'BaseRequest' => server()->baseRequest
], true);
// file_put_contents($this->server->config['tmp'] . 'debug.json', json_encode($content));
$this->makeContactList($content['MemberList']);
}
......@@ -51,50 +49,41 @@ class ContactFactory
{
foreach ($memberList as $contact) {
if($contact['VerifyFlag'] & 8 != 0){ #公众号
$type = 'public';
OfficialAccount::getInstance()->put($contact['UserName'], $contact);
}elseif (in_array($contact['UserName'], static::SPECIAL_USERS)){ # 特殊账户
$type = 'special';
SpecialAccount::getInstance()->put($contact['UserName'], $contact);
}elseif (strstr($contact['UserName'], '@@') !== false){ # 群聊
$type = 'group';
GroupAccount::getInstance()->put($contact['UserName'], $contact);
group()->put($contact['UserName'], $contact);
}else{
$type = 'contact';
ContactAccount::getInstance()->put($contact['UserName'], $contact);
contact()->put($contact['UserName'], $contact);
}
Account::getInstance()->addNormalMember($contact['UserName'], ['type' => $type, 'info' => $contact]);
}
$this->getBatchGroupMembers();
file_put_contents(server()->config['tmp'] . 'account.json', json_encode(Account::getInstance()->all()));
if(server()->config['debug']){
file_put_contents(server()->config['tmp'] . 'contact.json', json_encode(contact()->all()));
file_put_contents(server()->config['tmp'] . 'member.json', json_encode(member()->all()));
file_put_contents(server()->config['tmp'] . 'group.json', json_encode(group()->all()));
file_put_contents(server()->config['tmp'] . 'OfficialAccount.json', json_encode(OfficialAccount::getInstance()->all()));
file_put_contents(server()->config['tmp'] . 'SpecialAccount.json', json_encode(SpecialAccount::getInstance()->all()));
file_put_contents(server()->config['tmp'] . 'GroupAccount.json', json_encode(GroupAccount::getInstance()->all()));
file_put_contents(server()->config['tmp'] . 'ContactAccount.json', json_encode(ContactAccount::getInstance()->all()));
}
}
/**
* get group members by api
* 获取群组成员
*/
public function getBatchGroupMembers()
{
$url = sprintf(Server::BASE_URI . '/webwxbatchgetcontact?type=ex&r=%s&pass_ticket=%s', time(), server()->passTicket);
$list = [];
GroupAccount::getInstance()->each(function($item, $key) use (&$list){
group()->each(function($item, $key) use (&$list){
$list[] = ['UserName' => $key, 'EncryChatRoomId' => ''];
});
// file_put_contents($this->server->config['tmp'] . 'debug.json', json_encode([
// 'BaseRequest' => $this->server->baseRequest,
// 'Count' => count($list),
// 'List' => $list
// ]));
$content = http()->json($url, [
'BaseRequest' => server()->baseRequest,
'Count' => GroupAccount::getInstance()->count(),
'Count' => group()->count(),
'List' => $list
], true);
......@@ -102,19 +91,19 @@ class ContactFactory
}
/**
* init group members and chat room id
* 初始化群组成员
*
* @param $array
*/
private function initGroupMembers($array)
{
foreach ($array['ContactList'] as $group) {
$groupAccount = GroupAccount::getInstance()->get($group['UserName']);
$groupAccount = group()->get($group['UserName']);
$groupAccount['MemberList'] = $group['MemberList'];
$groupAccount['ChatRoomId'] = $group['EncryChatRoomId'];
GroupAccount::getInstance()->put($group['UserName'], $groupAccount);
group()->put($group['UserName'], $groupAccount);
foreach ($group['MemberList'] as $member) {
Account::getInstance()->addGroupMember($member['UserName'], ['type' => 'groupMember', 'info' => $member, 'group' => $group]);
member()->put($member['UserName'], $member);
}
}
......
......@@ -11,7 +11,7 @@ namespace Hanson\Robot\Collections;
use Illuminate\Support\Collection;
class GroupAccount extends Collection
class Group extends Collection
{
static $instance = null;
......@@ -19,19 +19,50 @@ class GroupAccount extends Collection
/**
* create a single instance
*
* @return GroupAccount
* @return Group
*/
public static function getInstance()
{
if(static::$instance === null){
static::$instance = new GroupAccount();
static::$instance = new Group();
}
return static::$instance;
}
/**
* 判断是否群组
*
* @param $userName
* @return bool
*/
public static function isGroup($userName){
return strstr($userName, '@@') !== false;
}
/**
* 根据群名筛选群组
*
* @param $name
* @param bool $blur
* @param bool $onlyUsername
* @return static
*/
public function getGroupsByNickname($name, $blur = false, $onlyUsername = false)
{
$groups = $this->filter(function($value, $key) use ($name, $blur){
if($blur){
return $value['NickName'] === $name;
}else{
return str_contains($value['NickName'], $name);
}
});
if($onlyUsername){
$groups = $groups->only(['UserName']);
}
return $groups;
}
}
\ No newline at end of file
......@@ -11,31 +11,39 @@ namespace Hanson\Robot\Collections;
use Illuminate\Support\Collection;
class ContactAccount extends Collection
class Member extends Collection
{
/**
* @var ContactAccount
* @var Member
*/
static $instance = null;
/**
* create a single instance
*
* @return ContactAccount
* @return Member
*/
public static function getInstance()
{
if(static::$instance === null){
static::$instance = new ContactAccount();
static::$instance = new Member();
}
return static::$instance;
}
public function isContact($id)
/**
* 根据username获取群成员
*
* @param $id
* @return array
*/
public function getMemberByUsername($id)
{
return static::$instance->get($id, false);
$member = $this->get($id);
return $member ?? null;
}
}
\ No newline at end of file
......@@ -39,6 +39,12 @@ class MessageHandler
return static::$instance;
}
/**
* 消息处理器
*
* @param Closure $closure
* @throws \Exception
*/
public function setMessageHandler(Closure $closure)
{
if(!$closure instanceof Closure){
......@@ -48,6 +54,12 @@ class MessageHandler
$this->handler = $closure;
}
/**
* 自定义处理器
*
* @param Closure $closure
* @throws \Exception
*/
public function setCustomHandler(Closure $closure)
{
if(!$closure instanceof Closure){
......@@ -66,7 +78,7 @@ class MessageHandler
while (true){
if($this->customHandler){
if($this->customHandler instanceof Closure){
call_user_func_array($this->customHandler, []);
}
......@@ -96,35 +108,11 @@ class MessageHandler
if($message['AddMsgList']){
foreach ($message['AddMsgList'] as $msg) {
$content = (new Message)->make($selector, $msg);
$response = call_user_func_array($this->handler, [$content]);
$this->send($response, $content);
}
if($this->handler instanceof Closure){
$reply = call_user_func_array($this->handler, [$content]);
Message::send($reply, $content->username);
}
}
private function send($word, $content)
{
if(!$word && !is_string($word)){
return false;
}
$random = strval(time() * 1000) . '0' . strval(rand(100, 999));
$result = http()->post(Server::BASE_URI . '/webwxsendmsg?pass_ticket=' . server()->passTicket,
json_encode([
'BaseRequest' => server()->baseRequest,
'Msg' => [
'Type' => 1,
'Content' => $word,
'FromUserName' => myself()->userName,
'ToUserName' => $content->rawMsg['FromUserName'],
'LocalID' => $random,
'ClientMsgId' => $random,
],
'Scene' => 0
], JSON_UNESCAPED_UNICODE), true);
if($result['BaseResponse']['Ret'] != 0){
Console::log('发送消息失败');
}
}
......
......@@ -13,7 +13,7 @@ use Endroid\QrCode\QrCode;
use GuzzleHttp\Client;
use Hanson\Robot\Collections\Account;
use Hanson\Robot\Collections\ContactFactory;
use Hanson\Robot\Collections\GroupAccount;
use Hanson\Robot\Collections\Group;
use Hanson\Robot\Support\Console;
use QueryPath\Exception;
use Symfony\Component\DomCrawler\Crawler;
......@@ -56,6 +56,8 @@ class Server
public function __construct($config = [])
{
$this->config = $config;
$this->config['debug'] = $this->config['debug'] ?? false;
}
/**
......@@ -241,9 +243,8 @@ class Server
{
if($contactList){
foreach ($contactList as $contact) {
if(GroupAccount::isGroup($contact['UserName'])){
GroupAccount::getInstance()->put($contact['UserName'], $contact);
Account::getInstance()->addNormalMember($contact['UserName'], ['type' => 'group', 'info' => $contact]);
if(Group::isGroup($contact['UserName'])){
group()->put($contact['UserName'], $contact);
}
}
}
......
......@@ -9,19 +9,20 @@
namespace Hanson\Robot\Message;
use Carbon\Carbon;
use Hanson\Robot\Core\Server;
use Hanson\Robot\Collections\Account;
use Hanson\Robot\Collections\ContactAccount;
use Hanson\Robot\Collections\Contact;
use Hanson\Robot\Collections\OfficialAccount;
use Hanson\Robot\Collections\SpecialAccount;
use Hanson\Robot\Models\Content;
use Hanson\Robot\Models\Sender;
use Hanson\Robot\Support\FileManager;
use Hanson\Robot\Support\Console;
class Message
{
/**
* @var array 消息来源
*/
public $from;
/**
......@@ -29,12 +30,24 @@ class Message
*/
public $sender;
/**
* @var string 来源的username,用于回复
*/
public $username;
/**
* @var array 消息接收者
*/
public $to;
/**
* @var string 经过处理的内容
*/
public $content;
/**
* @var Carbon 时间
*/
public $time;
/**
......@@ -47,8 +60,6 @@ class Message
*/
public $type;
static $message = [];
const USER_TYPE = [
0 => 'Init',
1 => 'Self',
......@@ -62,20 +73,14 @@ class Message
public $rawMsg;
// const MESSAGE_TYPE = [
// 0 => 'Text',
// ]
public function make($selector, $msg)
{
$this->rawMsg = $msg;
$this->time = Carbon::now();
$this->setFrom();
$this->setTo();
$this->setFromType();
$this->setType();
return $this;
......@@ -86,13 +91,13 @@ class Message
*/
private function setFrom()
{
$this->from = Account::getInstance()->getContactByUsername($this->rawMsg['FromUserName']);
$this->from = contact()->getContactByUsername($this->rawMsg['FromUserName']);
$this->username = $this->rawMsg['FromUserName'];
}
private function setTo()
{
$this->to = Account::getInstance()->getContactByUsername($this->rawMsg['ToUserName']);
$this->to = contact()->getContactByUsername($this->rawMsg['ToUserName']);
}
private function setFromType()
......@@ -107,7 +112,7 @@ class Message
$this->fromType = 'FileHelper';
} elseif (substr($this->rawMsg['FromUserName'], 0, 2) === '@@') { # group
$this->fromType = 'Group';
} elseif (ContactAccount::getInstance()->isContact($this->rawMsg['FromUserName'])) {
} elseif (Contact::getInstance()->isContact($this->rawMsg['FromUserName'])) {
$this->fromType = 'Contact';
} elseif (OfficialAccount::getInstance()->isPublic($this->rawMsg['FromUserName'])) {
$this->fromType = 'Public';
......@@ -151,6 +156,7 @@ class Message
case 1:
if(Location::isLocation($this->rawMsg['Content'])){
$this->type = 'Location';
$this->content = Location::getLocationText($this->rawMsg['Content']);
}else{
$this->type = 'Text';
$this->content = $this->rawMsg['Content'];
......@@ -160,13 +166,13 @@ class Message
$this->type = 'Image';
$this->content = Server::BASE_URI . sprintf('/webwxgetmsgimg?MsgID=%s&skey=%s', $this->rawMsg['MsgId'], server()->skey);
$content = http()->get($this->content);
FileManager::download(server()->config['tmp'] . $this->rawMsg['MsgId'] . '.jpg', $content);
FileManager::download($this->rawMsg['MsgId'], $content, 'jpg');
break;
case 34:
$this->type = 'Voice';
$this->content = Server::BASE_URI . sprintf('/webwxgetvoice?msgid=%s&skey=%s', $this->rawMsg['MsgId'], server()->skey);
$content = http()->get($this->content);
FileManager::download(server()->config['tmp'] . $this->rawMsg['MsgId'] . '.mp3', $content);
FileManager::download($this->rawMsg['MsgId'], $content, 'mp3');
break;
case 37:
$this->type = 'AddUser';
......@@ -196,31 +202,19 @@ class Message
default:
$this->type = 'Unknown';
break;
}
}
/**
* 设置当前message 为 location
*/
private function setLocationMessage()
{
$this->fromType = 'Location';
// $this->url = $this->rawMsg['Url'];
$this->content->msg = Location::getLocationText($this->rawMsg['Content']);
}
/**
* handle group content
* 处理群发消息的内容
*
* @param $content
* @param $content string 内容
*/
private function handleGroupContent($content)
{
list($uid, $content) = explode('<br/>', $content, 2);
$this->sender = Account::getInstance()->getGroupMember(substr($uid, 0, -1));
$this->sender = member()->getMemberByUsername(substr($uid, 0, -1));
$this->rawMsg['Content'] = $this->formatContent($content);
}
......
<?php
/**
* Created by PhpStorm.
* User: Hanson
* Date: 2016/12/17
* Time: 14:59
*/
namespace Hanson\Robot\Models;
class Content
{
public $type;
public $msg;
public $raw;
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Hanson
* Date: 2016/12/17
* Time: 13:55
*/
namespace Hanson\Robot\Models;
class Origin
{
public $type;
public $id;
const GROUP = 'Group';
const CONTACT = 'Contact';
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Hanson
* Date: 2016/12/17
* Time: 14:58
*/
namespace Hanson\Robot\Models;
class Sender
{
/**
* @var String 消息来源名称
*/
public $name;
public $type;
public $from;
public $to;
/**
* @var array 显示的聊天窗口
*/
public $contact;
}
\ No newline at end of file
......@@ -12,9 +12,14 @@ namespace Hanson\Robot\Support;
class FileManager
{
public static function download($name, $data)
public static function download($msgId, $data, $type)
{
file_put_contents($name, $data);
$path = server()->config['tmp'] . $type;
if(!is_dir($path)){
mkdir($path, 0700, true);
}
file_put_contents("$path/$msgId.$type", $data);
}
}
\ No newline at end of file
......@@ -9,6 +9,10 @@
use Hanson\Robot\Core\Server;
use Hanson\Robot\Core\Myself;
use Hanson\Robot\Core\Http;
use Hanson\Robot\Collections\Account;
use Hanson\Robot\Collections\Member;
use Hanson\Robot\Collections\Contact;
use Hanson\Robot\Collections\Group;
if (! function_exists('server')) {
/**
......@@ -44,3 +48,47 @@ if (! function_exists('http')) {
return Http::getInstance();
}
}
if (! function_exists('account')) {
/**
* Get the available container instance.
*
* @return Account
*/
function account()
{
return Account::getInstance();
}
}
if (! function_exists('contact')) {
/**
* Get the available container instance.
*
* @return Contact
*/
function contact()
{
return Contact::getInstance();
}
}
if (! function_exists('member')) {
/**
* Get the available container instance.
*
* @return Member
*/
function member()
{
return Member::getInstance();
}
}
if (! function_exists('group')) {
/**
* Get the available container instance.
*
* @return Group
*/
function group()
{
return Group::getInstance();
}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!